From 83dc4c778925cbe89953017911f55e7a6324dad4 Mon Sep 17 00:00:00 2001 From: Praveen Chandran Date: Tue, 8 Feb 2022 22:38:52 -0800 Subject: [PATCH] Support keystore using external flash for Infineon P6 board (#14929) --- .gitmodules | 3 + examples/all-clusters-app/p6/src/main.cpp | 46 ++++++++----- examples/lighting-app/p6/src/main.cpp | 46 ++++++++----- examples/lock-app/p6/src/main.cpp | 39 +++++++---- src/platform/P6/ConnectivityManagerImpl.cpp | 65 ++++++++++++------- src/platform/P6/MTBKeyValueStore.cpp | 53 +++++++-------- .../P6/NetworkCommissioningWiFiDriver.cpp | 5 +- src/platform/P6/P6Utils.cpp | 14 ++-- src/platform/P6/P6Utils.h | 5 +- .../CY8CKIT-062S2-43012/Debug/GCC_ARM.json | 3 + .../CY8CKIT-062S2-43012/Release/GCC_ARM.json | 3 + .../p6/p6_sdk/configs/FreeRTOSConfig.h | 2 +- third_party/p6/p6_sdk/libs/serial-flash | 1 + 13 files changed, 179 insertions(+), 106 deletions(-) create mode 160000 third_party/p6/p6_sdk/libs/serial-flash diff --git a/.gitmodules b/.gitmodules index 0e2b2f6a4602d6..3669fb04581332 100644 --- a/.gitmodules +++ b/.gitmodules @@ -187,3 +187,6 @@ [submodule "perfetto"] path = third_party/perfetto/repo url = https://github.com/google/perfetto +[submodule "p6/serial-flash"] + path = third_party/p6/p6_sdk/libs/serial-flash + url = https://github.com/Infineon/serial-flash diff --git a/examples/all-clusters-app/p6/src/main.cpp b/examples/all-clusters-app/p6/src/main.cpp index a943c132dc3620..a8f415ffa3744d 100644 --- a/examples/all-clusters-app/p6/src/main.cpp +++ b/examples/all-clusters-app/p6/src/main.cpp @@ -41,12 +41,16 @@ #ifdef HEAP_MONITORING #include "MemMonitoring.h" #endif +#define MAIN_TASK_STACK_SIZE (4096) +#define MAIN_TASK_PRIORITY 2 using namespace ::chip; using namespace ::chip::Inet; using namespace ::chip::DeviceLayer; volatile int apperror_cnt; +static void main_task(void * pvParameters); + // ================================================================================ // App Error //================================================================================= @@ -71,24 +75,17 @@ extern "C" void vApplicationIdleHook(void) // FreeRTOS Idle callback } -// ================================================================================ -// Main Code -// ================================================================================ -int main(void) +extern "C" void vApplicationDaemonTaskStartupHook() { - init_p6Platform(); - -#ifdef HEAP_MONITORING - MemMonitoring::startHeapMonitoring(); -#endif - - P6_LOG("==================================================\r\n"); - P6_LOG("chip-p6-all-clusters-example starting\r\n"); - P6_LOG("==================================================\r\n"); - // Init Chip memory management before the stack chip::Platform::MemoryInit(); + /* Create the Main task. */ + xTaskCreate(main_task, "Main task", MAIN_TASK_STACK_SIZE, NULL, MAIN_TASK_PRIORITY, NULL); +} + +static void main_task(void * pvParameters) +{ CHIP_ERROR ret = chip::DeviceLayer::PersistedStorage::KeyValueStoreMgrImpl().Init(); if (ret != CHIP_NO_ERROR) { @@ -123,6 +120,26 @@ int main(void) P6_LOG("GetAppTask().Init() failed"); appError(ret); } + + /* Delete task */ + vTaskDelete(NULL); +} + +// ================================================================================ +// Main Code +// ================================================================================ +int main(void) +{ + init_p6Platform(); + +#ifdef HEAP_MONITORING + MemMonitoring::startHeapMonitoring(); +#endif + + P6_LOG("==================================================\r\n"); + P6_LOG("chip-p6-all-clusters-example starting\r\n"); + P6_LOG("==================================================\r\n"); + /* Start the FreeRTOS scheduler */ vTaskStartScheduler(); @@ -132,5 +149,4 @@ int main(void) // Should never get here. P6_LOG("vTaskStartScheduler() failed"); - appError(ret); } diff --git a/examples/lighting-app/p6/src/main.cpp b/examples/lighting-app/p6/src/main.cpp index 7d493daff2a25e..a38d25811c2e1e 100644 --- a/examples/lighting-app/p6/src/main.cpp +++ b/examples/lighting-app/p6/src/main.cpp @@ -40,12 +40,16 @@ #ifdef HEAP_MONITORING #include "MemMonitoring.h" #endif +#define MAIN_TASK_STACK_SIZE (4096) +#define MAIN_TASK_PRIORITY 2 using namespace ::chip; using namespace ::chip::Inet; using namespace ::chip::DeviceLayer; volatile int apperror_cnt; +static void main_task(void * pvParameters); + // ================================================================================ // App Error //================================================================================= @@ -70,24 +74,17 @@ extern "C" void vApplicationIdleHook(void) // FreeRTOS Idle callback } -// ================================================================================ -// Main Code -// ================================================================================ -int main(void) +extern "C" void vApplicationDaemonTaskStartupHook() { - init_p6Platform(); - -#ifdef HEAP_MONITORING - MemMonitoring::startHeapMonitoring(); -#endif - - P6_LOG("==================================================\r\n"); - P6_LOG("chip-p6-lighting-example starting\r\n"); - P6_LOG("==================================================\r\n"); - // Init Chip memory management before the stack chip::Platform::MemoryInit(); + /* Create the Main task. */ + xTaskCreate(main_task, "Main task", MAIN_TASK_STACK_SIZE, NULL, MAIN_TASK_PRIORITY, NULL); +} + +static void main_task(void * pvParameters) +{ CHIP_ERROR ret = chip::DeviceLayer::PersistedStorage::KeyValueStoreMgrImpl().Init(); if (ret != CHIP_NO_ERROR) { @@ -115,6 +112,26 @@ int main(void) P6_LOG("GetAppTask().Init() failed"); appError(ret); } + + /* Delete task */ + vTaskDelete(NULL); +} + +// ================================================================================ +// Main Code +// ================================================================================ +int main(void) +{ + init_p6Platform(); + +#ifdef HEAP_MONITORING + MemMonitoring::startHeapMonitoring(); +#endif + + P6_LOG("==================================================\r\n"); + P6_LOG("chip-p6-lighting-example starting\r\n"); + P6_LOG("==================================================\r\n"); + /* Start the FreeRTOS scheduler */ vTaskStartScheduler(); @@ -124,5 +141,4 @@ int main(void) // Should never get here. P6_LOG("vTaskStartScheduler() failed"); - appError(ret); } diff --git a/examples/lock-app/p6/src/main.cpp b/examples/lock-app/p6/src/main.cpp index aceba9a2183528..9c213eeb8137fa 100644 --- a/examples/lock-app/p6/src/main.cpp +++ b/examples/lock-app/p6/src/main.cpp @@ -37,11 +37,16 @@ #include "init_p6Platform.h" #include +#define MAIN_TASK_STACK_SIZE (4096) +#define MAIN_TASK_PRIORITY 2 + using namespace ::chip; using namespace ::chip::Inet; using namespace ::chip::DeviceLayer; volatile int apperror_cnt; +static void main_task(void * pvParameters); + // ================================================================================ // App Error //================================================================================= @@ -66,20 +71,17 @@ extern "C" void vApplicationIdleHook(void) // FreeRTOS Idle callback } -// ================================================================================ -// Main Code -// ================================================================================ -int main(void) +extern "C" void vApplicationDaemonTaskStartupHook() { - init_p6Platform(); - - P6_LOG("==================================================\r\n"); - P6_LOG("chip-p6-lock-example starting\r\n"); - P6_LOG("==================================================\r\n"); - // Init Chip memory management before the stack chip::Platform::MemoryInit(); + /* Create the Main task. */ + xTaskCreate(main_task, "Main task", MAIN_TASK_STACK_SIZE, NULL, MAIN_TASK_PRIORITY, NULL); +} + +static void main_task(void * pvParameters) +{ CHIP_ERROR ret = chip::DeviceLayer::PersistedStorage::KeyValueStoreMgrImpl().Init(); if (ret != CHIP_NO_ERROR) { @@ -107,6 +109,22 @@ int main(void) P6_LOG("GetAppTask().Init() failed"); appError(ret); } + + /* Delete task */ + vTaskDelete(NULL); +} + +// ================================================================================ +// Main Code +// ================================================================================ +int main(void) +{ + init_p6Platform(); + + P6_LOG("==================================================\r\n"); + P6_LOG("chip-p6-lock-example starting\r\n"); + P6_LOG("==================================================\r\n"); + /* Start the FreeRTOS scheduler */ vTaskStartScheduler(); @@ -116,5 +134,4 @@ int main(void) // Should never get here. P6_LOG("vTaskStartScheduler() failed"); - appError(ret); } diff --git a/src/platform/P6/ConnectivityManagerImpl.cpp b/src/platform/P6/ConnectivityManagerImpl.cpp index 27a38150089d11..5e284d54659e3e 100644 --- a/src/platform/P6/ConnectivityManagerImpl.cpp +++ b/src/platform/P6/ConnectivityManagerImpl.cpp @@ -69,17 +69,22 @@ CHIP_ERROR ConnectivityManagerImpl::_SetWiFiStationMode(WiFiStationMode val) CHIP_ERROR err = CHIP_NO_ERROR; VerifyOrExit(val != kWiFiStationMode_NotSupported, err = CHIP_ERROR_INVALID_ARGUMENT); if (val != kWiFiStationMode_ApplicationControlled) - { - mWiFiStationMode = val; - DeviceLayer::SystemLayer().ScheduleWork(DriveStationState, NULL); - } - if (mWiFiStationMode != val) { ChipLogProgress(DeviceLayer, "WiFi station mode change: %s -> %s", WiFiStationModeToStr(mWiFiStationMode), WiFiStationModeToStr(val)); + mWiFiStationMode = val; + /* Schedule work for disabled case causes station mode not getting enabled */ + if (mWiFiStationMode != kWiFiStationMode_Disabled) + { + DeviceLayer::SystemLayer().ScheduleWork(DriveStationState, NULL); + } + else + { + /* Call Drive Station directly to disable directly instead of scheduling */ + DriveStationState(); + } } - mWiFiStationMode = val; exit: return err; } @@ -200,21 +205,38 @@ CHIP_ERROR ConnectivityManagerImpl::_Init() // Ensure that P6 station mode is enabled. err = Internal::P6Utils::EnableStationMode(); SuccessOrExit(err); - // If the code has been compiled with a default WiFi station provision, configure that now. - if (CHIP_DEVICE_CONFIG_DEFAULT_STA_SSID[0] != 0) + // If there is no persistent station provision... + if (!IsWiFiStationProvisioned()) { - ChipLogProgress(DeviceLayer, "Setting default WiFi station configuration (SSID: %s)", CHIP_DEVICE_CONFIG_DEFAULT_STA_SSID); - - // Set a default station configuration. - wifi_config_t wifiConfig; - memset(&wifiConfig, 0, sizeof(wifiConfig)); - memcpy(wifiConfig.sta.ssid, CHIP_DEVICE_CONFIG_DEFAULT_STA_SSID, - min(strlen(CHIP_DEVICE_CONFIG_DEFAULT_STA_SSID), sizeof(wifiConfig.sta.ssid))); - memcpy(wifiConfig.sta.password, CHIP_DEVICE_CONFIG_DEFAULT_STA_PASSWORD, - min(strlen(CHIP_DEVICE_CONFIG_DEFAULT_STA_PASSWORD), sizeof(wifiConfig.sta.password))); - wifiConfig.sta.security = CHIP_DEVICE_CONFIG_DEFAULT_STA_SECURITY; - err = Internal::P6Utils::p6_wifi_set_config(WIFI_IF_STA, &wifiConfig); - SuccessOrExit(err); + // If the code has been compiled with a default WiFi station provision, configure that now. + if (CHIP_DEVICE_CONFIG_DEFAULT_STA_SSID[0] != 0) + { + ChipLogProgress(DeviceLayer, "Setting default WiFi station configuration (SSID: %s)", + CHIP_DEVICE_CONFIG_DEFAULT_STA_SSID); + + // Set a default station configuration. + wifi_config_t wifiConfig; + memset(&wifiConfig, 0, sizeof(wifiConfig)); + memcpy(wifiConfig.sta.ssid, CHIP_DEVICE_CONFIG_DEFAULT_STA_SSID, + min(strlen(CHIP_DEVICE_CONFIG_DEFAULT_STA_SSID), sizeof(wifiConfig.sta.ssid))); + memcpy(wifiConfig.sta.password, CHIP_DEVICE_CONFIG_DEFAULT_STA_PASSWORD, + min(strlen(CHIP_DEVICE_CONFIG_DEFAULT_STA_PASSWORD), sizeof(wifiConfig.sta.password))); + wifiConfig.sta.security = CHIP_DEVICE_CONFIG_DEFAULT_STA_SECURITY; + err = Internal::P6Utils::p6_wifi_set_config(WIFI_IF_STA, &wifiConfig); + SuccessOrExit(err); + + // Enable WiFi station mode. + ReturnErrorOnFailure(SetWiFiStationMode(kWiFiStationMode_Enabled)); + } + else + { + ReturnErrorOnFailure(SetWiFiStationMode(kWiFiStationMode_Disabled)); + } + } + else + { + // Enable WiFi station mode. + ReturnErrorOnFailure(SetWiFiStationMode(kWiFiStationMode_Enabled)); } // Force AP mode off for now. err = Internal::P6Utils::SetAPMode(false); @@ -474,9 +496,6 @@ void ConnectivityManagerImpl::DriveStationState() CHIP_ERROR err = CHIP_NO_ERROR; bool stationConnected; - // Refresh the current station mode by reading the configuration from storage. - GetWiFiStationMode(); - // If the station interface is NOT under application control... if (mWiFiStationMode != kWiFiStationMode_ApplicationControlled) { diff --git a/src/platform/P6/MTBKeyValueStore.cpp b/src/platform/P6/MTBKeyValueStore.cpp index 17a01db87c4223..839be54bf37f72 100644 --- a/src/platform/P6/MTBKeyValueStore.cpp +++ b/src/platform/P6/MTBKeyValueStore.cpp @@ -23,23 +23,32 @@ */ #include "MTBKeyValueStore.h" +#include "cy_serial_flash_qspi.h" +#include "cybsp.h" +#include "cycfg_qspi_memslot.h" +#include "cyhal.h" namespace { -cyhal_flash_block_info_t block_info; -cyhal_flash_t flash_obj; mtb_kvstore_bd_t block_device; } // namespace +#define MEM_SLOT_NUM (0u) /* Slot number of the memory to use */ +#define QSPI_BUS_FREQUENCY_HZ (50000000lu) cy_rslt_t mtb_key_value_store_init(mtb_kvstore_t * kvstore_obj) { - cyhal_flash_info_t flash_info; - + uint32_t ext_mem_address = 0x00; + size_t sectorSize; // Initialize the block device - cy_rslt_t result = cyhal_flash_init(&flash_obj); + cy_rslt_t result = + cy_serial_flash_qspi_init(smifMemConfigs[MEM_SLOT_NUM], CYBSP_QSPI_D0, CYBSP_QSPI_D1, CYBSP_QSPI_D2, CYBSP_QSPI_D3, NC, NC, + NC, NC, CYBSP_QSPI_SCK, CYBSP_QSPI_SS, QSPI_BUS_FREQUENCY_HZ); if (CY_RSLT_SUCCESS != result) { return result; } + sectorSize = cy_serial_flash_qspi_get_erase_size(ext_mem_address); + uint32_t length = sectorSize * 2; + uint32_t start_addr = 0; block_device.read = bd_read; block_device.program = bd_program; @@ -47,16 +56,13 @@ cy_rslt_t mtb_key_value_store_init(mtb_kvstore_t * kvstore_obj) block_device.read_size = bd_read_size; block_device.program_size = bd_program_size; block_device.erase_size = bd_erase_size; - block_device.context = &flash_obj; - - cyhal_flash_get_info(&flash_obj, &flash_info); - block_info = flash_info.blocks[flash_info.block_count - 1]; + block_device.context = NULL; // Initialize the kv-store library - result = mtb_kvstore_init(kvstore_obj, block_info.start_address, block_info.size, &block_device); + result = mtb_kvstore_init(kvstore_obj, start_addr, length, &block_device); if (CY_RSLT_SUCCESS != result) { - cyhal_flash_free(&flash_obj); + cy_serial_flash_qspi_deinit(); } return result; @@ -69,40 +75,25 @@ uint32_t bd_read_size(void * context, uint32_t addr) uint32_t bd_program_size(void * context, uint32_t addr) { - return block_info.page_size; + return cy_serial_flash_qspi_get_prog_size(addr); } uint32_t bd_erase_size(void * context, uint32_t addr) { - return block_info.sector_size; + return cy_serial_flash_qspi_get_erase_size(addr); } cy_rslt_t bd_read(void * context, uint32_t addr, uint32_t length, uint8_t * buf) { - memcpy(buf, (const uint8_t *) (addr), length); - return CY_RSLT_SUCCESS; + return cy_serial_flash_qspi_read(addr, length, buf); } cy_rslt_t bd_program(void * context, uint32_t addr, uint32_t length, const uint8_t * buf) { - uint32_t prog_size = bd_program_size(context, addr); - CY_ASSERT(0 == (length % prog_size)); - cy_rslt_t result = CY_RSLT_SUCCESS; - for (uint32_t loc = addr; (result == CY_RSLT_SUCCESS) && (loc < addr + length); loc += prog_size, buf += prog_size) - { - result = cyhal_flash_program((cyhal_flash_t *) context, loc, (const uint32_t *) buf); - } - return result; + return cy_serial_flash_qspi_write(addr, length, buf); } cy_rslt_t bd_erase(void * context, uint32_t addr, uint32_t length) { - uint32_t erase_size = bd_erase_size(context, addr); - CY_ASSERT(0 == (length % erase_size)); - cy_rslt_t result = CY_RSLT_SUCCESS; - for (uint32_t loc = addr; (result == CY_RSLT_SUCCESS) && (loc < addr + length); loc += erase_size) - { - result = cyhal_flash_erase((cyhal_flash_t *) context, loc); - } - return result; + return cy_serial_flash_qspi_erase(addr, length); } diff --git a/src/platform/P6/NetworkCommissioningWiFiDriver.cpp b/src/platform/P6/NetworkCommissioningWiFiDriver.cpp index ec1fb771274e79..fe911c79c687a8 100644 --- a/src/platform/P6/NetworkCommissioningWiFiDriver.cpp +++ b/src/platform/P6/NetworkCommissioningWiFiDriver.cpp @@ -97,9 +97,11 @@ Status P6WiFiDriver::AddOrUpdateNetwork(ByteSpan ssid, ByteSpan credentials) VerifyOrReturnError(credentials.size() <= sizeof(mStagingNetwork.credentials), Status::kOutOfRange); VerifyOrReturnError(ssid.size() <= sizeof(mStagingNetwork.ssid), Status::kOutOfRange); + memset(mStagingNetwork.credentials, 0, sizeof(mStagingNetwork.credentials)); memcpy(mStagingNetwork.credentials, credentials.data(), credentials.size()); mStagingNetwork.credentialsLen = static_cast(credentials.size()); + memset(mStagingNetwork.ssid, 0, sizeof(mStagingNetwork.ssid)); memcpy(mStagingNetwork.ssid, ssid.data(), ssid.size()); mStagingNetwork.ssidLen = static_cast(ssid.size()); @@ -147,6 +149,7 @@ void P6WiFiDriver::OnConnectWiFiNetwork() { if (mpConnectCallback) { + CommitConfiguration(); mpConnectCallback->OnResult(Status::kSuccess, CharSpan(), 0); mpConnectCallback = nullptr; } @@ -159,7 +162,7 @@ void P6WiFiDriver::ConnectNetwork(ByteSpan networkId, ConnectCallback * callback VerifyOrExit(NetworkMatch(mStagingNetwork, networkId), networkingStatus = Status::kNetworkIDNotFound); VerifyOrExit(mpConnectCallback == nullptr, networkingStatus = Status::kUnknownError); - ChipLogProgress(NetworkProvisioning, "P6 NetworkCommissioningDelegate: SSID: %s", networkId.data()); + ChipLogProgress(NetworkProvisioning, "P6 NetworkCommissioningDelegate: SSID: %s", mStagingNetwork.ssid); err = ConnectWiFiNetwork(reinterpret_cast(mStagingNetwork.ssid), mStagingNetwork.ssidLen, reinterpret_cast(mStagingNetwork.credentials), mStagingNetwork.credentialsLen); mpConnectCallback = callback; diff --git a/src/platform/P6/P6Utils.cpp b/src/platform/P6/P6Utils.cpp index 4c38e6d89ac255..186ac46cc00359 100644 --- a/src/platform/P6/P6Utils.cpp +++ b/src/platform/P6/P6Utils.cpp @@ -210,9 +210,9 @@ CHIP_ERROR P6Utils::GetWiFiSSID(char * buf, size_t bufSize) return P6Config::ReadConfigValueStr(P6Config::kConfigKey_WiFiSSID, buf, bufSize, num); } -CHIP_ERROR P6Utils::StoreWiFiSSID(char * buf) +CHIP_ERROR P6Utils::StoreWiFiSSID(char * buf, size_t size) { - return P6Config::WriteConfigValueStr(P6Config::kConfigKey_WiFiSSID, buf); + return P6Config::WriteConfigValueStr(P6Config::kConfigKey_WiFiSSID, buf, size); } CHIP_ERROR P6Utils::GetWiFiPassword(char * buf, size_t bufSize) @@ -221,9 +221,9 @@ CHIP_ERROR P6Utils::GetWiFiPassword(char * buf, size_t bufSize) return P6Config::ReadConfigValueStr(P6Config::kConfigKey_WiFiPassword, buf, bufSize, num); } -CHIP_ERROR P6Utils::StoreWiFiPassword(char * buf) +CHIP_ERROR P6Utils::StoreWiFiPassword(char * buf, size_t size) { - return P6Config::WriteConfigValueStr(P6Config::kConfigKey_WiFiPassword, buf); + return P6Config::WriteConfigValueStr(P6Config::kConfigKey_WiFiPassword, buf, size); } CHIP_ERROR P6Utils::GetWiFiSecurityCode(uint32_t & security) @@ -252,10 +252,10 @@ CHIP_ERROR P6Utils::p6_wifi_set_config(wifi_interface_t interface, wifi_config_t if (interface == WIFI_IF_STA) { /* Store Wi-Fi Configurations in Storage */ - err = StoreWiFiSSID((char *) conf->sta.ssid); + err = StoreWiFiSSID((char *) conf->sta.ssid, strlen((char *) conf->sta.ssid)); SuccessOrExit(err); - err = StoreWiFiPassword((char *) conf->sta.password); + err = StoreWiFiPassword((char *) conf->sta.password, strlen((char *) conf->sta.password)); SuccessOrExit(err); err = StoreWiFiSecurityCode(conf->sta.security); @@ -759,7 +759,7 @@ static int xtlv_size_for_data(int dlen, uint16_t opts, const uint8_t ** data) { int hsz; hsz = xtlv_hdr_size(opts, data); - return ((opts & XTLV_OPTION_ALIGN32) ? ALIGN_SIZE(dlen + hsz, 4) : (dlen + hsz)); + return ((opts & XTLV_OPTION_ALIGN32) ? P6_ALIGN_SIZE(dlen + hsz, 4) : (dlen + hsz)); } static int xtlv_len(const xtlv_t * elt, uint16_t opts) diff --git a/src/platform/P6/P6Utils.h b/src/platform/P6/P6Utils.h index 411d498e211ea5..5861a75e25c6e7 100644 --- a/src/platform/P6/P6Utils.h +++ b/src/platform/P6/P6Utils.h @@ -166,6 +166,7 @@ typedef struct xtlv #define XTLV_OPTION_LENU8 0x0004 /* shorted length */ #define OFFSETOF(type, member) ((uintptr_t) & ((type *) 0)->member) #define _LTOH16_UA(cp) ((cp)[0] | ((cp)[1] << 8)) +#define P6_ALIGN_SIZE(value, align_to) (((value) + (align_to) -1) & ~((align_to) -1)) #define CHK_CNTBUF_DATALEN(cntbuf, ioctl_buflen) \ do \ @@ -219,9 +220,9 @@ class P6Utils static void unpack_xtlv_buf(const uint8_t * tlv_buf, uint16_t buflen, wl_cnt_ver_30_t * cnt, wl_cnt_ge40mcst_v1_t * cnt_ge40); static void heap_usage(heap_info_t * heap); static CHIP_ERROR GetWiFiSSID(char * buf, size_t bufSize); - static CHIP_ERROR StoreWiFiSSID(char * buf); + static CHIP_ERROR StoreWiFiSSID(char * buf, size_t size); static CHIP_ERROR GetWiFiPassword(char * buf, size_t bufSize); - static CHIP_ERROR StoreWiFiPassword(char * buf); + static CHIP_ERROR StoreWiFiPassword(char * buf, size_t size); static CHIP_ERROR GetWiFiSecurityCode(uint32_t & security); static CHIP_ERROR StoreWiFiSecurityCode(uint32_t security); static CHIP_ERROR wifi_get_mode(uint32_t & security); diff --git a/third_party/p6/p6_sdk/build/CY8CKIT-062S2-43012/Debug/GCC_ARM.json b/third_party/p6/p6_sdk/build/CY8CKIT-062S2-43012/Debug/GCC_ARM.json index 106edbd7d88be6..c8d7625938c4d7 100644 --- a/third_party/p6/p6_sdk/build/CY8CKIT-062S2-43012/Debug/GCC_ARM.json +++ b/third_party/p6/p6_sdk/build/CY8CKIT-062S2-43012/Debug/GCC_ARM.json @@ -142,6 +142,7 @@ "-I./libs/secure-sockets/include", "-I./libs/secure-sockets/include/COMPONENT_FREERTOS", "-I./libs/secure-sockets/source", + "-I./libs/serial-flash/", "-I./libs/whd-bsp-integration", "-I./libs/wifi-connection-manager", "-I./libs/wifi-connection-manager/include", @@ -428,6 +429,8 @@ "./libs/mtb-pdl-cat1/drivers/source/cy_wdt.c", "./libs/retarget-io/cy_retarget_io.c", "./libs/secure-sockets/source/cy_tls_weak.c", + "./libs/serial-flash/cy_serial_flash_prog.c", + "./libs/serial-flash/cy_serial_flash_qspi.c", "./libs/whd-bsp-integration/cy_network_buffer.c", "./libs/whd-bsp-integration/cybsp_wifi.c", "./libs/wifi-host-driver/WiFi_Host_Driver/resources/resource_imp/whd_resources.c", diff --git a/third_party/p6/p6_sdk/build/CY8CKIT-062S2-43012/Release/GCC_ARM.json b/third_party/p6/p6_sdk/build/CY8CKIT-062S2-43012/Release/GCC_ARM.json index c7449050d04e15..1ab41aaeef6975 100644 --- a/third_party/p6/p6_sdk/build/CY8CKIT-062S2-43012/Release/GCC_ARM.json +++ b/third_party/p6/p6_sdk/build/CY8CKIT-062S2-43012/Release/GCC_ARM.json @@ -142,6 +142,7 @@ "-I./libs/secure-sockets/include", "-I./libs/secure-sockets/include/COMPONENT_FREERTOS", "-I./libs/secure-sockets/source", + "-I./libs/serial-flash/", "-I./libs/whd-bsp-integration", "-I./libs/wifi-connection-manager", "-I./libs/wifi-connection-manager/include", @@ -428,6 +429,8 @@ "./libs/mtb-pdl-cat1/drivers/source/cy_wdt.c", "./libs/retarget-io/cy_retarget_io.c", "./libs/secure-sockets/source/cy_tls_weak.c", + "./libs/serial-flash/cy_serial_flash_prog.c", + "./libs/serial-flash/cy_serial_flash_qspi.c", "./libs/whd-bsp-integration/cy_network_buffer.c", "./libs/whd-bsp-integration/cybsp_wifi.c", "./libs/wifi-host-driver/WiFi_Host_Driver/resources/resource_imp/whd_resources.c", diff --git a/third_party/p6/p6_sdk/configs/FreeRTOSConfig.h b/third_party/p6/p6_sdk/configs/FreeRTOSConfig.h index e9f80425ec10c6..df4d89c52c93a4 100644 --- a/third_party/p6/p6_sdk/configs/FreeRTOSConfig.h +++ b/third_party/p6/p6_sdk/configs/FreeRTOSConfig.h @@ -79,7 +79,7 @@ extern uint32_t SystemCoreClock; #define configCHECK_FOR_STACK_OVERFLOW 2 #define configUSE_MALLOC_FAILED_HOOK 1 -#define configUSE_DAEMON_TASK_STARTUP_HOOK 0 +#define configUSE_DAEMON_TASK_STARTUP_HOOK 1 #define configUSE_APPLICATION_TASK_TAG 0 /* Run time and task stats gathering related definitions. */ diff --git a/third_party/p6/p6_sdk/libs/serial-flash b/third_party/p6/p6_sdk/libs/serial-flash new file mode 160000 index 00000000000000..db4a5dd646629a --- /dev/null +++ b/third_party/p6/p6_sdk/libs/serial-flash @@ -0,0 +1 @@ +Subproject commit db4a5dd646629ac31d669b4ed943d8ab1fa4a9d7