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.

MCU-PLUS-SDK-AM263PX: Relocatable project has wrong symbol addresses

Part Number: MCU-PLUS-SDK-AM263PX

Tool/software:

Hello

I used option '--relocatable' and neither RAM nor ROM model in linker setting to remove 'main' function (for project which can be compiled without entry point, and called by other 'main' project)

In this case addresses of my symbols in .map file are all started from 0x0000xxxx instead addressed in RAM, though sections RUN and LOAD addresses are correct (symbols addresses match section addresses in case of compilation with no '--relocatable' option).


In resulting .hex file all data/text are placed to RUN address instead LOAD address, which I consider as mistake, as this files should actually be loaded to ROM.

From .cmd file:

SECTIONS
{
    .text : run = OCRAM, load = FLASH, align = 8
    .data : run = OCRAM, load = FLASH, align = 8
    .rodata : run = OCRAM, load = FLASH, align = 8
    .bss :  > OCRAM, align = 8
    .config_table : run = OCRAM, load = FLASH, align = 8
}

MEMORY
{
    SBL   : ORIGIN = 0x70000000 , LENGTH = 0x40000 
    OCRAM   : ORIGIN = 0x70040000 , LENGTH = 0x40000 
    FLASH   : ORIGIN = 0x60100000 , LENGTH = 0x80000 
}


From .map file:

SECTION ALLOCATION MAP

 output                                  attributes/
section   page    origin      length       input sections
--------  ----  ----------  ----------   ----------------
.text      0    60100070    00000074     RUN ADDR = 70040070
                  60100070    00000014     platform_library.o (.text.convert_float_to_long)
                  60100084    0000000c     --HOLE-- [fill = 0]
                  60100090    00000014     platform_library.o (.text.convert_float_to_ulong)
                  601000a4    0000000c     --HOLE-- [fill = 0]
                  601000b0    00000014     platform_library.o (.text.convert_long_to_float)
                  601000c4    0000000c     --HOLE-- [fill = 0]
                  601000d0    00000014     platform_library.o (.text.convert_ulong_to_float)

.config_table 
*          0    60100000    00000070     RUN ADDR = 70040000
                  60100000    00000070     config_table.o (.config_table)


GLOBAL SYMBOLS: SORTED BY Symbol Address 

address   name                    
-------   ----                    
00000000  applicationConfigTable  
00000000  convert_float_to_long   
00000020  convert_float_to_ulong  
00000040  convert_long_to_float   
00000060  convert_ulong_to_float  

From .hex file:

$A70040000,
00 00 00 00 00 00 00 02 38 D1 B7 17 00 00 00 06 00 00 02 00 00 00 00 0A 
00 00 02 10 00 00 10 00 00 01 00 04 3B 03 12 6F 00 00 00 32 00 00 00 00 
00 00 00 50 00 00 00 32 00 01 70 00 00 00 00 02 3A 83 12 6F 00 00 00 06 
00 00 01 00 00 00 00 09 00 00 01 10 FF FF FF FF 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
EE 30 0A 41 EE 80 0A 20 EE BD 0A C0 EE 10 0A 10 E1 2F FF 1E 00 00 00 00 
00 00 00 00 00 00 00 00 EE 30 0A 41 EE 80 0A 20 EE BC 0A C0 EE 10 0A 10 
E1 2F FF 1E 00 00 00 00 00 00 00 00 00 00 00 00 EE 01 0A 10 EE B8 1A C1 
EE 21 0A 00 EE 30 0A 20 E1 2F FF 1E 00 00 00 00 00 00 00 00 00 00 00 00 
EE 01 0A 10 EE B8 1A 41 EE 21 0A 00 EE 30 0A 20 E1 2F FF 1E 

  • Unfortunately, TI does not document or support using the combination of --relocatable and the hex utility in this manner.  The hex utility is intended to be used on a complete program, not part of one.

    It is the case that the hex utility accepts a single object file (not a complete program) as input, and generates output.  This is to support learning about the hex utility by experimenting with small examples.  This manner of using the hex utility is never used in a production setting.

    Thanks and regards,

    -George