Explaining The Low Level Stuff You Don’t Know About ARM Programming

Most of us don’t realize how spoiled we are with the different development environments available on the internet. If someone wants to start a blank project on a new [ARM/DSP/…] platform, he usually fires up the dedicated Integrated Development Environment (IDE) and starts coding a C/C++ program. However, there are many initialization routines and scripts required with your program before it can run correctly. In his great article, [Andrew] explains to us what these are by starting a blank project without using any IDE.

As you can see in the above picture, [Andrew]’s project is made around an Atmel SAM4E microcontroller. The chosen toolchain is the arm-none-eabi-gcc from GNU Tools for ARM Embedded Processors. The first part of the article starts with a simplified explanation on how/why your code and variables are split into different memory sections (.bss, .data, .rodata, .text), then [Andrew] details how the linker script will put these sections at different physical addresses depending on your microcontroller’s memory layout. He also shows us how to take care of the stack placement, vector table, variable (non)initialization, and C Runtime. For information, the latter is executed when your processor starts, it is in charge of setting up the stack pointer, initializing the RAM, setting up the standard library and calling the main().

A very nice introduction on the very low level routines running on most processors out there.

8 thoughts on “Explaining The Low Level Stuff You Don’t Know About ARM Programming

  1. +1 indeed. I hate IDEs with a passion. Have been working on bare metal all my life. Sure, it takes a bit more investment into really understanding what goes on, but it’s a tremendous help later when you run into obscure problems.

      1. Yes, I could probably get used to an IDE that’s nothing but a helpful GUI wrapper around my regular toolchain. But I can work fast enough just using vim/make in a couple of terminal windows, that I never felt the need to bother with it.

    1. IDEs have absolutely nothing to do with working on bare metal other than the fact that many (most?) people who use IDEs don’t program on bare metal.

      BTW, I am not a fan of today’s “modern” IDEs either. I still have yet to find anything more helpful than Emacs which has been *my* IDE for over 25 years now…

      1. I was thinking why have no one mentioned this? I remember few years back we use to love Emacs as or IDE with its syntax highlighting and key combinations to fire the compilation/build, it was absolutely beauty.

    2. well, I’ve recently installed eclipse so I can navigate in my code more easily and it has some refactoring tools too. IDEs pay off especially in cases like refactoring – select piece of code – bam a new function. That takes some time to do in vim. The point is using IDE != not knowing about memory organization of your compiled program ;)

Leave a Reply to r4kCancel reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.