Skip to content

Commit a6a8f83

Browse files
[Silabs] SLC Lighting-app integration (project-chip#25717)
* Silabs Lighting-app SLC integration * fix ci * fix non-generated build * Apply comments * Fix CI * fix CI
1 parent def9802 commit a6a8f83

File tree

8 files changed

+393
-21
lines changed

8 files changed

+393
-21
lines changed

.github/workflows/examples-efr32.yaml

+5-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,11 @@ jobs:
8282
path: |
8383
.environment/gn_out/.ninja_log
8484
.environment/pigweed-venv/*.log
85-
85+
- name: Test SLC gen
86+
timeout-minutes: 30
87+
run: |
88+
scripts/examples/gn_efr32_example.sh examples/lighting-app/silabs/efr32 ./out/light-app BRD4187C --slc_generate --docker
89+
rm -rf ./out/
8690
- name: Build some BRD4187C variants
8791
timeout-minutes: 90
8892
run: |

examples/lighting-app/silabs/efr32/BUILD.gn

+14
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,20 @@ declare_args() {
4646
chip_print_memory_usage = false
4747
}
4848

49+
if (slc_generate) {
50+
# Generate Project Specific config (Board, hardware used etc..)
51+
print(exec_script("${chip_root}/third_party/silabs/slc_gen/run_slc.py",
52+
[
53+
rebase_path(chip_root),
54+
"${silabs_board}",
55+
"${disable_lcd}",
56+
"${use_wstk_buttons}",
57+
"${use_wstk_leds}",
58+
"${use_external_flash}",
59+
],
60+
"list lines"))
61+
}
62+
4963
efr32_sdk("sdk") {
5064
sources = [
5165
"${efr32_project_dir}/include/CHIPProjectConfig.h",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<!--Custom BLE GATT-->
3+
<gatt gatt_caching="true" generic_attribute_service="true" header="gatt_db.h" name="Custom BLE GATT" out="gatt_db.c" prefix="gattdb_">
4+
5+
<!--Generic Access-->
6+
<service advertise="false" name="Generic Access" requirement="mandatory" sourceId="org.bluetooth.service.generic_access" type="primary" uuid="1800">
7+
<informativeText>Abstract: The generic_access service contains generic information about the device. All available Characteristics are readonly. </informativeText>
8+
9+
<!--Device Name-->
10+
<characteristic const="false" id="device_name" name="Device Name" sourceId="org.bluetooth.characteristic.gap.device_name" uuid="2A00">
11+
<informativeText/>
12+
<value length="13" type="utf-8" variable_length="false">Empty Example</value>
13+
<properties>
14+
<read authenticated="false" bonded="false" encrypted="false"/>
15+
<write authenticated="false" bonded="false" encrypted="false"/>
16+
</properties>
17+
</characteristic>
18+
19+
<!--Appearance-->
20+
<characteristic const="true" name="Appearance" sourceId="org.bluetooth.characteristic.gap.appearance" uuid="2A01">
21+
<informativeText>Abstract: The external appearance of this device. The values are composed of a category (10-bits) and sub-categories (6-bits). </informativeText>
22+
<value length="2" type="hex" variable_length="false">0000</value>
23+
<properties>
24+
<read authenticated="false" bonded="false" encrypted="false"/>
25+
</properties>
26+
</characteristic>
27+
</service>
28+
29+
<!--Device Information-->
30+
<service advertise="false" name="Device Information" requirement="mandatory" sourceId="org.bluetooth.service.device_information" type="primary" uuid="180A">
31+
<informativeText>Abstract: The Device Information Service exposes manufacturer and/or vendor information about a device. Summary: This service exposes manufacturer information about a device. The Device Information Service is instantiated as a Primary Service. Only one instance of the Device Information Service is exposed on a device. </informativeText>
32+
33+
<!--Manufacturer Name String-->
34+
<characteristic const="true" name="Manufacturer Name String" sourceId="org.bluetooth.characteristic.manufacturer_name_string" uuid="2A29">
35+
<informativeText>Abstract: The value of this characteristic is a UTF-8 string representing the name of the manufacturer of the device. </informativeText>
36+
<value length="12" type="utf-8" variable_length="false">Silicon Labs</value>
37+
<properties>
38+
<read authenticated="false" bonded="false" encrypted="false"/>
39+
</properties>
40+
</characteristic>
41+
42+
<!--Model Number String-->
43+
<characteristic const="true" name="Model Number String" sourceId="org.bluetooth.characteristic.model_number_string" uuid="2A24">
44+
<informativeText>Abstract: The value of this characteristic is a UTF-8 string representing the model number assigned by the device vendor. </informativeText>
45+
<value length="10" type="utf-8" variable_length="false">Blue Gecko</value>
46+
<properties>
47+
<read authenticated="false" bonded="false" encrypted="false"/>
48+
</properties>
49+
</characteristic>
50+
51+
<!--System ID-->
52+
<characteristic const="true" name="System ID" sourceId="org.bluetooth.characteristic.system_id" uuid="2A23">
53+
<informativeText>Abstract: The SYSTEM ID characteristic consists of a structure with two fields. The first field are the LSOs and the second field contains the MSOs. This is a 64-bit structure which consists of a 40-bit manufacturer-defined identifier concatenated with a 24 bit unique Organizationally Unique Identifier (OUI). The OUI is issued by the IEEE Registration Authority (http://standards.ieee.org/regauth/index.html) and is required to be used in accordance with IEEE Standard 802-2001.6 while the least significant 40 bits are manufacturer defined. If System ID generated based on a Bluetooth Device Address, it is required to be done as follows. System ID and the Bluetooth Device Address have a very similar structure: a Bluetooth Device Address is 48 bits in length and consists of a 24 bit Company Assigned Identifier (manufacturer defined identifier) concatenated with a 24 bit Company Identifier (OUI). In order to encapsulate a Bluetooth Device Address as System ID, the Company Identifier is concatenated with 0xFFFE followed by the Company Assigned Identifier of the Bluetooth Address. For more guidelines related to EUI-64, refer to http://standards.ieee.org/develop/regauth/tut/eui64.pdf. Examples: If the system ID is based of a Bluetooth Device Address with a Company Identifier (OUI) is 0x123456 and the Company Assigned Identifier is 0x9ABCDE, then the System Identifier is required to be 0x123456FFFE9ABCDE. </informativeText>
54+
<value length="6" type="hex" variable_length="false">000102030405</value>
55+
<properties>
56+
<read authenticated="false" bonded="false" encrypted="false"/>
57+
</properties>
58+
</characteristic>
59+
</service>
60+
61+
<!--CHIPoBLE-->
62+
<service advertise="false" name="CHIPoBLE" requirement="mandatory" sourceId="custom.type" type="primary" uuid="fff6">
63+
<informativeText>Custom service</informativeText>
64+
65+
<!--CHIPoBLEChar_Rx-->
66+
<characteristic const="false" id="CHIPoBLEChar_Rx" name="CHIPoBLEChar_Rx" sourceId="custom.type" uuid="18EE2EF5-263D-4559-959F-4F9C429F9D11">
67+
<informativeText>Custom characteristic</informativeText>
68+
<value length="247" type="hex" variable_length="true">00</value>
69+
<properties>
70+
<read authenticated="false" bonded="false" encrypted="false"/>
71+
<write authenticated="false" bonded="false" encrypted="false"/>
72+
</properties>
73+
</characteristic>
74+
75+
<!--CHIPoBLEChar_Tx-->
76+
<characteristic const="false" id="CHIPoBLEChar_Tx" name="CHIPoBLEChar_Tx" sourceId="custom.type" uuid="18EE2EF5-263D-4559-959F-4F9C429F9D12">
77+
<informativeText>Custom characteristic</informativeText>
78+
<value length="247" type="hex" variable_length="true">00</value>
79+
<properties>
80+
<read authenticated="false" bonded="false" encrypted="false"/>
81+
<write authenticated="false" bonded="false" encrypted="false"/>
82+
<write_no_response authenticated="false" bonded="false" encrypted="false"/>
83+
<indicate authenticated="false" bonded="false" encrypted="false"/>
84+
</properties>
85+
</characteristic>
86+
87+
<characteristic const="false" id="CHIPoBLEChar_C3" name="CHIPoBLEChar_C3" sourceId="custom.type" uuid="64630238-8772-45F2-B87D-748A83218F04">
88+
<informativeText>Custom characteristic</informativeText>
89+
<value length="512" type="hex" variable_length="true">00</value>
90+
<properties>
91+
<read authenticated="false" bonded="false" encrypted="false"/>
92+
<write authenticated="false" bonded="false" encrypted="false"/>
93+
<write_no_response authenticated="false" bonded="false" encrypted="false"/>
94+
<indicate authenticated="false" bonded="false" encrypted="false"/>
95+
</properties>
96+
</characteristic>
97+
98+
</service>
99+
</gatt>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# Silicon Labs Project Configuration Tools: slcp, v0, Component selection file.
2+
project_name: matter-platform
3+
label: matter-platform
4+
description: |
5+
This project contains the minimal requirements to generate the dependencies needed by all Matter examples
6+
category: Matter Examples
7+
filter:
8+
- name: Capability
9+
value: [Multiprotocol]
10+
- name: Device Type
11+
value: [SoC]
12+
- name: Project Difficulty
13+
value: [Advanced]
14+
- name: Wireless Technology
15+
value: [Bluetooth, Thread]
16+
package: OpenThread
17+
quality: production
18+
readme:
19+
- {path: README.md}
20+
source:
21+
- {path: main.c}
22+
- {path: app.c}
23+
- {path: bluetooth_event_callback.c}
24+
tag: [prebuilt_demo]
25+
include:
26+
- path: ''
27+
file_list:
28+
- {path: app.h}
29+
- {path: reset_util.h}
30+
sdk: {id: gecko_sdk, version: 4.2.0}
31+
toolchain_settings: []
32+
33+
component:
34+
- {id: bluetooth_feature_nvm}
35+
- {id: bluetooth_feature_gatt_server}
36+
- {id: nvm3_lib}
37+
- {id: bluetooth_feature_sm}
38+
- {id: bluetooth_feature_gap}
39+
- {id: bluetooth_feature_legacy_advertiser}
40+
- {id: gatt_configuration}
41+
- {id: freertos}
42+
- {id: bluetooth_stack}
43+
- {id: brd4002a}
44+
- {id: rail_util_pti}
45+
- {id: bluetooth_feature_gatt}
46+
- {id: bluetooth_feature_connection}
47+
- {id: psa_crypto}
48+
- {id: rail_lib_multiprotocol}
49+
- {id: bluetooth_feature_system}
50+
- {id: bluetooth_feature_scanner}
51+
- instance: [vcom]
52+
id: uartdrv_usart
53+
- instance: [vcom]
54+
id: uartdrv_eusart
55+
56+
57+
config_file:
58+
- override:
59+
component: gatt_configuration
60+
file_id: gatt_configuration_file_id
61+
path: gatt_configuration.btconf
62+
directory: btconf
63+
64+
configuration:
65+
- {name: SL_BOARD_ENABLE_VCOM, value: '1'}
66+
- {name: SL_MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED, value: '1'}
67+
- {name: SL_MBEDTLS_KEY_EXCHANGE_PSK_ENABLED, value: '1'}
68+
- condition: [uartdrv_usart]
69+
name: UARTDRV_RESTRICT_ENERGY_MODE_TO_ALLOW_RECEPTION
70+
value: '0'
71+
- condition: [iostream_usart]
72+
name: SL_IOSTREAM_USART_VCOM_RESTRICT_ENERGY_MODE_TO_ALLOW_RECEPTION
73+
value: '0'
74+
- condition: [iostream_usart]
75+
name: SL_IOSTREAM_USART_VCOM_RX_BUFFER_SIZE
76+
value: '128'
77+
- {name: SL_HEAP_SIZE, value: '16384'}
78+
- {name: SL_STACK_SIZE, value: '4608'}
79+
80+
requires:
81+
- condition: [device_series_1]
82+
name: uartdrv_usart
83+
- condition: [device_series_2]
84+
name: uartdrv_eusart
85+
- condition: [device_series_2]
86+
name: device_init_dpll
87+
88+
ui_hints:
89+
highlight:
90+
- {path: ./README.md, focus: true}

scripts/examples/gn_efr32_example.sh

+40-6
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,14 @@ else
2828
CHIP_ROOT="$MATTER_ROOT"
2929
fi
3030

31-
source "$CHIP_ROOT/scripts/activate.sh"
32-
3331
set -x
3432
env
3533
USE_WIFI=false
3634
USE_DOCKER=false
3735
USE_GIT_SHA_FOR_VERSION=true
36+
USE_SLC=false
37+
GN_PATH=gn
38+
GN_PATH_PROVIDED=false
3839

3940
SILABS_THREAD_TARGET=\""../silabs:ot-efr32-cert"\"
4041
USAGE="./scripts/examples/gn_efr32_example.sh <AppRootFolder> <outputFolder> <silabs_board_name> [<Build options>]"
@@ -125,6 +126,10 @@ if [ "$#" == "0" ]; then
125126
Change GSDK root for docker builds
126127
--uart_log
127128
Forward Logs to Uart instead of RTT
129+
--slc_generate
130+
Generate files with SLC for current board and options Requires an SLC-CLI installation or running in Docker.
131+
--slc_reuse_files
132+
Use generated files without running slc again.
128133
129134
"
130135
elif [ "$#" -lt "2" ]; then
@@ -214,12 +219,32 @@ else
214219
shift
215220
;;
216221

222+
--slc_generate)
223+
optArgs+="slc_generate=true "
224+
USE_SLC=true
225+
shift
226+
;;
227+
--slc_reuse_files)
228+
optArgs+="slc_reuse_files=true "
229+
USE_SLC=true
230+
shift
231+
;;
232+
--gn_path)
233+
if [ -z "$2" ]; then
234+
echo "--gn_path requires a path to GN"
235+
exit 1
236+
else
237+
GN_PATH="$2"
238+
fi
239+
GN_PATH_PROVIDED=true
240+
shift
241+
shift
242+
;;
217243
*"sl_matter_version_str="*)
218244
optArgs+="$1 "
219245
USE_GIT_SHA_FOR_VERSION=false
220246
shift
221247
;;
222-
223248
*)
224249
if [ "$1" =~ *"use_rs9116=true"* ] || [ "$1" =~ *"use_SiWx917=true"* ] || [ "$1" =~ *"use_wf200=true"* ]; then
225250
USE_WIFI=true
@@ -243,6 +268,10 @@ else
243268
} &>/dev/null
244269
fi
245270

271+
if [ "$USE_SLC" == true ] && [ "$GN_PATH_PROVIDED" == false ]; then
272+
GN_PATH=./.environment/cipd/packages/pigweed/gn
273+
fi
274+
246275
BUILD_DIR=$OUTDIR/$SILABS_BOARD
247276
echo BUILD_DIR="$BUILD_DIR"
248277

@@ -254,7 +283,7 @@ else
254283
# wifi build
255284
# NCP mode EFR32 + wifi module
256285
optArgs+="$ipArgs"
257-
gn gen --check --fail-on-unused-args --export-compile-commands --root="$ROOT" --dotfile="$ROOT"/build_for_wifi_gnfile.gn --args="silabs_board=\"$SILABS_BOARD\" $optArgs" "$BUILD_DIR"
286+
"$GN_PATH" gen --check --fail-on-unused-args --export-compile-commands --root="$ROOT" --dotfile="$ROOT"/build_for_wifi_gnfile.gn --args="silabs_board=\"$SILABS_BOARD\" $optArgs" "$BUILD_DIR"
258287
else
259288
# OpenThread/SoC build
260289
#
@@ -263,11 +292,16 @@ else
263292
fi
264293

265294
if [ -z "$optArgs" ]; then
266-
gn gen --check --fail-on-unused-args --export-compile-commands --root="$ROOT" --args="silabs_board=\"$SILABS_BOARD\"" "$BUILD_DIR"
295+
"$GN_PATH" gen --check --script-executable="/usr/bin/python3" --root="$ROOT" --args="silabs_board=\"$SILABS_BOARD\"" "$BUILD_DIR"
267296
else
268-
gn gen --check --fail-on-unused-args --export-compile-commands --root="$ROOT" --args="silabs_board=\"$SILABS_BOARD\" $optArgs" "$BUILD_DIR"
297+
"$GN_PATH" gen --check --script-executable="/usr/bin/python3" --root="$ROOT" --args="silabs_board=\"$SILABS_BOARD\" $optArgs" "$BUILD_DIR"
269298
fi
270299
fi
300+
301+
# Activation needs to be after SLC generation which is done in gn gen.
302+
# Zap generation requires activation and is done in the build phase
303+
source "$CHIP_ROOT/scripts/activate.sh"
304+
271305
ninja -v -C "$BUILD_DIR"/
272306
#print stats
273307
arm-none-eabi-size -A "$BUILD_DIR"/*.out

0 commit comments

Comments
 (0)