This project gives a good starting point for developing a bare metal embedded program on the arm cortex m3/m4. It uses the gnu c and c++ compiler for building, therefore no expenses are necessary to get it running.
The following programs are used for development:
- Compiler - Gcc arm embedded compiler (4.9.3)
- IDE and Debugger - [Eclipse CDT (Mars - 4.5.0)] (https://www.eclipse.org)
- Unix tools (make, rm, grep ...) - Cygwin or MinGW - MSYS
- Documentation - Doxygen
The Makefile uses the environment variable ARM_GCC_PATH to locate the arm gcc compiler. This variable must be set to the installation directory of the compiler. On windows this path should not contain any whitespaces.
To build:
set ARM_GCC_PATH=...path-to-buildchain...
make
To get further information on the built elf file:
make info
To build the documentation:
make doc
Depending on the enabled options during newlibc building the function malloc is able to lock and unlock interrupts. To the time of writing this locking mechanismn is disabled when using the newlibc-nano prebuilts. Therefore calls to malloc and new are not thread safe. Do not call them from different interrupts or threads.
This section lists some usefull resources which I constantly use when working on an cortex m4 target.
The "Cortex M4 Technical Reference Manual" can be found here.
Some interesting topics in this manual are:
- 3.3.1. Cortex-M4 instructions - Instruction set summary
The "Cortex-M4 Devices Generic User Guide" can be found here.
Some interesting topics in this user guide are:
- 2.3.4. Vector table - General description of the vector table.
- 2.3.5. Exception priorities - Exception/Interrupt priorities.
The "GCC Documentation (4.9.3)" can be found here. It is quite usefull as reference for the used compiler switches.
For this project the following topics in this documentation are of special interest:
- 3.10 Options That Control Optimization - Optimization is very important on an embedded targets.
- 3.11 Options Controlling the Preprocessor - These are used for automatic dependency generation.
The "GNU Make Documentation" can be found here.
For this project the following topics in this documentation are of special interest:
- 5.2 Recipe Echoing
- 8.2 Functions for String Substitution and Analysis
- 6.3.1 Substitution References
- 8.2 Functions for String Substitution and Analysis
- 10.5.3 Automatic Variables
The "Binutils Documentation" can be found here.
The following tools are especially useful:
- nm - Lists symbols from object files.
- objdump - Display information from object files.
- size - List section sizes.
- addr2line - Translates addresses into file names and line numbers.
The Assembler is part of the binutils package. Its documentation can be found here.
For this project the following topics in this documentation are of special interest:
The Linker is part of the binutils package. Its documentation can be found here.
For this project the following topics in this documentation are of special interest:
- 2.1 Command Line Options
- 3.3 Simple Linker Script Example
- 3.4.1 Setting the Entry Point
- 3.6.4.4 Input Section and Garbage Collection
The "Doxygen" documentation can be found here.
The "newlibc" documentation can be found here.
For this project the following topics in this documentation are of special interest:
This section contains some book I found very helpful when programming on the Cortex M4:
- "Definitive Guide to ARM Cortex-M3 and Cortex-M4 Processors" from Joseph Yiu
- "System Interfaces and Header Issue 4 Version 2" from the open group