Hello community,
I have to sections defined. Bootloader_1 and Bootloader_2.
I would like to put the same code "bootBL.text" to both sections. The aim is the code twice in flash.
How can I achieve this with the Linker Command File ?
Hi XiangJun,
thank you for your reply.
The requirement is to make bootloader updatable.
At the beginning it is checked which bootloader section is active. Jump to this section. Update of the firmware and the other bootloader section. Store / save address of the updated section for the next time.
The source code of the bootloader at initial state is the same. One time in one section the second time in other section.
The idea was the put the same code two different sections. But you're right about the jump addresses. They must be absolute or relocated.
The question is whether it is possible at all to do this in this way?
Otherwise I have the same code twice with different module/function names for instance bootloader1.c bootloader2.c.
bootloader1.c placed to .Bootloader_1 section the bootloader2.c placed to .Bootloader_2 section.
BR,
Viktor
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