GNU toolchain for Infineon XMC Microcontroller software development
Most of the following explanations how to create a new automake project is perfectly explained on http://mij.oltrelinux.com/devel/autoconf-automake/
To create a new automake project, two config files and the src directory are necessary:
- configure.ac
- Makefile.am
- src/
Please execute the following commands in order to use automake to create a makefile
> aclocal
> autoconf
> automake
The following command must be executed only to reconfigure the Makefile after the source directory structure has changed.
./configure
If there are only changes to the source files, it's sufficient to execute
make
In order to flash, debug and run the program on our XMC4500 µController we have to install eclipse and some addtitional packages.
npm install --global xpm@latest
xpm install --global @xpack-dev-tools/arm-none-eabi-gcc@latest
- Download and Install Eclipse
- Install CDT feature
- Open pack manager in eclipse and refresh pack list
- Install pack for XMC4500
The arm gdb debugger is used and selected in eclipse in the Debugger tab. The eclipse textbox shows
${cross_prefix}gdb${cross_suffix}
which is expanded to
arm-none-eabi-gdb
Install SEGGER J-Link Driver
https://www.segger.com/downloads/jlink/#J-LinkSoftwareAndDocumentationPack
Open project properties and select XMC4500-F100x1024 device
Click on Apply and Close
Open debug configurations
Create new GDB SEGGER J-Link Debugging configuration
Make sure that Device name is XMC4500-1024
The blinky application code was originally shown in the following tutorial: https://embeddedplaygroup.wordpress.com/2012/12/12/its-relax-time-blinky-led/
INCLUDE_DIRS = -Isrc/include
ACLOCAL_AMFLAGS = -I m4
AM_CFLAGS = $(INCLUDE_DIRS) -std=c99 -Wall -O0 -g \
-DXMC4500_F100x1024 \
-mthumb \
-march=armv7-m \
--specs=nosys.specs \
-Wl,--gc-sections
CFLAGS = -g -O0
CC = arm-none-eabi-gcc
CCAS = arm-none-eabi-gcc
AM_LDFLAGS = -g -O0 -Tsrc/linker_script.ld
bin_PROGRAMS = main.bin
main_bin_SOURCES = src/Startup/system_XMC4500.c \
src/Startup/startup_XMC4500.S \
src/main.c
Reference for symbols in Makefile.am file: https://www.gnu.org/software/automake/manual/html_node/Program-Variables.html
- std=c99: C99 dialect of C http://en.cppreference.com/w/c/language
- Wall:
- O0: no optimization
- g: include debug symbols
- DXMC4500_F100x1024: value needed during compilations
- mthumb: ARM thumb 32 & 16 bit instruction set
- march=armv7-m: armv7 architecture
- specs=nosys.specs: needed because of error message (explained here: https://stackoverflow.com/questions/19419782/exit-c-text0x18-undefined-reference-to-exit-when-using-arm-none-eabi-gcc)
- gc-sections: enable garbage collection (more information: https://sourceware.org/binutils/docs/ld/Options.html)