Hi, Viktor,
Regarding your question, I do not know why you duplicate the same api function to different location, if you copy the same name api function to different location, when you execute the jumping function, how do you control which function will be executed?
If you want to write erase/program program flash, the operating flash code must be in program flash, we have the code to define an function in program RAM and copy the operating flash code from program flash to program RAM and execute the code in program flash.
I attach the example code, hope it can help you. But I do not test the example, any issue, pls tell us.
If I misunderstood you, I am sorry.
BR
XiangJun Rong