Go to file
Mario Hüttel 2e8194fe81 Merge branch 'master' of github.com:0mhu/STM32F407Vx-template 2021-10-11 22:48:27 +02:00
include Add GPIO macros 2020-08-21 22:49:56 +02:00
mathlib Move license files to root folder 2020-12-20 19:30:06 +01:00
obj Add basic file structure and linker script for 512K type 2020-08-21 22:37:31 +02:00
setup Add basic file structure and linker script for 512K type 2020-08-21 22:37:31 +02:00
startup Fix possible hardfault when optimizing code 2020-08-30 19:40:08 +02:00
.gitignore Add basic file structure and linker script for 512K type 2020-08-21 22:37:31 +02:00
GPLv2.MD Move license files to root folder 2020-12-20 19:30:06 +01:00
LICENSE.MD Move license files to root folder 2020-12-20 19:30:06 +01:00
Makefile Basic structure of startup code. CCM ram init still missing and interrupt vectors 2020-08-21 22:45:15 +02:00
README.MD Edit readme 2020-12-20 19:52:16 +01:00
main.c Add full vector table and implement region tests in main. Verified by debugger 2020-08-21 23:16:55 +02:00
stm32f407ve.ld Fix alignement errors in Linkerscript. This is not very critical as the Cortex M4 is able to read 32 bit words from unaligned addresses 2021-05-24 12:33:56 +02:00

README.MD

Overview

This is a template file for bare metal applications for the STM32F407xx controller.

Currently, the template is for the STM32F407VEx controllers which have 512k of Flash and 128k of RAM + 64k of core-coupled memory (in sum 192k of RAM), but can easily be changed for other F407 controllers by adapting the Flash and RAM sizes in the linkerscript.

Structure

  • the whole project is built by a single Makefile. This is rather comfortable, but can become quite a pain for larger projects.
  • The obj folder contains all build derived files.
  • The startup folder contains my own startup code written in C. Most projects for STM32 controllers use Assembly for their startup codes, which is unnecessary. A downside of the C startup code, is its slighly bigger memory footprint.
  • The stm32f407ve.ld is the linkerscript.
  • The setup folder contains ST's generated clock setup file. It contains the SystemInit() function which configures the system clocks and flash waitcycles. It is currently set up for a system frequency of 168 MHz. The Code is automatically called by the startup code right before jumping into the main() function
  • The mathlib folder contains CMSIS's math and DSP library in form of a precompiled static library and the corresponding header file. I never use it. No clue, if it works. A quick function check showed that the functions work, but no guarantee here. (Btw. there is no guarantee anywhere in this code, according to my GPLv2 license).

Compiler

The Makefile expects a arm-none-eabi-gcc which has to be available in the PATH. For most linux users this should work fine.

Adaptations

  • Memory regions (Flash and RAM sizes and locations) can be adapted in the linker script.
  • Stack and Heap reserved areas are also defined in the linkerscript.
  • The compiler flags force newlib to rely on external system calls. When using malloc(), printf() etc. you will get errors regarding missing syscalls like _sbrk() etc. I will add a basic systemcll file in future. But for now you have to implement them yourself.