lpc17xx update FW with RTOS via IAP

valentiiglesias wrote on Tuesday, October 23, 2012:

Hello freeRTOS,

I need to do a firmware with RTOS, able to update itself. This FW would update flash memory with the new FW sent before via remote communications (saved temporally in a portion of flash memory). The FW would be composed with an custom bootloader, the RTOS and the user’s firmware. The bootloader, on boot, would looking for a new FW valid on reserved flash memory. If so, it will update the actual firmware via IAP commands and then will delete the reserved flash memory.

I did that with more simple plataforms with 8 bits MCUs like PF81C51RD2 or P89LPC932 and without RTOS. But I’m newbie working with 32bits MCUs and also with RTOS. So any ideas or suggestions would be very appreciated.

Is there an easy way to do that? How could affect the RTOS in this process?
Thanks in advance.

PD: We use…
  MCU: LPC1758
  LPCXpresso: v4.2.3
  RTOS: FreeRTOS 7.2


rtel wrote on Tuesday, October 23, 2012:

Applications that use FreeRTOS are statically linked - they are just executable programs like any other program so there is no difference using a bootloader with FreeRTOS than without.

If you bootloader is always the first thing to run then the RTOS tick interrupt won’t be installed, so you need do nothing to stop it.  If the bootloader can run after the kernel has stared, then you will need to stop the tick interrupt first, to ensure the kernel does not attempt a context switch.  The consideration is the same for all interrupts though, so again this is not FreeRTOS specific.

Other things you have to do are map the interrupt vectors correctly, so the bootloader has its vector table, then you remap the vector table when the application starts running so it has its own vector table (including the RTOS handlers).  Again, that would need to be done with or without an RTOS though.