# Application + FOTA Bluetooth Low Energy Stack Update

This type of update is performed in multiple steps:

1. Start the DFU component.
2. When the FOTA process receives a Bluetooth Low Energy stack image instead of an application image, no revision check is performed, and the downloaded image is saved in the download area. The FOTA process executes code from the Bluetooth Low Energy stack area, so it is not possible to directly replace the Bluetooth Low Energy stack.
3. After completely programming the new Bluetooth Low Energy stack image into the download area, the DFU component performs a reset and thereby activates the bootloader.
4. The bootloader detects a valid Bluetooth Low Energy stack image in the download area and copies it to the Bluetooth Low Energy stack area. This is now possible because the previous Bluetooth Low Energy stack is no longer needed. After successfully copying the new Bluetooth Low Energy stack, the bootloader invalidates the Bluetooth Low Energy stack in the download area and proceeds with the firmware startup.
5. As with a usual bootloader startup, the DFU component of the new Bluetooth Low Energy stack detects no valid application, and therefore starts the FOTA DFU again to receive the new application image.
6. From this point on, the process is the same as it is with an application only upgrade.

Because the download area is used to temporarily hold the Bluetooth Low Energy stack image, the size of the Bluetooth Low Energy stack cannot exceed the size of the download area. This limits the Bluetooth Low Energy stack size to a maximum of 234 KB for non-secure bootloader and 218 KB for secure bootloader.

If the bootloader copy operation of the Bluetooth Low Energy stack image from the download area to the Bluetooth Low Energy stack area is aborted, at next startup the bootloader detects the still-valid Bluetooth Low Energy stack image in the download area and repeats the copy. This makes it possible to recover from power loss during the update process.