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

Finding function size at compile/link time and storing in memory.

I'm writing an application in which I want to obtain the code of a particular function during runtime.
Obtaining the code of a function is not a problem, as I just used function pointer to obtain the start address of the function. However, I'm not able to determine the end of the function.
I can solve this if I can obtain the size of the function and store it at a known memory location.

Is it possible to accomplish the above using:

1. ASSEMBLY: Use labels in assembly code to find the size of the function.
2. LINKER SCRIPT/SCATTER FILES: Use linker scripts or scatter files to find the size of the function.

Any help in this regard is highly appreciated.

Parents
  • Sorry for not being clear earlier.

    I want to copy code from one processor to another. Both the processors are the same and will have the same RTOS libraries installed.
    One processor will have all the code on it and other will just have memory space reserved (No code).

    From my design point, I want to first overwrite the code of one function (a dummy function with no code, but only space reserved) with the code of another on the local processor. WITH THIS WORKING I can then move on to copying between two processors (Since this introduces extra complexities).

    For this to work, I should obtain the code of that function. If that is possible then I can use IAP commands to overwrite the flash.

Reply
  • Sorry for not being clear earlier.

    I want to copy code from one processor to another. Both the processors are the same and will have the same RTOS libraries installed.
    One processor will have all the code on it and other will just have memory space reserved (No code).

    From my design point, I want to first overwrite the code of one function (a dummy function with no code, but only space reserved) with the code of another on the local processor. WITH THIS WORKING I can then move on to copying between two processors (Since this introduces extra complexities).

    For this to work, I should obtain the code of that function. If that is possible then I can use IAP commands to overwrite the flash.

Children