Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 uClinux course Day 4 of 5. 2 Author: D L Johnson CPU Architectures.

Similar presentations


Presentation on theme: "1 uClinux course Day 4 of 5. 2 Author: D L Johnson CPU Architectures."— Presentation transcript:

1 1 uClinux course Day 4 of 5

2 2 Author: D L Johnson CPU Architectures

3 3 Author: D L Johnson The ARM architecture u The ARM AT91 architecture

4 4 Author: D L Johnson The ARM architecture u Incorporates the ARM7TDMI™ ARM® Thumb® Processor Core u High-performance 32-bit RISC Architecture u High-density 16-bit Instruction Set using THUMB u Leader in MIPS/Watt u Embedded ICE (In-Circuit Emulation) u On-chip SRAM and/or ROM u 32-bit Data Bus u Single-clock Cycle Access u Fully Programmable External Bus Interface (EBI) u Maximum External Address Space of 64M Bytes u Up to 8 Chip Selects u Software Programmable 8/16-bit External Databus u 8-level Priority, Individually Maskable, Vectored Interrupt Controller

5 5 Author: D L Johnson The ARM architecture u 4 External Interrupts, Including a High-priority Low-latency Interrupt Request u 32 Programmable I/O Lines u 3-channel 16-bit Timer/Counter u 3 External Clock Inputs u 2 Multi-purpose I/O Pins per Channel u 2 USARTs u 2 Dedicated Peripheral Data Controller (PDC) Channels per USART u Programmable Watchdog Timer  Advanced Power-saving Feature

6 6 Author: D L Johnson ARM board memory layout u Memory map of EB40 + expansion board u EB40 board +FLASH memory –(4k) 0x01000000 – 0x01001FFF Bootcode –(60k) 0x01002000 – 0x0100FFFF angel debugger –(64k) 0x01010000 – 0x0101FFFF Application (select with SW1) +SRAM –(512k) 0x02000000 – 0x0207FFFF RAM space u Expansion board (MEC01) +FLASH memory –(2MB) 0x03000000 – 0x031FFFFF eg. Linux kernel –(1MB) 0x04000000 – 0x040FFFFF eg. romfs +SRAM –(2MB) 0x05000000 – 0x051FFFFF eg..data.bss stack

7 7 Author: D L Johnson Atmel EB40 board memory layout

8 8 Author: D L Johnson MEC01 memory expansion board memory layout

9 9 Author: D L Johnson Memory mapping techniques u 16M byte devices

10 10 Author: D L Johnson Memory mapping techniques u 1M byte devices

11 11 Author: D L Johnson External bus interface

12 12 Author: D L Johnson External bus interface

13 13 Author: D L Johnson External bus interface

14 14 Author: D L Johnson External bus interface

15 15 Author: D L Johnson External bus interface

16 16 Author: D L Johnson Memory inititalization scripts u #!/bin/sh u # u # board initializaton for ATMEL EB40 + MEC01 expansion board u # u # ATMEL EB40 u # u # FLASH: 0x0100000064KBBootcode,Angel u # 0x0101000064KBApplication u # 0x01020000 u # RAM: 0x02000000 512K RAM u # 0x0207FFFF u # u # ATMEL MEC01 u # u # FLASH0: 0x030000002MUser Flash u # 0x031FFFFF u # u # FLASH1: 0x040000001MUser Flash u # 0x040FFFFF u # u # SRAM: 0x050000002MUser RAM u # 0x051FFFFF u #

17 17 Author: D L Johnson Memory inititalization scripts u # u # board initializaton for ATMEL EB40 + MEC01 expansion board u echo "initialize board" u # EBI_CSR0 (EB40 128k FLash) u # 16MB, 2 tdf, 16 bits, 3WS u./armtool write 0xffe00000 0x01002529 u # EBI_CSR1 (EB40 512k SRAM) u # 16MB, 0hold, 16 bits, 1WS u./armtool write 0xffe00004 0x02002121 u # EBI_CSR2 (MEC01 2MB Flash) u # 16MB, 2 tdf, 16 bits, 3WS u./armtool write 0xffe00008 0x030024B5 u # EBI_CSR3 (MEC01 1MB Flash) u # 1MB, 2 tdf, 16 bits, 3WS u./armtool write 0xffe0000c 0x040024B5 u # EBI_CSR4 (MEC01 2MB SRAM - block1 0x05000000 - 0x050FFFFF) u # 1MB, 0 hold, 16 bits, 1WS u./armtool write 0xffe00010 0x05002021 u # EBI_CSR5 (MEC01 2MB SRAM - block2 0x05100000 - 0x051FFFFF) u # 1MB, 0 hold, 16 bits, 1WS u./armtool write 0xffe00014 0x05102021

18 18 Author: D L Johnson Memory inititalization scripts u /linux-2.4.x/arch/armnommu/vmlinux-armv.lds.in u /* ld script to make ARM Linux kernel u * taken from the i386 version by Russell King u * Written by Martin Mares u * Written by Martin Mares u */ u OUTPUT_ARCH(arm) u ENTRY(stext) u SECTIONS u { u. = TEXTADDR; u.init : { /* Init code and data */ u _stext =.; u __init_begin =.; u *(.text.init) u __proc_info_begin =.; u *(.proc.info) u __proc_info_end =.; u __arch_info_begin =.; u *(.arch.info) u __arch_info_end =.; u *(.data.init) u. = ALIGN(16); u __setup_start =.; u *(.setup.init) u __setup_end =.; u __initcall_start =.; u *(.initcall.init) u __initcall_end =.; u. = ALIGN(4096); u __init_end =.;

19 19 Author: D L Johnson External bus interface u. = ALIGN(8192); u.data : { u /* u * first, the init task union, aligned u * to an 8192 byte boundary. u */ u *(.init.task) u /* u * then the cacheline aligned data u */ u. = ALIGN(32); u *(.data.cacheline_aligned) u /* u * and the usual data section u */ u *(.data) u CONSTRUCTORS

20 20 Author: D L Johnson Memory mapping u Ways of changing address locations +Objcopy change-section options +Make menuconfig - Kernel settings - System type - Change RAM settings and FLASH settings

21 21 Author: D L Johnson Bootloaders u Bootloader good for debugging phase of project u Can choose from multiple startups u Can do initialisation in kernel u Penalty - Increases boot time

22 22 Author: D L Johnson Bootloaders - Redboot u u Boot scripting support u u Simple command line interface for RedBoot configuration and management, accessible via serial (terminal) or Ethernet (telnet) u u Integrated GDB stubs for connection to a host-based debugger via serial or ethernet. (Ethernet connectivity is limited to local network only) u u Attribute Configuration - user control of aspects such as system time and date (if applicable), default Flash image to boot from, default failsafe image, static IP address, etc. u u Configurable and extensible, specifically adapted to the target environment u u Network bootstrap support including setup and download, via BOOTP, DHCP and TFTP u u X/YModem support for image download via serial u u Power On Self Test

23 23 Author: D L Johnson Programming the RAM and FLASH u Programming and debugging can be done through the JTAG port or the serial port

24 24 Author: D L Johnson Programming the RAM and FLASH u Programming and debugging through the JTAG port is faster than the serial port u Programming and debugging with JTAG on Linux/Unix is done using the arm-elf-gdb software +cd /tmp/OCDemon/arm/AtmelAT91 +make +/usr/local/bin/OcdLibRemote –c arm7 & +/usr/local/arm/bin/arm-elf-gdb –n test +(arm-gdb) target remote localhost:8888 +(arm-gdb) load +(arm-gdb) b main +(arm-gdb) c

25 25 Author: D L Johnson Programming the RAM and FLASH u OcdLibRemote is a program which translates commands arriving on port 8888 to jtag commands on the parallel port u In gdb, the command: target remote localhost:8888 connects to the local port 8888 which in turn connects to the Atmel board through the JTAG u In gdb: the command load loads the test program into the memory address specified by the elf file format u Following this command normal gdb commands which will be covered in a later section can be issued such as +(arm-gdb) b main --- set a breakpoint in the main function +(arm-gdb) c --- continues execution of the program

26 26 Author: D L Johnson Programming the RAM and FLASH u Serial port programming is done using a programming stub running on the the atmel board called Angel u Gdb can connect to this stub using the target command in gdb u For the same test program do the following +cd /tmp/OCDemon/arm/AtmelAT91 +make +/usr/local/arm/bin/arm-elf-gdb –n +(arm-gdb) target rdi s=/dev/ttyS0 +(arm-gdb) load test +(arm-gdb) symbol-file test +(arm-gdb) b main +(arm-gdb) c

27 27 Author: D L Johnson Programming the RAM and FLASH u Bootloaders such as redboot often have programming functionality built in u The Atmel board already has redboot in the upper memory of its built in flash u To activate redboot move the SW1 switch to the upper memory position u Run the minicom terminal emulator +Minicom u Press reset on the Atmel board

28 28 Author: D L Johnson Programming the RAM and FLASH u The following should appear on your screen u You can now upload programs to memory using + +Redboot> load –m ymodem –b 0x02040000 u You can execute the code by typing + +Redboot> go 0x02040000

29 29 Author: D L Johnson Programming the RAM and FLASH u On the Atmel EB40 board you can only program the RAM directly, FLASH is programmed by first moving code to RAM and then running an internal program which moves code from RAM to FLASH u The redboot bootloader has commands to do this +Redboot> fi wr –f 0x01010000 –b 0x02040000 –l 0xe000 u This command will move the block of memory at RAM location 0x02040000 of length 0xe000 to the flash location 0x01010000

30 30 Author: D L Johnson Assignment 4 u Write a program which calculates the solution to ax^2 +bx + c = 0 using no output or input screens (enter the values for a,b, and c inside your code) +Hint modify the code in /tmp/OCDemon/arm/AtmelAT91 u Create a breakpoint in the debugger to examine your results u Use two different tools to program it into memory u Run it from RAM and FLASH +Hint: Remember when running from FLASH the.data section needs to be copied to RAM u If this is too easy – then try to run this as an application inside the kernel and include input and output


Download ppt "1 uClinux course Day 4 of 5. 2 Author: D L Johnson CPU Architectures."

Similar presentations


Ads by Google