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

[ST] Adding STM32 platform and lighting app example with STM32WB5MM-DK board #28889

Merged
merged 39 commits into from
Sep 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
1826add
add stm32cubewb submodule
STYoannZamaron Aug 25, 2023
765cee8
move submodule stm32cubewb to tag v1.17.0
STYoannZamaron Aug 25, 2023
08d0bdb
fix align in gitmodules
STYoannZamaron Aug 25, 2023
426f6e6
add st in third_party
STYoannZamaron Aug 25, 2023
e75280a
add builds and scripts to compile stm32 examples
STYoannZamaron Aug 25, 2023
b7f6949
add stm32 platform in matter source files and modifi gn files to use …
STYoannZamaron Aug 25, 2023
44ad5b9
add stm32 lighting app example using stm32wb5mm-dk board
STYoannZamaron Aug 25, 2023
a6b0292
put chip_detail_logging to false to optimize the size of the flash
STYoannZamaron Aug 25, 2023
c9280da
add support for st CI
STYoannZamaron Aug 25, 2023
b75f7de
typo fixs for ci
STYoannZamaron Aug 25, 2023
ea3efc7
add st getting started readme
STYoannZamaron Aug 25, 2023
e4dbe93
remove duplicate license
STYoannZamaron Aug 25, 2023
cbcc196
minor fixs in readme and stm32 getting started and add st getting sta…
STYoannZamaron Aug 25, 2023
f6893ca
typo fix
STYoannZamaron Aug 25, 2023
b3f98bf
Merge branch 'project-chip:master' into feature_stm32_platform
STYoannZamaron Aug 25, 2023
1edebf9
mispells fix
STYoannZamaron Aug 25, 2023
f8864a0
Merge branch 'master' into feature_stm32_platform
STYoannZamaron Aug 25, 2023
cd8b349
Restyled by whitespace
restyled-commits Aug 25, 2023
90c6d8f
Restyled by clang-format
restyled-commits Aug 25, 2023
bdab625
Restyled by gn
restyled-commits Aug 25, 2023
2ef1202
Restyled by prettier-markdown
restyled-commits Aug 25, 2023
447938f
Restyled by shellharden
restyled-commits Aug 25, 2023
17e861b
Restyled by shfmt
restyled-commits Aug 25, 2023
0370341
Restyled by isort
restyled-commits Aug 25, 2023
7d5e702
Revert "Restyled by clang-format"
STYoannZamaron Aug 25, 2023
7d62612
move otp to example and fix misspell and remove case sensitive in wor…
STYoannZamaron Aug 28, 2023
aaed463
remove unused defines and change return message for unused fonctions
STYoannZamaron Aug 28, 2023
0b5569a
Update docs/guides/stm32_getting_started_guide.md
STYoannZamaron Aug 28, 2023
e4e755c
Update docs/guides/stm32_getting_started_guide.md
STYoannZamaron Aug 28, 2023
9e07713
Restyled by whitespace
restyled-commits Aug 28, 2023
bff6d48
convert windows to linux file
STYoannZamaron Aug 28, 2023
9f5c448
convert windows to linux files
STYoannZamaron Aug 28, 2023
78b5714
Restyled by whitespace
restyled-commits Aug 28, 2023
e28e2db
Restyled by clang-format
restyled-commits Aug 28, 2023
8d4736c
add missing include
STYoannZamaron Aug 28, 2023
9b13afd
Merge branch 'master' into feature_stm32_platform
STYoannZamaron Aug 28, 2023
2d310da
removed unused arguments
STYoannZamaron Sep 6, 2023
ce39148
Merge branch 'master' into feature_stm32_platform
STYoannZamaron Sep 6, 2023
efd0106
update shutdown to call the upper class
STYoannZamaron Sep 6, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/.wordlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1276,6 +1276,9 @@ StatusCode
stderr
stdout
sterm
stmicroelectronics
stm
andy31415 marked this conversation as resolved.
Show resolved Hide resolved
stlink
storagepath
str
strcpy
Expand Down Expand Up @@ -1352,6 +1355,7 @@ ThreadNetworkDiagnostics
threadOperationalDataset
ThreadStackManager
ThreadStackManagerImpl
thread
ths
Thunderboard
timedInteractionTimeoutMs
Expand Down
71 changes: 71 additions & 0 deletions .github/workflows/examples-stm32.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Copyright (c) 2020-2021 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.

name: Build example - stm32

on:
push:
pull_request:
merge_group:

concurrency:
group: ${{ github.ref }}-${{ github.workflow }}-${{ (github.event_name == 'pull_request' && github.event.number) || (github.event_name == 'workflow_dispatch' && github.run_number) || github.sha }}
cancel-in-progress: true

env:
CHIP_NO_LOG_TIMESTAMPS: true

jobs:
stm32:
name: stm32
timeout-minutes: 60

env:
BUILD_TYPE: gn_stm32

runs-on: ubuntu-latest
if: github.actor != 'restyled-io[bot]'

container:
image: ghcr.io/project-chip/chip-build:1
volumes:
- "/tmp/bloat_reports:/tmp/bloat_reports"
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Checkout submodules & Bootstrap
uses: ./.github/actions/checkout-submodules-and-bootstrap
with:
platform: stm32

- name: Set up environment for size reports
uses: ./.github/actions/setup-size-reports
if: ${{ !env.ACT }}
with:
gh-context: ${{ toJson(github) }}

- name: Build stm32 example apps
timeout-minutes: 20
run: |
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py \
--target stm32-STM32WB5MM-DK-light build \
"

- name: Uploading Size Reports
uses: ./.github/actions/upload-size-reports
if: ${{ !env.ACT }}
with:
platform-name: stm32

6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -319,3 +319,9 @@
url = https://github.com/SiliconLabs/wiseconnect
branch = master
platforms = efr32
[submodule "third_party/st/STM32CubeWB"]
path = third_party/st/STM32CubeWB
url = https://github.com/STMicroelectronics/STM32CubeWB.git
branch = v1.17.0
platform = stm32

3 changes: 3 additions & 0 deletions BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,9 @@ if (current_toolchain != "${dir_pw_toolchain}/default:default") {

# Set this to true to enable genio builds by default.
enable_genio_builds = false

# Set this to true to enable stm32 builds by default.
enable_stm32_builds = false
}

# Pigweed does not provide a clang in some configurations.
Expand Down
18 changes: 18 additions & 0 deletions build_overrides/stm32_sdk.gni
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright (c) 2023 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 stm32 SDK build files.
stm32_sdk_build_root = "//third_party/st"
}
25 changes: 25 additions & 0 deletions config/stm32/toolchain/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright (c) 2023 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.

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

import("${build_root}/toolchain/arm_gcc/arm_toolchain.gni")

arm_toolchain("stm32_lighting_app") {
toolchain_args = {
current_os = "freertos"
import("${chip_root}/examples/lighting-app/stm32/args.gni")
}
}
1 change: 1 addition & 0 deletions docs/guides/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
- [Silicon Labs - Documentation](https://github.com/SiliconLabs/matter#readme)
- [Silicon Labs - Building](./silabs_efr32_building.md)
- [Silicon Labs - Software Update](./silabs_efr32_software_update.md)
- [STMicroelectronics (STM32)](./stm32_getting_started_guide.md)
- [TI - Platform Overview](./ti_platform_overview.md)
- [Open IoT SDK - Platform Overview](./openiotsdk_platform_overview.md)
- [Open IoT SDK - Examples](./openiotsdk_examples.md)
Expand Down
103 changes: 103 additions & 0 deletions docs/guides/stm32_getting_started_guide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# STM32 Getting Started Guide

The stm32 platform uses
[Matter](https://github.com/project-chip/connectedhomeip) sdk with FreeRTOS.

---

- [stm32 Getting Started Guide](#stm32-getting-started-guide)
- [Supported Chips](#supported-chips)
- [Matter Example Applications](#matter-example-applications)
- [Building the Example Application](#building-the-example-application)
- [Commissioning](#commissioning)
- [BLE-Thread mode](#ble-thread-mode)

---

## Supported Chips

The stm32 platform is supported on:

- [STM32WB5MM-DK](https://www.st.com/en/evaluation-tools/stm32wb5mm-dk.html)

## Matter Example Applications

Sample Matter applications are provided for the stm32 platform. They can be used
to speed up development. You can find them in the samples with `/stm32`
subfolder.

## Building the Example Application

- [Set Up Matter Environment](./BUILDING.md)

- Set up STLINK tools

```
apt-get install stlink-tools
```

- Building the Application

If the lighting example is to be built:

```
./scripts/build/build_examples.py --target stm32-$stm32_BOARD-lighting build
```

- The output image files are stored in the subdirectories under `out`, the
subdirectory name is the same as the argument specified after the option
`--target` when build the examples.

- After building the application, `ST-LINK` tool is used to flash it to the
board. Before flashing the application, you will need to flash the fuse and
the co processor binary. The co processor binary and fuse are available
[here](https://github.com/stm32-hotspot/stm32wb-matter-device-over-thread/tree/main/Projects/STM32WB_Copro_Wireless_Binaries/STM32WB5x)
Dynamic Concurrent Mode BLE Thread for Matter (Supports Full BLE Stack 5.2
certified and Minimal Thread Device ready v1.3)

```
sudo st-flash write chip-stm32-lighting-example.bin 0x08000000

```

## Commissioning

There is one commissioning modes supported by stm32 platform:

### BLE-Thread mode

1. Build and Flash
2. The example will run automatically after booting the stm32 board.
3. Restore factory settings using B1 button by pressing at least 10 seconds
4. Commissioning with
[Chip-Tool](https://github.com/project-chip/connectedhomeip/tree/master/examples/chip-tool),for
example:

```
./chip-tool pairing ble-thread <node_id> <hex:xxx> <pin_code> <discriminator>
```

### Bluetooth LE advertising

In this example, to commission the device onto a Matter network, it must be
discoverable over Bluetooth LE. After powering up the device, the device will
advertise automatically for 30 seconds. After this delay, you will need to reset
the device to start the commissioning procedure.

### Bluetooth LE rendezvous

In Matter, the commissioning procedure is done over Bluetooth LE between a
Matter device and the Matter controller(, where the controller has the
commissioner role.

To start the rendezvous, the controller must get the commissioning information
from the Matter device. The data payload is encoded within a QR code, printed to
the UART console.

### Thread provisioning

The provisioning operation, which is the Last part of the rendezvous procedure,
involves sending the Thread network credentials from the Matter controller to
the Matter device. As a result, the device joins the Thread network via a
OpenThread border Router (OTBR) and can communicate with other devices in the
network.
18 changes: 18 additions & 0 deletions examples/build_overrides/stm32_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 stm32 SDK.
stm32_sdk_build_root = "//third_party/connectedhomeip/third_party/st"
}
28 changes: 28 additions & 0 deletions examples/lighting-app/stm32/.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# 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.

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")
}
Loading