# README-at91bootstrap.ronetix # Building of AT91BootStrap # for AT91SAM9G45 based board PM9G45. # Aplicable for boards v1.2 and v1.3 # # Ronetix GmbH # www.ronetix.at # February, 2012 # Table of Contents: 1. Download AT91BootStrap image file 2. Installing and building AT91BootStrap 3. Programming/Writing 4. Debugging 1. Download AT91BootStrap image file $ wget http://download.ronetix.info/boards/linux/bootstrap/nandflashboot/pm9g45-nandflashboot-2.13.bin 2. Installing and building AT91BootStrap $ wget http://download.ronetix.info/boards/linux/bootstrap/nandflashboot/at91bootstrap-2.13-src-pm9g45-svn-r370.tar.bz2 $ tar xjvf at91bootstrap-2.13-src-pm9g45-svn-r370.tar.bz2 $ cd at91bootstrap-2.13-pm9g45-svn-r370 $ export ARCH=arm $ export CROSS_ARCH=arm-elf- # or put your ARM toolchain prefix $ make clean $ make pm9g45_defconfig $ make The file is binaries/pm9g45-nandflashboot-2.13.bin 3. Programming/Writing On how to program it see the README-programming.ronetix. 4. Debugging To debug a code running on PM9G45, PEEDI shall not init the target to let the environment(MCU setting) clean, but left a software in the pm9g45 to do that - AT91Bootstrap can do the boards setup. So in PEEDI configuration file make an empty init section and set COREn_STARTUP_MODE = RESET. The RESET startup mode lets the PEEDI to attach to the target at the very beginning - the reset state of the CPU. The JTAG clock have to be set as shown "JTAG_CLOCK = 3, 3" this means slow JTAG clock because the PLLs have not been yet initialized. Later when the PLLs and high clock have been turned on JTAG clock can be set higher in the PEEDI command line - "clock 20000". Check if PEEDI has stopped/attached to the target at reset state as executing PEEDI command "info reg" and make sure the registers and state are as shown: --- info reg --- pc : 00000000 cpsr : 000000D3 spsr : 00000000 State: Supervisor --- info reg --- Debug AT91Bootstrap by loading it with PEEDI at 0x300000 address, setting CPU status and instruction counter registers, then connect GDB to PEEDI and tell GDB which is the elf file load the debug data. Note that PEEDI loads the bin file, and GDB uses its elf file. --- PEEDI CLI --- mem load dimov/pm9g45/latest_site/pm9g45-nandflashboot-2.13.bin bin 0x300000 set cpsr 0xd3 set pc 0x300000 --- PEEDI CLI --- --- gdb cmd line --- target remote 192.168.10.42:2000 -attach file pm9g45-nandflashboot-2.13.elf hbreak hw_init c --- .gdb cmd line --- The bootstap can be debugged from NAND flash to, by letting the RomCode to load the At91Bootstrap to SRAM. For this the PEEDI have to make a hardware breakpoint at 0x30000 and to wait to break. In this case the "PEEDI CLI" commands are ignored and only the "gdb cmd line" commands are used. Instead of "hbreak hw_init" a "hbreak *0x300000" can be set to catch the At91Bootstrap from the very beginning.