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.

TDA4AL-Q1: How to make sure .cinit section has the same load address after compiler linker

Part Number: TDA4AL-Q1

Tool/software:

Hi, Dear Expert

This thread is an extend discussion of this thread.

 J721S2XSOMXEVM: Who and What to generate the .cinit of freertos_mcu1_0_release.xer5f.map ? 

I am not sure this is a right question, because I an not understand compiler linker use case.

As far as I know, the compiler creates .cinit records for each "statically" initialized variable, which containing the "variable's location" and "initial value" The linker then gathers these records into the final .cinit section

For example, we define some constant "static variable" in code, and try to make alignment w/ section "fardata.appdataconst"

Should we expect APP_DATA_CONST has the same memory load address after code compiler and link w/ each time compiling? 

Part code as below.

#include "app_data_const.h"
#define APP_DATA_CONST __attribute__((section(".fardata.appdataconst")))

APP_DATA_CONST volatile boolean_T KACC_ACCAdvCornrDecFcn_flg = 1U;
APP_DATA_CONST volatile real32_T KACC_ACCAdvCornrDecThrld_mps2 = 1.5F;
APP_DATA_CONST volatile real32_T KACC_ACCAdvCornrMeetLmtOfst_mps = 1.5F;
APP_DATA_CONST volatile real32_T KACC_ACCAdvCornrMeetLmtThrld_mps = 0.0F;
APP_DATA_CONST volatile real32_T KACC_ACCAdvCornrRadFlt_s = 0.3F;
APP_DATA_CONST volatile boolean_T KACC_ACCCalFllwDistOfst_flg = 0U;
APP_DATA_CONST volatile boolean_T KACC_ACCCaliNoLmtSW_flg = 0U;
APP_DATA_CONST volatile real32_T KACC_ACCClrnceAlrtThld_m = 3.0F;
APP_DATA_CONST volatile boolean_T KACC_ACCClrnceAlrtUseCust_flg = 0U;
APP_DATA_CONST volatile boolean_T KACC_ACCCstUseVehInfo_flg = 0U;
APP_DATA_CONST volatile real32_T KACC_ACCCtrlEffrtTrns_s = 0.1F;
APP_DATA_CONST volatile real32_T KACC_ACCDecAlrtOfst_mps2 = -0.1F;
APP_DATA_CONST volatile real32_T KACC_ACCDecPerfrmAlrThrld_mps2 = -2.0F;

For example, we know fardata.appdataconst.load address  = a08bc6a8

.cinit     0    a08a5300    00026300     
                  a08a5300    00000008     (__TI_handler_table)
                  a08a5308    00000030     (__TI_cinit_table)
                  a08a5338    00000008     (.cinit..bss.load) [load image, compression = zero_init]
                  a08a5340    00017356     (.cinit..data.load) [load image]
                  a08bc696    00000002     --HOLE-- [fill = 00000000]
                  a08bc698    00000008     (.cinit..bss.devgroup.load) [load image, compression = zero_init]
                  a08bc6a0    00000008     (.cinit..tracebuf.load) [load image, compression = zero_init]
                  a08bc6a8    0000ee58     (.cinit..fardata.appdataconst.load) [load image]
                  a08cb500    00000008     (.cinit..bss.appdatavar.load) [load image, compression = zero_init]
                  a08cb508    000000f8     --HOLE-- [fill = 00000000]

then Link generated,

.fardata.appdataconst: load addr=a08bc6a8

LINKER GENERATED COPY TABLES

__TI_cinit_table @ a08a5308 records: 6, size/record: 8, table size: 48
	.bss: load addr=a08a5338, load size=00000008 bytes, run addr=a0728000, run size=0013ad26 bytes, compression=zero_init
	.data: load addr=a08a5340, load size=00017356 bytes, run addr=a0880700, run size=00017380 bytes, compression=copy
	.bss.devgroup: load addr=a08bc698, load size=00000008 bytes, run addr=a0726c30, run size=000013c5 bytes, compression=zero_init
	.tracebuf: load addr=a08bc6a0, load size=00000008 bytes, run addr=a0100400, run size=00080004 bytes, compression=zero_init
	.fardata.appdataconst: load addr=a08bc6a8, load size=0000ee58 bytes, run addr=a0fa0000, run size=0000ee50 bytes, compression=copy
	.bss.appdatavar: load addr=a08cb500, load size=00000008 bytes, run addr=a0f90000, run size=00009be4 bytes, compression=zero_init

Could we let this section "fardata.appdataconst" always keep the same address , example like  a08bc6a8 ?

Because customer feedback, this address may sometime changes for each code build.

Is it possible to fix this address location?

Thank You Very Much

Gibbs