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.

Troubles with HEX470 -load_image generated object file (ARM 4.9.2)

I created image file using -load_image option from an executable and need to link it in as input data section. HEX470 created object OFD dump:

 Section Information

    id name                      load addr  run addr    size align alloc
    -- ----                      ---------  --------    ---- ----- -----
     0 (no name)                 0x00000000 0x00000000   0x0     0   N  
     1 .boot_1                       0x0801efe8 0x0801efe8 0xe00     4   Y  
     2 .ARM.attributes           0x00000000 0x00000000  0x62     0   N  
     3 .shstrtab                 0x00000000 0x00000000  0x28     0   N  

The linker file which links it in with other sections looks like this

--retain="*(.boot*)"


MEMORY

{

.........

BOOT:    origin=BOOT_START_ADDR    length=(1024 * 4)

}

SECTIONS

{

........

   .boot : fill=0xFFFFFFFF palign(8)
   {
      *(.boot*)
   } > BOOT

}

input section is in and map file looks like this

run origin  load origin   length   init length attrs members
----------  ----------- ---------- ----------- ----- -------
00000000    00000000    00000048   00000048    r-x
  00000000    00000000    00000020   00000020    r-x .exception_vectors
  00000020    00000020    00000028   00000028    r-- .header
00000048    00000048    00000e00   00000e00    rw-
  00000048    00000048    00000e00   00000e00    rw- .boot

However if I run HEX470 on resulting executable file with embedded .boot section data does not appear in output S-record. It looks like -load_image options does not create correct attributes for .boot_1 section and it is not loadable. If I specify RUN address then it works but this is not what needed and creates additional allocation problems

Is something missing in my linker file?

P.S.

After posting this I noticed following section in resulting OUT file:

.cinit     0    00001d40    00000da0     
                  00001d40    00000d8f     (.cinit..boot.load) [load image, compression = rle]
                  00002acf    00000001     --HOLE-- [fill = ffffffff]
                  00002ad0    00000008     (__TI_handler_table)
                  00002ad8    00000008     (__TI_cinit_table)

What does .cinit have to do with data section from HEX470 -load_Image?

  • Eugene,

    The sections produced by the hex utility are marked as SHF_WRITE. The linker, when using the --rom_model option (which is the default), will create cinit records for all writable data. You can work around this by using the NOINIT type attribute in the linker command file.

    .boot : fill=0xFFFFFFFF palign(8)
       {
          *(.boot*)
       } > BOOT type=NOINIT

  • That solves both of my problems.

    On the other hand, HEX470 sections should be 'pure' initialized constant data sections with whatever ELF section header flag comes with it.

    Thank you and Happy New Year!