Wednesday, June 19, 2013

My Journey with the Raspberry Pi

So in an effort to clean my blog up and stop having posts that cover multiple topics which is bad for searching and finding useful information, I'm consolidation topics. This is a consolidation of previous posts on information on the Raspberry Pi.

Saturday, June 1, 2013

ARM Startup and Compilation and the Relevant Files on the STM32F4-Discovery


Author: Richard Ballard
Date Created: 30/05/13
Date Modified: 23/06/13
Version: 2.0

I've revised this post to make it easier to understand. The previous version was written during my university exam period so it was a tad rushed.

This tutorial is about understanding how an ARM microcontroller starts its code and what is needed for this to occur. I will very quickly go thorough how the basic process and then get stuck into the key files that are needed. So to make this tutorial too generic, I'm using the STM32F4-Discovery Board as the target, so the file names and code will be geared towards this but should be easily translatable to other microcontrollers.

After I've discussed the startup process in basic form, I'll discuss the compilation process. This includes what the linker does, how the library is connected to our code and then what the make files does. The makefile is equivalent to how IDEs compile everything automatically but are much more flexible.

After I'll then discuss the startup file (startup_stm32f4xx.s) then move onto the linker file (stm32_flash.ld), makefile and some basics of the peripherals library provided by ST. The peripherals library is a set of functions that provide an easy to use interface to manage the registers on the microcontroller. All ARM Cortex-M based microcontrollers should have something similar provided by the manufacturer. If one is not provided, it should be very easy to create a similar library. The files used in this document can all be downloaded as part of Jeremy Herbert's STM32 Template from https://github.com/jeremyherbert/stm32-templates/archive/master.zip. They can also be downloaded from ST (minus the makefile) by downloading the STM32F4-Discovery Firmware Applications Package. The code in Jeremy's templates are from the IO_toggle example program in the application package.