What This Is About
In this series of articles, I want to share my experience while learning the bare metal approach. I want to not only show how certain things can be done but also show the process of gaining knowledge needed for implementation of specific examples.
All articles in this series will be available under tag UBMSTM32
About Bare Metal
For me, the bare metal approach is about directly controlling the hardware by accessing and modifying registers of the device. It means not using the provided library or software layer for the MCU but writing your own instead.
Motivation
There are 2 main reasons why I decided to try myself in the bare metal programming:
First Reason
I really dislike the default experience of working with CubeIDE, which is the official IDE provided by ST, which is the vendor I’ve started my journey with. I’ve had bad experiences with both the IDE and just the code generator CubeMX. Apart from that, I’m not a fan of the idea of mixing my code with the generated code, and even though you can generate them as separate files, it still feels like forcing you to use a certain paradigm.
Second Reason
As a beginner in the field, I find HAL (Hardware Abstraction Layer) confusing. The generated code uses a lot of wrapper functions just calling other, more “internal” functions, so it’s more difficult to understand the essence and necessary parts of what’s happening. Don’t get me wrong, it gets the job done, but while reading it, I couldn’t really get how exactly responsibilities are divided between software and hardware, and it was driving me crazy.
The Charm of Bare Metal
I like bare metal because it’s a very direct method of working with the device. It gives you control over your project and tools that you use. For me, it’s about learning universal low-level skills, and not just vendor-specific ones. This approach, even though demanding, at every step, rewarded me with new knowledge and a deeper understanding of different concepts, for which I’m grateful and would like to share.