This document illustrates APIs provided by ChirpBox with code explanation and demo project.
Parameters injection
For benchmarking setting, users can change the LoRa radio parameter value without modifying the code. This is achieved by the method similar used in D-Cube.
Example project is detailed here.
Project configuration:
1. As procedures in firmware preparation, open Project->Properties
, go to Paths and Symbols
in C/C++ General
, add ChirpBox/Miscellaneous/API/
to the include directories.
2. Add following codes in your main.c
file:
before main()
function (to declare the variable fut_config
):
1 |
1 | volatile chirpbox_fut_config __attribute((section (".FUTSettingSection"))) fut_config ={0}; |
in main()
function (to print fut_config
):
1 | print_chirpbox_fut_config ((chirpbox_fut_config*)&fut_config); |
3. Add following GCC linker flags to locate the parameter section address.
-Wl,--section-start -Wl,.FUTSettingSection=0x08000610
-Wl,--section-start -Wl,.text=0x08000620
4. Compile project and generate the .bin
file.
Firmware patch with custom parameters:
5. Custom parameters can be set within 255 4-byte variables, and should be declared in "FUT_CUSTOM_list"
(see example configuration).
1
2
3{
"FUT_CUSTOM_list": "0x0000000A, 0x00000005"
}
6. Run param_patch_FUT.py under ChirpBox/chirpbox manager/
to update the specified FUT firmware.
You may need to change the path of .bin
file and .json
file before run the script.
1
fut_param_patch('FUT.bin', 'example_config_method.json')