Hello,
I have some post-build data and I need it to be at a certain place inside the memory.
The linker generates this error

Is there a specific linker flag to build this kind of data?
Yours,
Afifi
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.
Hello,
I have some post-build data and I need it to be at a certain place inside the memory.
The linker generates this error

Is there a specific linker flag to build this kind of data?
Yours,
Afifi
Hi Afifi,
You could use the section attributes and an linker cmd script to define the desired address for that section:
__attribute__((section("main_section"))) int main() { printf("hello\n"); return 0; }
Linker cmd:
SECTIONS /* SECTIONS directive */ {
main_section: > SPECIFIC_MEM
or use the location attribute to place the symble or function to a absolute address:
for example:
__attribute__((location(0x2001))) int main() { printf("Good morning, Afifi.\n"); return 0; }
Hi Afifi,
Before you can run a C/C++ program, you have to create the C/C++ run-time environment. The C/C++ boot routine performs this task using a function called c_int00 (or _c_int00). The c_int00 or _c_int00 is declared and defined in boot.asm or boot.c in run-time support library.
This startup function performs any needed auto-initialization and system setup, then calls the user’s main() function. So the main() function is needed in your project.
Thanks for your help, but this is not the point.
I want to build somehow like calibration data, without any function(even the main).
Thanks,
It is not practical to put your data in a separate project. One way you can try is to place your calibration data at a specified location in a flash (e.g. NOR flash), and modify you code project to read the calibration data from the specified location in the flash.
Thanks,
I think you did not get the point.
I have some data which will be downloaded on the ECU through the software download process.
This data should be in hex format, so I want to build this data (some arrays for example) without any code to be executed.
In most compilers, there is a linker flag like LINKONLY which just compile and link the .o files without building it like software with code to be executed.
Yours,
Hi Afifi,
I don't know how to compile/link a project with data arrays only. The entry point is always required when linking the object files. I will post this kind of question to CCS/Compiler E2E forum to get suggestions.
I made a workaround to have my data only built, I compiled the .text, .data, and .stack in a separate section. Then I cropped the hex file to have my data only.
But it will be better to compile it directly without this workaround.
Hello,
I will post this kind of question to CCS/Compiler E2E forum to get suggestions.
Any updates?
This is my solution.
1. One array is defined in main.c
2. add attributes to this data array: section, retain, and location
3. Enable hex utilities

3. add section names excluded in the hex file

4. compile. The generated hex file contains the data array only