Skip to content

Commit

Permalink
[NXP] Initial support for K32W1 (#28777)
Browse files Browse the repository at this point in the history
* [NXP] Introducing Matter support for K32W1

Additional information:
* SDK: 2.12.5 K32W148-EVK, downloadable from https://mcuxpresso.nxp.com
* MCU overview: https://www.nxp.com/products/wireless/multiprotocol-mcus/secure-and-ultra-low-power-mcu-for-matter-over-thread-and-bluetooth-le-5-3:K32W148

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

* [NXP] Add CI/CV support for K32W1

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

* [NXP] Bump ot-nxp submodule

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

* [K32W] Add OPENTHREAD_PLATFORM_CORE_CONFIG_FILE define

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

* [K32W1] Fix misspell

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

* Restyled by whitespace

* Restyled by clang-format

* Restyled by gn

* Restyled by prettier-markdown

* Restyled by autopep8

* Restyled by isort

* [K32W1] Fix lint errors

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

* [K32W1] Removed deprecated class

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

* Restyled by clang-format

* [test] Update testdata/all_targets_linux_x64 with K32W1 targets

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

* [K32W] Fix target names in workflow

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

* [K32W1] Remove deprecated commented sections

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

* [K32W1] Add missing # to reference targets in README

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

* [K32W1] Fix spelling errors

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

* [K32W1] Update CSR crypto flag usage

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

* [K32W1] Remove ResetWatermarks empty implementation

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

* Fix typo in device.gni after fixing conflict

Signed-off-by: marius-alex-tache <[email protected]>

* [K32W1] Remove anchors and backtick some words

Signed-off-by: marius-alex-tache <[email protected]>

* [K32W] Fix confusing naming in K32W builder

Signed-off-by: marius-alex-tache <[email protected]>

* [K32W] Remove commented option

Signed-off-by: marius-alex-tache <[email protected]>

* [K32W] Fix binary extension format

Signed-off-by: marius-alex-tache <[email protected]>

* Restyled by autopep8

* [K32W] Fix binary name when copying

Signed-off-by: marius-alex-tache <[email protected]>

* Restyled by clang-format

* [K32W1] Fix ErrorStr header inclusion

Signed-off-by: marius-alex-tache <[email protected]>

---------

Signed-off-by: Doru Gucea <[email protected]>
Signed-off-by: Marius Tache <[email protected]>
Signed-off-by: marius-alex-tache <[email protected]>
Co-authored-by: Doru Gucea <[email protected]>
Co-authored-by: Restyled.io <[email protected]>
  • Loading branch information
3 people authored Oct 3, 2023
1 parent 23ebaeb commit 19771ed
Show file tree
Hide file tree
Showing 118 changed files with 12,615 additions and 93 deletions.
34 changes: 22 additions & 12 deletions .github/workflows/examples-k32w.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

name: Build example - K32W with SE051
name: Build example - K32W

on:
push:
Expand All @@ -37,7 +37,7 @@ jobs:
if: github.actor != 'restyled-io[bot]'

container:
image: ghcr.io/project-chip/chip-build-k32w:5
image: ghcr.io/project-chip/chip-build-k32w:6
volumes:
- "/tmp/bloat_reports:/tmp/bloat_reports"
steps:
Expand All @@ -46,7 +46,7 @@ jobs:
- name: Checkout submodules & Bootstrap
uses: ./.github/actions/checkout-submodules-and-bootstrap
with:
platform: k32w0
platform: k32w

- name: Set up environment for size reports
uses: ./.github/actions/setup-size-reports
Expand All @@ -58,32 +58,42 @@ jobs:
run: |
scripts/run_in_build_env.sh "\
./scripts/build/build_examples.py \
--target k32w-light-crypto-platform-tokenizer \
--target k32w-lock-crypto-platform-tokenizer \
--target k32w-lock-crypto-platform-low-power-nologs \
--target k32w-contact-crypto-platform-tokenizer \
--target k32w-contact-crypto-platform-low-power-nologs \
--target k32w-shell-crypto-platform \
--target k32w-k32w0-light-crypto-platform-tokenizer \
--target k32w-k32w0-lock-crypto-platform-tokenizer \
--target k32w-k32w0-lock-crypto-platform-low-power-nologs \
--target k32w-k32w0-contact-crypto-platform-tokenizer \
--target k32w-k32w0-contact-crypto-platform-low-power-nologs \
--target k32w-k32w0-shell-crypto-platform \
--target k32w-k32w1-light-crypto-platform-openthread-ftd \
--target k32w-k32w1-contact-crypto-platform-low-power-nologs \
build \
--copy-artifacts-to out/artifacts \
"
- name: Get light size stats
run: |
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
k32w k32w0+release light \
out/artifacts/k32w-light-crypto-platform-tokenizer/chip-k32w0x-light-example \
out/artifacts/k32w-k32w0-light-crypto-platform-tokenizer/chip-k32w0x-light-example.elf \
/tmp/bloat_reports/
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
k32w k32w1+release light \
out/artifacts/k32w-k32w1-light-crypto-platform-openthread-ftd/chip-k32w1-light-example.elf \
/tmp/bloat_reports/
- name: Get lock size stats
run: |
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
k32w k32w0+release lock \
out/artifacts/k32w-lock-crypto-platform-tokenizer/chip-k32w0x-lock-example \
out/artifacts/k32w-k32w0-lock-crypto-platform-tokenizer/chip-k32w0x-lock-example.elf \
/tmp/bloat_reports/
- name: Get contact size stats
run: |
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
k32w k32w0+release contact \
out/artifacts/k32w-contact-crypto-platform-tokenizer/chip-k32w0x-contact-example \
out/artifacts/k32w-k32w0-contact-crypto-platform-tokenizer/chip-k32w0x-contact-example.elf \
/tmp/bloat_reports/
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
k32w k32w1+release contact \
out/artifacts/k32w-k32w1-contact-crypto-platform-low-power-nologs/chip-k32w1-contact-example.elf \
/tmp/bloat_reports/
- name: Uploading Size Reports
uses: ./.github/actions/upload-size-reports
Expand Down
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,16 @@
path = third_party/freertos/repo
url = https://github.com/FreeRTOS/FreeRTOS-Kernel.git
branch = V10.3.1-kernel-only
platforms = ameba,cc13xx_26xx,bouffalolab,efr32,esp32,k32w0,infineon,qpg,cc32xx,silabs_docker
platforms = ameba,cc13xx_26xx,bouffalolab,efr32,esp32,k32w,infineon,qpg,cc32xx,silabs_docker
[submodule "simw-top-mini"]
path = third_party/simw-top-mini/repo
url = https://github.com/NXP/plug-and-trust.git
branch = int/CHIPSE_Release
platforms = k32w0
platforms = k32w
[submodule "third_party/openthread/ot-nxp"]
path = third_party/openthread/ot-nxp
url = https://github.com/openthread/ot-nxp.git
platforms = k32w0
platforms = k32w
[submodule "third_party/openthread/ot-qorvo"]
path = third_party/openthread/ot-qorvo
url = https://github.com/openthread/ot-qorvo.git
Expand Down
18 changes: 18 additions & 0 deletions build_overrides/k32w1_sdk.gni
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright (c) 2020 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

declare_args() {
# Root directory for K32W SDK build files.
k32w1_sdk_build_root = "//third_party/nxp/k32w1_sdk"
}
19 changes: 19 additions & 0 deletions examples/build_overrides/k32w1_sdk.gni
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright (c) 2020 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

declare_args() {
# Root directory for k32w SDK.
k32w1_sdk_build_root =
"//third_party/connectedhomeip/third_party/nxp/k32w1_sdk"
}
29 changes: 29 additions & 0 deletions examples/contact-sensor-app/nxp/k32w/k32w1/.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copyright (c) 2020-2023 Project CHIP Authors
# Copyright (c) 2023 NXP
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import("//build_overrides/build.gni")

# The location of the build configuration file.
buildconfig = "${build_root}/config/BUILDCONFIG.gn"

# CHIP uses angle bracket includes.
check_system_includes = true

default_args = {
target_cpu = "arm"
target_os = "freertos"

import("//args.gni")
}
136 changes: 136 additions & 0 deletions examples/contact-sensor-app/nxp/k32w/k32w1/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
# Copyright (c) 2021-2023 Project CHIP Authors
# Copyright (c) 2023 NXP
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import("//build_overrides/chip.gni")
import("//build_overrides/k32w1_sdk.gni")
import("//build_overrides/openthread.gni")

import("${k32w1_sdk_build_root}/k32w1_executable.gni")
import("${k32w1_sdk_build_root}/k32w1_sdk.gni")

import("${chip_root}/src/crypto/crypto.gni")
import("${chip_root}/src/lib/core/core.gni")
import("${chip_root}/src/platform/device.gni")

declare_args() {
chip_software_version = 0
}

assert(current_os == "freertos")

k32w1_platform_dir = "${chip_root}/examples/platform/nxp/k32w/k32w1"
k32w1_sdk_root = getenv("NXP_K32W1_SDK_ROOT")

k32w1_sdk("sdk") {
sources = [
"${k32w1_platform_dir}/app/project_include/OpenThreadConfig.h",
"include/CHIPProjectConfig.h",
"include/FreeRTOSConfig.h",
"main/include/app_config.h",
]

public_deps =
[ "${chip_root}/third_party/openthread/platforms:libopenthread-platform" ]

include_dirs = [
"main/include",
"main",
"include",
"${k32w1_platform_dir}/app/project_include",
"${k32w1_platform_dir}/app/support",
"${k32w1_platform_dir}/util/include",
]

defines = []
if (is_debug) {
defines += [ "BUILD_RELEASE=0" ]
} else {
defines += [ "BUILD_RELEASE=1" ]
}

if (chip_software_version != 0) {
defines += [
"CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION=${chip_software_version}",
]
}
}

k32w1_executable("contact_sensor_app") {
output_name = "chip-k32w1-contact-example"

sources = [
"${k32w1_platform_dir}/util/LEDWidget.cpp",
"${k32w1_platform_dir}/util/include/LEDWidget.h",
"main/AppTask.cpp",
"main/ContactSensorManager.cpp",
"main/ZclCallbacks.cpp",
"main/include/AppEvent.h",
"main/include/AppTask.h",
"main/include/ContactSensorManager.h",
"main/main.cpp",
]

deps = [
":sdk",
"${chip_root}/examples/common/QRCode",
"${chip_root}/examples/contact-sensor-app/contact-sensor-common",
"${chip_root}/examples/providers:device_info_provider",
"${chip_root}/src/lib",
"${chip_root}/src/platform:syscalls_stub",
"${chip_root}/third_party/mbedtls:mbedtls",
"${k32w1_platform_dir}/app/support:freertos_mbedtls_utils",
]

if (chip_openthread_ftd) {
deps += [
"${chip_root}/third_party/openthread/repo:libopenthread-cli-ftd",
"${chip_root}/third_party/openthread/repo:libopenthread-ftd",
]
} else {
deps += [
"${chip_root}/third_party/openthread/repo:libopenthread-cli-mtd",
"${chip_root}/third_party/openthread/repo:libopenthread-mtd",
]
}

cflags = [ "-Wconversion" ]

output_dir = root_out_dir

ldscript = "${k32w1_sdk_root}/middleware/wireless/framework/Common/devices/kw45_k32w1/gcc/connectivity.ld"

inputs = [ ldscript ]

ldflags = [
"-Wl,--defsym=__heap_size__=0",
"-Wl,--defsym=__stack_size__=0x480",
"-Wl,--defsym=gNvmSectors=8",
"-Wl,--defsym=lp_ram_lower_limit=0x04000000",
"-Wl,--defsym=lp_ram_upper_limit=0x2001C000",
"-Wl,-print-memory-usage",
"-Wl,--no-warn-rwx-segments",
"-T" + rebase_path(ldscript, root_build_dir),
]

output_dir = root_out_dir
}

group("k32w1") {
deps = [ ":contact_sensor_app" ]
}

group("default") {
deps = [ ":k32w1" ]
}
Loading

0 comments on commit 19771ed

Please sign in to comment.