Name
Setup — Preparing the AT91SAM7X-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. So, in all cases it is necessary to set up a JTAG device for the board. This document describes how to set up either an Abatron BDI3000 or Ronetix PEEDI and then use them to program an application into the flash.
Initial Installation with Abatron BDI3000
Preparing the Abatron BDI3000 JTAG debugger
The BDI3000 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 BDI3000 JTAG debugger via both serial and ethernet to the host PC and power it on. Use the serial cable supplied with the BDI3000.
- Install the Abatron BDI3000 bdiGDB support software on the host PC.
-
Locate the file
bdi3000.at91sam7xek.cfg
within the eCos platform HAL package in the source repository. This will be in the directorypackages/hal/arm/at91/at91sam7xek/
relative to the root of your eCos installation.VERSION
/misc -
Locate the file
regSAM7S.def
within the installation of the BDI3000 bdiGDB support software. -
Place the
bdi3000.at91sam7xek.cfg
file in a location on the PC accessible to the TFTP server. Later you will configure the BDI3000 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
bdi3000.at91sam7xek.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 BDI3000 in line with the bdiGDB
instruction manual. Configure the BDI3000 to use the
bdi3000.at91sam7xek.cfg
configuration file at the appropriate point of this process.
Preparing the AT91SAM7X-EK board for programming with BDI3000
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 BDI3000 using a 20-pin ARM/Xscale cable from the JTAG interface connector to the Target A port on the BDI3000.
- Power up the AT91SAM7X-EK board.
Connect to the BDI3000'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:
SAM7X>
Confirm correct connection with the BDI3000 with the reset halt command as follows:
SAM7X>
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 SAM7X>
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.at91sam7xek.cfg
within the eCos platform HAL package in the source repository. This will be in the directorypackages/hal/arm/at91/at91sam7xek/
relative to the root of your eCos installation.VERSION
/misc -
Place the
peedi.at91sam7xek.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
at91sam7xek.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.at91sam7xek.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.at91sam7xek.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 ------------------------------------------------------------ sam7xek>
Preparing the AT91SAM7X-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 AT91SAM7X-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:
sam7xek>
reset
++ info: user reset sam7xek> ++ 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 sam7xek>
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 BDI3000, use the unlock command:
SAM7X>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 SAM7X>
For the PEEDI, use the flash unlock command:
sam7xek> flash unlock 0x100000 65536 unlocking region #0 at 0x00100000 unlocking region #1 at 0x00104000 unlocking region #2 at 0x00108000 unlocking region #3 at 0x0010C000 sam7xek>
This command unlocks 256 pages, i.e. 64KiB. 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 (BDI3000) or flash erase (PEEDI) command to clear any previous contents.
For the BDI3000:
SAM7X>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 SAM7X>
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:
sam7xek> flash erase done. sam7xek>
Now give the prog (BDI3000) or flash program (PEEDI) command to fetch the executable from the TFTP server and program it to the flash.
For the BDI3000:
SAM7X>prog 0x100000 sam7.bin bin Programming sam7.bin , please wait .... Programming flash passed SAM7X>
For the PEEDI:
sam7xek> 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 sam7xek>
Finally, the processor must be switched to boot from the flash rather than the internal ROM. This is done by programming a General Purpose NVM bit in the flash memory. This can be done using memory write commands in the JTAG device telnet interface. On the BDI3000 this is done using the following commands:
SAM7X>md 0xffffff60 3 ffffff60 : 0x00480100 4718848 ..0. ffffff64 : 0x00000000 0 .... ffffff68 : 0x00000001 1 .... SAM7X>mm 0xffffff64 0x5a00020b SAM7X>md 0xffffff60 3 ffffff60 : 0x00480100 4718848 ..0. ffffff64 : 0x00000000 0 .... ffffff68 : 0x00000401 1025 .... SAM7X>
And on the PEEDI:
sam7xek> mem read 0xffffff60 3 0xFFFFFF60: 0x00480100 0x00000000 0x00000001 sam7xek> mem write 0xffffff64 0x5a00020b sam7xek> mem read 0xffffff60 3 0xFFFFFF60: 0x00480100 0x00000000 0x00000401 sam7xek>
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 at91sam7xek_256 or at91sam7xek_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 AT91SAM7X-EK board.
- Power up the board by plugging the USB cable from the AT91SAM7X-EK board into the PC and Windows should recognize the USB device. If it does not, then you will need to erase the existing program that has already been programmed into flash. To do this, disconnect the USB cable from the PC, effectively powering down the device, connect jumper J8 (ERASE) on the AT91SAM7X-EK board and reconnect the USB cable. This step should have erased the flash. Finally disconnect the USB cable followed by J8, reconnect the USB cable and the board should be recognized now. Windows may ask you to install a new driver, in which case follow the instructions.
- Start SAM-BA. Select "\usb\ARM0" for the communication interface, and "at91sam7x256-ek" or "at91sam7x512-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.13) 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: 0x7400 bytes at 0x0 (buffer addr : 0x202BC8) -I- 0x7400 bytes written by applet (AT91-ISP v1.13) 1 %
You may get a pop-up asking "Do you want to lock involved lock region(s) (0 to 1)?". Select "No" if prompted.
In the Scripts section, select the script "Boot from Flash (GPNVM2)" and press "Execute". The following output should be seen:
(AT91-ISP v1.13) 1 % FLASH::ScriptGPNMV 4 -I- GPNVM2 set (AT91-ISP v1.13) 1 %
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 AT91SAM7X256-EK board on the DEBUG serial line:
$T050f:cc051000;0d:e8072000;#7f
For a AT91SAM7X512-EK board you should see something similar. For example:
$T050f:d0051000;0d:e8072000;#4d
2024-03-18 | eCosPro Non-Commercial Public License |