Skip to content

Commit

Permalink
[Infineon] Update PSoC6 assets to latest release
Browse files Browse the repository at this point in the history
  • Loading branch information
praveenCY committed Jul 18, 2024
1 parent 351d6eb commit 22baaf4
Show file tree
Hide file tree
Showing 131 changed files with 14,981 additions and 9,683 deletions.
41 changes: 24 additions & 17 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,6 @@
path = third_party/infineon/psoc6/psoc6_sdk/libs/abstraction-rtos
url = https://github.com/Infineon/abstraction-rtos
platforms = infineon
[submodule "p6/bluetooth-freertos"]
path = third_party/infineon/psoc6/psoc6_sdk/libs/bluetooth-freertos
url = https://github.com/Infineon/bluetooth-freertos
branch = v2.X
platforms = infineon
[submodule "p6/btstack"]
path = third_party/infineon/psoc6/psoc6_sdk/libs/btstack
url = https://github.com/Infineon/btstack
Expand Down Expand Up @@ -134,10 +129,6 @@
path = third_party/infineon/psoc6/psoc6_sdk/libs/mtb-pdl-cat1
url = https://github.com/Infineon/mtb-pdl-cat1
platforms = infineon
[submodule "p6/psoc6cm0p"]
path = third_party/infineon/psoc6/psoc6_sdk/libs/psoc6cm0p
url = https://github.com/Infineon/psoc6cm0p
platforms = infineon
[submodule "p6/whd-bsp-integration"]
path = third_party/infineon/psoc6/psoc6_sdk/libs/whd-bsp-integration
url = https://github.com/Infineon/whd-bsp-integration
Expand Down Expand Up @@ -185,10 +176,6 @@
[submodule "third_party/jsoncpp/repo"]
path = third_party/jsoncpp/repo
url = https://github.com/open-source-parsers/jsoncpp.git
[submodule "third_party/p6/p6_sdk/libs/anycloud-ota"]
path = third_party/infineon/psoc6/psoc6_sdk/libs/anycloud-ota
url = https://github.com/Infineon/anycloud-ota
platforms = infineon
[submodule "third_party/mbed-mcu-boot/repo"]
path = third_party/mbed-mcu-boot/repo
url = https://github.com/ATmobica/mcuboot.git
Expand Down Expand Up @@ -312,10 +299,6 @@
url = https://github.com/STMicroelectronics/STM32CubeWB.git
branch = v1.18.0
platforms = stm32
[submodule "p6/lwip-network-interface-integration"]
path = third_party/infineon/psoc6/psoc6_sdk/libs/lwip-network-interface-integration
url = https://github.com/Infineon/lwip-network-interface-integration.git
platforms = infineon
[submodule "third_party/infineon/trustm/optiga-trust-m"]
path = third_party/infineon/trustm/optiga-trust-m
url = https://github.com/Infineon/optiga-trust-m.git
Expand All @@ -326,3 +309,27 @@
url = https://github.com/NXP/nxp_matter_support.git
branch = master
platforms = nxp
[submodule "third_party/infineon/psoc6/psoc6_sdk/libs/btstack-integration"]
path = third_party/infineon/psoc6/psoc6_sdk/libs/btstack-integration
url = https://github.com/Infineon/btstack-integration.git
platforms = infineon
[submodule "third_party/infineon/psoc6/psoc6_sdk/libs/cat1cm0p"]
path = third_party/infineon/psoc6/psoc6_sdk/libs/cat1cm0p
url = https://github.com/Infineon/cat1cm0p.git
platforms = infineon
[submodule "third_party/infineon/psoc6/psoc6_sdk/libs/cmsis"]
path = third_party/infineon/psoc6/psoc6_sdk/libs/cmsis
url = https://github.com/Infineon/cmsis.git
platforms = infineon
[submodule "third_party/infineon/psoc6/psoc6_sdk/libs/ota-bootloader-abstraction"]
path = third_party/infineon/psoc6/psoc6_sdk/libs/ota-bootloader-abstraction
url = https://github.com/Infineon/ota-bootloader-abstraction.git
platforms = infineon
[submodule "third_party/infineon/psoc6/psoc6_sdk/libs/ota-update"]
path = third_party/infineon/psoc6/psoc6_sdk/libs/ota-update
url = https://github.com/Infineon/ota-update.git
platforms = infineon
[submodule "third_party/infineon/psoc6/psoc6_sdk/libs/lwip-network-interface-integration"]
path = third_party/infineon/psoc6/psoc6_sdk/libs/lwip-network-interface-integration
url = https://github.com/Infineon/lwip-network-interface-integration.git
platforms = infineon
12 changes: 9 additions & 3 deletions docs/guides/infineon_psoc6_software_update.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,29 @@ Infineon PSoC6 example applications by passing the

```
$ scripts/build/build_examples.py --enable-flashbundle --target infineon-psoc6-lock-ota build
$ third_party/infineon/psoc6/psoc6_sdk/ota/ota_base_build.sh out/infineon-psoc6-lock-ota chip-psoc6-lock-example
$ third_party/infineon/psoc6/psoc6_sdk/ota/ota_base_build.sh psoc6-lock chip-psoc6-lock-example
```

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

```
$ scripts/build/build_examples.py --enable-flashbundle --no-log-timestamps --target infineon-psoc6-lock-ota-updateimage build
$ third_party/infineon/psoc6/psoc6_sdk/ota/ota_update_build.sh out/infineon-psoc6-lock-ota-updateimage chip-psoc6-lock-example
$ third_party/infineon/psoc6/psoc6_sdk/ota/ota_update_build.sh psoc6-lock chip-psoc6-lock-example
```

* Additionally a pre-compiled bootloader must be flashed to the board using
* Additionally a pre-compiled bootloader must be flashed to the board before flashing the application using
[Cypress Programmer](https://softwaretools.infineon.com/tools/com.ifx.tb.tool.cypressprogrammer).
This image can be found at:

$ ./third_party/infineon/psoc6/psoc6_sdk/ota/matter-psoc6-mcuboot-bootloader.hex

* Flash the application after putting the CY8CKIT-062S2-43012 board on KitProg3 CMSIS-DAP Mode by pressing the
`MODE SELECT` button.

$ cd ~/connectedhomeip
$ python3 out/infineon-psoc6-lock-ota/chip-psoc6-lock-example.flash.py

* In a terminal start the Provider app passing to it the path to the Matter
OTA file created in the previous step:(output of ota_update_build step)

Expand Down
48 changes: 27 additions & 21 deletions examples/all-clusters-app/infineon/psoc6/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -45,32 +45,38 @@ config("psoc6_ota_config") {

ldflags = [ "-T" + rebase_path(linker_script, root_build_dir) ]

ldflags += [ "-Wl,--defsym,MCUBOOT_HEADER_SIZE=0x400,--defsym,MCUBOOT_BOOTLOADER_SIZE=0x18000,--defsym,CY_BOOT_PRIMARY_1_SIZE=0x1C0000" ]
ldflags += [ "-Wl,--undefined=uxTopUsedPriority -Wl,--defsym,MCUBOOT_HEADER_SIZE=0x400,--defsym,FLASH_AREA_IMG_1_PRIMARY_START=0x028000,--defsym,FLASH_AREA_IMG_1_PRIMARY_SIZE=0x1c0000" ]

defines = [
"P6_OTA",
"OTA_SUPPORT ",
"OTA_USE_EXTERNAL_FLASH",
"CY_BOOT_USE_EXTERNAL_FLASH",
"MCUBOOT_HEADER_SIZE=0x400",
"MCUBOOT_MAX_IMG_SECTORS=3584",
"CY_BOOT_SCRATCH_SIZE=0x00004000",
"MCUBOOT_BOOTLOADER_SIZE=0x00018000",
"CY_BOOT_BOOTLOADER_SIZE=0x00018000",
"CY_BOOT_PRIMARY_1_START=0x00018000",
"CY_BOOT_PRIMARY_1_SIZE=0x1C0000",
"CY_BOOT_SECONDARY_1_START=0x00000000",
"CY_BOOT_SECONDARY_1_SIZE=0x001C0000",
"CY_FLASH_ERASE_VALUE=0xFF",
"COMPONENT_MCUBOOT",
"CY_BOOTLOADER=MCUBOOT",
"OTA_SUPPORT=1",
"COMPONENT_OTA_PSOC_062",
"PSOC_062_2M",
"OTA_USE_EXTERNAL_FLASH=1",
"ENABLE_OTA_LOGS",
"ENABLE_OTA_BOOTLOADER_ABSTRACTION_LOGS",
"MCUBOOT_IMAGE_NUMBER=1",
"MCUBOOT_SLOT_SIZE=0x1C0000",
"MCUBOOT_SCRATCH_SIZE=0x4000",
"MCUBOOT_SECTOR_SIZE = 512",
"MCUBOOT_MAX_IMG_SECTORS=3584",
"FLASH_AREA_BOOTLOADER_DEV_ID='FLASH_DEVICE_INTERNAL_FLASH'",
"FLASH_AREA_BOOTLOADER_SIZE=0x028000",
"FLASH_AREA_BOOTLOADER_START=0x000000",
"FLASH_AREA_IMAGE_SCRATCH_DEV_ID='FLASH_DEVICE_EXTERNAL_FLASH(CY_BOOT_EXTERNAL_DEVICE_INDEX)'",
"FLASH_AREA_IMAGE_SCRATCH_SIZE=0x080000",
"FLASH_AREA_IMAGE_SCRATCH_START=0x440000",
"FLASH_AREA_IMAGE_SWAP_STATUS_DEV_ID='FLASH_DEVICE_INTERNAL_FLASH'",
"FLASH_AREA_IMAGE_SWAP_STATUS_SIZE=0x006c00",
"FLASH_AREA_IMAGE_SWAP_STATUS_START=0x1e8000",
"FLASH_AREA_IMG_1_PRIMARY_DEV_ID='FLASH_DEVICE_INTERNAL_FLASH'",
"FLASH_AREA_IMG_1_PRIMARY_SIZE=0x1c0000",
"FLASH_AREA_IMG_1_PRIMARY_START=0x028000",
"FLASH_AREA_IMG_1_SECONDARY_DEV_ID='FLASH_DEVICE_EXTERNAL_FLASH(CY_BOOT_EXTERNAL_DEVICE_INDEX)'",
"FLASH_AREA_IMG_1_SECONDARY_SIZE=0x1c0000",
"FLASH_AREA_IMG_1_SECONDARY_START=0x000200",
"APP_VERSION_MAJOR=1",
"APP_VERSION_MINOR=0",
"APP_VERSION_BUILD=0",
"MCUBOOT_OVERWRITE_ONLY",
"CY_ENABLE_XIP_PROGRAM",
"APP_VERSION_BUILD=0"
]

if (build_update_image) {
Expand All @@ -87,7 +93,7 @@ psoc6_sdk_sources("all_clusters_app_sdk_sources") {

defines = [
"BOARD_ID=${psoc6_board}",
"P6_LOG_ENABLED=1",
"PSOC6_LOG_ENABLED=1",
"CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE=${setup_pin_code}",
]

Expand Down
6 changes: 3 additions & 3 deletions examples/all-clusters-app/infineon/psoc6/include/AppConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@
#define THREAD_ACTIVE_POLLING_INTERVAL_MS 100
#define THREAD_INACTIVE_POLLING_INTERVAL_MS 1000

// P6 Logging
// PSOC6 Logging
#ifdef __cplusplus
extern "C" {
#endif

void appError(int err);
void P6Log(const char * aFormat, ...);
#define P6_LOG(...) P6Log(__VA_ARGS__)
void PSOC6Log(const char * aFormat, ...);
#define PSOC6_LOG(...) PSOC6Log(__VA_ARGS__)

#ifdef __cplusplus
}
Expand Down
4 changes: 4 additions & 0 deletions examples/all-clusters-app/infineon/psoc6/include/AppTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
#include <ble/Ble.h>
#include <platform/CHIPDeviceLayer.h>

extern "C" {
#include "flash_map_backend.h"
}

// Application-defined error codes in the CHIP_ERROR space.
#define APP_ERROR_EVENT_QUEUE_FAILED CHIP_APPLICATION_ERROR(0x01)
#define APP_ERROR_CREATE_TASK_FAILED CHIP_APPLICATION_ERROR(0x02)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@
#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"
#define CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_NAME "PSOC6-CYW43012 All Clusters"

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

/* The HardwareVersion attribute of the Basic cluster. */
#define CHIP_DEVICE_CONFIG_DEFAULT_DEVICE_HARDWARE_VERSION 43012
Expand Down
36 changes: 18 additions & 18 deletions examples/all-clusters-app/infineon/psoc6/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ CHIP_ERROR AppTask::StartAppTask()
sAppEventQueue = xQueueCreateStatic(APP_EVENT_QUEUE_SIZE, sizeof(AppEvent), sAppEventQueueBuffer, &sAppEventQueueStruct);
if (sAppEventQueue == NULL)
{
P6_LOG("Failed to allocate app event queue");
PSOC6_LOG("Failed to allocate app event queue");
appError(APP_ERROR_EVENT_QUEUE_FAILED);
}
// Start App task.
Expand All @@ -160,10 +160,10 @@ CHIP_ERROR AppTask::Init()
{
CHIP_ERROR err = CHIP_NO_ERROR;
#if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR
int rc = boot_set_confirmed();
int rc = flash_area_boot_set_confirmed();
if (rc != 0)
{
P6_LOG("boot_set_confirmed failed");
PSOC6_LOG("flash_area_boot_set_confirmed failed");
appError(CHIP_ERROR_UNINITIALIZED);
}
#endif
Expand Down Expand Up @@ -196,11 +196,11 @@ CHIP_ERROR AppTask::Init()
);
if (sFunctionTimer == NULL)
{
P6_LOG("funct timer create failed");
PSOC6_LOG("funct timer create failed");
appError(APP_ERROR_CREATE_TIMER_FAILED);
}
NetWorkCommissioningInstInit();
P6_LOG("Current Software Version: %s", CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING);
PSOC6_LOG("Current Software Version: %s", CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING);

// Initialize LEDs
sStatusLED.Init(SYSTEM_STATE_LED);
Expand All @@ -221,11 +221,11 @@ void AppTask::AppTaskMain(void * pvParameter)
CHIP_ERROR err = sAppTask.Init();
if (err != CHIP_NO_ERROR)
{
P6_LOG("AppTask.Init() failed");
PSOC6_LOG("AppTask.Init() failed");
appError(err);
}

P6_LOG("App Task started");
PSOC6_LOG("App Task started");

while (true)
{
Expand Down Expand Up @@ -301,7 +301,7 @@ void AppTask::FunctionHandler(AppEvent * event)
{
if (!sAppTask.mFunctionTimerActive && sAppTask.mFunction == Function::kNoneSelected)
{
P6_LOG("Factory Reset Triggered. Press button again within %us to cancel.", FACTORY_RESET_CANCEL_WINDOW_TIMEOUT / 1000);
PSOC6_LOG("Factory Reset Triggered. Press button again within %us to cancel.", FACTORY_RESET_CANCEL_WINDOW_TIMEOUT / 1000);
// Start timer for FACTORY_RESET_CANCEL_WINDOW_TIMEOUT to allow user to
// cancel, if required.
sAppTask.StartTimer(FACTORY_RESET_CANCEL_WINDOW_TIMEOUT);
Expand All @@ -325,7 +325,7 @@ void AppTask::FunctionHandler(AppEvent * event)
// canceled.
sAppTask.mFunction = Function::kNoneSelected;

P6_LOG("Factory Reset has been Canceled");
PSOC6_LOG("Factory Reset has been Canceled");
}
}
}
Expand All @@ -334,7 +334,7 @@ void AppTask::CancelTimer()
{
if (xTimerStop(sFunctionTimer, 0) == pdFAIL)
{
P6_LOG("app timer stop() failed");
PSOC6_LOG("app timer stop() failed");
appError(APP_ERROR_STOP_TIMER_FAILED);
}

Expand All @@ -345,7 +345,7 @@ void AppTask::StartTimer(uint32_t aTimeoutInMs)
{
if (xTimerIsTimerActive(sFunctionTimer))
{
P6_LOG("app timer already started!");
PSOC6_LOG("app timer already started!");
CancelTimer();
}

Expand All @@ -354,7 +354,7 @@ void AppTask::StartTimer(uint32_t aTimeoutInMs)
// cannot immediately be sent to the timer command queue.
if (xTimerChangePeriod(sFunctionTimer, aTimeoutInMs / portTICK_PERIOD_MS, 100) != pdPASS)
{
P6_LOG("app timer start() failed");
PSOC6_LOG("app timer start() failed");
appError(APP_ERROR_START_TIMER_FAILED);
}

Expand Down Expand Up @@ -385,11 +385,11 @@ void AppTask::PostEvent(const AppEvent * event)
}

if (!status)
P6_LOG("Failed to post event to app task event queue");
PSOC6_LOG("Failed to post event to app task event queue");
}
else
{
P6_LOG("Event Queue is NULL should never happen");
PSOC6_LOG("Event Queue is NULL should never happen");
}
}

Expand All @@ -401,7 +401,7 @@ void AppTask::DispatchEvent(AppEvent * event)
}
else
{
P6_LOG("Event received with no handler. Dropping event.");
PSOC6_LOG("Event received with no handler. Dropping event.");
}
}

Expand All @@ -414,7 +414,7 @@ void AppTask::OnOffUpdateClusterState(intptr_t context)

if (status != Protocols::InteractionModel::Status::Success)
{
P6_LOG("ERR: updating on/off %x", to_underlying(status));
PSOC6_LOG("ERR: updating on/off %x", to_underlying(status));
}
}

Expand All @@ -435,7 +435,7 @@ void AppTask::InitOTARequestor()

gRequestorUser.Init(&gRequestorCore, &gImageProcessor);

P6_LOG("Current Software Version: %u", CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION);
P6_LOG("Current Software Version String: %s", CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING);
PSOC6_LOG("Current Software Version: %u", CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION);
PSOC6_LOG("Current Software Version String: %s", CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING);
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ void ButtonHandler::TimerCallback(TimerHandle_t xTimer)
buttonevent = cyhal_gpio_read(APP_FUNCTION_BUTTON);
break;
default:
P6_LOG("Unhandled TimerID: %d", timerId);
PSOC6_LOG("Unhandled TimerID: %d", timerId);
break;
}

Expand Down
Loading

0 comments on commit 22baaf4

Please sign in to comment.