This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to execute code from RAM on nRF51 using GCC Environment

How to execute code from RAM on nRF51 using GCC Environment

Parents
  • 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.

Reply
  • 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.

Children
No Data