Name
Setup — Preparing the AT91SAM9G20-EK board for eCos Development
Overview
In a typical development environment, the AT91SAM9G20-EK board boots from the DataFlash and runs the RedBoot ROM monitor from SDRAM. eCos applications are configured for RAM startup and then downloaded and run on the board via the debugger arm-eabi-gdb. Preparing the board therefore usually involves programming a suitable RedBoot image into flash memory.
The following RedBoot configurations are supported:
Configuration | Description | Use | File |
---|---|---|---|
ROM | RedBoot loaded from Dataflash to SDRAM | redboot_ROM.ecm | redboot_ROM.bin |
For serial communications, all versions run with 8 bits, no parity, and 1 stop bit at 115200 baud. RedBoot also supports ethernet communication and flash management.
Note that the use of the term ROM for the initial RedBoot configuration is a historical accident. RedBoot actually runs from SDRAM after being loaded there from Dataflash by the second-level bootstrap. The use of ROM for this configuration is intended to indicate that it initializes the microprocessor and board peripherals, as opposed to the RAM configuration which assumes that this has already been done.
Initial Installation
The on-chip boot program on the AT91SAM9G20 is only capable of loading programs from Dataflash or NAND flash into 4Kbytes of on-chip SRAM and is therefore quite restrictive. Consequently RedBoot cannot be booted directly and a second-level bootstrap must be used. Such a second-level bootstrap is supplied by Atmel in the form of AT91Bootstrap. This is therefore programmed into the start of Dataflash and is then responsible for initializing the SDRAM and loading RedBoot from Dataflash and executing it.
Caution | |
---|---|
There is a size limit on the size of applications which the AT91Bootstrap
second level bootstrap will load. Images larger than 320Kbytes will
require the AT91Bootstrap application to be rebuilt with a
larger |
There are basically two ways to write the second-level bootstrap and RedBoot to the Dataflash. The first is to use the Atmel-supplied SAM-BA program that interacts with the on-chip boot program. The second is to use a JTAG debugger that understands the microcontroller and can write to the dataflash (for example the Ronetix PEEDI). Since the availability of the latter cannot be guaranteed, only the first method will be described here.
Programming RedBoot into DataFlash using SAM-BA
The following gives the steps needed to program the second-level bootstrap and RedBoot into the DataFlash using SAM-BA. The user should refer to the SAM-BA documentation for full details of how to run the program.
- Download the corresponding AT91 In-system Programmer software package from the Atmel website according to your host operating system and install it on your PC (SAM9 series CPU's require the 2.1.x series version of SAM-BA).
-
From the root directory of your eCosPro installation, copy the file
dataflash_at91sam9g20ek.bin
from the sub-directorypackages/hal/arm/arm9/sam9260ek/current/AT91Bootstrap/board/at91sam9g20ek/dataflash
andredboot_ROM.bin
from the sub-directoryloaders/sam9g20ek
to a suitable location on the Windows PC. - Connect a null-modem serial cable between the DEBUG serial port of the board and a serial port on a convenient host (which need not be the PC running SAM-BA). Run a terminal emulator (Hyperterm or minicom) at 115200 baud. Connect a USB cable between the PC and the AT91SAM9G20-EK board. Windows may ask you to install a new driver, in which case follow the instructions.
Remove Jumper J33 from the board and press the reset button. You should see the following output on the serial line:
RomBoot >
Now reinsert the jumper.
- Start SAM-BA. Select the appropriate COM port for the communication interface (on Windows hosts this will be of the form "COMx" and on Linux hosts this will be of the form "/dev/ttyUSBx"), and "AT91SAM9G20-EK" for the board. Click on "Connect".
In the SAM-BA main window, select the "DataFlash AT45DB/DBC" tab and in the "Scripts" dropdown menu select "Enable Dataflash (SPIO CS1)", to program the on-board Dataflash device. Click Execute and SAM-BA should emit the following in the message area:
sam-ba_cdc_linux) 1 % DATAFLASH::Init 1 -I- DATAFLASH::Init 1 (trace level : 4) -I- Loading applet isp-dataflash-at91sam9g20.bin at address 0x200000 -I- Memory Size : 0x840000 bytes -I- Buffer address : 0x202D38 -I- Buffer size: 0xC60 bytes -I- Applet initialization done
The actual options and output of SAM-BA may vary according to the version you are using. The behaviour documented here is that of SAM-BA CDC 2.10 on Linux.
Now select "Send BootFile" from the "Scripts" menu and "Execute" it. When the file open dialog appears, select the
dataflash_at91sam9g20ek.bin
file and click "Open". The following output should be seen:(sam-ba_cdc_linux) 1 % GENERIC::SendBootFileGUI GENERIC::SendFile /tmp/dataflash_at91sam9g20ek.bin at address 0x0 -I- File size : 0xE7C byte(s) -I- Writing: 0xC60 bytes at 0x0 (buffer addr : 0x202D38) -I- 0xC60 bytes written by applet -I- Writing: 0x21C bytes at 0xC60 (buffer addr : 0x202D38) -I- 0x21C bytes written by applet
- The second-level bootstrap has now been written to DataFlash, we must now write RedBoot.
-
In the "Send File Name" box type in the path name to the
redboot_ROM.bin
file, or use the Open Folder button and browse to it. - In the Address field set the value to 0x8400.
Click the "Send File" button. SAM-BA will put up a dialog box while it is writing the file to the DataFlash, and will output something similar to the following in the message area:
(sam-ba_cdc_linux) 1 % send_file {DataFlash AT45DB/DCB} "/tmp/redboot_ROM.bin" 0x8400 0 -I- Send File /tmp/redboot_ROM.bin at address 0x8400 GENERIC::SendFile /tmp/redboot_ROM.bin at address 0x8400 -I- File size : 0x248D8 byte(s) -I- Writing: 0xC60 bytes at 0x8400 (buffer addr : 0x202D38) -I- 0xC60 bytes written by applet -I- Writing: 0xC60 bytes at 0x9060 (buffer addr : 0x202D38) -I- 0xC60 bytes written by applet ... -I- Writing: 0xC60 bytes at 0x2BD40 (buffer addr : 0x202D38) -I- 0xC60 bytes written by applet -I- Writing: 0x338 bytes at 0x2C9A0 (buffer addr : 0x202D38) -I- 0x338 bytes written by applet
Shut down SAM-BA and disconnect the USB cable. Press the reset button on the board and something similar to the following should be output on the DEBUG serial line.
RomBOOT >Start AT91Bootstrap... +**Warning** FLASH configuration checksum error or invalid key Use 'fconfig -i' to [re]initialize database No space to add 'net_device' AT91_ETH: Waiting for PHY to reset. AT91_ETH: Waiting for link to come up.. Ethernet eth0: MAC address 12:34:56:78:9a:bc No IP info for device! RedBoot(tm) bootstrap and debug environment [ROM] eCosCentric certified release, version v3_0_22 - built 14:12:12, Sep 7 2010 Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 eCosCentric Limited RedBoot is free software, covered by the eCos license, derived from the GNU General Public License. You are welcome to change it and/or distribute copies of it under certain conditions. Under the license terms, RedBoot's source code and full license terms must have been made available to you. Redboot comes with ABSOLUTELY NO WARRANTY. Platform: AT91SAM9G20-EK (ARM9) RAM: 0x20000000-0x24000000 [0x200362e8-0x23ffef80 available] FLASH: 0x40000000-0x4083ffff, 8192 x 0x420 blocks RedBoot>
RedBoot Flash configuration
The following steps describe how to initialize RedBoot's Flash configuration.
Use the following command to initialize RedBoot's Flash Information System (FIS):
RedBoot>
fis init
About to initialize [format] FLASH image system - continue (y/n)?y
*** Initialize FLASH Image System ... Erase from 0x4083fbe0-0x4083ffff: . ... Program from 0x23fffbe0-0x24000000 to 0x4083fbe0: . RedBoot>Now configure RedBoot's Flash configuration with the command:
RedBoot>
fconfig -i
Remember to substitute the appropriate MAC address for this board at the appropriate step. If a BOOTP/DHCP server is not available, then IP configuration may be set manually. The default server IP address can be set to a PC that will act as a TFTP host for future RedBoot load operations, or may be left unset. The following gives an example configuration:
RedBoot>
fconfig -i
Initialize non-volatile configuration - continue (y/n)?y
Run script at boot:false
Use BOOTP for network configuration:false
Gateway IP address:192.168.7.11
Local IP address:192.168.7.83
Local IP address mask:255.255.255.0
Default server IP address:192.168.7.11
Console baud rate:115200
DNS domain name:farm.ecoscentric.com
DNS server IP address:192.168.7.11
Network hardware address [MAC]:0x0E:0x00:0x00:0xEA:0x18:0xF0
GDB connection port:9000
Force console for special debug messages:false
Update RedBoot non-volatile configuration - continue (y/n)?y
... Erase from 0x4083f7c0-0x4083fbdf: . ... Program from 0x23fff7c0-0x23fffbe0 to 0x4083f7c0: . RedBoot>
The RedBoot installation is now complete. This can be tested by powering off the board, and then powering on the board again. Output similar to the following should be seen on the DEBUG serial port. Verify the IP settings are as expected.
Ethernet eth0: MAC address 0e:00:00:ea:18:e3 IP: 192.168.7.222/255.255.255.0, Gateway: 192.168.7.11 Default server: 192.168.7.11 DNS server IP: 192.168.7.11, DNS domain name: <null> RedBoot(tm) bootstrap and debug environment [ROM] eCosCentric certified release, version v3_0_22 - built 14:12:12, Sep 7 2010 Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 eCosCentric Limited RedBoot is free software, covered by the eCos license, derived from the GNU General Public License. You are welcome to change it and/or distribute copies of it under certain conditions. Under the license terms, RedBoot's source code and full license terms must have been made available to you. Redboot comes with ABSOLUTELY NO WARRANTY. Platform: AT91SAM9G20-EK (ARM9) RAM: 0x20000000-0x24000000 [0x20036218-0x23ffef80 available] FLASH: 0x40000000-0x4083ffff, 8192 x 0x420 blocks RedBoot>
If it proves necessary to re-install RedBoot, this may be achieved by repeating the above process. Alternatively, a new image may be downloaded and programmed into flash more directly using RedBoot's own commands. See the RedBoot documentation for details.
Rebuilding RedBoot
Should it prove necessary to rebuild a RedBoot binary, this is done most conveniently at the command line. The steps needed to rebuild the ROM version of RedBoot for the AT91SAM9G20-EK are:
$ mkdir redboot_at91sam9g20ek_rom $ cd redboot_at91sam9g20ek_rom $ ecosconfig new at91sam9g20ek redboot $ ecosconfig import $ECOS_REPOSITORY/hal/arm/arm9/sam9g20ek/current/misc/redboot_ROM.ecm $ ecosconfig resolve $ ecosconfig tree $ make
At the end of the build the install/bin
subdirectory should contain
the file redboot.bin
.
Rebuilding AT91Bootstrap
The sources of AT91Bootstrap are found in the
AT91Bootstrap
directory of the sam9260ek
package. This is a copy of the software as supplied by Atmel with some
slight modifications to permit it to be built with the same tools as eCos.
To rebuild the second-level bootstrap for the AT91SAM9G20-EK execute the following commands:
$ cd $ECOS_REPOSITORY/hal/arm/arm9/sam9260ek/current/AT91Bootstrap/board/at91sam9g20ek/dataflash $ make
This should result in the creation of a number of files, including
dataflash_at91sam9g20ek.bin
which can be copied out.
2024-03-18 | eCosPro Non-Commercial Public License |