OTA modular update STM32F446ZET6 with FreeRTOS
Hi all,
I need to perform a modular update in my f446 board for my project.
The board is running a FreeRTOS, and the idea is to only modify the content of one task without affecting the content of other tasks. For doing this, every task calls its function, and these functions are defined in specific areas of memory defined in the linker file.
Here is an example of a function:
void __attribute__((section(".custom_section1"))) application1 (void)
{
printf("in app 1 \r\n");
}
Here is a part of the linker file:
...
APPLICATION_1 (rx) : ORIGIN = 0x8010000, LENGTH = 64K /* Sector 3 */
...
.custom_section1 :
{
*(.custom_section1)
} > APPLICATION_1
And here is the task calling the application:
void StartApp1(void *argument)
{
for(;;)
{
application1();
osDelay(1000);
}
/* USER CODE END StartApp1 */
}
Before performing the update everything works perfectly, the tasks call the functions and with CubeProgrammer I check that they are stored where we want them to be.
The problem comes after the update. I am sending through CAN the code of the new function that I want to run, which is this:
void __attribute__((section(".custom_section1"))) application1 (void)
{
printf("in app 1.1 \r\n");
}
This function works also perfectly in the sending board and in the location where it is expected.
When the information comes through CAN, the task that runs the application is deleted, the memory sector gets erased and then I coppy this message in that exact same memory address. After checking the memory content I see that it is the exact content as in the 'sending board'.
But then, when launching the new task that calls this new function it crashes right when it calls it.
I have already tried different approaches, to do it by suspending and relaunching the original task, to create a new task (like described before), to stop all the tasks . I see that the problem is not task related because I put some printf in the new task to see that it works, the problem is just in calling this new function. I also tried to reset the system after the new function is coppied, but still crashes there.
Is what I am trying to do possible? And what is avoiding launching this new function?
Thanks a lot in advance
