Name
Setup — Preparing the STM32X0G-EVAL Board for eCos Development
Overview
In a typical development environment, the STM32X0G-EVAL board boots from internal flash into either the GDB stubrom or RedBoot. eCos applications are configured for RAM startup and then downloaded and run on the board via the debugger arm-eabi-gdb, or via the Eclipse IDE.
RedBoot Installation
The following RedBoot configurations are supported:
Configuration | Description | Use | File |
---|---|---|---|
ROM | RedBoot running from internal FLASH | redboot_ROM.ecm | redboot_ROM.bin |
RAM | RedBoot running from external RAM | redboot_RAM.ecm | redboot_RAM.bin |
JTAG | RedBoot running from external RAM, loaded via JTAG | redboot_JTAG.ecm | redboot_JTAG.elf |
For serial communications, all versions run with 8 bits, no parity, and 1 stop bit at 115200 baud. This rate can be changed using the RedBoot baud command, or in the eCos configuration used for building RedBoot.
Under normal circumstances, RedBoot runs in-place from the internal Flash. The RAM version is provided to allow for updating the resident RedBoot image in Flash. The JTAG version is only used if loading RedBoot into RAM via a JTAG debugger. It is similar to the RAM version, but loads at a lower address within RAM. The ELF format image of this JTAG version of RedBoot can also be loaded and executed from GDB using a JTAG device, to allow it to be debugged.
Programming RedBoot with ST Flash Loader Demonstrator
To program RedBoot into the internal flash either a JTAG debugger that understands the STM32 flash may be used, such as a Ronetix PEEDI , or the ST Flash Loader Demonstrator may be used. Configuration files for the PEEDI have been supplied in the STM32X0G-EVAL HAL package. If no JTAG debugger is available, then RedBoot must be downloaded using the Flash Loader Demonstrator which can be downloaded from the page for the STM32F207IG CPU, in the Design Support->Software & Development Tools->Software Demos section of ST's website at http://www.st.com/internet/mcu/product/245085.jsp#SOFTWARE_AND_DEVELOPMENT_TOOLS. It must be at least version 2.4.0 in order to support the STM32F2xx devices. At time of writing, a direct link to this version is available at http://www.st.com/internet/com/SOFTWARE_RESOURCES/SW_COMPONENT/SW_DEMO/stm32-stm8_flash_loader_demo.zip.
The following are brief instructions for downloading RedBoot using the Flash Loader Demonstrator. For more complete usage instructions, consult the ST documentation for this tool at http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/USER_MANUAL/CD00171488.pdf
- Download the Flash Loader Demonstrator from the ST website and install it on a PC running Windows that has an available RS232 serial port, or with a USB to RS232 adaptor.
-
Copy the file
redboot_ROM.bin
from theloaders/stm32x0g_eval
sub-directory within your eCosPro installation to a suitable location on the Windows PC. - Connect a null-modem serial cable between the USART serial port (CN16) and the RS232 serial port on the Windows machine.
- Move the BOOT0/SW2 switch to the 1 position, ensuring the BOOT1/SW1 switch remains in the 0 position, and press the reset button.
- Start the Flash Loader Demonstrator and in the first screen select the COM port connected to the board under Port Name. Ensure that the baud rate is also set at 115200, with Even parity, Echo disabled and Flow control off. Press Next. If you are succesfully connected to the board, you should see the message Target is readable. Please click "Next" to proceed . Press Next and you will be prompted to select a target. Select STM32F2_1024K, then Next to go to the Operation choice page. If any of these steps fail, follow the direction given by the loader to recover.
-
On the operation choice page select "Download to
device" and under "Download from
file" either type the location of the
redboot_ROM.bin
file, or browse to it. Ensure that the "@" field is set to 8000000, the "Global Erase" radio button is selected and that all other options are clear except "Verify after download". - Press "Next" and the loader should download and verify the binary file. The download or verify may fail if the flash has been previously locked, in which case you should select the "Enable/Disable Flash protection" radio button, "Disable" and "Write Protection" drop-down items, press Next and retry the download. Upon successful download press "Close" to exit the loader.
- Move the BOOT0/SW2 switch back to the 0 position and press the reset button.
The behaviour of the Flash Loader Demonstrator documented here is that of version 2.4.0. The actual behaviour of newer versions may vary slightly.
Whatever mechanism is used to program RedBoot, something similar to the following output should be seen on the RS232 serial port when the reset button is pressed:
+**Warning** FLASH configuration checksum error or invalid key Use 'fconfig -i' to [re]initialize database RedBoot(tm) bootstrap and debug environment [ROM] eCosCentric certified release, version v3_1_X - built 04:32:11, Feb 3 2012 Copyright (C) 2000-2009 Free Software Foundation, Inc. Copyright (C) 2003-2012 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: ST STM3220G EVAL (Cortex-M3) RAM: 0x64000000-0x64200000 [0x64003668-0x641dd000 available] 0x20000000-0x2001f000 [0x20000000-0x2001f000 available] FLASH: 0x08000000-0x080fffff, 4 x 0x4000 blocks, 1 x 0x10000 blocks, 7 x 0x20000 blocks RedBoot>
You should now proceed to the section describing how to initialize RedBoot's flash configuration.
Programming RedBoot with Ronetix PEEDI
This section describes how to install RedBoot using a Ronetix PEEDI JTAG debugger.
The PEEDI must be configured to allow communication with your local network, and configured with the parameters for interfacing with the target board. It must then be used to download and program a RedBoot image into the internal flash. The following steps give a typical outline for doing this. Consult the PEEDI documentation for alternative approaches, such as using FTP or HTTP instead of TFTP.
Preparing the Ronetix PEEDI JTAG debugger
- Prepare a PC to act as a host 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).
- Verify the PEEDI is using up-to-date firmware, of version 11.10.1 or later. Older PEEDI firmware does not support the STM32 F2 family correctly, particularly if wishing to use the PEEDI's own 'flash' commands to modify the on-chip Flash. If the firmware is not recent enough, follow the PEEDI User Manual's instructions which describe how to update the PEEDI firmware.
-
Locate the appropriate file
peedi.stm3220g.cfg
(STM3220G-EVAL) orpeedi.stm3240g.cfg
(STM3240G-EVAL and STM3241G-EVAL) within the eCos platform HAL package in the source repository. This will be in the directorypackages/hal/cortexm/stm32/stm32x0g/
relative to the root of your eCos installation.VERSION
/misc - Place the respective configuration 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
peedi.stm3220g.cfg
orpeedi.stm3240g.cfg
(as appropriate) 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 appropriate
peedi.stm3220g.cfg
orpeedi.stm3240g.cfg
target configuration file on the TFTP server at the appropriate point of the config process, for example with a path such as:tftp://192.168.7.9/peedi.stm3220g.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-2011 www.ronetix.at - All rights reserved Hw:1.2, L:JTAG v1.5 Fw:11.10.1, SN: PD-0000-XXXX-XXXX ------------------------------------------------------------ stm3220g>
Preparing the STM32X0G 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.
- Connect a null modem DB9 RS232 serial cable between the serial port on the board and a serial port on the host computer.
- Start a suitable terminal emulator on the host computer such as minicom on Linux or PuTTY on Windows. Set the communication parameters to 115200 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 to the Target port on the PEEDI.
- Power up the STM32X0G board.
- Connect to the PEEDI's telnet CLI on port 23 as before.
Confirm correct connection with the PEEDI with the reset reset command as follows:
stm3220g>
reset reset
++ info: RESET and TRST asserted ++ info: TRST released ++ info: BYPASS check passed ++ info: 2 TAP controller(s) detected ++ info: TAP 0 : IDCODE = 0x06411041, unknown ID ++ info: TAP 1 : IDCODE = 0x4BA00477, Cortex M3 JTAG ++ info: RESET released ++ info: core #0 connected ++ info: core 0: initialized stm3220g>
Installation into Flash
The following describes the procedure for installing the RedBoot ROM monitor into on-chip Flash. It can also be adapted for installing user applications into Flash.
-
Locate the
redboot_ROM.bin
image within theloaders
subdirectory of the base of the eCos installation. For applications, use arm-eabi-objcopy -O binary to convert the linked application, in ELF format, into binary format. -
Copy the
redboot_ROM.bin
file into a location on the host computer accessible to its TFTP server. Connect to the PEEDI's telnet interface, and program the RedBoot image into Flash with the following command, replacing
TFTP_SERVER
with the address of the TFTP server and/RBPATH
with the location of the redboot_ROM.bin file relative to the TFTP server root directory:stm3220g> flash program tftp://
TFTP_SERVER
/RBPATH/
redboot_ROM.bin bin 0x08000000 erase ++ info: Programming image file: tftp://TFTP_SERVER
/RBPATH/
redboot_ROM.bin ++ info: Programming using agent, buffer = 4096 bytes ++ info: At absolute address: 0x08000000 erasing at 0x08000000 (sector #0) programming at 0x08000000 programming at 0x08001000 programming at 0x08002000 programming at 0x08003000 erasing at 0x08004000 (sector #1) programming at 0x08004000 programming at 0x08005000 programming at 0x08006000 programming at 0x08007000 erasing at 0x08008000 (sector #2) programming at 0x08008000 programming at 0x08009000 programming at 0x0800A000 programming at 0x0800B000 erasing at 0x0800C000 (sector #3) programming at 0x0800C000 programming at 0x0800D000 programming at 0x0800E000 programming at 0x0800F000 ++ info: successfully programmed 64.00 KB in 2.39 sec stm3220g>
The RedBoot installation is now complete. This can be tested by powering off the board, disconnecting the JTAG, and then powering on the board again. The RedBoot banner should be visible on the serial port:
+**Warning** FLASH configuration checksum error or invalid key Use 'fconfig -i' to [re]initialize database RedBoot(tm) bootstrap and debug environment [ROM] eCosCentric certified release, version v3_1_X - built 04:32:11, Feb 3 2012 Copyright (C) 2000-2009 Free Software Foundation, Inc. Copyright (C) 2003-2012 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: ST STM3220G EVAL (Cortex-M3) RAM: 0x64000000-0x64200000 [0x64003668-0x641dd000 available] 0x20000000-0x2001f000 [0x20000000-0x2001f000 available] FLASH: 0x08000000-0x080fffff, 4 x 0x4000 blocks, 1 x 0x10000 blocks, 7 x 0x20000 blocks RedBoot>
Note | |
---|---|
An alternative approach would be to use arm-eabi-gdb
to load and run the $ |
Initializing RedBoot Flash Configuration
RedBoot manages the internal flash for the storage of application programs and configuration data. The flash needs to be initialized with the following commands:
RedBoot>fis init
About to initialize [format] FLASH image system - continue (y/n)?y
*** Initialize FLASH Image System ... Erase from 0x080e0000-0x080fffff: . ... Program from 0x641e0000-0x64200000 to 0x080e0000: . RedBoot>fconfig -i
Initialize non-volatile configuration - continue (y/n)?y
Run script at boot: false Console baud rate: 115200 Update RedBoot non-volatile configuration - continue (y/n)?y
... Erase from 0x080e0000-0x080fffff: . ... Program from 0x641e0000-0x64200000 to 0x080e0000: . RedBoot>
Issue the reset command to RedBoot, and verify the the target board comes up as expected with the correct settings.
You may also need to run the fconfig -i command if you have updated your RedBoot from a previous version with a different configuration which might not have any new config fields used by the newly programmed RedBoot.
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 are:
$mkdir redboot_stm3220g_rom
$cd redboot_stm3220g_rom
$ecosconfig new stm3220g redboot
[ … ecosconfig output elided … ] $ecosconfig import $ECOS_REPOSITORY/hal/cortexm/stm32/stm32x0g_eval/
$VERSION
/misc/redboot_ROM.ecmecosconfig tree
$make
At the end of the build the install/bin
subdirectory should
contain the file redboot.bin
. This may be
programmed to the board using the above procedure, or by using
RedBoot's own flash update mechanisms.
The other versions of RedBoot - RAM or JTAG - may be similarly built by choosing the appropriate alternative .ecm file.
2024-12-10 | eCosPro Non-Commercial Public License |