This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

problems when compiling with eabi option for Cortex M3 psf762

Hi All,

I have question for you about the following compiler options

 

--abi=eabi        ; EABI

 

Originally when I was trying to get Vector GMLAN software to run on Cortex M3 core I used the following compiler options,

                          -o2 -fr $(OBJ_PATH)                        \

                         -fb $(LST_PATH)                        \

                         -ff $(LST_PATH)                        \

                         -fs $(LST_PATH)                        \

                         -dC_DERIVATIVE_$(PLANET_$(DERIVATIVE)) \

                         -dBRS_TIMEBASE=$(CPU_FREQUENCY)        \

                         -k                                     \

                         -g                                     \

                                     -mv7M3                                                       

  and linker options were

                          -a                                  \
                          -c                                  \
                          -x                                  \
                          -i $(COMPILER_LIB)                  \
                          -m $(PROJECT_NAME).map              \
                          -o $(PROJECT_NAME).$(BINARY_SUFFIX)                                   

I was also using rtsv7M3_T_be_tiarm9.lib

But when I try to migrate to eabi

–abi=eabi option and rtsv7M3_T_be_eabi library to link

And the following warnings  were

 

warning: LOAD placement specified for section

   ".text:decompress:none:rtsv7M3_T_be_eabi.lib<copy_decompress_none.obj>".

   This section contains decompression routines required for linker generated

   copy tables and C/C++ auto-initialization.  Must ensure that this section is

   copied to run address before the C/C++ boot code is executed or is placed

   with single allocation specifier (ex. "> MEMORY").

warning: LOAD placement specified for section

   ".text:decompress:ZI:rtsv7M3_T_be_eabi.lib<copy_zero_init.obj>". This

   section contains decompression routines required for linker generated copy

   tables and C/C++ auto-initialization.  Must ensure that this section is

   copied to run address before the C/C++ boot code is executed or is placed

   with single allocation specifier (ex. "> MEMORY").

warning: LOAD placement specified for section

   ".text:rtsv7M3_T_be_eabi.lib<memset_t2.obj>". This section contains

   decompression routines required for linker generated copy tables and C/C++

   auto-initialization.  Must ensure that this section is copied to run address

   before the C/C++ boot code is executed or is placed with single allocation

   specifier (ex. "> MEMORY").

warning: LOAD placement specified for section

   ".text:decompress:rle:rtsv7M3_T_be_eabi.lib<copy_decompress_rle.obj>". This

   section contains decompression routines required for linker generated copy

   tables and C/C++ auto-initialization.  Must ensure that this section is

   copied to run address before the C/C++ boot code is executed or is placed

   with single allocation specifier (ex. "> MEMORY").

warning: creating ".stack" section with default size of 0x800; use the -stack

   option to change the default size

 

In addition I tried to run the code on the secondary cortex m3 core and the code no longer works.

 

i change the following in the startup code:

I removed .cinit and its auto initialization code and it was replace by the following code

typedef void (*handler_fptr)(const unsigned char *in,unsigned char *out);

#define HANDLER_TABLE __TI_Handler_Table_Base
#define HANDLER_TABLE_LIMIT __TI_Handler_Table_Limit

#pragma WEAK(HANDLER_TABLE)
#pragma WEAK(HANDLER_TABLE_LIMIT)

extern unsigned int HANDLER_TABLE;
extern unsigned int HANDLER_TABLE_LIMIT;
extern unsigned char *__TI_CINIT_Base;
extern unsigned char *__TI_CINIT_Limit;

void auto_initialize()
{
unsigned char **table_ptr;
unsigned char **table_limit;
/*--------------------------------------------------------------*/
/* Check if Handler table has entries. */
/*--------------------------------------------------------------*/
if (&__TI_Handler_Table_Base >= &__TI_Handler_Table_Limit)
    return;
/*---------------------------------------------------------------*/
/* Get the Start and End of the CINIT Table. */
/*---------------------------------------------------------------*/
table_ptr = (unsigned char **)&__TI_CINIT_Base;
table_limit = (unsigned char **)&__TI_CINIT_Limit;
while (table_ptr < table_limit)
{
/*-------------------------------------------------------------*/
/* 1. Get the Load and Run address. */
/* 2. Read the 8-bit index from the load address. */
/* 3. Get the hander function pointer using the index from */
/* handler table. */
/*-------------------------------------------------------------*/
unsigned char *load_addr = *table_ptr++;
unsigned char *run_addr = *table_ptr++;
unsigned char handler_idx = *load_addr++;
handler_fptr handler =
(handler_fptr)(&HANDLER_TABLE)[handler_idx];
/*-------------------------------------------------------------*/
/* 4. Call the handler and pass the pointer to the load data */
/* after index and the run address. */
/*-------------------------------------------------------------*/
(*handler)((const unsigned char *)load_addr, run_addr);
}
}

and I call auto_initialize() in c_int00

Can you help me migrate my code from ti arm9 to eabi? I tried to do that on my own using TMS470EABIMIGRATION.pdf and didnt work and I am still having the warnings.

Thanks for your time.

  • The issue is in the linker command file, which is apparently specifying a different LOAD address than the RUN address for the library's .text section.  Basically, you need to separate at least the .text:decompress subsection (and the .text section of memset_t2.obj) from the rest of the .text section.  When using linker-generated copy tables, these functions are responsible for moving functions from the LOAD address to the RUN address, and if they are themselves not already at their own RUN address, there is nobody to move them.

  • i am running the code on the Cortex M3 secondary core, so Load address have to be different than run address.

    How can I seperate .text:decompress subsection from the rest of the .text section. Do you have an example?

    the following is my implementation of linker command file:

    ROM     (RX)  :  origin=0x00000200   length=0x0002fdd0"   
    ROM_M     (RX)   :  origin=0xFD000200   length=0x0002fdd0"
                                  
    RAM     (RW)   :  origin=0x08000000   length=0x00002fff"  
    STACKS  (RW)   :  origin=0x08003000   length=0x00001000"  
       $(ECHO) "MEMORY"                                                                                     >> $@; \
       $(ECHO) "{"                                                                                          >> $@; \
       $(ECHO) "   VECTORS (X)    :  origin=0x00000000   length=0x00000200"                                 >> $@; \
       $(ECHO) "   VECTORS_M (X)  :  origin=0xFD000000   length=0x00000200"                                 >> $@; \
       $(REGION_$(PLANET_$(DERIVATIVE)))                                                                           \
       $(ECHO) ""                                                                                           >> $@; \
       $(ECHO) "   /* sar module addresses */"                                                              >> $@; \
       $(ECHO) "   MMC     (RW)   :  origin=0xFFFFFD00   length=0x40"                                       >> $@; \
       $(ECHO) "   DEC     (RW)   :  origin=0xFFFFFE00   length=0x60"                                       >> $@; \
       $(ECHO) "   SYS     (RW)   :  origin=0xFFFFFFD0   length=0x30"                                       >> $@; \
       $(ECHO) "}"                                                                                          >> $@; \
       $(ECHO) "/****************************************************************************************/" >> $@; \
       $(ECHO) ""                                                                                           >> $@; \
       $(ECHO) ""                                                                                           >> $@; \
       $(ECHO) "/****************************************************************************************/" >> $@; \
       $(ECHO) "/* SPECIFY THE SECTIONS ALLOCATION INTO MEMORY                                          */" >> $@; \
       $(ECHO) "/****************************************************************************************/" >> $@; \
       $(ECHO) "SECTIONS"                                                                                   >> $@; \
       $(ECHO) "{"                                                                                          >> $@; \
       $(ECHO) "    .stack   : {"                                                                           >> $@; \
       $(STACK_3)                                                                                                  \
       $(ECHO) "               } > STACKS       /* SOFTWARE SYSTEM STACK             */"                    >> $@; \
       $(ECHO) ""                                                                                           >> $@; \
       $(ECHO) "    .bss     : {} > RAM         /* GLOBAL & STATIC VARS              */"                    >> $@; \
       $(ECHO) "    .sysmem  : {} > RAM         /* DYNAMIC MEMORY ALLOCATION AREA    */"                    >> $@; \
       $(ECHO) "    .data    : {} > RAM         /* INITIALIZED DATA                  */"                    >> $@; \
       $(ECHO) ""                                                                                           >> $@; \
       $(ECHO) ""                                                                                           >> $@; \
       $(ECHO) ""                                                                                           >> $@; \
       $(ECHO) ""                                                                                           >> $@; \
       $(RESET)                                                                                                    \
       $(VECT)                                                                                                     \
       $(ECHO) ""                                                                                           >> $@; \
       $(ECHO) "    .startup : {} > ROM_M     run = ROM    /* START ADDRESS                     */"                    >> $@; \
       $(ECHO) "    .text    : {} > ROM_M     run = ROM    /* CODE                              */"                    >> $@; \
       $(ECHO) "    .const   : {} > ROM_M     run = ROM    /* CONSTANT DATA                     */"                    >> $@; \
       $(ECHO) "    .cinit   : {} > ROM_M     run = ROM    /* INITIALIZATION TABLES             */"                    >> $@; \
       $(ECHO) ""                                                                                           >> $@; \
       $(ECHO) "    .MMC     : {_e_SARMMC_ST = .;}  > MMC"                                                  >> $@; \
       $(ECHO) "    .DEC     : {_e_SARDEC_ST = .;}  > DEC"                                                  >> $@; \
       $(ECHO) "    .SYS     : {_e_SARSYS_ST = .;}  > SYS"                                                  >> $@; \
       $(ECHO) "}"                                                                                          >> $@

    Thanks for your help.

  • In brief, this is the sort of thing you want:

    
        .text:decompress : {} > ROM
        .text:memset     : { rtsv7M3_T_be_eabi.lib<memset_t2.obj>(.text) } > ROM
        .text            : {} > ROM_M   run = ROM
    

    Moe Charara said:
    i am running the code on the Cortex M3 secondary core, so Load address have to be different than run address.

    I'm afraid that's a bit outside my knowledge. The decompression routines must be at their RUN addresses before autoinit begins, so if they have a distinct LOAD address, something else needs to move them.

  • I suspect we are dealing with multiple issues here.  Let's try to deal with one at a time.  So, I suggest you disable compression of the .cinit records by using the linker option --cinit_compression=off.  Get that working.  Then come back to the compression problem.

    Hope this helps ...

    -George