Hi everyone,
I'm using CW 10.2, MQX 3.8.1 and Kinetis K60.
Due to an alomst full RAM use, I'm doing some optimization in my code.
I noticed that the instruction:
printf( "String to print\n");
Is compiled putting the pointer to the string in the register and then calling the printf function: the pointer points to an address placed in RAM that is initialized in the startup phase by copying data from the flash to the RAM.
I would like to put the string "String to printf\n" only in flash the way the copying phase is not needed and the RAM location can be used in another way.
How must I specify this requirement in CW?
Many thanks
Teckna
Solved! Go to Solution.
Hello,
there is a compiler option you have to set for putting strings into .rodata:
Hope this helps,
Erich
Hey there Teckna!
Has this helped you out?
We would like to know how is your project going!
Regards!
Hi Monica,
At Erich suggestion, I saved a lot of RAM.
Many thanks
Teckna
Hello,
there is a compiler option you have to set for putting strings into .rodata:
Hope this helps,
Erich
No one can help?
Teckna
Hello
As far as I can tell the string constants are allocated in section .rodata.
Can you please check in your linker file, where this section is placed.
If it is placed in a block of memory located in RAM, you may just have to move it over into a block of memory located in flash
I hope this helps.
CrasyCat