Porting GCC to 8051

Thomas Schuetzkowski Thomas.Schuetzkowski@web.de
Tue Mar 14 14:16:00 GMT 2000


Dear GCC-Developers,

I want to port GCC to 8051 microcontroller and  therefore support
different data type sizes.
I´ve used different target_flags to define which data type size to use:

#define TARGET_SWITCHES {                            \
   { "int8",  -1, "Integer-Werte sind 8 Bit breit"  },        \
   { "int16",  1, "Integer-Werte sind 16 Bit breit" },        \
   { "", TARGET_DEFAULT } \
 }

#define TARGET_INT16    (target_flags & 1)

#define INT_TYPE_SIZE        (TARGET_INT16 ? 16 : 8)

but I got a error when linking cccp, because target_flags are there not
available.

        cc -DCROSS_COMPILE -DIN_GCC   -g   -o cccp cccp.o cexp.o \
          version.o obstack.o ` case "cc" in "cc") echo "" ;; esac `
        cccp.o: In function `special_symbol':
        /gnu/gcc-2.7.2.3/cccp.c:4145: undefined reference to
`target_flags'
        cccp.o: In function `initialize_builtins':
        /gnu/gcc-2.7.2.3/cccp.c:9655: undefined reference to
`target_flags'
        cexp.o: In function `yylex':
        /gnu/gcc-2.7.2.3/cexp.y:596: undefined reference to
`target_flags'

In the Target Description of pdp11 (pdp11.h) I´ve seen such a definition
and it works fine.

#define TARGET_SWITCHES  \
{   { "fpu", 1},                \
          .
          .
          .
/* use 32 bit for int */        \
    { "int32", 32},             \
    { "no-int16", 32},          \
    { "int16", -32},            \
    { "no-int32", -32},         \
          .
          .
          .
    { "", TARGET_DEFAULT}       \
}


#define TARGET_INT16            (! TARGET_INT32)
#define TARGET_INT32            (target_flags & 32)

#define INT_TYPE_SIZE           (TARGET_INT16 ? 16 : 32)

What do I have to do that my definition also works?


Thanks,
Thomas Schützkowski

-- 
\|/ ______ \|/
"@'/  ,.  \'@"
/__| \__/ |__\
    \__U_/


More information about the Gcc mailing list