Difference between revisions of "The Cortex M3 board"
(→Flashing a new firmware (using ARM-USB-TINY)) |
(→Flashing a new firmware (using ARM-USB-TINY)) |
||
Line 35: | Line 35: | ||
** <tt>openocd-0.2.0-win32.exe</tt> | ** <tt>openocd-0.2.0-win32.exe</tt> | ||
** <tt>olimex_stm32_h103_ft2232.cfg</tt> | ** <tt>olimex_stm32_h103_ft2232.cfg</tt> | ||
+ | ** The binary file (in this case the <tt>main.bin</tt> demo) | ||
* Run the command: | * Run the command: | ||
> openocd-0.2.0-win32 -f olimex_stm32_h103_ft2232.cfg | > openocd-0.2.0-win32 -f olimex_stm32_h103_ft2232.cfg | ||
Line 52: | Line 53: | ||
Info : JTAG tap: stm32.bs tap/device found: 0x16410041 (mfg: 0x020, part: 0x6410, ver: 0x1) | Info : JTAG tap: stm32.bs tap/device found: 0x16410041 (mfg: 0x020, part: 0x6410, ver: 0x1) | ||
Info : JTAG Tap/device matched | Info : JTAG Tap/device matched | ||
− | * Open a secondary console | + | * Open a secondary console (no need to change the path) |
* Launch a telnet session: | * Launch a telnet session: | ||
> telnet localhost 4444 | > telnet localhost 4444 | ||
− | * Execute the following commands: | + | * Execute the following commands to write the image to the flash. ''Note:'' The path to the flash image is relative to the location the openocd executable has been launched at. |
> halt | > halt | ||
> flash write_image erase main.bin 0x08000000 | > flash write_image erase main.bin 0x08000000 |
Revision as of 11:20, 14 October 2009
Contents
The Cortex M3 board
Manufacturer: Olimex --> (http://olimex.com/dev/stm32-p103.html)
CPU: Cortex M3 (STM32F103RBT6 @ 72MHz, 20k RAM, 128k ROM)
Flashing the board
Easiest way: Use ARM USB TINY JTAG adaptor (http://olimex.com/dev/arm-usb-tiny.html).
You need OpenOCD version 0.2.0, a windows executable and the config file is here --> SVN
Compiling OpenOCD
Get openocd-0.2.0, libusb-win32-device-bin-0.12.2, ftdi drivers 2.04.16.
Compile with cygwin gcc, but for cygwin-independent target.
Enabled programmers are the usbProg and the ARM-USB-TINY.
Compile this way:
> ./configure --enable-usbprog --enable-ft2232_ftd2xx \ --with-ftd2xx-win32-zipdir=<path_to_ftd2xx_driver> \ CC="gcc -mno-cygwin" \ CFLAGS="-I<path_to_libusb-win32-device-bin>/include/"\ LDFLAGS="-L<path_to_libusb-win32-device-bin>/lib/" > make
After that, the executable openocd.exe is in the src folder. It should be identical to the openocd-0.2.0-win32.exe from SVN.
Flashing a new firmware (using ARM-USB-TINY)
The SVN contains a file main.bin which is a very simple blinking lights demo for the board.
- Open a console (cygwin bash or DOS shell) and enter the directory with the following files:
- openocd-0.2.0-win32.exe
- olimex_stm32_h103_ft2232.cfg
- The binary file (in this case the main.bin demo)
- Run the command:
> openocd-0.2.0-win32 -f olimex_stm32_h103_ft2232.cfg
- The console should show this output:
Open On-Chip Debugger 0.2.0 (2009-10-13-12:05) Release $URL: http://svn.berlios.de/svnroot/repos/openocd/tags/openocd-0.2.0/src/openocd.c $ For bug reports, read http://svn.berlios.de/svnroot/repos/openocd/trunk/BUGS jtag_speed: 0 jtag_nsrst_delay: 100 jtag_ntrst_delay: 100 Info : device: 4 Info : deviceID: 364511236 Info : SerialNumber: FTS92Y5TA Info : Description: Olimex OpenOCD JTAG TINY A Info : JTAG tap: stm32.cpu tap/device found: 0x3ba00477 (mfg: 0x23b, part: 0xba00, ver: 0x3) Info : JTAG Tap/device matched Info : JTAG tap: stm32.bs tap/device found: 0x16410041 (mfg: 0x020, part: 0x6410, ver: 0x1) Info : JTAG Tap/device matched
- Open a secondary console (no need to change the path)
- Launch a telnet session:
> telnet localhost 4444
- Execute the following commands to write the image to the flash. Note: The path to the flash image is relative to the location the openocd executable has been launched at.
> halt > flash write_image erase main.bin 0x08000000
- Your console prompt should be showing something like this:
Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. Open On-Chip Debugger > reset JTAG tap: stm32.cpu tap/device found: 0x3ba00477 (mfg: 0x23b, part: 0xba00, ver: 0x3) JTAG Tap/device matched JTAG tap: stm32.bs tap/device found: 0x16410041 (mfg: 0x020, part: 0x6410, ver: 0x1) JTAG Tap/device matched > halt target state: halted target halted due to debug-request, current mode: Thread xPSR: 0x21000000 pc: 0x000000c2 > flash write_image erase main.bin 0x08000000 auto erase enabled device id = 0x20036410 flash size = 128kbytes wrote 4052 byte from file main.bin in 0.375000s (10.552083 kb/s)
- Congratulations! Your new firmware is flashed. You can start it by resetting the MCU or by issuing another command in the telnet session:
> resume 0
If you flashed the blinking demo, the LED is blinking right now ...
Flashing a new firmware (using UsbProg)
Should be similar, but this device sucks in openOCD mode ...
Remarks
- Flashing speed is quite high, > 10kBytes/s, so the whole process takes only seconds.