This repository contains examples on how to write clean and minimal assembler code for the STM32F0.
I tested the examples on the 32F072BDISCOVERY Discovery kit. Different STM32F0 may require a change of register addresses and pins.
I found cortex-debug for vscode very helpful to debug the assembler code.
It flashes the main.elf
(produced by make
) onto the microcontroller and allows the inspection of memory and peripheral register during a single execution.
Clone the repository:
git clone https://github.com/bodokaiser/stm32f0-asm
Open Visual Studio Code (VSC):
code stm32f0-asm
Inside VSC, open an example, i.e. blink/main.s
and run a build task in VSC (as an alternative, run make
), start the debugger in VSC.
- The SVD file
STM32F072x.svd
required to debug the peripheral registers is copied from posborne/cmsis-svd. - This tutorial is extremely helpful.
- The RM0091 Reference manual describes the use of registers.
- The Cortex-M0 Generic User Guide describes details of the M0 architecture, i.e. the vector table format.