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.
Tool/software: TI C/C++ Compiler
Hi,
In AUTOSAR MCAL drivers memory protection is done by sectioning the code to the normal text/data sections. These sections are created by compiler directives that are defined in MemMap files.
Syntax to set the section for variable declaration and function is different in arm compiler to gcc compiler.
For eg: In TI ARM Cortex M4 compiler, for setting data section, we do following.
#pragma SET_DATA_SECTION("mydata")
int x;
int y;
#pragma SET_DATA_SECTION()
Where as In GCC compiler,
int x __attribute__ ((section ("mydata")));
int y __attribute__ ((section ("mydata")));
From the above examples we can notice that using ARM all the variables can be grouped inside #pragma, but using GCC compiler this is not possible and we need to explicitly section for each variables.
With this, we cannot re-use existing TI compiler framework. Also AUTOSAR requires us to combine the common section.
Is there any way with GCC compiler to combine section declarations for variables and functions?
I am not aware of any feature in the GCC ARM compiler which acts like #pragma SET_DATA_SECTION from the TI ARM compiler. I very much doubt there is any such feature.
One alternative to consider ... It is probably possible, in the linker script, to indicate that the section from one object file be treated differently. For instance, you can probably say that the .bss section from special_file.obj does not get combined into the usual .bss section, but goes elsewhere. I don't know the details of how it is done. Before I look into that, I need to know whether this would be helpful.
Thanks and regards,
-George
Hello George,
Thanks for your reply and sorry for my late response.
Unfortunately, there is no way which complies with AUTOSAR spec for variable/function declaration. We are adding this as an exception and defining attribute for each variable/function.
https://answers.launchpad.net/gcc-arm-embedded/+question/263510