Bluetooth Dfu Image File
Download --->>> https://urluss.com/2sY2zv
The example bootloader accepts images that contain a new bootloader, SoftDevice, application, or any combination of these. To protect the target device against malicious attackers trying to impersonate the rightful sender of the firmware update, the init packet of the firmware package must be signed.
When performing a DFU, you must provide a package (in zip format) that contains the firmware image, an init packet, and a manifest file that indicates the package format. The init packet contains information about the firmware image that is used to validate the image, and it must be signed to ensure that the update stems from a trusted source.
To create a zip file that contains the firmware image (or images) and the corresponding init packet, use the nrfutil tool (version 2.2.0 or later). This tool is available as a standalone Python package from the Nordic Semiconductor nrfutil GitHub repository or can be installed from pypi with pip install nrfutil. See the nrfutil documentation for more information. Run nrfutil pkg generate --help to display help about creating a zip file.
You can also combine several images in one zip file. Note that, depending on the combination of images, the created zip file might contain two firmware packages (one for the bootloader and/or SoftDevice and one for the application) and the DFU process will be carried out in two steps. If you include both a bootloader and a SoftDevice in your firmware package, those two images will be merged together. An application, however, will always be updated separately after the other updates are completed.
Validation of the image includes checks to verify that the image originates from a trusted source and that it is compatible with the device and the current firmware and hardware. If the flag is_debug is set in the init packet, the debug version of the example skips version validation.
The open-source Simple Management Protocol (SMP) was originally created for flashing firmware on devices running Mynewt and Zephyr operating systems. SMP is based on the Bluetooth LE Generic Attribute (GATT) Profile.
PineTime stores two firmware images in Flash ROM: Active and Standby. PineTime boots from the Active Firmware Image. It activates the SMP service for firmware update over Bluetooth LE.
If the new firmware doesn't start properly, at the next reboot the bootloader swaps back the Active and Standby Firmware images. The bootloader starts the Active Firmware Image (now containing the old firmware)
Active Firmware Image: Contains PineTime firmware code that will be executed. The image starts with a Firmware Image Header (0x20 bytes) followed by the Arm Cortex-M4 Interrupt Vector Table (0xD8 bytes).
off: Offset of this chunk. Starts at 0. size: Total size of the firmware image data_len: Size of this chunk data_sha_len: Size of the SHA hash upgrade: If true, the version number of the new firmware must be greater than the Active Firmware version in Flash ROM
size: Total size of the firmware image write_bytes: Number of image bytes to write to flash for the chunk area_id: The flash area to write to proceed: Whether to process the request; false if offset is wrong. erase: Whether to erase the destination flash area.
To update PineTime's firmware over Bluetooth LE, the MCU Manager Library calls img_mgmt_impl_write_image_data to write each chunk of received firmware to PineTime's Flash ROM. PineTime Firmware Developers would have to implement img_mgmt_impl_write_image_data in C, so let's look inside the function...
MCUBoot (coded in C) plays a critical role in the firmware update process... During firmware update, MCUBoot swaps the old and new firmware images (and swaps them back if the new firmware fails to start)