However, my small project does not make real use of library functions, so that does not make a big difference and becomes irrelevant.
For the final executable the linker can eliminate unused functions or might add veneers (to jump from Flash to RAM or from Thumb to ARM) and padding (for example to start on a 4 byte boundary) if necessary.Īnother source of flash usage can be code that gets pulled in from libraries, such as the C Runtime Library. The Project explorer tells me that there are 3 source files which make up the executable, and how much Code+RO space they use. Note that these are the numbers for the compiler-generated object. In order to do that, I can look at the Memory Usage Window, the linker map file, the ELF file that has been produced by the linker, or simply at the Project Explorer. Not bad, but I would like to understand what the memory is used for and what can be done to minimize the program, before adding the Now, to get started with a minimal application, let’s reduce this to basically an empty loop and see what we get.Īfter a build, the Output window nicely presents the memory usage.ġ58 bytes of Flash. The debugger is set to stop at main, so this is where I am: At the start of the standard small little program, a grown up version of “Hello world”.
I do not have the hardware connected at this point, so Embedded Studio asks me to use the built-in simulator instead.Ĭlicking Yes or hitting Enter starts the simulator. Selecting Build -> Build Mini or hitting F7 builds my program. The first option, an executable for a Cortex-M CPU running from Flash, is what I want.Īfter clicking next a few times to use the defaults, I end up with a small project, as shown below in the Project Explorer Window. Selecting File -> New Project from the menu, I get to select a template.
I just needed a board with an LED under software control, so pretty much any hardware would do. I use a regular J-Link to download the program.
However, in this case I do not care about trace.
Our reference project allows getting trace up in less than 10 minutes. It is a very simple board with not much more than an STM32F407 microcontroller, 3 LEDs, a debug / trace connector and a USB port that can also be used as power supply. Hardwareįor hardware I used our STM32 Trace Reference board. It is a good way to understand what really happens when booting a computer, so what happens “under the hood” before main() is reached.Īnd to cut a long story short: Yes, it can be done in less than 100 bytes with Embedded Studio. This article will pretty much look at every byte and every instruction required.