Hello,
I know there is a way to store extern variables in a section defined in ld file as below:
__attribute__ ((section(".ccp_database1"))) struct stDataCache stDataRamCacheA;
__attribute__ ((section(".ccp_database1"))) struct stDataCache stDataRamCacheB;
....
But it is quite inconvenient if there are many extern variables in source files. Some compiler can do it by writing it in link file, for example TI CCS. Could S32 IDE also have this feature?
My platform is: S32 IDE V1.1 + MPC574x
Hi,
You can e.g. replace an attribute with shorter alias:
#define CCP_DATA1 __attribute__ ((section(".ccp_database1")))
CCP_DATA1 struct stDataCache stDataRamCacheA;
You can also explicitly assign the object files into a custom section in the linker script command file (.ld).
First I'd suggest to turn off function and data sections compiler flags since they might interfere with it.
SECTION
{
.my_custom_section_consts :
{
* source1.o (.rodata)
* source2.o (.rodata)
* source3.o (.rodata)
} > m_text
.my_custom_text :
{ INPUT_SECTION_FLAGS (SHF_PPC_VLE)
* source1.o (.text)
* source2.o (.text)
} > m_text
...
Hope it helps.
Stan
Thanks very much. I will have a try as you provide.