2021-09-15 08:20 AM
2021-09-15 01:07 PM
Should be able to use an attribute or pragma to indicate which section a particular function is placed in by the linker. Code in the startup or scatter loader should move the code from ROM into RAM.
It is more of a linker directive than a compiler one.
2021-09-15 11:53 PM
Something like this ? :
#define EXEC_FUNC_ON_RAM __attribute__ ((section(".data")))
EXEC_FUNC_ON_RAM void myFunc(int data) {....}
Do I have to modify the linker?
/* Initialized data sections into "RAM" Ram type memory */
.data :
{
. = ALIGN(4);
_sdata = .; /* create a global symbol at data start */
*(.data) /* .data sections */
*(.data*) /* .data* sections */
*(.RamFunc) /* .RamFunc sections */
*(.RamFunc*) /* .RamFunc* sections */
. = ALIGN(4);
_edata = .; /* define a global symbol at data end */
} >RAM AT> FLASH
Also, how do I check if the function in in RAM or FLASH ?
2021-09-20 12:03 AM
Found this; it worked correctly:
just add it before the function declaration:
__attribute__ ((section(".RamFunc")));
2023-03-07 03:17 AM
But don't add a semicolon in the end! Shall be:
__attribute__ ((section(".RamFunc"))) void some_function() {}
2023-03-07 06:45 AM
Define section in RAM in linkerscript
use void procedureinram() __attribute__ ((section(".yoursectionname")) {procedure code}
of course it may not be void and may have any parameters.
2023-03-07 11:45 PM
Just tried that, same results
2023-03-07 11:46 PM
This is been tried, same results
2023-03-07 11:46 PM
Ignore this wrong post.
2023-03-07 11:46 PM
Ignore this wrong post.