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, In theory you can run all your code in RAM if you have the space. However; it seems like gcc does not like it when you try to put standard functions (like memset from string.h) in RAM. This functionality is more towards the compiler suite that you're using rather than nordic specific functionality, so we do not really have any guidelines on this. Note that even if you put calls to the softdevice into RAM, the softdevice will still access the flash to run it's own functions.

    Cheers, Håkon

Reply
  • Hi Anand, In theory you can run all your code in RAM if you have the space. However; it seems like gcc does not like it when you try to put standard functions (like memset from string.h) in RAM. This functionality is more towards the compiler suite that you're using rather than nordic specific functionality, so we do not really have any guidelines on this. Note that even if you put calls to the softdevice into RAM, the softdevice will still access the flash to run it's own functions.

    Cheers, Håkon

Children
No Data
Related