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.
I do not want to duplicate the entire code. I just want to migrate a portion of the code, (in chunks of functions) from one processor to another.
And what about all references that function does to other functions and variables at very specific addresses?
I can overlook that fact for now. I am still working on a protocol to program such a system. For now I just want to copy the code correctly.
It is almost like a run time firmware upgrade.
I just want to migrate a portion of the code, (in chunks of functions) from one processor to another.
I don't think you understand what you are trying to do. You might be able to make it work with a simple function, but that won't mean it will work with any function. You would be able to do it if the functions were coded in assembly.