FOTA Stack Source Code
The RSL CMSIS-Pack includes a prebuilt version of the FOTA Stack available in the form of a software component, as shown in Chapter 1 "Performing Your First FOTA Update" on page 1. The fota.bin and libfota.a files are located under <cmsis_pack_root>\ONSemiconductor\<device>\<version>\lib\Release. The source code to generate these files is also available in the CMSIS-Pack, under <cmsis_pack_root>\ONSemiconductor\<device>\<version>\firmware\source\lib\fota.
If you would like to customize and rebuild these files, follow these steps:
| 1. | Import the source code project. Navigate to File > Import > General > Existing Projects into Workspace, set the Select root directory: option with the path to the source code <cmsis_pack_root>\ONSemiconductor\<device>\<version>\firmware\source\lib\fota, mark the checkbox Copy projects into workspace, and click Finish. The project appears in the left side of Project Explorer, as shown in the "Copying the Project" figure. |
| 2. | Modify the source code. For example, change the FOTA stack version number in app.conf.h. |
#define FOTA_VER_MAJOR 1
#define FOTA_VER_MINOR 1 //0
#define FOTA_VER_REVISION 0
| 3. | Build the project. After building successfully, libfota.a and fota.bin are generated under the Debug or Release folder, as shown in the "Building the Project" figure. |
| 4. | To use your customized files, replace the libfota.a and the fota.bin in your in your CMSIS-Pack installation (<cmsis_pack_root>\ONSemiconductor\<device>\<version>\lib\Release). |
| 5. | After replacing these files, it is necessary to refresh the RTE folder of existing projects in your workspace, so that the IDE uses the newly generated files. The simplest way to do this is to delete the fota.bin and libfota.a files under RTE > Device > <device>, and right-click the project name and choose Refresh to refresh your sample project (for example, you can do this in blinky_fota). |
| 6. | Rebuild the existing project so that a new .fota image is generated based on your modified libfota.a and fota.bin files. |
| 7. | Run BLE Explorer to perform a FOTA update. The tool detects the updated version number of the stack FOTA stack version: FOTA <higher_version_number>, in comparison to the one installed on the device. (In this example, we are using FOTA stack version: FOTA 1.1.0, for when version 1.0.0 is installed.) This means a full update is required (FOTA Stack + application). This is performed in two steps: first, the FOTA stack is updated; next, the device resets and the user application is updated. |
|
IMPORTANT: FOTA stack updates are not yet supported in this release. If the build ID in the FOTA stack (fota.bin) does not match the build ID in the application, BLE Explorer transmits the FOTA stack to update, but the stack does not update on the EVB. Therefore, all application sub-images must have the same FOTA stack with the Build ID, and use the same fota.bin file. |
| 8. | Run the updater.py tool to load the blinky_fota.fota image over UART with the following command: |
python updater.py com4 blinky_fota.fota Image : BLINKY ver=1.0.0 / FOTA ver=1.1.0 Application: FOTA ver=1.0.0 Bootloader : BOOTL* ver=1.0.0 *******************************************************************************************