Cannot build GCC for Cortex-M0
Andriy Sukhynyuk
asukhynyuk@yahoo.com
Thu Sep 2 09:27:00 GMT 2010
Hi Kai,
>> Well I spent yesterday and could not find how to do it. It all ends up in
>error
>> trying to compile test file with -march=armv6-m but without -mthumb.
>Please describe 'compile'... Producing the assembly source and even
>the object file should succeed but linking the object with a Thumb-only
>C library of course would lead into troubles. Tests with my similar
>GCC on Linux built by pure curiosity :
When I try to compile C-source file with Code Red LPCXpresso which is shipped
with GCC 4.3.3 with -mcpu=cortex-m0 but without -mthumb
arm-none-eabi-gcc -I"YYYY" -O0 -g3 -Wall -c -fmessage-length=0 -fno-builtin
-ffunction-sections -mcpu=cortex-m0 -MMD -MP -MF"src/XXXX.d" -MT"src/XXXX.d"
-o"src/XXXX.o" "../src/XXXX.c"
I get the message:
../src/XXXX.c:1: error: target CPU does not support ARM mode
make: *** [src/XXXX.o] Error 1
I am pretty sure that it is a compile time error. Adding, or rather restoring
since, option -mthumb results in successful production of object file.
It is also true that when we build toolchain with --with-mode=thumb then
excluding -mthumb does not make compile process fail.
Returning back to building toolchain with multilib enabled and default mode
--with-mode=arm, I made the following changes to
\gcc-4.5.0\gcc\config\arm\t-arm-elf file
+MULTILIB_OPTIONS += march=armv6-m mthumb
+MULTILIB_DIRNAMES += thumb\/armv6-m
+MULTILIB_EXCEPTIONS += *marm*/*march=armv6-m*
+MULTILIB_OPTIONS += mno-thumb-interwork/mthumb-interwork
+MULTILIB_DIRNAMES += normal interwork
+MULTILIB_EXCEPTIONS += *mthumb-interwork*/*march=armv6-m*
I would like to think that *marm*/*march=armv6-m* forbids building ARM library
when -marmv6-m is present but it does not!
The last lines of the `config.log' are (sorry for pasting here so much text):
------------------------------------------------------------------------------------------------------------------------------------
configure:3004: $? = 0
configure:2993: /f/asu/Cortex/gcc-4.5.0/build4/./gcc/xgcc
-B/f/asu/Cortex/gcc-4.5.0/build4/./gcc/ -B/f/cross-gcc/4.5.0/arm-none-eabi/bin/
-B/f/cross-gcc/4.5.0/arm-none-eabi/lib/ -isystem
/f/cross-gcc/4.5.0/arm-none-eabi/include -isystem
/f/cross-gcc/4.5.0/arm-none-eabi/sys-include -march=armv6-m -v >&5
Reading specs from f:/asu/Cortex/gcc-4.5.0/build4/gcc/specs
COLLECT_GCC=f:\asu\Cortex\gcc-4.5.0\build4\gcc\xgcc.exe
COLLECT_LTO_WRAPPER=f:/asu/Cortex/gcc-4.5.0/build4/gcc/lto-wrapper.exe
Target: arm-none-eabi
Configured with: ../gcc-4.5.0/configure --target=arm-none-eabi
--build=i686-pc-mingw32 --host=i686-pc-mingw32 --prefix=/f/cross-gcc/4.5.0
--disable-nls --disable-shared --disable-threads --with-gnu-gcc --with-gnu-ld
--with-gnu-as --with-dwarf2 --enable-languages=c --enable-interwork
--enable-multilib --with-gmp=/f/cross-gcc/4.5.0 --with-mpfr=/f/cross-gcc/4.5.0
--with-mpc=/f/cross-gcc/4.5.0 --with-newlib
--with-headers=../../newlib-1.18.0/newlib-1.18.0/newlib/libc/include
--disable-libssp --disable-libstdcxx-pch --disable-libmudflap --disable-libgomp
-v
Thread model: single
gcc version 4.5.0 (GCC)
configure:3004: $? = 0
configure:2993: /f/asu/Cortex/gcc-4.5.0/build4/./gcc/xgcc
-B/f/asu/Cortex/gcc-4.5.0/build4/./gcc/ -B/f/cross-gcc/4.5.0/arm-none-eabi/bin/
-B/f/cross-gcc/4.5.0/arm-none-eabi/lib/ -isystem
/f/cross-gcc/4.5.0/arm-none-eabi/include -isystem
/f/cross-gcc/4.5.0/arm-none-eabi/sys-include -march=armv6-m -V >&5
xgcc.exe: '-V' must come at the start of the command line
configure:3004: $? = 1
configure:2993: /f/asu/Cortex/gcc-4.5.0/build4/./gcc/xgcc
-B/f/asu/Cortex/gcc-4.5.0/build4/./gcc/ -B/f/cross-gcc/4.5.0/arm-none-eabi/bin/
-B/f/cross-gcc/4.5.0/arm-none-eabi/lib/ -isystem
/f/cross-gcc/4.5.0/arm-none-eabi/include -isystem
/f/cross-gcc/4.5.0/arm-none-eabi/sys-include -march=armv6-m -qversion >&5
xgcc.exe: unrecognized option '-qversion'
xgcc.exe: no input files
configure:3004: $? = 1
configure:3020: /f/asu/Cortex/gcc-4.5.0/build4/./gcc/xgcc
-B/f/asu/Cortex/gcc-4.5.0/build4/./gcc/ -B/f/cross-gcc/4.5.0/arm-none-eabi/bin/
-B/f/cross-gcc/4.5.0/arm-none-eabi/lib/ -isystem
/f/cross-gcc/4.5.0/arm-none-eabi/include -isystem
/f/cross-gcc/4.5.0/arm-none-eabi/sys-include -march=armv6-m -o conftest -g
-O2 conftest.c >&5
conftest.c:1:0: error: target CPU does not support ARM mode
configure:3023: $? = 1
configure:3211: checking for suffix of object files
configure:3233: /f/asu/Cortex/gcc-4.5.0/build4/./gcc/xgcc
-B/f/asu/Cortex/gcc-4.5.0/build4/./gcc/ -B/f/cross-gcc/4.5.0/arm-none-eabi/bin/
-B/f/cross-gcc/4.5.0/arm-none-eabi/lib/ -isystem
/f/cross-gcc/4.5.0/arm-none-eabi/include -isystem
/f/cross-gcc/4.5.0/arm-none-eabi/sys-include -march=armv6-m -c -g -O2
conftest.c >&5
conftest.c:1:0: error: target CPU does not support ARM mode
configure:3237: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "GNU C Runtime Library"
| #define PACKAGE_TARNAME "libgcc"
| #define PACKAGE_VERSION "1.0"
| #define PACKAGE_STRING "GNU C Runtime Library 1.0"
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL "http://www.gnu.org/software/libgcc/"
| /* end confdefs.h. */
|
| int
| main ()
| {
|
| ;
| return 0;
| }
configure:3251: error: in
`/f/asu/Cortex/gcc-4.5.0/build4/arm-none-eabi/thumb/armv6-m/libgcc':
configure:3254: error: cannot compute suffix of object files: cannot compile
See `config.log' for more details.
More information about the Gcc-help
mailing list