My firmware support upgrade by means of a bootloader (USB bootloader). I do not wan't to upgrade all the firmware, but only a specific function in the firmware.
My problem with updating all the firmware at once is that if a user removes power from the target while upating, it won't be possible to recover the target unless some form of backup is on the target board or physical re-porgramming of the target with a programmer.
I do not have the option of a backup.
So to be safe, I only want to update the specific function, and after all that is the only thing that will be changed in the firmware.
The function is compiled at an absolute address and does not use any interrupts.
I am faced with several problems.
1.) Is it possible to compile the function by itself, since the function does use other functions from the project? Because if I want to update the function only I will need a HEX file containing the data of the function only.If possible, how do I do this?
2.) What happens if I size of the function changes, will the rest of the project be able to detect the end address of the function. What affect will this have on the stack, PC etc.?
But what about the return address, will there be any problems with the overlay process when the function changes in size??
no that won't be any problem since the return address is poped from the stack. One last thing I forgot: all used lib functions have to be already in the code. You will need a snapshot of your shiped code and have to make sure that no new lib functions will be included. This will be the hardest task I think.
My approach for the last projects was a bit different: I build two different apps update code at 0x0000 main firmware at 0x2000. With some tests you can ensure that update code is always startable even after a broken download. That will be much more stable if update and firmware resist in different flashpages.
Thomas
you can not use more vars in your function after the product is delivered unless you have a special mempool reserved for that in your firmware.
How can I reserve a mempool/memory space for future variables?
MC
How can I reserve a mempool/memory space for future variables? that depends on the memory you have in reserve One way would to declare a array or struct globally in your app with a fixed address. This memory space can then be used in your function.