Hi Oliver,
Thank you for your guide.
The general steps are correct, but it might be also managed slightly simple way.
The functions which should be executed from RAM may be defined directly at RAM by #pragma CODE_SEG linker command.
In that case, the function's code is loaded into RAM automatically during Startup() and you may call them directly.
See attached example code (I used your code as a template).
The approach from you is better in the case when we use these functions only occasionally – the load into RAM is executed only at request and it does not consume execution time during every MCU reset/startup.
The next potential advantage is that RAM dedicated for functions may be used as temp memory buffer when we do not need these functions in RAM or we may load an only predefined set of functions per our request. This may help with decreasing memory size requirements.
The calling through pointer function may be also used for calling a function which is not compiled directly into our code (call bootloader functions from the application or opposite).
I hope it helps you.
Have a great day,
Radek
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------