Flashing Firmware

From Open-BLDC
Jump to: navigation, search


This HowTo is based on this blogpost.

Compiling and flashing an example program

You have to set the seo services PATH variable first. So that the cross compiler binaries can be found by the makefile.

export PATH=/opt/mine/arm-none-eabi/bin:$PATH

Openocd supplied config file for jtagkey-tiny has an error in my case. On my machine the jtagkey-tiny appears as "Amontec JTAGkey" and not "Amontec JTAGkey A". You have to edit /opt/mine/lib/openocd/interface/jtagkey-tiny.cfg and change the line ft2232_device_desc "Amontec JTAGkey A" to ft2232_device_desc "Amontec JTAGkey".

Now you can download stm32-blink.tar.bz2 that has been cleaned up a bit. It is based on the example blink project from Olimex.

The example project from Olimex uses parts of the Firmware Library from ST. The documentation and the library itself can be found and downloaded here. You have to be careful though, the library has a very wired license that is probably problematic when used in open source projects. I assume that the strange license may pose also problems when used in closed source projects too. We are not lawyers so do not kill us if we are wrong.

tar xfvj stm32-blink.tar.bz2
cd stm32-blink

Next step is to start openocd. You should start opencd in the stm32-blink directory so that later openocd can find the binary you will be uploading.

openocd -f /opt/mine/lib/openocd/interface/jtagkey-tiny.cfg -f /opt/mine/lib/openocd/target/stm32.cfg

Now open a new terminal and run the following commands to flash the stm32-blink binary.

telnet localhost 4444
reset halt
flash write_image erase stm_h103_blink_rom.hex

Now the diode on the stm32-h103 board should start to blink happily! :)