Here’s what we’re going to focus on – small and versatile general purpose MCU
Hardware
For starters, you need two things:
- STM32F103C8T6 (bluepill, our target)
- ST-LINK programmer (for flashing and debugging)
The latter can be purchased as a standalone device. If you happen to have stm32 nucleo board somewhere in the drawer, I have good news – it has built-it st-link programmer attached to it.
Here’s how to hook it up:
To make sure our OS is able to recognise it, install stlink programming toolset and make sure it can be globally accessed by adding it to environment variables (windows) or ~/.bashrc (linux). Now, connect your programmer with USB and try the following command:
st-info --probe
If you get similar result:
This means we can continue
Compiler and debugger
In order to generate binary files for ARM architecture we need GNU Arm Embedded Toolchain. It allows us to perfom cross-compilation – generating assembly instructions suitable for target other than one we’re currently at (Windows/Linux etc.). Additionally, it ships with debugger we’re going to use (GDB) and a bunch of other useful tools. Go ahead and download it. Next, add make the “bin” folder accessible globally (just like st-link suite discussed above)
We’re done!
Next -> Overview of ARM Architecture