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

Copy a function from SRAM to flash and execute from flash

Hello,
what I would like to do is to copy a function from SRAM to flash and decide in the main if I want to execute from flash or from SRAM.
What I observed it is that if this function is calling a subroutine placed in SRAM, when I execute it from flash the jump will not be set correctly: it will try to jump to a subroutine placed in flash, but this function is located in SRAM!!!
What can I do to have the correct address when I execute from flash?
I tried with the PI qualifiers ropi, but it does not work...
I am using a device with Cortex M4

Parents
  • Hi,

    Thank you very much for your quick answer:-)
    So to better explain lets' say I have the function f calling functions g and l:

    void f (void)
    {
     call g;
     call l;
    }
    

    all these functions are in SRAM, then I copied f in flash but I want that g and l are still in SRAM when I execute the code from flash. How can I do that?

    Alex

Reply
  • Hi,

    Thank you very much for your quick answer:-)
    So to better explain lets' say I have the function f calling functions g and l:

    void f (void)
    {
     call g;
     call l;
    }
    

    all these functions are in SRAM, then I copied f in flash but I want that g and l are still in SRAM when I execute the code from flash. How can I do that?

    Alex

Children