GNU ARM
ARM maintains a complete toolchain for building and debugging firmware for ARM-based micro-controllers. This is the primary toolchain used by the OpenWSN team to program the following motes:
This page details the installation steps:
Installing ARM toolchain
You can find the ARM toolchain at https://launchpad.net/gcc-arm-embedded. Version 4.7 is the latest currently used: https://launchpad.net/gcc-arm-embedded/4.7/4.7-2013-q3-update
The installation consists in the following steps:
Download the toolchain
Inflate (unzip) the toolchain
Modify the
PATHenvironment variable so Eclipse can invoke the compiler.
Installing Eclipse
Download Eclipse CDT for C/C++ developers from http://www.eclipse.org/downloads/packages/eclipse-ide-cc-developers/keplersr1
Note: Do not install Eclipse using apt. It is outdated and the plugins require a more recent version of Eclipse
unzip eclipse in your favorite folder e.g.,
/opt/eclipseExecute eclipse and go to Help->Install New Software.
Add gnu-arm eclipse plug-in url and install the plug-in. Use the following url.
http://gnuarmeclipse.sourceforge.net/updatesRestart eclipse when installation finishes
Testing
Once the
gnu-armplug-in is installed you can test that everything works by creating a test project.To do so, click
File > New > C Projectand selectARM Cross Target ApplicationMake sure to select the right cross compiler. In my case I choose
ARM Linux GCC (GNUARM). If you are using Code Sourcery or Yagarto or another tool chains, select the appropriate.Name your project (e.g. "test") and click
Finish.Right click on the project and select properties:
Select the micro-controller architecture, for example
Cortex M4Move to the "assembler" option and set up the path to your
gcc-arm-none/directory. Selectarm-none-eabi-gccIf you have update your computer
PATHenvironment variable, you can just enterarm-none-eabi-gcc, without the full path.Repeat the same steps for the compiler, which in our case is also
arm-none-eabi-gcc.Repeat the same steps for the linker, which in our case is also
arm-none-eabi-gcc.Configure the "Flash image creator" as follows:
Configure the "Create Listing" as follows:
Configure the "Print Size" as follows:
At this point, configure any extra options you might want, such as optimizations and debug levels.
Click
OKto apply all changes.Create a file to test the compiler. You can toggle an LED according to your hardware specification or simply code a while loop and test the compiler.
int main(void){ int i = 0; while (i < 10) { i++; } return i; }Right-click on the project and select
Build Project. Based on your configuration, Eclipse invokes the ARM GCC compiler, linker, flash image creator, and size printer tools.15:49:03 **** Incremental Build of configuration Debug for project openwsn **** make all Building file: ../src/main.c Invoking: ARM Linux GCC C Compiler arm-none-eabi-gcc -O0 -Wall -Wa,-adhlns="src/main.o.lst" -c -fmessage-length=0 -MMD -MP -MF"src/main.d" -MT"src/main.d" -mcpu=cortex-m4 -mthumb -g3 -gdwarf-2 -o "src/main.o" "../src/main.c" Finished building: ../src/main.c Building target: openwsn.elf Invoking: ARM Linux GCC C Linker arm-none-eabi-gcc -nostartfiles -Wl,-Map,openwsn.map -mcpu=cortex-m4 -mthumb -g3 -gdwarf-2 -o "openwsn.elf" ./src/main.o /home/xvilajosana/Development/tools/gcc-arm-none-eabi-4_7/bin/../lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/bin/ld: warning: cannot find entry symbol _start; defaulting to 00008000 Finished building target: openwsn.elf Invoking: ARM Linux GNU Create Flash Image arm-none-eabi-objcopy -O ihex openwsn.elf "openwsn.hex" Finished building: openwsn.hex Invoking: ARM Linux GNU Create Listing arm-none-eabi-objdump -h -S openwsn.elf > "openwsn.lst" Finished building: openwsn.lst Invoking: ARM Linux GNU Print Size arm-none-eabi-size --format=berkeley openwsn.elf text data bss dec hex filename 44 0 0 44 2c openwsn.elf Finished building: openwsn.siz 15:49:03 Build Finished (took 114ms)