Programming an ARM-processor (I)

There are probably better ways to go about programming the STM32F401re board than what you’ll see here, but I wanted as transparent and simple a programming environment as possible. Now you’ve been warned, here are the details:

First a cross-compiler is needed. I’m using the gcc-arm-none-eabi. It’s as simple as downloading and extracting the tar-ball/zip-file. In linux (wheezy) you then add the path to the compiler to your path, which can be done by adding the following line to .bashrc:

export PATH=/home/esben/chem-hw/stm32/gcc-arm-none-eabi-4_9-2015q1/bin:$PATH

Then you’ll want all the firmware libraries and stuff from ST Micro. They have a new pet graphical wizard called STM32CubeMX, but this does not contain the old SPL (standard peripheral library). The old SPL can be hard to find, but it still exists as a bundle called STM32F4 DSP and standard peripherals library.

Unzipping the DSP package gives a directory like this:

stm32-dsp-splThe folder My_project was added by me. I will copy the entire My_project folder for each project. The My_project contains the following:

my_project

The Device folder contains a linker script and startup code in assembly, specific for the STM32F401re board. They can be found here:

../STM32F4xx_DSP_StdPeriph_Lib/Libraries/CMSIS/Device/ST/STM32F4xx/Source/Templates/arm

and here (from the STM32CubeMX package):

../STM32Cube_FW_F4/Projects/STM32F401RE-Nucleo/Examples/UART/UART_Printf/TrueSTUDIO/STM32F4xx-Nucleo

The inc folder contains the relevant header files:

inc

and src contains the actual code.

src

The Makefile may need some editing between different projects, depending on dependencies (no pun intended).

The entire library structure may be downloaded from here. That should get you started for bare metal programming of the STM32F401re board.

The information above is pieced together from several different sources that I no longer have the references for. If you have problems getting it to run, I really can’t help you. I’m a chemist, I know about chemistry, not programming. Ask google.

Advertisements

One thought on “Programming an ARM-processor (I)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s