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.

Linker generated tables

Hi,

I want to move data located in the flash after building the firmware for recovering on memory faults.

I found out there are some absolute addresses generated in the data section. These are called "LINKER GENERATED COPY TABLES" and "LINKER GENERATED HANDLER TABLE" in the linker map file.

In the autoinit.h is mentioned a table() command to be used in the LCF (I guess: Linker Control File = linker script). I can not find any usage of a table() command. Where are these?

Using CCs 6.1, CGT 4.4.5

  • Please see if this application note is helpful.  It has examples that use copy tables.

    Thanks and regards,

    -George

  • Hi George,

    thank you for the document. It describes copy tables and how to use them.

    I'm interessted in linker generated handler tables. These are listed in the map file. I want to know where these have been declared. I couln'd find any table() commands in the linker script generated by CCS.

  • I think you mean the initialization tables described in the section titled System Initialization of the MSP430 compiler manual.

    Thanks and regards,

    -George

  • The handler table is just a list of function pointers to the decompression routines. These are defined in the RTS in the source files copy*.c

    For EABI, the linker automatically generates the .cinit copy tables to initialize C global variables. No table() operators are needed.
  • Thanks for the hints! I'm using MSP320 with EABI. After reading the docs some things seem to be different in my application and some open questions.

    a) slau132j.pdf talks about 32 bit addresses in the handler table (section 6.9.4.4). In my application I can only see 16 bit addresses.

    b) In the handler table there are different functions. I assume the linker makes the choice which of the functions to put in. Is there are a way to follow these decisions?

    c) I found the .cinit section in the map file. I can understand the two tables now. In between there are "load images". What is this? The first one (.cinit..data.load) p.ex. contains absolute addresses. Where do they come from?

    .cinit     0    000083b2    0000001c
                      000083b2    0000000a     (.cinit..data.load) [load image]
                      000083bc    00000006     (__TI_handler_table)
                      000083c2    00000004     (.cinit..bss.load) [load image, compression = zero_init]
                      000083c6    00000008     (__TI_cinit_table)

  • a) In small code model, function pointers are only 16 bits, so the pointers in the handler table will only be 16 bits. In large code model, the pointers are 32 bits.

    b) Look at the linker map file. In the section "linker-generated copy tables," for each table, it will tell you the kind of compression used. Usually this ends up being either zero init or RLE (run-length encoding). See also the linker options --cinit_compression and --copy_compression

    c) Please see the latest copy of the MSP430 assembly language tools guide chapters 2 "Introduction to Object Modules" and 3 "Program Loading and Running", especially section 3.1 "Loading", which defines "load image." The linker puts those absolute addresses in the .cinit table; for EABI, the linker completely creates the .cinit section. Don't be fooled by the fact that the section is named ".cinit"; that's not where the cinit table starts. The actual cinit table starts at 0x83c6. What you're seeing at 0x83b2 and 0x83c2 are the initialization data for sections .data and .bss