uClinux course - PowerPoint PPT Presentation

About This Presentation
Title:

uClinux course

Description:

2 Multi-purpose I/O Pins per Channel. 2 USARTs ... default Flash image to boot from, default failsafe image, static IP address, etc. ... – PowerPoint PPT presentation

Number of Views:68
Avg rating:3.0/5.0
Slides: 31
Provided by: dljoh
Category:

less

Transcript and Presenter's Notes

Title: uClinux course


1
uClinux course
  • Day 4 of 5

2
CPU Architectures
3
The ARM architecture
  • The ARM AT91 architecture

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

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

6
ARM board memory layout
  • Memory map of EB40 expansion board
  • 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
  • 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
Atmel EB40 board memory layout
8
MEC01 memory expansion board memory layout
9
Memory mapping techniques
  • 16M byte devices

10
Memory mapping techniques
  • 1M byte devices

11
External bus interface
12
External bus interface
13
External bus interface
14
External bus interface
15
External bus interface
16
Memory inititalization scripts
  • !/bin/sh
  • board initializaton for ATMEL EB40 MEC01
    expansion board
  • ATMEL EB40
  • FLASH 0x01000000 64KB Bootcode,Angel
  • 0x01010000 64KB Application
  • 0x01020000
  • RAM 0x02000000 512K RAM
  • 0x0207FFFF
  • ATMEL MEC01
  • FLASH0 0x03000000 2M User Flash
  • 0x031FFFFF

17
Memory inititalization scripts
  • board initializaton for ATMEL EB40 MEC01
    expansion board
  • echo "initialize board"
  • EBI_CSR0 (EB40 128k FLash)
  • 16MB, 2 tdf, 16 bits, 3WS
  • ./armtool write 0xffe00000 0x01002529
  • EBI_CSR1 (EB40 512k SRAM)
  • 16MB, 0hold, 16 bits, 1WS
  • ./armtool write 0xffe00004 0x02002121
  • EBI_CSR2 (MEC01 2MB Flash)
  • 16MB, 2 tdf, 16 bits, 3WS
  • ./armtool write 0xffe00008 0x030024B5
  • EBI_CSR3 (MEC01 1MB Flash)
  • 1MB, 2 tdf, 16 bits, 3WS
  • ./armtool write 0xffe0000c 0x040024B5

18
Memory inititalization scripts
  • /linux-2.4.x/arch/armnommu/vmlinux-armv.lds.in
  • / ld script to make ARM Linux kernel
  • taken from the i386 version by Russell King
  • Written by Martin Mares ltmj_at_atrey.karlin.mff.cu
    ni.czgt
  • /
  • OUTPUT_ARCH(arm)
  • ENTRY(stext)
  • SECTIONS
  • . TEXTADDR
  • .init / Init
    code and data /
  • _stext .
  • __init_begin .
  • (.text.init)
  • __proc_info_begin .
  • (.proc.info)
  • __proc_info_end .
  • __arch_info_begin .
  • (.arch.info)

19
External bus interface
  • . ALIGN(8192)
  • .data
  • /
  • first, the init task union,
    aligned
  • to an 8192 byte boundary.
  • /
  • (.init.task)
  • /
  • then the cacheline aligned
    data
  • /
  • . ALIGN(32)
  • (.data.cacheline_aligned)
  • /
  • and the usual data section
  • /
  • (.data)

20
Memory mapping
  • Ways of changing address locations
  • Objcopy change-section options
  • Make menuconfig - Kernel settings - System type -
    Change RAM settings and FLASH settings

21
Bootloaders
  • Bootloader good for debugging phase of project
  • Can choose from multiple startups
  • Can do initialisation in kernel
  • Penalty - Increases boot time

22
Bootloaders - Redboot
  • Boot scripting support
  • Simple command line interface for RedBoot
    configuration and management, accessible via
    serial (terminal) or Ethernet (telnet)
  • Integrated GDB stubs for connection to a
    host-based debugger via serial or ethernet.
    (Ethernet connectivity is limited to local
    network only)
  • 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.
  • Configurable and extensible, specifically adapted
    to the target environment
  • Network bootstrap support including setup and
    download, via BOOTP, DHCP and TFTP
  • X/YModem support for image download via serial
  • Power On Self Test

23
Programming the RAM and FLASH
  • Programming and debugging can be done through the
    JTAG port or the serial port

24
Programming the RAM and FLASH
  • Programming and debugging through the JTAG port
    is faster than the serial port
  • 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 localhost8888
  • (arm-gdb) load
  • (arm-gdb) b main
  • (arm-gdb) c

25
Programming the RAM and FLASH
  • OcdLibRemote is a program which translates
    commands arriving on port 8888 to jtag commands
    on the parallel port
  • In gdb, the command target remote localhost8888
    connects to the local port 8888 which in turn
    connects to the Atmel board through the JTAG
  • In gdb the command load loads the test program
    into the memory address specified by the elf file
    format
  • 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
Programming the RAM and FLASH
  • Serial port programming is done using a
    programming stub running on the the atmel board
    called Angel
  • Gdb can connect to this stub using the target
    command in gdb
  • 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
Programming the RAM and FLASH
  • Bootloaders such as redboot often have
    programming functionality built in
  • The Atmel board already has redboot in the upper
    memory of its built in flash
  • To activate redboot move the SW1 switch to the
    upper memory position
  • Run the minicom terminal emulator
  • Minicom
  • Press reset on the Atmel board

28
Programming the RAM and FLASH
  • The following should appear on your screen
  • You can now upload programs to memory using
  • Redbootgt load m ymodem b 0x02040000
  • You can execute the code by typing
  • Redbootgt go 0x02040000

29
Programming the RAM and FLASH
  • 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
  • The redboot bootloader has commands to do this
  • Redbootgt fi wr f 0x01010000 b 0x02040000 l
    0xe000
  • This command will move the block of memory at RAM
    location 0x02040000 of length 0xe000 to the flash
    location 0x01010000

30
Assignment 4
  • Write a program which calculates the solution to
    ax2 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/AtmelAT9
    1
  • Create a breakpoint in the debugger to examine
    your results
  • Use two different tools to program it into memory
  • Run it from RAM and FLASH
  • Hint Remember when running from FLASH the .data
    section needs to be copied to RAM
  • If this is too easy then try to run this as an
    application inside the kernel and include input
    and output
Write a Comment
User Comments (0)
About PowerShow.com