What is OTAP?
OTAP is the acronym for On The Air Programming. A BLE OTAP system consists of an OTAP Server and an OTAP Client which exchange an image file over the air using the infrastructure provided by BLE (GAP, GATT, SM) via a custom GATT Service and GATT Profile.
This chapter contains a detailed description of the Over The Air Programming capabilities of the BLE Host Stack enabled by dedicated GATT Service/Profile, the support modules needed for OTA programming and the Bootloader application which performs the actual image upgrade on a device. The image transfer is done using a dedicated protocol which is designed to run on both the BLE transport and serial transport.
The image file format is independent of the protocol but must contain information specific to the image upgrade infrastructure on an OTAP Client device.
There are 3 applications involved in the OTAP demo: 1 PC application which builds the image file and serves it to the embedded OTAP Server and 2 embedded applications (OTAP Server and OTAP Client).
While you are creating the application to send over the air the executable must be provided in the .srec format. This can be obtained by using the IAR Output Converter and setting the output format to Motorola as shown below.
The created .srec image must contain the Bootloader application in the reserved space
at the beginning of the flash memory because the OTAP Bootloader is configured not to overwrite itself and will skip the part of the flash it knows it occupies when copying the image received over the air into the internal memory.
To include the Bootloader into an application follow below steps:
Using IAR Embedded Workbench, open the application you want to send through OTAP. (for example temperature_sensor project)
In the options menu, go to the Output Converter submenu. In the Output Converter submenu, check the "Generate additional output" box, and choose Motorola as the Output format.
In the options menu, go to the Linker submenu. Now, in the Config tab, replace the symbols in the Configuration file symbol definitions box with these:
In the Linker submenu, go to the Input tab. In the Keep symbols box, add the symbol 'bootloader' (without the quotes).
In the Input tab, in the Raw binary image box, in the File option, add the following path:
In the Raw binary image box, add the following options to the Symbol, Section and Align boxes:
Press OK. Compile the project. The output file (*.srec) should be in the main project folder, inside the debug folder.
You can now use this binary file to reprogram your device with OTAP.