Skip to content

Commit 0b9dfec

Browse files
STYoannZamaronrestyled-commitsbzbarsky-apple
authored
[ST] Adding STM32 platform and lighting app example with STM32WB5MM-DK board (#28889)
* add stm32cubewb submodule * move submodule stm32cubewb to tag v1.17.0 * fix align in gitmodules * add st in third_party * add builds and scripts to compile stm32 examples * add stm32 platform in matter source files and modifi gn files to use st as a third party * add stm32 lighting app example using stm32wb5mm-dk board * put chip_detail_logging to false to optimize the size of the flash * add support for st CI * typo fixs for ci * add st getting started readme * remove duplicate license * minor fixs in readme and stm32 getting started and add st getting started to the guides/readme * typo fix * mispells fix * Restyled by whitespace * Restyled by clang-format * Restyled by gn * Restyled by prettier-markdown * Restyled by shellharden * Restyled by shfmt * Restyled by isort * Revert "Restyled by clang-format" This reverts commit 90c6d8f. * move otp to example and fix misspell and remove case sensitive in wordlist * remove unused defines and change return message for unused fonctions * Update docs/guides/stm32_getting_started_guide.md Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Update docs/guides/stm32_getting_started_guide.md Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Restyled by whitespace * convert windows to linux file * convert windows to linux files * Restyled by whitespace * Restyled by clang-format * add missing include * removed unused arguments * update shutdown to call the upper class --------- Co-authored-by: Restyled.io <commits@restyled.io> Co-authored-by: Boris Zbarsky <bzbarsky@apple.com>
1 parent b94eb85 commit 0b9dfec

File tree

120 files changed

+19412
-2
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

120 files changed

+19412
-2
lines changed

.github/.wordlist.txt

+4
Original file line numberDiff line numberDiff line change
@@ -1276,6 +1276,9 @@ StatusCode
12761276
stderr
12771277
stdout
12781278
sterm
1279+
stmicroelectronics
1280+
stm
1281+
stlink
12791282
storagepath
12801283
str
12811284
strcpy
@@ -1352,6 +1355,7 @@ ThreadNetworkDiagnostics
13521355
threadOperationalDataset
13531356
ThreadStackManager
13541357
ThreadStackManagerImpl
1358+
thread
13551359
ths
13561360
Thunderboard
13571361
timedInteractionTimeoutMs

.github/workflows/examples-stm32.yaml

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Copyright (c) 2020-2021 Project CHIP Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: Build example - stm32
16+
17+
on:
18+
push:
19+
pull_request:
20+
merge_group:
21+
22+
concurrency:
23+
group: ${{ github.ref }}-${{ github.workflow }}-${{ (github.event_name == 'pull_request' && github.event.number) || (github.event_name == 'workflow_dispatch' && github.run_number) || github.sha }}
24+
cancel-in-progress: true
25+
26+
env:
27+
CHIP_NO_LOG_TIMESTAMPS: true
28+
29+
jobs:
30+
stm32:
31+
name: stm32
32+
timeout-minutes: 60
33+
34+
env:
35+
BUILD_TYPE: gn_stm32
36+
37+
runs-on: ubuntu-latest
38+
if: github.actor != 'restyled-io[bot]'
39+
40+
container:
41+
image: ghcr.io/project-chip/chip-build:1
42+
volumes:
43+
- "/tmp/bloat_reports:/tmp/bloat_reports"
44+
steps:
45+
- name: Checkout
46+
uses: actions/checkout@v3
47+
- name: Checkout submodules & Bootstrap
48+
uses: ./.github/actions/checkout-submodules-and-bootstrap
49+
with:
50+
platform: stm32
51+
52+
- name: Set up environment for size reports
53+
uses: ./.github/actions/setup-size-reports
54+
if: ${{ !env.ACT }}
55+
with:
56+
gh-context: ${{ toJson(github) }}
57+
58+
- name: Build stm32 example apps
59+
timeout-minutes: 20
60+
run: |
61+
./scripts/run_in_build_env.sh \
62+
"./scripts/build/build_examples.py \
63+
--target stm32-STM32WB5MM-DK-light build \
64+
"
65+
66+
- name: Uploading Size Reports
67+
uses: ./.github/actions/upload-size-reports
68+
if: ${{ !env.ACT }}
69+
with:
70+
platform-name: stm32
71+

.gitmodules

+6
Original file line numberDiff line numberDiff line change
@@ -319,3 +319,9 @@
319319
url = https://github.com/SiliconLabs/wiseconnect
320320
branch = master
321321
platforms = efr32
322+
[submodule "third_party/st/STM32CubeWB"]
323+
path = third_party/st/STM32CubeWB
324+
url = https://github.com/STMicroelectronics/STM32CubeWB.git
325+
branch = v1.17.0
326+
platform = stm32
327+

BUILD.gn

+3
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,9 @@ if (current_toolchain != "${dir_pw_toolchain}/default:default") {
276276

277277
# Set this to true to enable genio builds by default.
278278
enable_genio_builds = false
279+
280+
# Set this to true to enable stm32 builds by default.
281+
enable_stm32_builds = false
279282
}
280283

281284
# Pigweed does not provide a clang in some configurations.

build_overrides/stm32_sdk.gni

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Copyright (c) 2023 Project CHIP Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
declare_args() {
16+
# Root directory for stm32 SDK build files.
17+
stm32_sdk_build_root = "//third_party/st"
18+
}

config/stm32/toolchain/BUILD.gn

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Copyright (c) 2023 Project CHIP Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
import("//build_overrides/build.gni")
16+
import("//build_overrides/chip.gni")
17+
18+
import("${build_root}/toolchain/arm_gcc/arm_toolchain.gni")
19+
20+
arm_toolchain("stm32_lighting_app") {
21+
toolchain_args = {
22+
current_os = "freertos"
23+
import("${chip_root}/examples/lighting-app/stm32/args.gni")
24+
}
25+
}

docs/guides/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
- [Silicon Labs - Documentation](https://github.com/SiliconLabs/matter#readme)
2323
- [Silicon Labs - Building](./silabs_efr32_building.md)
2424
- [Silicon Labs - Software Update](./silabs_efr32_software_update.md)
25+
- [STMicroelectronics (STM32)](./stm32_getting_started_guide.md)
2526
- [TI - Platform Overview](./ti_platform_overview.md)
2627
- [Open IoT SDK - Platform Overview](./openiotsdk_platform_overview.md)
2728
- [Open IoT SDK - Examples](./openiotsdk_examples.md)
+103
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
# STM32 Getting Started Guide
2+
3+
The stm32 platform uses
4+
[Matter](https://github.com/project-chip/connectedhomeip) sdk with FreeRTOS.
5+
6+
---
7+
8+
- [stm32 Getting Started Guide](#stm32-getting-started-guide)
9+
- [Supported Chips](#supported-chips)
10+
- [Matter Example Applications](#matter-example-applications)
11+
- [Building the Example Application](#building-the-example-application)
12+
- [Commissioning](#commissioning)
13+
- [BLE-Thread mode](#ble-thread-mode)
14+
15+
---
16+
17+
## Supported Chips
18+
19+
The stm32 platform is supported on:
20+
21+
- [STM32WB5MM-DK](https://www.st.com/en/evaluation-tools/stm32wb5mm-dk.html)
22+
23+
## Matter Example Applications
24+
25+
Sample Matter applications are provided for the stm32 platform. They can be used
26+
to speed up development. You can find them in the samples with `/stm32`
27+
subfolder.
28+
29+
## Building the Example Application
30+
31+
- [Set Up Matter Environment](./BUILDING.md)
32+
33+
- Set up STLINK tools
34+
35+
```
36+
apt-get install stlink-tools
37+
```
38+
39+
- Building the Application
40+
41+
If the lighting example is to be built:
42+
43+
```
44+
./scripts/build/build_examples.py --target stm32-$stm32_BOARD-lighting build
45+
```
46+
47+
- The output image files are stored in the subdirectories under `out`, the
48+
subdirectory name is the same as the argument specified after the option
49+
`--target` when build the examples.
50+
51+
- After building the application, `ST-LINK` tool is used to flash it to the
52+
board. Before flashing the application, you will need to flash the fuse and
53+
the co processor binary. The co processor binary and fuse are available
54+
[here](https://github.com/stm32-hotspot/stm32wb-matter-device-over-thread/tree/main/Projects/STM32WB_Copro_Wireless_Binaries/STM32WB5x)
55+
Dynamic Concurrent Mode BLE Thread for Matter (Supports Full BLE Stack 5.2
56+
certified and Minimal Thread Device ready v1.3)
57+
58+
```
59+
sudo st-flash write chip-stm32-lighting-example.bin 0x08000000
60+
61+
```
62+
63+
## Commissioning
64+
65+
There is one commissioning modes supported by stm32 platform:
66+
67+
### BLE-Thread mode
68+
69+
1. Build and Flash
70+
2. The example will run automatically after booting the stm32 board.
71+
3. Restore factory settings using B1 button by pressing at least 10 seconds
72+
4. Commissioning with
73+
[Chip-Tool](https://github.com/project-chip/connectedhomeip/tree/master/examples/chip-tool),for
74+
example:
75+
76+
```
77+
./chip-tool pairing ble-thread <node_id> <hex:xxx> <pin_code> <discriminator>
78+
```
79+
80+
### Bluetooth LE advertising
81+
82+
In this example, to commission the device onto a Matter network, it must be
83+
discoverable over Bluetooth LE. After powering up the device, the device will
84+
advertise automatically for 30 seconds. After this delay, you will need to reset
85+
the device to start the commissioning procedure.
86+
87+
### Bluetooth LE rendezvous
88+
89+
In Matter, the commissioning procedure is done over Bluetooth LE between a
90+
Matter device and the Matter controller(, where the controller has the
91+
commissioner role.
92+
93+
To start the rendezvous, the controller must get the commissioning information
94+
from the Matter device. The data payload is encoded within a QR code, printed to
95+
the UART console.
96+
97+
### Thread provisioning
98+
99+
The provisioning operation, which is the Last part of the rendezvous procedure,
100+
involves sending the Thread network credentials from the Matter controller to
101+
the Matter device. As a result, the device joins the Thread network via a
102+
OpenThread border Router (OTBR) and can communicate with other devices in the
103+
network.
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Copyright (c) 2020 Project CHIP Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
declare_args() {
16+
# Root directory for stm32 SDK.
17+
stm32_sdk_build_root = "//third_party/connectedhomeip/third_party/st"
18+
}

examples/lighting-app/stm32/.gn

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Copyright (c) 2020 Project CHIP Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
import("//build_overrides/build.gni")
16+
17+
# The location of the build configuration file.
18+
buildconfig = "${build_root}/config/BUILDCONFIG.gn"
19+
20+
# CHIP uses angle bracket includes.
21+
check_system_includes = true
22+
23+
default_args = {
24+
target_cpu = "arm"
25+
target_os = "freertos"
26+
27+
import("//args.gni")
28+
}

0 commit comments

Comments
 (0)