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.

Compiler: how to assigns address to multiple variable defined by DATA_SECTION in linker command file?

Guru 63250 points

Tool/software: TI C/C++ Compiler

Hello Champs

I have three variables defined by the DATA_SECTION and i want my linker file can automatically assign the address based on the order. The size of three variables could vary upon to the version. I want to have single linker file to handle all version.

    #pragma DATA_SECTION(log_union_flash_a, "Log_A");
    #pragma DATA_SECTION(log_union_flash_b, "Log_B");

   #pragma DATA_SECTION(defaults,      "Defaults");

Log_A and Log_B are the same size and Defaults has much large size than log.

Ideally, the three variables shall have following address rule:

Log_A shall be at the beginning of the data flash, log_B is after and the Defautls are the last. Each varisable shall be 32B alignment without any other gap.

I have below in my command file, but the result is alwasy Defautls at th begining of the data flash.

Memory

{

    DFLASH  (RX)    : origin = 0x00018800, length = 0x00000800

}

SECTIONS

{

LOG_A  :: {} > (DFLASH align(32))

LOG_B : : {} > (DFLASH align(32))

DEFAULTS : : {} > (DFLASH align(32))

}

How can i let the link to assign the address based on my desired ways.

Regards

Yihe