Minimal toolchain and sample example projects on STM32 MCU without using any HAL driver. Projects from course "Laboratorio di misure" for Computer Science Engineering in Federico II.
For the course the STM32F3Discovery MCU is used, and IAR Embedded Workbench IDE is used for programming and debugging. I already had a STM32 MCU, which is the STM32F401RE on the NUCLEO64 board. So instead of using the Discovery, I used this one.
Why didn't I use IAR ER? For two main reasons:
- I wanted to understand what was going under the hood while I was using IAR
- I wanted a very lightweight toolchain which I could customize based on my preferences
Using the Makefile it is possibile to compile the project. Edit it based on your arm compiler path, your code and the libraries you use.
The following commands are executed for:
- Flashing:
foo@bar:~$ st-flash write filename.bin FLASH_MEMORY_ADDRESS
- Debugging: First open a connection with st-util, then debug with gdb
foo@bar:~$ st-util
[in a separate terminal]
foo@bar:~$ arm-eabi-none-gdb filename.elf
[...]
(gbd) target extended-remote :port_number (usually :4242)
(gdb) load
(gdb) continue
- Write linker_script.ld
- Write .cfg for OpenOCD (can take this one from ChibiStudio maybe - I should first check the LICENSE)
- Properly use arm compiler and generate Makefile
- Improve default debugger usage
- st-link for communication with the board
- ARM toolchain (compiler, linker, debugger)