Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[NXP][k32w1] Rework reference apps (#34926)
* [NXP][platform][common] Update pw RPC flag in streamer_nxp Signed-off-by: marius-alex-tache <[email protected]> (cherry picked from commit 4ae033a1bddd5d914e862791c111eebca41a62e8) * [NXP][examples][common] Fix binding issue due to generated Zap flag renaming Signed-off-by: Martin Girardot <[email protected]> (cherry picked from commit b50b382478138ad02103e55194b0145b1e61e841) * [NXP][examples][common] make-pretty update (cherry picked from commit efc51cc65471f4f5f667947ef18a4656e1d29578) * [NXP][examples][common] Fix contact-sensor-app always returning empty diagnostic logs The LogProvider class method GetSizeForIntent() was always returning zero as log size due to an incorrect evaluation of the result of the SyncGetValue() call. GetSizeForIntent() is evaluating the size of the diagnostic log by trying to read the key using a zero length buffer. This action will return the size of the key in storage, but it will also yield a CHIP_ERROR_BUFFER_TOO_SMALL error code. GetSizeForIntent() however was not expecting this error code and it was returning zero in all situations when the status returned by SyncGetValue() was anything else but CHIP_NO_ERROR. The function was updated to take into account that, under these circumstances, the SyncGetValue() function always returns CHIP_ERROR_BUFFER_TOO_SMALL. Signed-off-by: Marian Chereji <[email protected]> Reviewed-by: Doru-Cristian Gucea <[email protected]> (cherry picked from commit dd3b3b784318f73cf6f0390f79d1fdf0160169d3) * [NXP][examples][common] Call init using the base class reference Signed-off-by: marius-alex-tache <[email protected]> (cherry picked from commit b7a0a0a4d88bd5d03b70f36b34c2475b614bd296) * [NXP][examples][common] Update app task common code New task base API: - PostEventsProcessedAction - this will be called in the main loop, after all events have been processed. An example of concrete action is to animate some LEDs. - PrintOnboardingInfo - the default implementation remains the same. It can be overwritten by the concrete application task class. - AppMatter_DisallowDeviceToSleep/AppMatter_AllowDeviceToSleep - An application that uses low power mode should overwrite the API to implement the allow/disallow entering low power mechanism. Before taking the OT mutex, the device is disallowed to enter low power. The device is allowed to enter low power after the OT mutex is released. Other changes: - The app event queue handle should be static such that the concrete application task can initialize it during Start() call. - The ticksToWait passed to xQueueReceived is used to specify the maximum amount of time the task should block waiting for an event. This can be modified according to the application needs, e.g. is needed by an application that has LED animation. - PostEvent should take into account ISR context when populating the event queue. - PostEvent becomes a static method. - Thread device type is specified by the following flag: CONFIG_THREAD_DEVICE_TYPE This is set by default to kThreadDeviceType_Router. Signed-off-by: marius-alex-tache <[email protected]> (cherry picked from commit d88e78ea6c973eb736915110bb227ad3515eec98) * [NXP][examples][common] Add additional common components - Add led widget component - Add diagnostic logs component - chip::NXP::App::DiagnosticLogsDemo::DisplayUsage should be implemeneted to showcase how the diagnostic logs provider should be used. - Add low power component - chip::NXP::App::LowPower::Init should be implemented according to the application needs. A default example is implemented, which registers an empty enter/exit low power callback. - Add operational keystore component - the API contains two functions: - GetInstance - should return the address of a concrete operational keystore class - Init - can be used to register a persistent storage delegate in case the concrete class is using persistent storage (which will be our case) - Add user interface feedback component - this component defines an abstract interface that can be implemented by applications in order to provide some kind of feedback to the user in certain conditions: logging, LED animations, etc. Add example of lighting manager, which uses LED animation for user feedback. - Add clusters component - add an API for identify related callbacks. Add implementation for common MatterPostAttributeChangeCallback, which delegates the work to the device manager component. - Add RPC component - this is a simple Init API that can be used to initialize PW RPC related components, such as UART. Signed-off-by: marius-alex-tache <[email protected]> (cherry picked from commit 46a1d3d673b9cae14d33c749e3741727449e6ff9) * [NXP][examples][common] Add missing header in Identify Signed-off-by: marius-alex-tache <[email protected]> (cherry picked from commit 3abfee2c6eea327ae931a150733ac83639d157d5) * [NXP][examples][common] Add multi-image OTA requestor initiator Signed-off-by: marius-alex-tache <[email protected]> (cherry picked from commit 5848e4d4e2d384c4bfe41714bd41e25c4b1ba1e8) * [NXP][examples][common] Update pw RPC implementation Update AppRpc API by adding two new methods used by the common RPC implementation: - ButtonHandler - Reboot Signed-off-by: marius-alex-tache <[email protected]> (cherry picked from commit 5e40934145825c61444e43e479ed7ac5c26605a4) * [NXP][examples][common] Small updates to common app code - Add call to feedback manager init. - Remove PostEventsProcessedAction. Call FeedbackMgr().DisplayInLoop() directly in the main loop. - Move PostEvent in AppTaskBase interface and make it virtual. - Add demo of diagnostic logs usage. - Update PrintOnboardingInfo to take into account user action requried commissioning flow. - Remove usage of deprecated sFunction from Lighting manager. - Add LowPower::Init call. - If FSL_OSA_TASK_ENABLE is used, then call AppTaskMain inside Start, instead of creating the app task. - Add PrintCurrentVersion API to print the software version string and software version. - Enclose DeviceInfoProviderImpl usage based on CONFIG_DEVICE_INFO_PROVIDER_IMPL - Add diagnostic logs cluster init under the corresponding flag. Signed-off-by: marius-alex-tache <[email protected]> (cherry picked from commit 1619c92380275dc0466f9cf9dc9e818671406b06) * [NXP][examples][common] Make Animate pure virtual Signed-off-by: marius-alex-tache <[email protected]> (cherry picked from commit eaf3789fc2d1e562fe030acc758e5f322b5f02d3) * [NXP][examples][common] Add pw RPC init RPC_TASK_STACK_SIZE and RPC_TASK_PRIORITY can now be defined in the build system to override the default values. Signed-off-by: marius-alex-tache <[email protected]> (cherry picked from commit 7962d612b14502dc3f514c5c3d39891b086cfd63) * [NXP][examples][common] Allow platforms to redefine the path to the FactoryDataProvider.h that needs to be included Signed-off-by: Dina Benamar <[email protected]> (cherry picked from commit 097cd999c4767572f8cc55fac18f93ac3cb5d50c) * [NXP][examples][common] Add TestEventTriggerDelegate * TestEventTriggerDelegate is now used at Server Initialization to add the ICDManager instance as Handler Signed-off-by: Andrei Menzopol <[email protected]> (cherry picked from commit edce1dc967130589e74cdd9c8289719171141178) * [NXP][examples][common] Minor updates for some components The KVS wear stats are stored in the user diagnostic log key hence only initialize this key if the KVS wear stats are not enabled. Signed-off-by: Marian Chereji <[email protected]> [nxp noup][examples][common] Remove UpdateState API The interface can be simplified by calling RestoreState instead of UpdateState when needed. This implies that the caller must update the cluster attribute by itself. Signed-off-by: marius-alex-tache <[email protected]> [nxp noup][examples][common] Rename LightingManager to LedManager Signed-off-by: marius-alex-tache <[email protected]> * [NXP][examples][common] Add initial version of lighting app - Copy lighting app sources to common folder - Add device callbacks - Use common OTA support - Use common app factory data - Use led widgets for lighting app - Use common app task and button management - Decouple lighting manager from app task - Update LED status function - Update lighting manager related flags Flags: - LIGHTING_MANAGER_ENABLE_DIMMABLE_LED to enable dimmable LED feature - LIGHTING_MANAGER_ENABLE_STATUS_LED to enable status LED usage These flags can be overwritten in AppConfig.h. - Make lighting manager more configurable - Create button manager The ButtonManager class should define the buttons callbacks and all callback delegates. Moved AppMatterButton_registerButtons implementation inside the button manager source file. - Update lighting manager interface - Replace lighting manager calls with feedback manager LightingManager now implements the UserFeedbackInterface abstract class and the dimmable feature was moved to a new class: LightingManagerDimmable. - Move identify code in a separate file - Remove deprecated #include statements from all files. - Add commissioning complete state A boolean static member is added to AppTask. It is set when the kCommissioningComplete event is received. It should be used by other components if they need a way to check the state of the device. - Add button action to switch to ICD active mode - Add support for BooleanState in device callbacks - Add diagnostic logs usage demo - Enclose feedback manager calls in CONFIG_ENABLE_FEEDBACK flag This flag should be defined whenever the application must provide some kind of user interface feedback, such as LED animation. In case of low power, this flag will not be defined. - Remove unused features (e.g. diagnostic logs) - Overwrite event queue and ticks to wait - Call PlatformMgrImpl API for PreInitMatterStack actions - Replace PW_RPC_ENABLED with CONFIG_ENABLE_PW_RPC Signed-off-by: marius-alex-tache <[email protected]> (cherry picked from commit bed6655227d44900279cbd0ef547771da9143895) * [NXP][examples][common] Add initial version of contact sensor Signed-off-by: marius-alex-tache <[email protected]> (cherry picked from commit 637580aa6c63048ae1a956807c284165c2af17ed) * [NXP][openthread][k32w1] Update mbedtls target Signed-off-by: marius-alex-tache <[email protected]> (cherry picked from commit 3c84b1fd3987958bc0dcf49a283c281e48b400f8) * [NXP][platform][k32w] OTA/FactoryData changes * Add FactoryDataDriver interface which handles factory data update functionality and factory data ram backup operations; must be implemented for each platform * Make FactoryDataProvider global instances * Move Restore mechanism and plain-text SignWithDacKey in common FactoryDataProvider * Adapt Validate and SearchForId to use factory data config which stores size, start, payload * Move OTAFactoryDataProcessor in common folder * Adapt to be generic and use FactoryDataDriver functions instead Signed-off-by: Andrei Menzopol <[email protected]> (cherry picked from commit 3a81c2367013c2a2ed08ecbbeac89ce15943998e) * [NXP][platform][k32w1] SDK 2.15 platform updates * remove RNG_SetPseudoRandomNoSeed call to accomodate new RNG API changes. * add SDK root, SDK release, and SDK 2.15 gn arguments. They will be used to differentiate between SDK versions (2.12 vs 2.15) and release status (repo vs packages). Signed-off-by: Andrei Menzopol <[email protected]> [nxp noup][platform][k32w] Small fixes for k32w platform code * correct typos * remove executable access permissions * remove unused files * change openthread_root to ot-nxp/openthread-k32w1 * use nxp_mbedtls gn target Signed-off-by: Andrei Menzopol <[email protected]> (cherry picked from commit 1905c1cea645506f8a88e514c2eacecea81ac385) * [NXP][platform][k32w1] Add "chip_key_storage" solution selector and littlefs support Updated the K32W1 platform build files by adding the "chip_key_storage" selector which will help developers select an implementation option for the key storage between "littlefs" and "fwk_nvm". Signed-off-by: Marian Chereji <[email protected]> [nxp noup][k32w1] Temporarily disable OpenThread settings save-on-idle when using LittleFS key storage When using LittleFS key storage, the OpenThread settings save-on-idle feature requires additional support in the application idle task, which is not yet available. In order for the OT settings saving to work at this stage and in this configuration, the save-on-idle feature must be disabled until the required idle task support will be implemented. Signed-off-by: Marian Chereji <[email protected]> [nxp noup][platform][k32w1] Fix minimum data chunk size required when programming the flash memory According to the specifications, the internal flash memory of the K32W1 platform supports programming chunks of memory which are 128 bytes long (instead of 256). Signed-off-by: Marian Chereji <[email protected]> [nxp noup][platform][k32w1] Increase LittleFS cache size to 1K to suppress frequent data synchronizations A small cache size forces LittleFS to perform frequent data synchronizations with the storage (flash memory) and this consumes a number of data blocks which are not available in the K32W1 Matter applications. To reduce the fast consumption of flash memory data blocks, the LittleFS cache size was increased to 1KB. Signed-off-by: Marian Chereji <[email protected]> (cherry picked from commit 753f7d7390661bd5dbd29cc9cfa7d3a4e4728ba2) * [NXP][platform][k32w1] Add Zephyr NVS based key storage build option Added a new build option (chip_key_storage="nvs") which allows the developers to use the Zephyr NVS file system as a key storage solution. Signed-off-by: Marian Chereji <[email protected]> (cherry picked from commit 1d42e48d8f50f6e9999b49025ea3d71545e89a3d) * [NXP][examples][k32w1] App updates * the sdk root was moved to platform args. * update readme files * Add CONNECTIVITY_MANAGER_THREAD_DEVICE_TYPE define. * Set define accordingly based on FTD/MTD configuration. * Solve issue when lighting-app is MTD but device type is set to Router because it was hardcoded. * Remove deprecated files * Move some headers in examples/platform for common usage Signed-off-by: Andrei Menzopol <[email protected]> (cherry picked from commit c2b626df132e058ce674df0ee20965b3029c462d) * [NXP][examples][k32w1] Update ZclCallbacks after transition to common code Signed-off-by: marius-alex-tache <[email protected]> * [NXP][k32w1] Remove k32w parent folder Signed-off-by: marius-alex-tache <[email protected]> * [NXP][platform][k32w1] Add FactoryDataDriver implementation Signed-off-by: marius-alex-tache <[email protected]> * [NXP][platform][k32w] Remove k32w/common This folder was moved to nxp/common/legacy area. Signed-off-by: marius-alex-tache <[email protected]> (cherry picked from commit 755081c71bde287e2d065e5fd9b1a0922c3b341a) * [NXP][scripts] Minor updates for NXP related scripts Add HWParams APP FactoryData support * Add proper format for HWParameters app factory data section * Put changes under new argument Signed-off-by: Andrei Menzopol <[email protected]> [nxp noup][scripts][common] Fix Crc16 attribute when using latest version Signed-off-by: marius-alex-tache <[email protected]> [nxp noup][scripts] Update structure k32w1 path All k32w1 folders were moved under nxp, removing the k32w parent. Signed-off-by: marius-alex-tache <[email protected]> [nxp noup][scripts][ota] Update paths after k32w transition Signed-off-by: marius-alex-tache <[email protected]> (cherry picked from commit 4963ce98725b74e94f498f959d46edf4933fa56c) * [NXP][platform][common] Add nxp_factory_data, nxp_ota gn targets The application can use these targets to integrate the default, platform-specific NXP factory data provider and OTA implementation. Each platform should define an "nxp_factory_data" and "nxp_ota" source sets. Usage: deps += [ "${chip_root}/src/platform/nxp:nxp_factory_data" ] deps += [ "${chip_root}/src/platform/nxp:nxp_ota" ] Signed-off-by: marius-alex-tache <[email protected]> (cherry picked from commit 4869c4a97134692fe87a59b9b69d33f836d9b2e9) * [NXP][platform][common] Create NXPConfigNVS.cpp file, remove NXPConfig BLE dependencies Signed-off-by: Martin Girardot <[email protected]> (cherry picked from commit 50e14e4a1b9f8561126310e19ebbaf72ca7bbdbe) * [NXP] revert mcxw71 headers Signed-off-by: marius-alex-tache <[email protected]> * [NXP][k32w1] Add default logging target Signed-off-by: marius-alex-tache <[email protected]> * [NXP][k32w1] Update paths to reference nxp_matter_support Signed-off-by: marius-alex-tache <[email protected]> * [NXP] Bump nxp_matter_support Signed-off-by: marius-alex-tache <[email protected]> * Restyled by whitespace * Restyled by clang-format * Restyled by gn * Restyled by prettier-markdown * Restyled by autopep8 * Restyled by isort * [NXP][k32w1] Fix gn import order Signed-off-by: marius-alex-tache <[email protected]> * [NXP][k32w1] Fix wrong README reference Signed-off-by: marius-alex-tache <[email protected]> * [NXP][k32w1] Update workflow docker image Signed-off-by: marius-alex-tache <[email protected]> * [NXP][rw61x] Adding nxp_ota and nxp_factory_data as they are now mandatory Signed-off-by: Gatien Chapon <[email protected]> * [NXP][platform][common] Fix build warning (cherry picked from commit 72b1cbaaf36fe6cf2af57a8c7ad3cc457b45c713) * Restyled by gn * [NXP][platform] Remove deprecated files Signed-off-by: marius-alex-tache <[email protected]> * [NXP][workflow] Create separate jobs for k32w0/k32w1 k32w0 builds use chip-build-k32w Docker image, but k32w1 builds use chip-build-nxp Docker image. Signed-off-by: marius-alex-tache <[email protected]> * [NXP][k32w0] Adding nxp_ota and nxp_factory_data as they are now mandatory Signed-off-by: marius-alex-tache <[email protected]> * [NXP][scripts] Fix script issue when there is no --args Signed-off-by: Martin Girardot <[email protected]> * [NXP][k32w1] Disable SMU2 Signed-off-by: marius-alex-tache <[email protected]> --------- Signed-off-by: marius-alex-tache <[email protected]> Signed-off-by: Gatien Chapon <[email protected]> Signed-off-by: Martin Girardot <[email protected]> Co-authored-by: Martin Girardot <[email protected]> Co-authored-by: Dina Benamar <[email protected]> Co-authored-by: Marian Chereji <[email protected]> Co-authored-by: Andrei Menzopol <[email protected]> Co-authored-by: Restyled.io <[email protected]> Co-authored-by: Gatien Chapon <[email protected]> Co-authored-by: Yassine El Aissaoui <[email protected]>
- Loading branch information