Re: Cannot build GCC for Cortex-M0

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2.9.2010 16:41, Kai Ruottu kirjoitti:

Instead of adding rows you maybe should comment away the later :

MULTILIB_OPTIONS += mfloat-abi=hard
MULTILIB_DIRNAMES += fpu
MULTILIB_EXCEPTIONS += *mthumb/*mfloat-abi=hard*

with '#' first in the line. And uncomment the interwork settings :

# MULTILIB_OPTIONS += mno-thumb-interwork/mthumb-interwork
# MULTILIB_DIRNAMES += normal interwork
<clip>
I will try this myself, first I only removed the '--disable-multilib'
and '--disable-interwork', didn't edit the multilib defs,

Let's comment the extra multilib defs away and see where the smoke rises
then...

There was no smoke in libgcc, multilibs were produced into the

libgcc
interwork/libgcc
thumb/libgcc
thumb/interwork/libgcc

the default one and the '-mthumb' one had different sizes...
The next step was to try a normal 'arm-eabi' targeted toolchain
with an added '-mcpu=cortex-m0' specific multilib, so I added
the following ('+') :

# MULTILIB_EXCEPTIONS += *mthumb/*mcpu=ep9312*
#
+MULTILIB_OPTIONS    += mcpu=cortex-m0
+MULTILIB_DIRNAMES   += cortex-m0
+MULTILIB_EXCEPTIONS += *mthumb/*mcpu=cortex-m0*
#
# MULTILIB_OPTIONS     += mlittle-endian/mbig-endian

and :

MULTILIB_OPTIONS    += mno-thumb-interwork/mthumb-interwork
MULTILIB_DIRNAMES   += normal interwork
+MULTILIB_EXCEPTIONS += *mthumb-interwork/*mcpu=cortex-m0*

to the 'gcc/config/arm/t-arm-elf'.  And then removed the options
'--with-cpu=cortex-m0 --with-mode=thumb' from the GCC configure
command.

The smoke rose from use of the bare '-mcpu=cortex-m0' when the
default 'mode' was '-marm'. So something must be invented for
this. My first hack was to add also '-mthumb' when '-mcpu=cortex-m0'
was used. And put this into 'gcc/config/arm/unknown-elf.h' :

-------------- clip ----------------
*** unknown-elf.h.orig  2010-09-02 20:29:22.000000000 +0300
--- unknown-elf.h       2010-09-02 20:34:51.000000000 +0300
***************
*** 46,52 ****
  /* The __USES_INITFINI__ define is tested in newlib/libc/sys/arm/crt0.S
     to see if it needs to invoked _init() and _fini().  */
  #undef  SUBTARGET_CPP_SPEC
! #define SUBTARGET_CPP_SPEC  "-D__USES_INITFINI__"

  #undef  PREFERRED_DEBUGGING_TYPE
  #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
--- 46,52 ----
  /* The __USES_INITFINI__ define is tested in newlib/libc/sys/arm/crt0.S
     to see if it needs to invoked _init() and _fini().  */
  #undef  SUBTARGET_CPP_SPEC
! #define SUBTARGET_CPP_SPEC "%{mcpu=cortex-m0:-mthumb} -D__USES_INITFINI__"

  #undef  PREFERRED_DEBUGGING_TYPE
  #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
-------------- clip ----------------

Maybe not in the right place but it worked...

The default assembly code starts with something like :

        .cpu arm7tdmi
        .fpu softvfp
        .eabi_attribute 20, 1
        .eabi_attribute 21, 1
        .eabi_attribute 23, 3

and when using '-mcpu=cortex-m0', it changes to :

        .cpu cortex-m0
        .fpu softvfp
        .eabi_attribute 20, 1
        .eabi_attribute 21, 1
        .eabi_attribute 23, 3

So with the previous fixes you should get a GCC which produces
code for armv7tdmi as default and for cortex-m0 with the proper
option and includes multilibs for the arm7tdmi variations, with
-mthumb and -mthumb-interworking, plus the '-mcpu=cortex-m0'
specific multilibs...


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux