How to execute code from RAM on nRF51 using GCC Environment
How to execute code from RAM on nRF51 using GCC Environment
Hi,
You can place a function in RAM in GCC like this:
__attribute__((used, long_call, section(".data"))) void some_func(void)
{
do_something();
}
Then you should check the .map file to see that it's located somewhere in RAM (0x2000XYZZ)
Cheers, Håkon
Hi Anand,
It seems gcc is trying to place standard functions (memset) into RAM, which will not work. Try switching out the "memset" command with a for-loop or similar to set it to '0'. Is there a specific reason why you want to place this specific function "advertising_init" in RAM? Normally you run this function only once, then you're done with it. It makes more sense to place timing and power critical functions in RAM.
Hi Anand,
It seems gcc is trying to place standard functions (memset) into RAM, which will not work. Try switching out the "memset" command with a for-loop or similar to set it to '0'. Is there a specific reason why you want to place this specific function "advertising_init" in RAM? Normally you run this function only once, then you're done with it. It makes more sense to place timing and power critical functions in RAM.