In one of my previous articles I described in short, how to flash the IFLAT-32 by using the X-Link JTAG and OpenOCD. Here I will give some hints, on how the X-Link JTAG could be used to flash the STM32VL Descovery (or any other ST32) as well. As a prerequisite, make sure to install OpenOCD as described in the section „Insatalling OpenOCD“. Falshing the STM32 Discovery in general works the same way as flashing the IFLAT-32. There are only two things to take care of:
- A different board configuration has to be used for OpenOCD.
- There is no JTAG connector on the STM32VL Discovery (since you are supposed to use ST-Link for flashing/debugging).
1. Connecting the STM32 Discovery to the X-Link JTAG
The following table shows, which pins from the STM32 must be connected to the corresponding pins of the X-Link (They are labeled on the X-Links back-side):
Note on the 3.3V power supply: you could also use 5V power supply since the X-Link has a switch to select the power supply. Using 5V power supply has the advantage, that the 5V pin on the STM32 Discovery is on the same side as the rest of the needed pins.
2. Check if OpenOCD is Working
For the STM32, which is a STM32100, we use the „board/stm32100b_eval.cfg“ which is provided by the default OpenOCD install (mine is version 0.5.0). To check if your board is detected try the following:
openocd -f interface/openocd-usb.cfg -f board/stm32100b_eval.cfg
If everything works, your CPU should be reported (check for „Info : JTAG tap: stm32.cpu …“), and you should be able to telnet to the OpenOCD console on port 4444.
3. Flashing with OpenOCD
E. g. to flash the firmware “firmware.elf”:
openocd -f interface/openocd-usb.cfg -f board/stm32100b_eval.cfg \ -c init -c targets -c "halt" \ -c "flash write_image erase firmware.elf" \ -c "verify_image firmware.elf" \ -c "reset run" -c shutdown