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:
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:
The Device folder contains a linker script and startup code in assembly, specific for the STM32F401re board. They can be found here:
and here (from the STM32CubeMX package):
The inc folder contains the relevant header files:
and src contains the actual code.
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.