This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

DFU erase application after init packet

I have a question about when the application is erased during serial DFU single-bank update:

According to the S110 Serial HCI documentation, the serial update packets are sent in the following order:

  1. Start packet
  2. Init packet
  3. Data packets
  4. Stop packet

Only after the init packet passes the validation checks is the old application erased.

"The DFU bootloader checks this information to determine if the image is valid for the device. If it is, it prepares (erases) the flash memory to accommodate the new image."

However, in the single-bank serial DFU example, the bootloader erases the application after receiving the start packet and before the init packet. In dfu_serial_bank.c, after receiving a start packet:

  • dfu_start_packet_handle is called which sets and calls m_functions.prepare = dfu_prepare_func_app_erase
  • dfu_prepare_func_app_erase erases BANK_0 which is where the application is stored

This happens for SD, bootloader, and application updates. I would like the memory to be erased only after the init packet passes its checks instead of after every start packet. How do I do this?

Note: I am using SDK 8.0.0 and S110 (v8.0.0).

Update: I also notice this during a SD update using dual-bank updates: the Application is erased before the init packet is received (and checked).

Related