The linker will resolve symbols to addresses when it has arranged all the objects according to the rules in the linker script.What we’re getting close to here is that a C program isn’t just the code we type.If you want to learn a bit of assembler too, then definitely head off to there!
So go clone or fork now so you have all the code to compile and modify as you work through the tutorials.
Let’s have a look at compiling one of the simplest programs that we can.
The settings are gleaned from the GCC ARM options page.
In order to use a C compiler, we need to understand what the compiler does and what the linker does in order to generate executable code.
The other flags merely tell GCC what type of floating point unit we have, tell it to produce hard-floating point code (GCC can create software floating point support instead), and tells GCC what ARM processor architecture we have so that it can produce optimal and compatible assembly/machine code.
For the Raspberry-Pi 2 we know that the architecture is different.Although the Raspberry-Pi comes with a good Linux distribution, the Pi is about software development, and sometimes we want a real-time system without an operating system.I decided it’d be great to do a tutorial outside of Linux to get to the resources of this great piece of hardware in a similar vein to the [Cambridge University Tutorials]( which are excellently written.There are some fundamental things that must happen for C code to run.For example, some variables need to be initialised to certain values, and some variables need to be initialised to 0.The compiler converts C statements into assembler and performs optimisation of the assembly instructions. The C compiler then implicitly calls the assembler to assemble that file (usually a temporary) into an object file.