Recent site activity

Welcome‎ > ‎

Missing GCC cortex-m3

posted 18 Oct 2009 15:56 by Chris Shucksmith   [ updated 17 Jul 2011 11:02 ]
Time to upgrade my microprocessor skills into the 21st century, by building my first project using an ARM CPU, the Cortex M3. I'm using the Olimex STM-H103 development board, and the partner USB TINY JTAG cable. This is a little different from the Rabbit Core and PIC Microprocessors I've used before, being a 32bit machine.

For development, the standard open source toolchain seems to be the Eclipse IDE (I use this at work for Java, it's great), gcc compiler, OpenOCD as the debugging/JTAG/flashing firmware engine and a USB JTAG interface. I've attempted to build some sample code, on Linux (Fedora 11) but pretty quickly hit snags with the build.

[chris@chris-desktop stm-h103]$ make
.compiling
gcc -I./ -c -fno-common -O0 -g -march=cortex-m3 -mthumb  main.c
cc1: error: unrecognized command line option "-mthumb"
main.c:1: error: bad value (cortex-m3) for -march= switch
main.c:1: error: bad value (cortex-m3) for -mtune= switch
make: *** [main.o] Error 1

It looks like the Fedora provided gcc compiler was configured without 'cortex-m3' support... ie. "-mcpu=cortex-m3 -mthumb" rebuilding gcc could be a whole day of fun!

[chris@chris-desktop stm-h103]$ gcc -v
Using built-in specs.
Target: i586-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --enable-plugin --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch=i586 --build=i586-redhat-linux
Thread model: posix
gcc version 4.4.1 20090725 (Red Hat 4.4.1-2) (GCC)