Skip to content

Commit

Permalink
[TI] CC13x4_26x4 OTA (project-chip#30757)
Browse files Browse the repository at this point in the history
* image is downloaded but apply fails

* increased size of mcuboot_max_img_sectors

* ota header debug ongoing

* modified first block so that the Matter OTA header is skipped when writing into external flash

* added header offset in first block to account for img magic, img length, header length and other padding

* OTA working with SDK MCUBoot build

* code cleanup and enable OTA for all apps

* more code cleanup

* various build error fixes

* image is downloaded but apply fails

* increased size of mcuboot_max_img_sectors

* ota header debug ongoing

* modified first block so that the Matter OTA header is skipped when writing into external flash

* added header offset in first block to account for img magic, img length, header length and other padding

* OTA working with SDK MCUBoot build

* code cleanup and enable OTA for all apps

* more code cleanup

* various build error fixes

* added merged ti_simplelink_sdk.gni

* ti_simplelink_sdk.gni fix

* updated TI OTA readme

* added back in MCUBoot, updates README docs, fixed spelling errors

* Restyled by whitespace

* Restyled by clang-format

* Restyled by gn

* fixed clang formatting in flash_map_backend.c

* Restyled by clang-format

---------

Co-authored-by: Restyled.io <[email protected]>
  • Loading branch information
abiradarti and restyled-commits authored Dec 11, 2023
1 parent 0373659 commit d4595af
Show file tree
Hide file tree
Showing 38 changed files with 2,101 additions and 165 deletions.
5 changes: 4 additions & 1 deletion examples/all-clusters-app/cc13x4_26x4/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ ti_sysconfig("sysconfig") {
sources = [ "${project_dir}/chip.syscfg" ]

outputs = [
"ti_devices_config.c",
"ti_radio_config.c",
"ti_radio_config.h",
"ti_drivers_config.c",
Expand All @@ -47,6 +46,10 @@ ti_sysconfig("sysconfig") {
"ti_dmm_application_policy.c",
"ti_dmm_application_policy.h",

# CCFG generation disabled for OTA-able application
#"ti_devices_config.c",
#"ti_devices_config.h",

# disabled until upstream generation is aligned
#"tiop_config.h",
#"tiop_config.c",
Expand Down
4 changes: 2 additions & 2 deletions examples/all-clusters-app/cc13x4_26x4/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ the session.
Select the ELF image to load on the device with the `Browse` button. This file
is placed in the `out/debug` folder by this guide and ends with the `*.out` file
extension. For OTA enabled applications, the standalone image will instead end
with the `*-bim.hex` file extension. This this is a combined image with
application and and `BIM` included. The flag to enable or disable the OTA
with the `*-mcuboot.hex` file extension. This this is a combined image with
application and `MCUBoot` included. The flag to enable or disable the OTA
feature is determined by "chip_enable_ota_requestor" in the application's
args.gni file.

Expand Down
4 changes: 2 additions & 2 deletions examples/all-clusters-app/cc13x4_26x4/args.gni
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ ti_simplelink_board = "LP_EM_CC1354P10_6"
optimize_debug_level = "s"
lwip_debug = false

chip_enable_ota_requestor = false
chip_enable_ota_requestor = true

openthread_external_platform = "${chip_root}/third_party/openthread/platforms/cc13x4_26x4:libopenthread-cc13x4_cc26x4"
chip_openthread_ftd = true
Expand All @@ -49,4 +49,4 @@ chip_stack_lock_tracking = "none"
matter_device_vid = "0xFFF1"
matter_device_pid = "0x8006"
matter_software_ver = "0x0001"
matter_software_ver_str = "1.0d1"
matter_software_ver_str = "1.0.1+1"
3 changes: 2 additions & 1 deletion examples/all-clusters-app/cc13x4_26x4/chip.syscfg
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ for(var setting in ccfgSettings)
CCFG[setting] = ccfgSettings[setting];
}

CCFG.enableCodeGeneration = true;
/* disable CCFG for OTA-able application */
CCFG.enableCodeGeneration = false;


/* NVS */
Expand Down
2 changes: 1 addition & 1 deletion examples/all-clusters-app/cc13x4_26x4/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#include <app/clusters/ota-requestor/DefaultOTARequestor.h>
#include <app/clusters/ota-requestor/DefaultOTARequestorDriver.h>
#include <app/clusters/ota-requestor/DefaultOTARequestorStorage.h>
#include <platform/cc13x2_26x2/OTAImageProcessorImpl.h>
#include <platform/cc13xx_26xx/OTAImageProcessorImpl.h>
#endif
#include <lib/support/CHIPMem.h>
#include <lib/support/CHIPPlatformMemory.h>
Expand Down
6 changes: 4 additions & 2 deletions examples/lighting-app/cc13x4_26x4/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,10 @@ ti_sysconfig("sysconfig") {
"ti_ble_config.h",
"ti_dmm_application_policy.c",
"ti_dmm_application_policy.h",
"ti_devices_config.c",
"ti_devices_config.h",

# CCFG generation disabled for OTA-able application
#"ti_devices_config.c",
#"ti_devices_config.h",

# disabled until upstream generation is aligned
#"tiop_config.h",
Expand Down
4 changes: 2 additions & 2 deletions examples/lighting-app/cc13x4_26x4/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ the session.
Select the ELF image to load on the device with the `Browse` button. This file
is placed in the `out/debug` folder by this guide and ends with the `*.out` file
extension. For OTA enabled applications, the standalone image will instead end
with the `*-bim.hex` file extension. This this is a combined image with
application and and `BIM` included. The flag to enable or disable the OTA
with the `*-mcuboot.hex` file extension. This this is a combined image with
application and `MCUBoot` included. The flag to enable or disable the OTA
feature is determined by "chip_enable_ota_requestor" in the application's
args.gni file.

Expand Down
4 changes: 2 additions & 2 deletions examples/lighting-app/cc13x4_26x4/args.gni
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ ti_simplelink_board = "LP_EM_CC1354P10_6"
optimize_debug_level = "s"
lwip_debug = false

chip_enable_ota_requestor = false
chip_enable_ota_requestor = true

chip_openthread_ftd = true
openthread_external_platform = "${chip_root}/third_party/openthread/platforms/cc13x4_26x4:libopenthread-cc13x4_cc26x4"
Expand All @@ -47,4 +47,4 @@ chip_stack_lock_tracking = "none"
matter_device_vid = "0xFFF1"
matter_device_pid = "0x8005"
matter_software_ver = "0x0001"
matter_software_ver_str = "1.0d1"
matter_software_ver_str = "1.0.1+1"
3 changes: 2 additions & 1 deletion examples/lighting-app/cc13x4_26x4/chip.syscfg
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ for(var setting in ccfgSettings)
CCFG[setting] = ccfgSettings[setting];
}

CCFG.enableCodeGeneration = true;
/* disable CCFG for OTA-able application */
CCFG.enableCodeGeneration = false;


/* NVS */
Expand Down
8 changes: 3 additions & 5 deletions examples/lock-app/cc13x4_26x4/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,14 @@ ti_sysconfig("sysconfig") {
"ti_radio_config.h",
"ti_drivers_config.c",
"ti_drivers_config.h",
"ti_devices_config.c",
"ti_devices_config.h",
"ti_ble_config.c",
"ti_ble_config.h",
"ti_dmm_application_policy.c",
"ti_dmm_application_policy.h",

# disabled until upstream generation is aligned
#"tiop_config.h",
#"tiop_config.c",
# CCFG generation disabled for OTA-able application
#"ti_devices_config.c",
#"ti_devices_config.h",

# not traditional source files
#"ti_utils_build_linker.cmd.genlibs",
Expand Down
4 changes: 2 additions & 2 deletions examples/lock-app/cc13x4_26x4/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ the session.
Select the ELF image to load on the device with the `Browse` button. This file
is placed in the `out/debug` folder by this guide and ends with the `*.out` file
extension. For OTA enabled applications, the standalone image will instead end
with the `*-bim.hex` file extension. This this is a combined image with
application and and `BIM` included. The flag to enable or disable the OTA
with the `*-mcuboot.hex` file extension. This this is a combined image with
application and `MCUBoot` included. The flag to enable or disable the OTA
feature is determined by "chip_enable_ota_requestor" in the application's
args.gni file.

Expand Down
11 changes: 6 additions & 5 deletions examples/lock-app/cc13x4_26x4/args.gni
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ ti_simplelink_board = "LP_EM_CC1354P10_6"
optimize_debug_level = "s"
lwip_debug = false

chip_enable_ota_requestor = false
chip_enable_ota_requestor = true

chip_openthread_ftd = true
openthread_external_platform = "${chip_root}/third_party/openthread/platforms/cc13x4_26x4:libopenthread-cc13x4_cc26x4"

# Disable CHIP Logging
#chip_progress_logging = false
#chip_detail_logging = false
#chip_automation_logging = false
chip_progress_logging = true
chip_detail_logging = true
chip_automation_logging = true

# BLE options
chip_config_network_layer_ble = true
Expand All @@ -47,4 +47,5 @@ chip_stack_lock_tracking = "none"
matter_device_vid = "0xFFF1"
matter_device_pid = "0x8006"
matter_software_ver = "0x0001"
matter_software_ver_str = "1.0d1"
matter_software_ver_str = "1.0.1+1"
# should be maj.min.rev+build with later parts optional for MCUBoot
3 changes: 2 additions & 1 deletion examples/lock-app/cc13x4_26x4/chip.syscfg
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ for(var setting in ccfgSettings)
CCFG[setting] = ccfgSettings[setting];
}

CCFG.enableCodeGeneration = true;
/* disable CCFG for OTA-able application */
CCFG.enableCodeGeneration = false;


/* NVS */
Expand Down
5 changes: 4 additions & 1 deletion examples/pump-app/cc13x4_26x4/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ ti_sysconfig("sysconfig") {
sources = [ "${project_dir}/chip.syscfg" ]

outputs = [
"ti_devices_config.c",
"ti_radio_config.c",
"ti_radio_config.h",
"ti_drivers_config.c",
Expand All @@ -46,6 +45,10 @@ ti_sysconfig("sysconfig") {
"ti_dmm_application_policy.c",
"ti_dmm_application_policy.h",

# CCFG generation disabled for OTA-able application
#"ti_devices_config.c",
#"ti_devices_config.h",

# disabled until upstream generation is aligned
#"tiop_config.h",
#"tiop_config.c",
Expand Down
4 changes: 2 additions & 2 deletions examples/pump-app/cc13x4_26x4/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,8 @@ the session.
Select the ELF image to load on the device with the `Browse` button. This file
is placed in the `out/debug` folder by this guide and ends with the `*.out` file
extension. For OTA enabled applications, the standalone image will instead end
with the `*-bim.hex` file extension. This this is a combined image with
application and and `BIM` included. The flag to enable or disable the OTA
with the `*-mcuboot.hex` file extension. This this is a combined image with
application and `MCUBoot` included. The flag to enable or disable the OTA
feature is determined by "chip_enable_ota_requestor" in the application's
args.gni file.

Expand Down
4 changes: 2 additions & 2 deletions examples/pump-app/cc13x4_26x4/args.gni
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ ti_simplelink_board = "LP_EM_CC1354P10_6"
optimize_debug_level = "s"
lwip_debug = false

chip_enable_ota_requestor = false
chip_enable_ota_requestor = true

openthread_external_platform = "${chip_root}/third_party/openthread/platforms/cc13x4_26x4:libopenthread-cc13x4_cc26x4"
chip_openthread_ftd = true
Expand All @@ -47,4 +47,4 @@ chip_stack_lock_tracking = "none"
matter_device_vid = "0xFFF1"
matter_device_pid = "0x800A"
matter_software_ver = "0x0001"
matter_software_ver_str = "1.0d1"
matter_software_ver_str = "1.0.1+1"
3 changes: 2 additions & 1 deletion examples/pump-app/cc13x4_26x4/chip.syscfg
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ for(var setting in ccfgSettings)
CCFG[setting] = ccfgSettings[setting];
}

CCFG.enableCodeGeneration = true;
/* disable CCFG for OTA-able application */
CCFG.enableCodeGeneration = false;


/* NVS */
Expand Down
5 changes: 4 additions & 1 deletion examples/pump-controller-app/cc13x4_26x4/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ ti_sysconfig("sysconfig") {
sources = [ "${project_dir}/chip.syscfg" ]

outputs = [
"ti_devices_config.c",
"ti_radio_config.c",
"ti_radio_config.h",
"ti_drivers_config.c",
Expand All @@ -47,6 +46,10 @@ ti_sysconfig("sysconfig") {
"ti_dmm_application_policy.c",
"ti_dmm_application_policy.h",

# CCFG generation disabled for OTA-able application
#"ti_devices_config.c",
#"ti_devices_config.h",

# disabled until upstream generation is aligned
#"tiop_config.h",
#"tiop_config.c",
Expand Down
4 changes: 2 additions & 2 deletions examples/pump-controller-app/cc13x4_26x4/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ the session.
Select the ELF image to load on the device with the `Browse` button. This file
is placed in the `out/debug` folder by this guide and ends with the `*.out` file
extension. For OTA enabled applications, the standalone image will instead end
with the `*-bim.hex` file extension. This this is a combined image with
application and and `BIM` included. The flag to enable or disable the OTA
with the `*-mcuboot.hex` file extension. This this is a combined image with
application and `MCUBoot` included. The flag to enable or disable the OTA
feature is determined by "chip_enable_ota_requestor" in the application's
args.gni file.

Expand Down
4 changes: 2 additions & 2 deletions examples/pump-controller-app/cc13x4_26x4/args.gni
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ ti_simplelink_board = "LP_EM_CC1354P10_6"
optimize_debug_level = "s"
lwip_debug = false

chip_enable_ota_requestor = false
chip_enable_ota_requestor = true

openthread_external_platform = "${chip_root}/third_party/openthread/platforms/cc13x4_26x4:libopenthread-cc13x4_cc26x4"
chip_openthread_ftd = true
Expand All @@ -47,4 +47,4 @@ chip_stack_lock_tracking = "none"
matter_device_vid = "0xFFF1"
matter_device_pid = "0x8011"
matter_software_ver = "0x0001"
matter_software_ver_str = "1.0d1"
matter_software_ver_str = "1.0.1+1"
3 changes: 2 additions & 1 deletion examples/pump-controller-app/cc13x4_26x4/chip.syscfg
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ for(var setting in ccfgSettings)
CCFG[setting] = ccfgSettings[setting];
}

CCFG.enableCodeGeneration = true;
/* disable CCFG for OTA-able application */
CCFG.enableCodeGeneration = false;


/* NVS */
Expand Down
4 changes: 2 additions & 2 deletions examples/shell/cc13x4_26x4/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ the session.
Select the ELF image to load on the device with the `Browse` button. This file
is placed in the `out/debug` folder by this guide and ends with the `*.out` file
extension. For OTA enabled applications, the standalone image will instead end
with the `*-bim.hex` file extension. This this is a combined image with
application and and `BIM` included.
with the `*-mcuboot.hex` file extension. This this is a combined image with
application and and `MCUBoot` included.

Finally click the `Load Image` button to load the executable image onto the
device. You should be able to see the log output over the XDS110 User UART.
Expand Down
4 changes: 2 additions & 2 deletions examples/shell/cc13x4_26x4/args.gni
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ ti_simplelink_board = "LP_EM_CC1354P10_6"
# use -Os instead of -Og, LWIP release build
is_debug = false

chip_enable_ota_requestor = false
chip_enable_ota_requestor = true

# Disable FTD Build for all-clusters app to save Flash
chip_openthread_ftd = false
Expand All @@ -48,4 +48,4 @@ chip_stack_lock_tracking = "none"
matter_device_vid = "0xFFF1"
matter_device_pid = "0x8006"
matter_software_ver = "0x0001"
matter_software_ver_str = "1.0d1"
matter_software_ver_str = "1.0.1+1"
3 changes: 2 additions & 1 deletion examples/shell/cc13x4_26x4/chip.syscfg
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ for(var setting in ccfgSettings)
CCFG[setting] = ccfgSettings[setting];
}

CCFG.enableCodeGeneration = true;
/* disable CCFG for OTA-able application */
CCFG.enableCodeGeneration = false;


/* NVS */
Expand Down
3 changes: 3 additions & 0 deletions scripts/setup/requirements.ti.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
cbor>=1.0.0
click
cryptography>=2.6
ecdsa>=0.17.0
intelhex
3 changes: 1 addition & 2 deletions src/platform/cc13xx_26xx/cc13x2_26x2/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ static_library("cc13x2_26x2") {
# this needs to be in the final link to place the data correctly
# see ${chip_root}/third_party/ti_simplelink_sdk/ti_simplelink_executable.gni
#"oad_image_header.c",
"../OTAImageProcessorImpl.cpp",
"../OTAImageProcessorImpl.h",
"OTAImageProcessorImpl.cpp",
]
}

Expand Down
8 changes: 1 addition & 7 deletions src/platform/cc13xx_26xx/cc13x4_26x4/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,7 @@ static_library("cc13x4_26x4") {
}

if (chip_enable_ota_requestor) {
sources += [
# this needs to be in the final link to place the data correctly
# see ${chip_root}/third_party/ti_simplelink_sdk/ti_simplelink_executable.gni
#"oad_image_header.c",
"../OTAImageProcessorImpl.cpp",
"../OTAImageProcessorImpl.h",
]
sources += [ "OTAImageProcessorImpl.cpp" ]
}

if (chip_enable_openthread) {
Expand Down
Loading

0 comments on commit d4595af

Please sign in to comment.