I have a bare metal STM32 C project working on a NUCLEO-F446RE. To learn about MCUs, I did not use any code generators or IDEs, but created a simple Makefile, linker script, start up C code, and #define
s for the memory registers (using things like this and this as references.
I'd like to include the CMSIS files for STM32 Cortex M F446RE, so that I don't have to manually define the register locations. However, all the instructions I can find on how to do this state "Download Keil or STM32Cube and use the GUI".
Since CMSIS is a standard, I expect it possible to avoid having to use a GUI generator. I've already downloaded all the STM32 files, and I'd simply like to use them in my project. However, navigating them, to know which ones to include, is proving tough.
I'd expect to be able to do something like:
- Add one or more
#define
s (e.g. specifying the MCU)to the command line args given to gcc in my Makefile - Add one or more source files (
.c
or.s
) to the sources given to gcc in my Makefile - Add one or more
#include
s in my actual code.
Is this documented anywhere? How can I determine what to #define
/compile/#include
to use CMSIS?
I'd expect perhaps a few other potential steps:
- Take out some of my linker script and initialization code
- and instead implement some of the symbols defined in the CMSIS (for startup and interrupt routines).
I'm happy to do this, but would like to do this knowingly, without using a GUI IDE which generates all sorts of code for me. How can I do this? Is there a simple example available? Or reference doc? This https://www.keil.com/pack/doc/CMSIS/Core/html/using_pg.html provides a high level overview, but not enough to know which specific files and #define
s are needed for e.g. STM32F446RE.
Clarification
I see the original question title "Can I use CMSIS without a GUI or IDE" may be misleading. I know that in principle this is possible - the GUI doesn't have any magic powers, it simply sets up the relevant files. I've corrected the question to be more clear: How do I do this? How do I find:
- Which files I need to copy into my project
- Which defines I need to make
- What else is, if anything, is needed to use CMSIS
#define
the specific MCU you're using it on and then#include
the "master" header file for that MCU family. So for your F446RE, you'd#define STM32F446xx
and#include "stm32f4xx.h"
. \$\endgroup\$