Skip to content

oruamdalo/mapi_programming

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 

Repository files navigation

MAPI

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.

Toolchain

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

Usage

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

TODO

  • 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

Requirements

Credits