mkfotaimg.py
The mkfotaimg.py tool takes two positional arguments as inputs: the FOTA Bluetooth Low Energy stack sub-image and the user application sub-image. Its usage and optional arguments are shown below.
Usage:
> mkfotaimg.py [-h] [--version] [-d UUID] [-s SecureBoot] [-i UUID][-n NAME] [-o OUT-IMG] FOTA-IMG APP-IMG
Arguments: see the "Positional Arguments" table and the "Optional Arguments" table.
Argument |
Meaning |
FOTA-IMG |
FOTA stack sub-image containing the Bluetooth Low Energy stack and the DFU component (.bin file) |
APP-IMG |
application sub-image (.bin file) |
Argument |
Meaning |
-h, --help |
show help message and exit |
--version |
show program's version number and exit |
-d UUID, --devid UUID |
device UUID to embed in the image (default: no ID) |
-s SecureBoot, --secure SecureBoot |
the size of secure bootloader for the secure FOTA (default: non-secure) |
-i UUID, --srvid UUID |
advertised UUID to embed in the image (default: DFU service UUID) |
-n NAME, --name NAME |
advertised name to embed in the image (default: ON RSL FOTA ) |
-o OUT-IMG |
name of output image file (default: <APP-IMG>.fota) |
This Python utility can be integrated into the post-build steps of Eclipse to generate the .fota format file every time a user application project is built. This configuration is available in Project > Properties > C/C++ Build > Settings > Build Steps > Post-Build Steps. Two steps are required to generate the .fota image. First, we need to generate the app.bin, which is the application sub-image. This is done using the objcopy tool, as follows:
arm-none-eabi-objcopy -O binary <app_name>.elf <app_name>.bin
Then, we can call the mkfotaimg.py utility to generate the final FOTA image (app.fota file) from the stack sub-image (fota.bin) and the application sub-image (app.bin) generated above the .fota image, as follows:
mkfotaimg.py <app_name>.fota fota.bin <app_name>.bin
In order to invoke both commands, the two can be combined with the “&&” operator. Integrating FOTA Into Your Application, walks you step-by-step through generically configuring this post-build step for any application, including the path for the Python utility, FOTA stack binary file, and application binary file.