Skip to content

Commit

Permalink
[Infineon] Update OTA asset and remove OTA REQUESTOR example app for …
Browse files Browse the repository at this point in the history
…P6 (#21552)
  • Loading branch information
praveenCY authored and pull[bot] committed Jul 21, 2023
1 parent 9fdc2b7 commit 2545640
Show file tree
Hide file tree
Showing 60 changed files with 337 additions and 1,893 deletions.
15 changes: 11 additions & 4 deletions docs/guides/infineon_p6_software_update.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,18 @@ option to the build script.

- Build the P6 OTA Requestor application from the chip root dir:

$ ./examples/<example directory>/p6/ota_base_build.sh
```
$ scripts/build/build_examples.py --enable-flashbundle --target infineon-p6-lock-ota build
$ third_party/p6/p6_sdk/ota/ota_base_build.sh out/infineon-p6-lock-ota chip-p6-lock-example
```

- Build the P6 OTA Update application from the chip root dir:
- Build the P6 OTA Update application from the chip root dir and create OTA
file

$ ./examples/<example directory>/p6/ota_update_build.sh
```
$ scripts/build/build_examples.py --enable-flashbundle --no-log-timestamps --target infineon-p6-lock-ota-updateimage build
$ third_party/p6/p6_sdk/ota/ota_update_build.sh out/infineon-p6-lock-ota-updateimage chip-p6-lock-example
```

* Additionally a pre-compiled bootloader must be flashed to the board using
[Cypress Programmer](https://softwaretools.infineon.com/tools/com.ifx.tb.tool.cypressprogrammer).
Expand All @@ -40,7 +47,7 @@ option to the build script.

```
rm -r /tmp/chip_*
./out/debug/chip-ota-provider-app -f chip-p6-lighting-example.ota
./out/debug/chip-ota-provider-app -f chip-p6-lock-example.ota
```

* In a separate terminal run the chip-tool commands to provision the Provider:
Expand Down
19 changes: 0 additions & 19 deletions examples/all-clusters-app/p6/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ config("p6_ota_config") {

if (build_update_image) {
defines += [ "CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION=2" ]
} else {
defines += [ "CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION=1" ]
}
}

Expand All @@ -98,23 +96,6 @@ p6_sdk_sources("all_clusters_app_sdk_sources") {
public_configs = [ "${chip_root}/third_party/p6:p6_sdk_config" ]

if (chip_enable_ota_requestor) {
sources += [
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/bootutil/src/bootutil_misc.c",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/cy_flash_pal/cy_flash_map.c",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/cy_flash_pal/cy_flash_psoc6.c",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/cy_flash_pal/cy_smif_psoc6.c",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/cy_flash_pal/mem_config/mem_config_sfdp.c",
]
include_dirs += [
"${p6_sdk_root}/ota/config",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/cy_flash_pal/",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/cy_flash_pal/mem_config/",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/cy_flash_pal/include/",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/cy_flash_pal/include/flash_map_backend/",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/sysflash/",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/bootutil/include",
]
public_configs += [ ":p6_ota_config" ]
}
}
Expand Down
25 changes: 6 additions & 19 deletions examples/all-clusters-app/p6/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,13 @@ will then join the network.
* Build the example application:
```
$ ./scripts/examples/gn_p6_example.sh ./examples/all-clusters-app/p6 out/clusters_app_p6
```
$ source scripts/activate.sh
$ scripts/build/build_examples.py --no-log-timestamps --target 'infineon-p6-all-clusters' build
- To delete generated executable, libraries and object files use:
```
$ cd ~/connectedhomeip
$ rm -rf out/
```
<a name="flashing"></a>
Expand All @@ -74,10 +71,8 @@ will then join the network.
- On the command line:
```
$ cd ~/connectedhomeip
$ python3 out/clusters_app_p6/chip-p6-clusters-example.flash.py
```
$ python3 out/infineon-p6-all-clusters/chip-p6-clusters-example.flash.py
<a name="Commissioning and cluster control"></a>
Expand All @@ -94,16 +89,12 @@ perform commissioning and cluster control.
- Set up python controller.
```
$ cd {path-to-connectedhomeip}
$ ./scripts/examples/gn_build_example.sh examples/chip-tool out/debug
```
- Execute the controller.
```
$ ./out/debug/chip-tool
```
<a name="Commissioning over BLE"></a>
Expand All @@ -112,7 +103,6 @@ perform commissioning and cluster control.
Run the built executable and pass it the discriminator and pairing code of the
remote device, as well as the network credentials to use.
```
$ ./out/debug/chip-tool pairing ble-wifi 1234 ${SSID} ${PASSWORD} 20202021 3840
Parameters:
Expand All @@ -121,7 +111,6 @@ remote device, as well as the network credentials to use.
3. Node ID: 1234 (you can assign any node id)
4. SSID : Wi-Fi SSID
5. PASSWORD : Wi-Fi Password
```
<a name="Notes"></a>
Expand All @@ -130,11 +119,9 @@ remote device, as well as the network credentials to use.
Raspberry Pi 4 BLE connection issues can be avoided by running the following
commands. These power cycle the BlueTooth hardware and disable BR/EDR mode.
```
sudo btmgmt -i hci0 power off
sudo btmgmt -i hci0 bredr off
sudo btmgmt -i hci0 power on
```
$ sudo btmgmt -i hci0 power off
$ sudo btmgmt -i hci0 bredr off
$ sudo btmgmt -i hci0 power on
## OTA Software Update
Expand Down
19 changes: 17 additions & 2 deletions examples/all-clusters-app/p6/include/CHIPProjectConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,21 @@
#define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR 0xF00
#endif

/* The ProductID attribute of the Basic cluster. */
#define CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID 0x8003

/* The ProductName attribute of the Basic cluster. */
#define CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_NAME "P6-CYW43012 All Clusters"

/* The HardwareVersionString attribute of the Basic cluster. */
#define CHIP_DEVICE_CONFIG_DEFAULT_DEVICE_HARDWARE_VERSION_STRING "P6-43012"

/* The HardwareVersion attribute of the Basic cluster. */
#define CHIP_DEVICE_CONFIG_DEFAULT_DEVICE_HARDWARE_VERSION 43012

/* The SoftwareVersion attribute of the Basic cluster. */
#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION 1

// For convenience, Chip Security Test Mode can be enabled and the
// requirement for authentication in various protocols can be disabled.
//
Expand All @@ -54,7 +69,7 @@
* physical device, a change to its packaging, and/or a change to its marketing presentation.
* This value is generally *not* incremented for device software versions.
*/
#define CHIP_DEVICE_CONFIG_DEVICE_HARDWARE_VERSION 1
#define CHIP_DEVICE_CONFIG_DEVICE_HARDWARE_VERSION 43012

/**
* CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING
Expand All @@ -64,7 +79,7 @@
* {MAJOR_VERSION}.0d{MINOR_VERSION}
*/
#ifndef CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING
#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING "0.1ALPHA"
#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING "1.0"
#endif
/**
* CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE
Expand Down
8 changes: 0 additions & 8 deletions examples/all-clusters-app/p6/ota_base_build.sh

This file was deleted.

14 changes: 0 additions & 14 deletions examples/all-clusters-app/p6/ota_update_build.sh

This file was deleted.

31 changes: 5 additions & 26 deletions examples/all-clusters-app/p6/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,15 @@
#include <app/clusters/ota-requestor/DefaultOTARequestorDriver.h>
#include <app/clusters/ota-requestor/DefaultOTARequestorStorage.h>
#include <platform/P6/OTAImageProcessorImpl.h>
extern "C" {
#include "cy_smif_psoc6.h"
}

using chip::BDXDownloader;
using chip::CharSpan;
using chip::DefaultOTARequestor;
using chip::FabricIndex;
using chip::GetRequestorInstance;
using chip::NodeId;
using chip::OTADownloader;
using chip::OTAImageProcessorImpl;
using chip::DeviceLayer::OTAImageProcessorImpl;
using chip::System::Layer;

using namespace ::chip;
Expand Down Expand Up @@ -314,35 +312,16 @@ bool lowPowerClusterSleep()
#if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR
void AppTask::InitOTARequestor()
{
CHIP_ERROR err = CHIP_NO_ERROR;
SetRequestorInstance(&gRequestorCore);
ConfigurationMgr().StoreSoftwareVersion(CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION);
gRequestorStorage.Init(chip::Server::GetInstance().GetPersistentStorage());
gRequestorCore.Init(chip::Server::GetInstance(), gRequestorStorage, gRequestorUser, gDownloader);
gImageProcessor.SetOTADownloader(&gDownloader);
gDownloader.SetImageProcessorDelegate(&gImageProcessor);
gRequestorUser.Init(&gRequestorCore, &gImageProcessor);

uint32_t savedSoftwareVersion;
err = ConfigurationMgr().GetSoftwareVersion(savedSoftwareVersion);
if (err != CHIP_NO_ERROR)
{
P6_LOG("Can't get saved software version");
appError(err);
}

if (savedSoftwareVersion != CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION)
{
ConfigurationMgr().StoreSoftwareVersion(CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION);

P6_LOG("Confirming update to version: %u", CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION);
chip::OTARequestorInterface * requestor = chip::GetRequestorInstance();
if (requestor != nullptr)
{
requestor->NotifyUpdateApplied();
}
}
gRequestorUser.Init(&gRequestorCore, &gImageProcessor);

P6_LOG("Current Software Version: %u", CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION);
P6_LOG("Current Firmware Version String: %s", CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING);
P6_LOG("Current Software Version String: %s", CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING);
}
#endif
2 changes: 1 addition & 1 deletion examples/all-clusters-app/p6/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ int main(void)
#endif

P6_LOG("==================================================\r\n");
P6_LOG("chip-p6-all-clusters-example starting\r\n");
P6_LOG("chip-p6-all-clusters-example starting Version %d\r\n", CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION);
P6_LOG("==================================================\r\n");

/* Start the FreeRTOS scheduler */
Expand Down
19 changes: 0 additions & 19 deletions examples/all-clusters-minimal-app/p6/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ config("p6_ota_config") {

if (build_update_image) {
defines += [ "CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION=2" ]
} else {
defines += [ "CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION=1" ]
}
}

Expand All @@ -98,23 +96,6 @@ p6_sdk_sources("all_clusters_app_sdk_sources") {
public_configs = [ "${chip_root}/third_party/p6:p6_sdk_config" ]

if (chip_enable_ota_requestor) {
sources += [
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/bootutil/src/bootutil_misc.c",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/cy_flash_pal/cy_flash_map.c",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/cy_flash_pal/cy_flash_psoc6.c",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/cy_flash_pal/cy_smif_psoc6.c",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/cy_flash_pal/mem_config/mem_config_sfdp.c",
]
include_dirs += [
"${p6_sdk_root}/ota/config",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/cy_flash_pal/",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/cy_flash_pal/mem_config/",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/cy_flash_pal/include/",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/cy_flash_pal/include/flash_map_backend/",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/sysflash/",
"${p6_sdk_root}/libs/anycloud-ota/source/mcuboot/bootutil/include",
]
public_configs += [ ":p6_ota_config" ]
}
}
Expand Down
25 changes: 6 additions & 19 deletions examples/all-clusters-minimal-app/p6/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,13 @@ will then join the network.
* Build the example application:
```
$ ./scripts/examples/gn_p6_example.sh ./examples/all-clusters-minimal-app/p6 out/minimal_clusters_app_p6
```
$ source scripts/activate.sh
$ scripts/build/build_examples.py --no-log-timestamps --target 'infineon-p6-all-clusters-minimal' build
- To delete generated executable, libraries and object files use:
```
$ cd ~/connectedhomeip
$ rm -rf out/
```
<a name="flashing"></a>
Expand All @@ -74,10 +71,8 @@ will then join the network.
- On the command line:
```
$ cd ~/connectedhomeip
$ python3 out/clusters_app_p6/chip-p6-clusters-minimal-example.flash.py
```
$ python3 out/infineon-p6-all-clusters-minimal/chip-p6-clusters-minimal-example.flash.py
<a name="Commissioning and cluster control"></a>
Expand All @@ -94,16 +89,12 @@ perform commissioning and cluster control.
- Set up python controller.
```
$ cd {path-to-connectedhomeip}
$ ./scripts/examples/gn_build_example.sh examples/chip-tool out/debug
```
- Execute the controller.
```
$ ./out/debug/chip-tool
```
<a name="Commissioning over BLE"></a>
Expand All @@ -112,7 +103,6 @@ perform commissioning and cluster control.
Run the built executable and pass it the discriminator and pairing code of the
remote device, as well as the network credentials to use.
```
$ ./out/debug/chip-tool pairing ble-wifi 1234 ${SSID} ${PASSWORD} 20202021 3840
Parameters:
Expand All @@ -121,7 +111,6 @@ remote device, as well as the network credentials to use.
3. Node ID: 1234 (you can assign any node id)
4. SSID : Wi-Fi SSID
5. PASSWORD : Wi-Fi Password
```
<a name="Notes"></a>
Expand All @@ -130,11 +119,9 @@ remote device, as well as the network credentials to use.
Raspberry Pi 4 BLE connection issues can be avoided by running the following
commands. These power cycle the BlueTooth hardware and disable BR/EDR mode.
```
sudo btmgmt -i hci0 power off
sudo btmgmt -i hci0 bredr off
sudo btmgmt -i hci0 power on
```
$ sudo btmgmt -i hci0 power off
$ sudo btmgmt -i hci0 bredr off
$ sudo btmgmt -i hci0 power on
## OTA Software Update
Expand Down
Loading

0 comments on commit 2545640

Please sign in to comment.