Compile STM32 code for flashing

In another post “Firmware Update on v1.1” I read on how to flash the STM32. However it is not clear to me how to compile the code first.

I found the makefile for the 3-phase meter under Hardware/DeviceV2_02/Firmware/Makefile.
Do you have any suggestions on programming environment, compiler and flashing tools?

Thanks in advance for your reply and also for the amazing work!


For programing we use VScode IDE
We build in linux with make and arm-none-eabi-gcc.
For flashing we use St link V2 and openocd.

Some advices:
Device is not isolated! Take lot of care, do not plug in to mains while flashing or debuging.
Firmware is a bit difficult to debug, if compiled with -O0 it run too slow and samples are lost.

Please if you make some improvement share it.

Thanks for your response. This is how I ended up flashing my STM32 on linux with STLink V2:

Install compile environment

sudo apt-get install gcc-arm-none-eabi



Install program for flashing

sudo apt-get install stlink-tools
sudo apt-get install stlink-gui

Check if ST Link V2 is connected

st-info --probe
st-flash read dummy.bin 0 0xFFFF

Load Image.bin to device

Open stlink (GUI)
Connect to Board
Open file Image.bin