Starting Electronics Needs Your Help!
It is that time of the year when we need to pay for web hosting and buy new components and equipment for new tutorials. You can help by making a donation. Contribute to this website by clicking the Donate button. The total will be updated once daily. (You may need to clear your browser cache to see the updates.)
Target Amount: $2000
Amount Raised: $1224
Top Donor: C.C. $100
Created on: 28 August 2012
The ST-LINK/V2 programmer/debugger can be used to program STM32 microcontrollers in Linux.
In this tutorial, the ST-LINK is used in SWD mode to program a STM32 Value Line Discovery Board.
Install the st-link command line program as described in the Programming STM32 Microcontroller Flash in Linux tutorial on this website.
Set up the hardware as shown in the Using the ST-LINK/V2 to Program STM32F100 Microcontrollers tutorial and video on this website. The tutorial is for Windows, but the hardware is set up the same for Linux.
If you are using the STM32 Value Line Discovery board, make sure that you have removed the two jumper links from the CN3 header pins. Plug the ST-LINK/V2 into a spare USB port on the PC. Power up the target board – if using the STM32 value line discovery board, it can be powered from a spare USB port.
In a terminal window, change to the directory containing the binary file that you want to load to the STM32 board. Enter:
st-flash write myflash.bin 0x8000000
Where myflash is the name of your binary file to load.