STM32 Flash Loader for Linux
eGizmo STM32 MCU Board
I've had this STM32 Board from eGizmo for about 2 years now and I think it's about time it gets powered up.
The STM32 features a builtin serial bootloader. ST Microelectronics provides a Flash Loader command line tool for Windows here:
Since I've been on a Linux workstation (Xubuntu 14.04 LTS) for a few months now, I started looking for an alternative, preferably open
source, to load the flash memory of the STM32. I found stm32flash.
I used git to clone the repository on my home directory. Git can be downloaded from the Ubuntu repository:
sudo aptget install git
Clone the repository.
git clone https://git.gitorious.org/stm32flash/stm32flash.git
A directory stm32flash will be made. Change directory then make the project.
sudo make install
The last line installs stm32flash on /usr/local/bin .
The eGizmo STM32 board provides a switch to access the bootloader. To test if stm32flash is properly installed and can communicate
with the STM32 board, the board must be switched to bootloader mode, and run stm32flash to get device information. The eGizmo
STM32 board uses a Prolific PL2303 chip, its serial port's name is typically of the form /dev/ttyUSBx .
If stm32flash successfully communicates with the board, it will display:
Config: 57600 8E1
Version : 0x22
Option 1 : 0x00
Option 2 : 0x00
Device ID : 0x0420 (Mediumdensity VL)
RAM : 8KiB (512b reserved by bootloader)
Flash : 128KiB (sector size: 4x1024)
Option RAM : 16b
System RAM : 2KiB
Resetting device... done.
If otherwise it displays:
Serial Config: 57600 8E1
Failed to read byte: read_byte: Success
Check to make sure that the switch is on bootloader mode, then press the reset button before running stm32flash again.
If the serial port name is improperly entered, it will display something like this:
Failed to open serial port: /dev/ttyUSB1: No such file or directory
If it is taking a long time after displaying Serial Config: 57600 8E1 , it can be terminated using CtrlC , then try pushing the
reset button before running stm32flash again.
Posted by Reymond Dominic Tarlengco at 3:51 AM
Labels: ARM, CortexM3, Embedded, Linux, Microcontroller, STM32