Name
Setup — Preparing the AT91SAM7S-EK board for eCos Development
Overview
eCos applications are either programmed into the on-chip flash, or run from RAM using either a JTAG device or the GDB stubs ROM. The installation of the GDB stubs or any flash-resident application requires use of a JTAG device to write to the flash, or the Atmel-supplied SAM-BA program that interacts with the on-chip boot program. This document describes how to set up an Abatron BDI2000 Ronetix PEEDI for programming the gdb stubs and applications into the flash, and use the Atmel SAM-BA application to program the gdb stubs into the flash.
Initial Installation with Abatron BDI2000
Preparing the Abatron BDI2000 JTAG debugger
The BDI2000 must first be configured to allow communication with your local network, and configured with the parameters for interfacing with the target board. The following steps should be followed:
- Prepare a PC to act as a host PC and start a TFTP server on it.
- Connect the Abatron BDI2000 JTAG debugger via both serial and ethernet to the host PC and power it on. Use the serial cable supplied with the BDI2000.
- Install the Abatron BDI2000 bdiGDB support software on the host PC.
-
Locate the file
bdi2000.at91sam7sek.cfg
within the eCos platform HAL package in the source repository. This will be in the directorypackages/hal/arm/at91/at91sam7sek/
relative to the root of your eCos installation.VERSION
/misc -
Locate the file
regSAM7S.def
within the installation of the BDI2000 bdiGDB support software. -
Place the
bdi2000.at91sam7sek.cfg
file in a location on the PC accessible to the TFTP server. Later you will configure the BDI2000 to load this file via TFTP as its configuration file. -
Similarly place the file
regSAM7S.def
in a location accessible to the TFTP server. -
Open
bdi2000.at91sam7sek.cfg
in an editor such as emacs or notepad and if necessary adjust the path of theregSAM7S.def
file in the[REGS]
section to match its location relative to the TFTP server root. -
Install and configure the Abatron BDI2000 in line with the bdiGDB
instruction manual. Configure the BDI2000 to use the
bdi2000.at91sam7sek.cfg
configuration file at the appropriate point of this process.
Preparing the AT91SAM7S-EK board for programming with BDI2000
Follow the steps in this section in order to allow communication between the board and the host PC, and between the board and the JTAG device.
- First you must connect a null modem DB9 serial cable between the Serial Debug Port on the board and a serial port on the host computer.
- Start a suitable terminal emulator on the host computer such as minicom or HyperTerminal. Set the communication parameters to 38400 baud, 8 data bits, no parity bit and 1 stop bit with no flow control.
- Connect the board to the BDI2000 using a 20-pin ARM/Xscale cable from the JTAG interface connector to the Target A port on the BDI2000.
- Power up the AT91SAM7S-EK board.
Connect to the BDI2000's CLI interface via TCP/IP on the standard telnet port 23. The telnet application is suitable for this. You should see usage information followed by the prompt:
SAM7S>
Confirm correct connection with the BDI2000 with the reset halt command as follows:
SAM7S>
reset halt
- TARGET: processing reset request - TARGET: BDI asserts TRST and RESET - TARGET: BDI removes TRST - TARGET: Bypass check 0x000000001 => 0x00000001 - TARGET: JTAG exists check passed - Core#0: ID code is 0x3F0F0F0F - TARGET: All ICEBreaker access checks passed - TARGET: BDI removes RESET - TARGET: BDI waits for RESET inactive - TARGET: resetting target passed - TARGET: processing target startup .... - TARGET: processing target startup passed SAM7S>
Initial Installation with Ronetix PEEDI
Preparing the Ronetix PEEDI JTAG debugger
The PEEDI must first be configured to allow communication with your local network, and configured with the parameters for interfacing with the target board. The following steps give a typical outline of setting up the PEEDI using TFTP. Consult the PEEDI documentation for alternative mechanisms.
- Prepare a PC to act as a host PC and start a TFTP server on it.
- Connect the PEEDI JTAG debugger via both serial and ethernet to the host PC and power it on. Use the serial cable supplied with the PEEDI (straight through, not null modem).
-
Locate the file
peedi.at91sam7sek.cfg
within the eCos platform HAL package in the source repository. This will be in the directorypackages/hal/arm/at91/at91sam7sek/
relative to the root of your eCos installation.VERSION
/misc -
Place the
peedi.at91sam7sek.cfg
file in a location on the PC accessible to the TFTP server. Later you will configure the PEEDI to load this file via TFTP as its configuration file. -
Open
at91sam7sek.cfg
in an editor such as emacs or notepad and insert your own license information in the[LICENSE]
section. -
Install and configure the PEEDI in line with the PEEDI Quick Start Guide or
User's Manual, especially configuring PEEDI's RedBoot with the network information.
Configure it to use the
peedi.at91sam7sek.cfg
target configuration file on the TFTP server at the appropriate point of the fconfig process, for example with a path such as:tftp://192.168.7.9/peedi.at91sam7sek.cfg
- Reset the PEEDI.
Connect to the PEEDI's CLI interface via TCP/IP on the standard telnet port 23. The telnet application is suitable for this. You should see output similar to the following:
$ telnet 192.168.7.225 Trying 192.168.7.225... Connected to 192.168.7.225. Escape character is '^]'. PEEDI - Powerful Embedded Ethernet Debug Interface Copyright (c) 2005-2007 www.ronetix.at - All rights reserved Hw:1.2, Fw:2.0.13, SN: PD-0000-XXXX-XXXX ------------------------------------------------------------ sam7sek>
Preparing the AT91SAM7S-EK board for programming with PEEDI
Follow the steps in this section in order to allow communication between the board and the host PC, and between the board and the JTAG device.
- First you must connect a null modem DB9 serial cable between the Serial Debug Port on the board and a serial port on the host computer.
- Start a suitable terminal emulator on the host computer such as minicom or HyperTerminal. Set the communication parameters to 38400 baud, 8 data bits, no parity bit and 1 stop bit with no flow control.
- Connect the board to the PEEDI using a 20-pin ARM/Xscale cable from the JTAG interface connector on the board to the Target port on the PEEDI.
- Power up the AT91SAM7S-EK board.
- Connect to the PEEDI's CLI on port 23 as before.
Confirm correct connection with the PEEDI with the reset command as follows:
sam7sek>
reset
++ info: user reset sam7sek> ++ info: RESET and TRST asserted ++ info: TRST released ++ info: 1 TAP controller(s) detected ++ info: TAP : IDCODE = 0x3F0F0F0F, ARM7TDMI compliant ++ info: RESET released ++ info: core 0: initialized sam7sek>
Installation into Flash
Installation of an application into the on-chip flash, or the installation of the GDB stubs, using a JTAG programmer takes exactly the same form:
-
Locate the binary image of the executable to be installed. For the GDB
stubs do this by locating the file
gdb_module.bin
within theloaders
subdirectory of the base of the eCos installation. For applications use arm-eabi-objcopy -O binary to convert the ELF output of the linker into binary. - Copy the file into a location on the host computer accessible to its TFTP server.
- Connect to the JTAG device telnet port as before.
The flash must be unlocked to ensure that the flash area we want to program is writable.
For the BDI2000, use the unlock command:
SAM7S>unlock 0x100000 0x100 256 Unlocking flash at 0x00100000 Unlocking flash at 0x00100100 Unlocking flash at 0x00100200 ... Unlocking flash at 0x0010fe00 Unlocking flash at 0x0010ff00 Unlocking flash passed SAM7S>
For the PEEDI, use the flash unlock command:
sam7sek> flash unlock 0x100000 65536 unlocking region #0 at 0x00100000 unlocking region #1 at 0x00104000 unlocking region #2 at 0x00108000 unlocking region #3 at 0x0010C000 sam7sek>
This command unlocks 256 pages, i.e. 64KiB on the AT91SAM7S512. The number of pages unlocked should match at least the size of the executable to be programmed. With the PEEDI you can use an unadorned flash unlock to unlock the entire flash.
Give the erase (BDI2000) or flash erase (PEEDI) command to clear any previous contents.
For the BDI2000:
SAM7S>erase 0x100000 0x100 256 Erasing flash at 0x00100000 Erasing flash at 0x00100100 Erasing flash at 0x00100200 ... Erasing flash at 0x0010fe00 Erasing flash at 0x0010ff00 Erasing flash passed SAM7S>
As with the unlock command, the size of the area erased must be at least the size of the executable to be programmed.
For the PEEDI, only full flash erase is supported:
sam7sek> flash erase done. sam7sek>
Now give the prog (BDI2000) or flash program (PEEDI) command to fetch the executable from the TFTP server and program it to the flash.
For the BDI2000:
SAM7S>prog 0x100000 sam7.bin bin Programming sam7.bin , please wait .... Programming flash passed SAM7S>
For the PEEDI:
sam7sek> flash program tftp://192.168.7.9/gdb_module.bin bin 0x100000 ++ info: Programming directly ++ info: Programming image file: tftp://192.168.7.9/gdb_module.bin ++ info: At absolute addres: 0x00100000 unlocking at 0x00100000 (region #0) programming at 0x00100000 programming at 0x00101000 programming at 0x00102000 programming at 0x00103000 unlocking at 0x00104000 (region #1) programming at 0x00104000 programming at 0x00105000 programming at 0x00106000 programming at 0x00107000 ++ info: successfully programmed 32.00 KB in 0.93 sec sam7sek>
The installation is now complete. This can be tested by powering off the board, disconnecting the JTAG, and then powering on the board again. A ROM based application should start immediately, and any output will be seen on the serial connection. If the GDB stub ROM has been installed, then something similar to the following will be seen on the serial port:
+$T050f:cc061000;0d:18082000;#4d
Programming GDB Stubs into Flash using SAM-BA
The following gives the steps needed to program the gdb stubs into Flash using SAM-BA. The user should refer to the SAM-BA documentation for full details of how to run the program.
- Download the AT91 In-system Programmer software package from the Atmel website. Install it on a suitable PC running Windows or Linux. The remainder of this section documents the behaviour seen under Windows, although the behaviour on Linux should not be too different.
-
Copy
gdb_module.bin
from either the at91sam7sek_256 or at91sam7sek_512 subdirectories, depending on which of the two boards you are using, to a suitable location on the 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 38400 baud. Connect a USB cable between the PC and the AT91SAM7S-EK board.
- JP5 (TST) jumper needs to be temporarily closed and USB connected into the PC for 10 seconds. This writes the SAM-BA bootstrap into the boot sectors so the board can then be programmed. USB should then be disconnected and JP5 moved to the open position. If you do not do this then the option of connecting SAM-BA to the \usb\ARM0 will not be available when the USB cable is reconnected to the PC.
- Power up the board by plugging the USB cable from the AT91SAM7S-EK board into the PC and Windows should now recognize the USB device.
- Start SAM-BA. Select "\usb\ARM0" for the communication interface, and "at91sam7s256-ek" or "at91sam7s512-ek" for the board to match the board you are about to program. If the USB option does not appear, check the cable and look in the Windows Device Manager for the active device. If all is well, click on "Connect".
In the SAM-BA main window, select the "FLASH" tab and in the "Send File Name" field, select the
gdb_module.bin
. Ensure that the Address field contains "0x100000" and click "Send File". The following output should be seen:(AT91-ISP v1.12) 1 % send_file {Flash} "gdb_module.bin" 0x100000 0 -I- Send File gdb_module.bin at address 0x100000 first_sector 0 last_sector 1 -I- Writing: 0x740C bytes at 0x0 (buffer addr : 0x202B68) -I- 0x740C bytes written by applet (AT91-ISP v1.12) 1 %
You may get a popup asking if you want to unlock sectors 0, 1 of flash. Select "Y" if prompted.
You may also get a pop-up asking "Do you want to lock involved lock region(s) (0 to 1)?". Select "No" if prompted.
Shut down SAM-BA, disconnect and reconnect the USB cable. Press the reset button on the board and something similar to the following should be output for a AT91SAM7S256-EK board on the DEBUG serial line:
$T050f:cc051000;0d:e8072000;#7f
For a AT91SAM7S512-EK board you should see something similar. For example:
$T050f:c0051000;0d:e0072000;#44
2024-12-10 | eCosPro Non-Commercial Public License |