Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[K32W0] SDK 2.6.11 fixes & features #27380

Merged
merged 1 commit into from
Jun 21, 2023

Conversation

marius-alex-tache
Copy link
Contributor

Cherry-pick work from #26827.

* [K32W0] Sync with SDK NCCL change

Signed-off-by: Marius Tache <[email protected]>

* [K32W0] Add a flag chip_with_pdm_encryption to disable PDM encryption

* [K32W0] Fix name for OPENTHREAD_CONFIG_MAC_DEFAULT_MAX_FRAME_RETRIES_DIRECT

* [K32W0] Fix reboot reason bug

* [K32W0] Change date type for rebootCause, uint8_t is enough

* [K32W0] Add stop advertising retry

If stop advertising fails (timeout on event wait), then
rearm the timer as fast as possible to retry.
Once stop advertising is successful, slow advertising can start.

Signed-off-by: Marius Tache <[email protected]>

* [K32W0] Add ExitAction to OTATlvProcessor API

An OTA TLV processor should have the option of executing an action
when before a new processor is selected. This is called an exit
action. It should be useful in the context of transferring multiple
OTA images in external flash.

Signed-off-by: Marius Tache <[email protected]>

* [K32W0] Update OTA SDK usage

* Application and bootloader processors are now the same, referred to as
firmware processor.
* Application can now register callbacks for descriptor
processing.
* When using default processors, the OTA flags gOTAUseCustomOtaEntry
and gOTAAllowCustomStartAddress are defined and set to 1.

Signed-off-by: Marius Tache <[email protected]>

* [K32W0] Add JSON support for custom TLVs

*A user can now specify a custom TLV format (tag, descriptor and path)
by following the design of the ota_payload.schema. Option `--json` should
be used to specify the JSON file path.
* Add SSBL payload generation.

Signed-off-by: Marius Tache <[email protected]>

* [K32W0] Call ExitAction from TLV processor when all block has been consumed - Move code from ApplyAction to ExitAction method

* [K32W0] Update usage of new OTA SDK APIs

* [K32W0] Set custom OTA entry flags

Custom OTA entry structure will be saved at the top of external flash by default.
Fix heap start address. It should start after the stack size is subtracted from the top.

Signed-off-by: Marius Tache <[email protected]>

* [K32W0] Access OTA entry at Init and check OTA status

* [K32W0] Update OTA tool to support SSBL

Add a few examples to generate:
* application update image
* factory data update image
* SSBL update image
* app + SSBL + factory data update image
* maximum number of custom OTA entries image

Add README for K32W OTA.

Signed-off-by: Marius Tache <[email protected]>

* [K32W0] Add example for max entries testing

Signed-off-by: Marius Tache <[email protected]>

* [K32W0] Split default processors options

* chip_enable_ota_firmware_processor enables the firmware (App/SSBL)
processor. Enabled by default.
* chip_enable_ota_factory_data_processor enables the factory data
processor. Disabled by default.

Signed-off-by: Marius Tache <[email protected]>

* [K32W0] Update README SSBL/PSECT sections

Signed-off-by: Marius Tache <[email protected]>

* [K32W0] Bring README files up to date

Signed-off-by: Marius Tache <[email protected]>

* [K32W0] Fix chip_crypto_flavour name

Signed-off-by: Marius Tache <[email protected]>

* [K32W0] Fix readmes for k32w0 apps

* [K32W0] Update SecLib path in SDK build file

Signed-off-by: Marius Tache <[email protected]>

* [K32W0] Fix typo in README files regarding OTA image tool

Signed-off-by: Marius Tache <[email protected]>

* [K32W0] Extend factory data restore mechanism

The default restore mechanism is implemented as a weak function:
`FactoryDataDefaultRestoreMechanism`. It is registered in
`K32W0FactoryDataProvider::Init`, before factory data validation,
and it can be overwritten at application level.

Application can register additional restore mechanisms using the API:
`K32W0FactoryDataProvider::RegisterRestoreMechanism`.

Signed-off-by: Marius Tache <[email protected]>

* [K32W0] Improve rotating device id

Add README section related to rotating device id.
If unique id is not found in factory data, use the
default one.

Signed-off-by: Marius Tache <[email protected]>

* [K32W0] Fix error status for rotating device id getter

Signed-off-by: Marius Tache <[email protected]>

* [K32W0] Add retry mechanism when OTA is aborted

Upon an aborted transfer, the OTA will retry a query on the
backed up provider if CONFIG_CHIP_K32W0_OTA_ABORT_HOOK is set.

The retry mechanism is disabled by default.

Signed-off-by: Marius Tache <[email protected]>

* [K32W0] Add ota_custom_entry_address option

ota_custom_entry_address specifies at which address in external flash
the OTA custom entry is saved during OTA. By default, it is set to the
end of the PDM area: 0x000C1000.

Add internal/external flash description in linker.

Signed-off-by: Marius Tache <[email protected]>

* [K32W0] Revert all applied actions upon error

AbortAction for all selected OTA TLV processors will be called
if any processor fails to apply its action. This is a safety
mechanism to avoid having incompatible apps/data caused by partial
updates (e.g. incompatibility between SSBL and app).

Other changes:
* Clean factory data RAM buffer

* Increase reset resilience during OTA

During OTA, if factory data is updated, it is firstly backed up
in a PDM entry with id kNvmId_FactoryDataBackup. This entry should
be deleted only if the OTA entry state is otaApplied, which means
the device reset happened as expected.

If OTA entry state is not otaApplied, it means the reset was caused
by a different factor (e.g. power loss etc.) and the factory data
should be restored from the PDM (for the default registered mechanism).

* AbortAction should delete PDM id for factory data backup

* Add reset state for OTATlvProcessor base class

Derived classes should call OTATlvProcessor::ClearInternal() whenever
they want to reset their state.

* Update abort action for firmware processor

OTA_ResetCurrentEepromAddress should be called before setting
the offset to 0 through OTA_SetStartEepromOffset. Otherwise,
a check in OTA_SetStartEepromOffset will fail and the state is
not reset correctly.

Signed-off-by: Marius Tache <[email protected]>

* [K32W0] Add SPIFI_DUAL_MODE_SUPPORT info in README files

For K32W041AM, the multi-image SSBL must also be compiled with
SPIFI_DUAL_MODE_SUPPORT=1.

Signed-off-by: Marius Tache <[email protected]>

* [K32W0] Enclose CheckOtaEntry in OTA flag

Signed-off-by: Marius Tache <[email protected]>

* [K32W0] Enclose factory data backup usage in corresponding flag

Signed-off-by: Marius Tache <[email protected]>

* [K32W0] Update SDK in README files

Fix minor issue with image partitions information.

Signed-off-by: Marius Tache <[email protected]>

* [K32W0] Fix DiagnosticDataProvider memory leak

GetNetworkInterfaces returns some dynamically allocated data,
which is supposed to be freed upon calling ReleaseNetworkInterfaces.

Our platform implementation was using the default implementation of
ReleaseNetworkInterfaces (which does nothing). This is an obvious memory leak,
since subsequent calls to GetNetworkInterfaces dynamically allocated data that
was never freed.

Signed-off-by: Marius Tache <[email protected]>

* [K32W0] Automate output binary signing

Add BUILD.gn changes to call a python script postbuild
that signs the output binary.

Add signing python script.

Update readme files.

Signed-off-by: Andrei Menzopol <[email protected]>

* [K32W0] Fix chip_crypto_flavor typo

Signed-off-by: Marius Tache <[email protected]>

* [K32W0] Bump ot-nxp to latest

Signed-off-by: Marius Tache <[email protected]>

* [K32W0] Fix OTA generation tool

Signed-off-by: Marius Tache <[email protected]>

* [K32W0] Bump ot-nxp to latest

Signed-off-by: Marius Tache <[email protected]>

* [K32W0] Sync scripts and generated data with development

Updated manufacturing flow.

Signed-off-by: Mihai Ignat <[email protected]>
Signed-off-by: Marius Tache <[email protected]>

* [K32W0] Bump ot-nxp to latest

Signed-off-by: Marius Tache <[email protected]>

* Restyled by whitespace

* Restyled by clang-format

* Restyled by gn

* Restyled by prettier-markdown

* Restyled by shellharden

* Restyled by shfmt

* Restyled by autopep8

* Restyled by isort

* [K32W0] Fix spell check

Signed-off-by: Marius Tache <[email protected]>

* [K32W0] Remove some binary examples (not used)

Signed-off-by: Marius Tache <[email protected]>

* [K32W0] Fix some lint errors

Signed-off-by: Marius Tache <[email protected]>

* [K32W0] Update workflow example yaml to latest

Signed-off-by: Marius Tache <[email protected]>

* Restyled by prettier-markdown

* [K32W0] Fix script issues

Signed-off-by: Marius Tache <[email protected]>

* Restyled by autopep8

* Restyled by isort

* [K32W0] Add PDM ID base value for apps

Applications should use kNvmId_ApplicationBase alongside an
offset to generate their own PDM IDs.

Signed-off-by: Marius Tache <[email protected]>

* Restyled by clang-format

---------

Signed-off-by: Marius Tache <[email protected]>
Signed-off-by: Andrei Menzopol <[email protected]>
Signed-off-by: Mihai Ignat <[email protected]>
Co-authored-by: tanyue518 <[email protected]>
Co-authored-by: Martin Cuvelier <[email protected]>
Co-authored-by: Mihai Ignat <[email protected]>
Co-authored-by: Andrei Menzopol <[email protected]>
Co-authored-by: Restyled.io <[email protected]>
@marius-alex-tache marius-alex-tache force-pushed the upstream-k32w0-2.6.11-v1.1 branch from 3b8799b to 9e42ccf Compare June 21, 2023 12:16
@andy31415 andy31415 merged commit c95efa9 into project-chip:v1.1-branch Jun 21, 2023
@GabrielCouturier GabrielCouturier deleted the upstream-k32w0-2.6.11-v1.1 branch November 10, 2023 08:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants