In this series, we set up an ARM Cortex-M development environment and write some code targeting STM32F407, but using only open-source tools. The general process should be similar for all ARM Cortex-M processors.
This is the first part of the series, detailing the process of installing the IDE and the tools and setting up the development environment.
Tools and environment
This tutorial will be based on the GNU toolchain for ARM and Eclipse CDT. Both tools are cross platform free and open source software. I will be demonstrating on macOS, but the process should be similar across all platforms, especially after the tools are installed.
What you need to install now, in no particular order, is:
- GNU Toolchain for ARM,
- Eclipse CDT (Although you may need to follow OS-specific guides for this.)
- OpenOCD (I am using the GNU MCU Eclipse distribution on macOS.)
- If you are using Windows, you also need to install a few UNIX command line tools. If you are using macOS, you will need Xcode for the tools. (You don’t need Apple Developer account though, just an Apple ID capable of accessing Mac App Store.)
- If you have a Segger J-Link debug probe, it may be better to prefer its own driver over generic OpenOCD ones.
- Also for Windows, if you don’t want to bother with debug probe drivers (or your own devices’) you should have Zadig ready, as it can force install WinUSB or libusb drivers for devices without tackling driver signing.
After installing the tools above, we need one last piece of software to link them together: the GNU MCU Eclipse plugin. GNU MCU Eclipse introduces project templates, toolchain setting panes, debug support, Keil packs and peripheral viewer support to Eclipse CDT.
While we are not using the Keil µVision toolchain, it is still somewhat necessary to install a few Keil packs for the peripheral viewer, as it uses the SVD files. It also gives us a repository of header files and libraries that we may find useful, like the CMSIS header files often referenced in microcontroller manufacturers’ header files.
Open the Packs Perspective in Eclipse after installing GNU MCU Eclipse plugin to access the packs manager. For this example, we will need ARM CMSIS and Keil STM32F4xx_DFP packs.