Microcontroller Software : Building Executables
Writing Software is easy, writing Software targeting a specific hardware can be pretty daunting. Daunting in terms of setting up your development environment, which compiler to use, what do the numerous compiler flags mean, how the linker comes around and its role in mitigating all those ‘undefined reference’ tags among other things.
I had a very basic understanding of C and some practical experience on the Arduino. Starting off with ARM was no joke, i didn’t really sleep comfortably for too many nights in a row. For me understanding how the things fit in the big picture of having that LED blink is more important than that content feeling one gets after seeing the same. Flashing the code onto the board and seeing it run is easy, there is more than sufficient documentation online and follow any of those tutes and you’ll find your way through. I suggest you do that if you would like to right now, this post tries to put things in perspective for a Beginner in embedded software and in a way helps me put down everything on ‘paper’. Also, i am no embedded Software God.
So, starting off with the aim of building the final hex/bin file. The first step is to choose a suitable toolchain for your use. Toolchains are basically a set of tool used to build a final bit of software (executable) which can be run on a machine. If the architecture of the machine you are targetting is different from the architecture of the machine you are using to build the code, then the toolchain is called a cross-toolchain. So, how do you choose which toolchain to use ? I will help you out here. Broadly, when you are building a executable file for a microcontroller what you can be targetting is one of two, building the hex/bin file to be run on the hardware directly or you could be targetting a layer above that (an .c capable executing hardware). The toolchain you’d be using for the former case is what would be called as a barebone toolchains. Here are some example of a barebone toolchains. I generally use the CodeSourcery Lite toolchain (barebone), it is a prebuilt set of tools put together and updated frequently by CodeSourcery (bought by Mentor Graphics). You can also build your own