Skip to content

Commit

Permalink
Merge branch 'master' into enable_op_state_pause_and_resume_for_compa…
Browse files Browse the repository at this point in the history
…tible_states
  • Loading branch information
hicklin authored Dec 11, 2023
2 parents 3acdba9 + c4dd75e commit 4af68ac
Show file tree
Hide file tree
Showing 57 changed files with 2,086 additions and 231 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
path: matter
fetch-depth: 0
- name: Install Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: 3.8
cache-dependency-path: matter/docs/requirements.txt
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/examples-k32w.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
if: github.actor != 'restyled-io[bot]'

container:
image: ghcr.io/project-chip/chip-build-k32w:26
image: ghcr.io/project-chip/chip-build-k32w:27
volumes:
- "/tmp/bloat_reports:/tmp/bloat_reports"
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/protocol_compatibility.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Setup python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Install dependencies
Expand Down
198 changes: 122 additions & 76 deletions docs/guides/nxp_manufacturing_flow.md

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion examples/all-clusters-app/nxp/common/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -473,5 +473,7 @@ void AppTask::SwitchCommissioningStateHandler(void)

void AppTask::FactoryResetHandler(void)
{
ConfigurationMgr().InitiateFactoryReset();
/* Emit the ShutDown event before factory reset */
chip::Server::GetInstance().GenerateShutDownEvent();
chip::Server::GetInstance().ScheduleFactoryReset();
}
5 changes: 5 additions & 0 deletions examples/contact-sensor-app/nxp/k32w/k32w0/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import("${chip_root}/src/platform/device.gni")

declare_args() {
chip_software_version = 0
chip_simple_hash_verification = 0
}

if (chip_pw_tokenizer_logging) {
Expand Down Expand Up @@ -177,6 +178,10 @@ action("binsign") {
script = "${k32w0_platform_dir}/scripts/sign-outdir.py"
output_name = "bignsign.log"
outputs = [ "${root_build_dir}/${output_name}" ]

if (chip_simple_hash_verification == 1) {
args = [ "--simple-hash" ]
}
}

group("default") {
Expand Down
22 changes: 22 additions & 0 deletions examples/contact-sensor-app/nxp/k32w/k32w0/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,10 @@ SSBL demo application can be imported from the `Quickstart panel`:
![SSBL Application Select](../../../../platform/nxp/k32w/k32w0/doc/images/ssbl_select.JPG)
### Features
#### Multi image
To support multi-image OTA feature, the SSBL project must be compiled using the
following defines:
Expand All @@ -457,6 +461,24 @@ Optionally, add the following defines:
![SSBL_MULTI_IMAGE](../../../../platform/nxp/k32w/k32w0/doc/images/ssbl_multi_image.JPG)
#### Simple hash verification
When secure boot is not used, a simple hash can be appended at the end of the
image for integrity check. Applications should be built with
`chip_simple_hash_verification=1`.
To support simple hash verification feature, the SSBL project must be compiled
with:
- `gSimpleHashVerification=1`
and update the post-build command to use simple hash verification instead of the
default options. Go to
`Project -> Properties -> C/C++ Build -> Settings -> Build steps` and press
`Edit` under `Post-build steps` subsection. The command should look similar to:
![SSBL_SIMPLE_HASH_VERIFICATION](../../../../platform/nxp/k32w/k32w0/doc/images/ssbl_simple_hash.JPG)
Once compiled, the required SSBL file is called `k32w061dk6_ssbl.bin`.
![SSBL_BIN](../../../../platform/nxp/k32w/k32w0/doc/images/ssbl_bin.JPG)
Expand Down
4 changes: 4 additions & 0 deletions examples/contact-sensor-app/nxp/k32w/k32w0/args.gni
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,7 @@ k32w0_sdk_target = get_label_info(":sdk", "label_no_toolchain")
chip_enable_ota_requestor = true
chip_stack_lock_tracking = "fatal"
chip_enable_ble = true

chip_enable_icd_server = true
chip_persist_subscriptions = true
chip_subscription_timeout_resumption = true
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@
#define CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID 0x1037
#define CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID 0xA220

// Set the following define to use the Certification Declaration from below and not use it stored in factory data section
#ifndef CHIP_USE_DEVICE_CONFIG_CERTIFICATION_DECLARATION
#define CHIP_USE_DEVICE_CONFIG_CERTIFICATION_DECLARATION 0
#endif

#ifndef CHIP_DEVICE_CONFIG_CERTIFICATION_DECLARATION
//-> format_version = 1
//-> vendor_id = 0x1037
Expand Down Expand Up @@ -188,8 +193,7 @@
#define CHIP_CONFIG_MAX_FABRICS 5 // 5 is the minimum number of supported fabrics

#define CHIP_DEVICE_CONFIG_ENABLE_SED 1
#define CHIP_DEVICE_CONFIG_ICD_SLOW_POLL_INTERVAL 1000_ms32
#define CHIP_DEVICE_CONFIG_ICD_FAST_POLL_INTERVAL 100_ms32

/**
* @def CHIP_IM_MAX_NUM_COMMAND_HANDLER
*
Expand Down
25 changes: 25 additions & 0 deletions examples/contact-sensor-app/nxp/k32w/k32w0/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
#include <src/platform/nxp/k32w/common/OTAImageProcessorImpl.h>
#endif

#include "BLEManagerImpl.h"

#include "Keyboard.h"
#include "LED.h"
#include "LEDWidget.h"
Expand Down Expand Up @@ -123,6 +125,18 @@ CHIP_ERROR AppTask::StartAppTask()
return err;
}

static void app_gap_callback(gapGenericEvent_t * event)
{
/* This callback is called in the context of BLE task, so event processing
* should be posted to app task. */
}

static void app_gatt_callback(deviceId_t id, gattServerEvent_t * event)
{
/* This callback is called in the context of BLE task, so event processing
* should be posted to app task. */
}

#if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR
static void CheckOtaEntry()
{
Expand Down Expand Up @@ -240,6 +254,17 @@ CHIP_ERROR AppTask::Init()

K32W_LOG("Current Software Version: %s, %" PRIu32, currentSoftwareVer, currentVersion);

#if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR
/* SSBL will always be seen as booting from address 0, thanks to the remapping mechanism.
* This means the SSBL version will always offset from address 0. */
extern uint32_t __MATTER_SSBL_VERSION_START[];
K32W_LOG("Current SSBL Version: %ld. Found at address 0x%lx", *((uint32_t *) __MATTER_SSBL_VERSION_START),
(uint32_t) __MATTER_SSBL_VERSION_START);
#endif

auto & bleManager = chip::DeviceLayer::Internal::BLEMgrImpl();
bleManager.RegisterAppCallbacks(app_gap_callback, app_gatt_callback);

return err;
}

Expand Down
17 changes: 17 additions & 0 deletions examples/contact-sensor-app/nxp/k32w/k32w1/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
#include <src/platform/nxp/k32w/common/OTAImageProcessorImpl.h>
#endif

#include <src/platform/nxp/k32w/k32w1/BLEManagerImpl.h>

#include "K32W1PersistentStorageOpKeystore.h"

#include "LEDWidget.h"
Expand Down Expand Up @@ -106,6 +108,18 @@ static BDXDownloader gDownloader __attribute__((section(".data")));
constexpr uint16_t requestedOtaBlockSize = 1024;
#endif

static void app_gap_callback(gapGenericEvent_t * event)
{
/* This callback is called in the context of BLE task, so event processing
* should be posted to app task. */
}

static void app_gatt_callback(deviceId_t id, gattServerEvent_t * event)
{
/* This callback is called in the context of BLE task, so event processing
* should be posted to app task. */
}

CHIP_ERROR AppTask::StartAppTask()
{
CHIP_ERROR err = CHIP_NO_ERROR;
Expand Down Expand Up @@ -188,6 +202,9 @@ CHIP_ERROR AppTask::Init()

K32W_LOG("Current Software Version: %s, %d", currentSoftwareVer, currentVersion);

auto & bleManager = chip::DeviceLayer::Internal::BLEMgrImpl();
bleManager.RegisterAppCallbacks(app_gap_callback, app_gatt_callback);

return err;
}

Expand Down
5 changes: 5 additions & 0 deletions examples/lighting-app/nxp/k32w/k32w0/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import("${chip_root}/src/platform/device.gni")

declare_args() {
chip_software_version = 0
chip_simple_hash_verification = 0
}

if (chip_pw_tokenizer_logging) {
Expand Down Expand Up @@ -170,6 +171,10 @@ action("binsign") {
script = "${k32w0_platform_dir}/scripts/sign-outdir.py"
output_name = "bignsign.log"
outputs = [ "${root_build_dir}/${output_name}" ]

if (chip_simple_hash_verification == 1) {
args = [ "--simple-hash" ]
}
}

group("default") {
Expand Down
22 changes: 22 additions & 0 deletions examples/lighting-app/nxp/k32w/k32w0/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,10 @@ SSBL demo application can be imported from the `Quickstart panel`:

![SSBL Application Select](../../../../platform/nxp/k32w/k32w0/doc/images/ssbl_select.JPG)

### Features

#### Multi image

To support multi-image OTA feature, the SSBL project must be compiled using the
following defines:

Expand All @@ -474,6 +478,24 @@ Optionally, add the following defines:

![SSBL_MULTI_IMAGE](../../../../platform/nxp/k32w/k32w0/doc/images/ssbl_multi_image.JPG)

#### Simple hash verification

When secure boot is not used, a simple hash can be appended at the end of the
image for integrity check. Applications should be built with
`chip_simple_hash_verification=1`.

To support simple hash verification feature, the SSBL project must be compiled
with:

- `gSimpleHashVerification=1`

and update the post-build command to use simple hash verification instead of the
default options. Go to
`Project -> Properties -> C/C++ Build -> Settings -> Build steps` and press
`Edit` under `Post-build steps` subsection. The command should look similar to:

![SSBL_SIMPLE_HASH_VERIFICATION](../../../../platform/nxp/k32w/k32w0/doc/images/ssbl_simple_hash.JPG)

Once compiled, the required SSBL file is called `k32w061dk6_ssbl.bin`.

![SSBL_BIN](../../../../platform/nxp/k32w/k32w0/doc/images/ssbl_bin.JPG)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@
#define CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID 0x1037
#define CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID 0xA220

// Set the following define to use the Certification Declaration from below and not use it stored in factory data section
#ifndef CHIP_USE_DEVICE_CONFIG_CERTIFICATION_DECLARATION
#define CHIP_USE_DEVICE_CONFIG_CERTIFICATION_DECLARATION 0
#endif

#ifndef CHIP_DEVICE_CONFIG_CERTIFICATION_DECLARATION
//-> format_version = 1
//-> vendor_id = 0x1037
Expand Down
25 changes: 23 additions & 2 deletions examples/lighting-app/nxp/k32w/k32w0/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,14 @@ CHIP_ERROR AppTask::Init()

K32W_LOG("Current Software Version: %s, %" PRIu32, currentSoftwareVer, currentVersion);

#if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR
/* SSBL will always be seen as booting from address 0, thanks to the remapping mechanism.
* This means the SSBL version will always offset from address 0. */
extern uint32_t __MATTER_SSBL_VERSION_START[];
K32W_LOG("Current SSBL Version: %ld. Found at address 0x%lx", *((uint32_t *) __MATTER_SSBL_VERSION_START),
(uint32_t) __MATTER_SSBL_VERSION_START);
#endif

return err;
}

Expand Down Expand Up @@ -897,11 +905,24 @@ void AppTask::PostTurnOnActionRequest(int32_t aActor, LightingManager::Action_t

void AppTask::PostEvent(const AppEvent * aEvent)
{
portBASE_TYPE taskToWake = pdFALSE;
if (sAppEventQueue != NULL)
{
if (!xQueueSend(sAppEventQueue, aEvent, 1))
if (__get_IPSR())
{
K32W_LOG("Failed to post event to app task event queue");
if (!xQueueSendToFrontFromISR(sAppEventQueue, aEvent, &taskToWake))
{
K32W_LOG("Failed to post event to app task event queue");
}

portYIELD_FROM_ISR(taskToWake);
}
else
{
if (!xQueueSend(sAppEventQueue, aEvent, 1))
{
K32W_LOG("Failed to post event to app task event queue");
}
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions examples/lock-app/nxp/k32w/k32w0/args.gni
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,7 @@ k32w0_sdk_target = get_label_info(":sdk", "label_no_toolchain")

chip_stack_lock_tracking = "fatal"
chip_enable_ble = true

chip_enable_icd_server = true
chip_persist_subscriptions = true
chip_subscription_timeout_resumption = true
7 changes: 5 additions & 2 deletions examples/lock-app/nxp/k32w/k32w0/include/CHIPProjectConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@
#define CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID 0x1037
#define CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID 0xA220

// Set the following define to use the Certification Declaration from below and not use it stored in factory data section
#ifndef CHIP_USE_DEVICE_CONFIG_CERTIFICATION_DECLARATION
#define CHIP_USE_DEVICE_CONFIG_CERTIFICATION_DECLARATION 0
#endif

#ifndef CHIP_DEVICE_CONFIG_CERTIFICATION_DECLARATION
//-> format_version = 1
//-> vendor_id = 0x1037
Expand Down Expand Up @@ -179,8 +184,6 @@
#define CHIP_CONFIG_MAX_FABRICS 5 // 5 is the minimum number of supported fabrics

#define CHIP_DEVICE_CONFIG_ENABLE_SED 1
#define CHIP_DEVICE_CONFIG_ICD_SLOW_POLL_INTERVAL 1000_ms32
#define CHIP_DEVICE_CONFIG_ICD_FAST_POLL_INTERVAL 100_ms32

/**
* CHIP_CONFIG_EVENT_LOGGING_DEFAULT_IMPORTANCE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -432,8 +432,13 @@ SECTIONS

__StackLimit = _vStackTop - STACK_SIZE;

__FACTORY_DATA_START = FACTORY_DATA_START_ADDRESS;
__FACTORY_DATA_SIZE = m_factory_data_size;
__MATTER_FACTORY_DATA_START = FACTORY_DATA_START_ADDRESS;
__MATTER_FACTORY_DATA_SIZE = m_factory_data_size;

/* The .ro_version section inside SSBL is set after the .m_interrupts sections,
* which is assumed to never change, so the offset remains the same across different
* SSBL versions. This symbol is used in Matter Application to retrieve the SSBL version. */
__MATTER_SSBL_VERSION_START = 0x00000120;

ASSERT(((m_app_start + m_app_size + m_app_meta_data + m_factory_data_size + m_flash_config_size) <= m_int_flash_size),
"Internal flash capacity exceeded")
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 4af68ac

Please sign in to comment.