Setup — Preparing the IAR KickStart Board for eCos Development
In a typical development environment, the IAR KickStart Board boots from internal flash into either the GDB stub ROM monitor or directly into the user application. In the case of microcontrollers with less than 64Kbytes of SRAM, the latter is recommended. eCos applications to be loaded and run from the GDB stub ROM monitor may be 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 ROM image into Flash memory, either the GDB stub ROM or application images.
For serial communications, all versions run with 8 bits, no parity, and 1
stop bit at 38400 baud. This baud rate can be changed via the configuration
rebuilding the application, or if applicable, GDB stub ROM. A "straight
through" 9-pin RS232 serial cable, with Male<->Female connectors is
required. Using a "null modem" serial cable will not work.
Jumper settings must be checked and potentially changed on the board to ensure correct operation. This section describes jumper settings that are known to require attention. In general, any board-specific documentation from IAR takes precedence over the documentation here, as this may reflect hardware which has been modified since the time of writing of this documentation. Many KickStart boards are similar to each other, the only change of note being of course the choice of LPC2xxx microcontroller fitted. But if your board does not fit the description here (which has initially been based on the LPC2106 KickStart) then you should consult the board documentation.
Firstly, there are two jumpers located close to the serial connectors, labelled JP3 and JP4 on the LPC2106 KickStart. These can both be closed (i.e. jumper fitted and connecting the two pins) in order to permit use of both serial ports.
There are two jumpers labelled EN_SW_ISP and EN_SW_RST close to the push buttons, also labelled JP7 and JP8 respectively on the LPC2106 KickStart. In general, these jumpers should only be closed when wishing to reprogram the on-chip Flash via ISP. Otherwise they should remain open (jumper not connecting the two pins) so that any unplugging of the serial connector, movement of the serial connector, or use of flow control signals from the host PC, do not cause a spurious reset or interrupt (on the EINT1 line) of the board.
The jumpers controlling the LEDs (labelled LED Jumper Block on the LPC2106 KickStart) may remain in their default state of being connected to P0.0-P0.15. This is assumed by code which allows use of the user-configurable LEDs, as described later.
All other jumpers can remain in their factory-supplied default state.
This process assumes that a Microsoft Windows machine with the Flash Magic utility installed is available. Flash Magic is a tool for programming flash based microcontrollers from NXP using a protocol via the RS232 serial port to communicate with the In-System Programming (ISP) firmware on the LPC2xxx. The Flash Magic utility is sponsored by NXP and available from this website.
The first step is to connect the RS232 cable between UART0 of the KickStart board and the host PC. Do not use UART1. Now close the two jumpers mentioned earlier labelled EN_SW_ISP and EN_SW_RST. These allow the software on the PC to reset the LPC2xxx and enter the ISP firmware. Finally apply the power.
Start the Flash Magic utility on the host PC, and a window will be displayed allowing various parameters to be configured in a series of steps. For step 1, firstly choose the appropriate COM port that is being used on your PC and set the Baud Rate to 38400 baud. Next select the appropriate LPC2xxx device in use such as LPC2106. The "Interface" should be set to "None (ISP)". And finally for step 1 choose the appropriate Oscillator Frequency for the KickStart board in use. This may be found in the board documentation, and is usually visibly readable on the surface of the oscillator on the board (in a metal package). For example for the LPC2106 KickStart, the oscillator reads T14.7456 indicating 14.7456MHz.
For step 2, it is usually adequate to leave the option "Erase blocks used by hex file" checked,
and ignore the other settings. For step 3, you must select the program image to be
downloaded, in Intel HEX format. To program the pre-built GDB stub ROM image,
locate the file
gdb_module.hex in the
subdirectory of your release. To generate an Intel HEX format version of
an application you have built yourself run the following command at
a shell prompt:
$ arm-eabi-objcopy -O ihex app.elf app.hex
This converts the application image in ELF format (as output by the linker), to
Intel HEX format in the file
app.hex. Note that the arm-eabi
tools must be on your path at this point. If they are not, run the command
below before you run the above arm-eabi-objcopy command:
$ . /opt/ecos/ecosenv.sh
In step 4, it is recommended to set the option "Verify after programming". Finally it is possible to click on "Start" to program the image into the on-chip Flash.
If there is a problem communicating with the board, such as a report of a failure to autobaud, then this may imply that the Flash Magic tool was not able to control the serial lines properly. This can happen with some USB-Serial converters. To workaround this issue, power the board off and remove (i.e. open) the EN_SW_ISP and EN_SW_RST jumpers. Then simultaneously press the buttons marked 'Reset' and 'ISP/INT1' then release the Reset button, and finally release the 'ISP/INT1' button. This is an alternative mechanism of forcing the ISP firmware to be entered. Once this has been successfully performed, the programming operation may be retried from the Flash Magic utility.
When the process completes, remove (i.e. open) the two jumpers next to the serial port. If a GDB stub ROM image has been programmed, verify the programming has been successful by starting a terminal emulation application such as HyperTerminal on the host PC and set the serial communication parameters to 38400 baud, 8 data bits, no parity, 1 stop bit (8N1) and no flow control (handshaking). Reset the board and the stubrom should start. For boards programmed with GDB stubs the output should be similar to the following:
This is the stubrom attempting to communicate with GDB and indicates that it is functioning correctly.
Rebuilding the GDB Stub ROM
Should it prove necessary to rebuild the GDB Stub ROM binary, this is done
most conveniently at the command line. Your
ECOS_REPOSITORY environment variables must first be set correctly,
The following steps given an example of how to rebuild the stubs for a KickStart board
$ mkdir stub_rom $ cd stub_rom $ ecosconfig new iar_kickstart_lpc2106 stubs $ ecosconfig resolve $ ecosconfig tree $ make
At the end of the build the
install/bin subdirectory should contain
gdb_module.img (ELF format),
gdb_module.srec (Motorola S-Record format),
gdb_module.bin (raw binary format), and
gdb_module.hex (Intel HEX format).
|2019-06-13||eCosPro Non-Commercial Public License|