I read interesting application note from ST - AN3968 STM32F407/STM32F417 in-application programming (IAP) over Ethernet. To use same technic we have to do some things:
In order to build an image for IAP (to be loaded using the IAP software), make sure that: 1. The software is compiled/linked to run starting from the start address of the user Flash area (this address should be the same address as the one defined by USER_FLASH_FIRST_PAGE_ADDRESS in main.h). 2. The vector table start address is configured as the start address of the user Flash area.
Not sure, I don't know that software. Probably it would be possible to implement a bootloader using ChibiOS and lwIP and achieve something similar to what you described.
The idea is to change Chibiuos vector table and start address in flash in order to place IAP application at the beginning of the flash area. So, it will be possible to flash modified Chibios application over Ethernet.
Then it would be like a bootloader, if you search the Development forum you should find a thread regarding bootloaders and also an example of bootloader.
Basically you have to put the ChibiOS vectors table and the ChibiOS application itself at a different address, there is a port option that allows to do that. You also need a tweaked linker script for your application.