Skip to content

Commit aa1b62e

Browse files
mkardous-silabsandy31415
authored andcommitted
[Silabs] Add Support for Modules for Matter (#22793)
* rename variables to be agnostic from board family * Add support for the BRD4317a * Add support for the mgm24 boards * Add argument to remove LEDs if necessary * Change default value to support multiple board types * Add Support for the BRD4316A * Add Support for BRD4319A * update matter_support submodule * Rename variable in missing location Co-authored-by: Andrei Litvin <andy314@gmail.com>
1 parent dc66d4e commit aa1b62e

File tree

38 files changed

+808
-327
lines changed

38 files changed

+808
-327
lines changed

.github/workflows/examples-efr32.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ concurrency:
2525
jobs:
2626
efr32:
2727
name: EFR32
28-
timeout-minutes: 110
28+
timeout-minutes: 110
2929

3030
env:
31-
EFR32_BOARD: BRD4161A
31+
SILABS_BOARD: BRD4161A
3232
BUILD_TYPE: gn_efr32
3333

3434
runs-on: ubuntu-latest

.github/workflows/release_artifacts.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ jobs:
6969
efr32:
7070
name: EFR32
7171
env:
72-
EFR32_BOARD: BRD4161A
72+
SILABS_BOARD: BRD4161A
7373
BUILD_DIRECTORY: out/lock_app_debug/BRD4161A
7474

7575
runs-on: ubuntu-latest
@@ -100,7 +100,7 @@ jobs:
100100
.environment/pigweed-venv/*.log
101101
- name: Build example EFR32 Lock App
102102
run: scripts/examples/gn_efr32_example.sh examples/lock-app/efr32/
103-
out/lock_app_debug $EFR32_BOARD
103+
out/lock_app_debug $SILABS_BOARD
104104

105105
- name: Upload artifact
106106
run: |
@@ -110,4 +110,4 @@ jobs:
110110
--release-tag "${{ github.event.inputs.releaseTag }}" \
111111
--bundle-files $BUILD_DIRECTORY/lock_app.flashbundle.txt \
112112
--working-directory $BUILD_DIRECTORY \
113-
--bundle-name efr32-$EFR32_BOARD-chip-lock-example
113+
--bundle-name efr32-$SILABS_BOARD-chip-lock-example

examples/chef/chef.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def load_config() -> None:
8383
config["silabs-thread"]["GECKO_SDK"] = f"{_REPO_BASE_PATH}third_party/efr32_sdk/repo"
8484
config["silabs-thread"]["TTY"] = None
8585
config["silabs-thread"]["CU"] = None
86-
config["silabs-thread"]["EFR32_BOARD"] = None
86+
config["silabs-thread"]["SILABS_BOARD"] = None
8787
config["ameba"]["AMEBA_SDK"] = None
8888
config["ameba"]["MATTER_SDK"] = None
8989
config["ameba"]["MODEL"] = 'D'
@@ -493,11 +493,11 @@ def main() -> int:
493493
pass
494494
elif options.build_target == "silabs-thread":
495495
flush_print('Path to gecko sdk is configured within Matter.')
496-
if 'EFR32_BOARD' not in config['silabs-thread'] or config['silabs-thread']['EFR32_BOARD'] is None:
496+
if 'SILABS_BOARD' not in config['silabs-thread'] or config['silabs-thread']['SILABS_BOARD'] is None:
497497
flush_print(
498-
'EFR32_BOARD was not configured. Make sure silabs-thread.EFR32_BOARD is set on your config.yaml file')
498+
'SILABS_BOARD was not configured. Make sure silabs-thread.SILABS_BOARD is set on your config.yaml file')
499499
exit(1)
500-
efr32_board = config['silabs-thread']['EFR32_BOARD']
500+
silabs_board = config['silabs-thread']['SILABS_BOARD']
501501
elif options.build_target == "ameba":
502502
if config['ameba']['AMEBA_SDK'] is None:
503503
flush_print(
@@ -669,7 +669,7 @@ def main() -> int:
669669
f'{_REPO_BASE_PATH}/scripts/examples/gn_efr32_example.sh')
670670
efr32_cmd_args.append('./')
671671
efr32_cmd_args.append(f'out/{options.sample_device_type_name}')
672-
efr32_cmd_args.append(f'{efr32_board}')
672+
efr32_cmd_args.append(f'{silabs_board}')
673673
efr32_cmd_args.append(
674674
f'\'sample_name=\"{options.sample_device_type_name}\"\'')
675675
if sw_ver_string:
@@ -808,7 +808,7 @@ def main() -> int:
808808
elif (options.build_target == "silabs-thread") or (options.build_target == "silabs-wifi"):
809809
shell.run_cmd(f"cd {_CHEF_SCRIPT_PATH}/efr32")
810810
shell.run_cmd(
811-
f"python3 out/{options.sample_device_type_name}/{efr32_board}/chip-efr32-chef-example.flash.py")
811+
f"python3 out/{options.sample_device_type_name}/{silabs_board}/chip-efr32-chef-example.flash.py")
812812

813813
shell.run_cmd(f"cd {_CHEF_SCRIPT_PATH}")
814814
elif (options.build_target == "ameba"):

examples/chef/efr32/BUILD.gn

+9-6
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,9 @@ chip_data_model("chef-common") {
9292
is_server = true
9393
}
9494

95-
# ThunderBoards and Explorer Kit (No LCD)
96-
if (efr32_board == "BRD4166A" || efr32_board == "BRD2601B" ||
97-
efr32_board == "BRD2703A") {
95+
# ThunderBoards, Explorer Kit and MGM240L do not support LCD (No LCD)
96+
if (silabs_board == "BRD4166A" || silabs_board == "BRD2601B" ||
97+
silabs_board == "BRD2703A" || silabs_board == "BRD4319A") {
9898
show_qr_code = false
9999
disable_lcd = true
100100
}
@@ -135,7 +135,7 @@ efr32_sdk("sdk") {
135135
]
136136

137137
defines = [
138-
"BOARD_ID=${efr32_board}",
138+
"BOARD_ID=${silabs_board}",
139139
"CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE=${setupPinCode}",
140140
"CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR=${setupDiscriminator}",
141141
"OTA_PERIODIC_TIMEOUT=${OTA_periodic_query_timeout}",
@@ -182,7 +182,6 @@ efr32_executable("chef_app") {
182182

183183
sources = [
184184
"${examples_plat_dir}/BaseApplication.cpp",
185-
"${examples_plat_dir}/LEDWidget.cpp",
186185
"${examples_plat_dir}/efr32_utils.cpp",
187186
"${examples_plat_dir}/heap_4_silabs.c",
188187
"${examples_plat_dir}/init_efrPlatform.cpp",
@@ -193,6 +192,10 @@ efr32_executable("chef_app") {
193192
"src/main.cpp",
194193
]
195194

195+
if (use_wstk_leds) {
196+
sources += [ "${examples_plat_dir}/LEDWidget.cpp" ]
197+
}
198+
196199
if (chip_enable_pw_rpc || chip_build_libshell || enable_openthread_cli ||
197200
use_wf200 || use_rs911x) {
198201
sources += [ "${examples_plat_dir}/uart.cpp" ]
@@ -312,7 +315,7 @@ efr32_executable("chef_app") {
312315
defines += [ "HEAP_MONITORING" ]
313316
}
314317

315-
ldscript = "${examples_plat_dir}/ldscripts/${efr32_family}.ld"
318+
ldscript = "${examples_plat_dir}/ldscripts/${silabs_family}.ld"
316319

317320
inputs = [ ldscript ]
318321

examples/chef/efr32/src/AppTask.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,11 @@
2020
#include "AppTask.h"
2121
#include "AppConfig.h"
2222
#include "AppEvent.h"
23+
24+
#ifdef ENABLE_WSTK_LEDS
2325
#include "LEDWidget.h"
2426
#include "sl_simple_led_instances.h"
27+
#endif // ENABLE_WSTK_LEDS
2528

2629
#ifdef DISPLAY_ENABLED
2730
#include "lcd.h"
@@ -52,7 +55,10 @@
5255

5356
#include <platform/CHIPDeviceLayer.h>
5457

58+
#ifdef ENABLE_WSTK_LEDS
5559
#define SYSTEM_STATE_LED &sl_led_led0
60+
#endif // ENABLE_WSTK_LEDS
61+
5662
#define APP_FUNCTION_BUTTON &sl_button_btn0
5763

5864
using namespace chip;

examples/light-switch-app/efr32/BUILD.gn

+9-6
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ if (chip_enable_wifi) {
8585
enable_openthread_cli = false
8686
}
8787

88-
# ThunderBoards and Explorer Kit (No LCD)
89-
if (efr32_board == "BRD4166A" || efr32_board == "BRD2601B" ||
90-
efr32_board == "BRD2703A") {
88+
# ThunderBoards, Explorer Kit and MGM240L do not support LCD (No LCD)
89+
if (silabs_board == "BRD4166A" || silabs_board == "BRD2601B" ||
90+
silabs_board == "BRD2703A" || silabs_board == "BRD4319A") {
9191
show_qr_code = false
9292
disable_lcd = true
9393
}
@@ -128,7 +128,7 @@ efr32_sdk("sdk") {
128128
]
129129

130130
defines = [
131-
"BOARD_ID=${efr32_board}",
131+
"BOARD_ID=${silabs_board}",
132132
"CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE=${setupPinCode}",
133133
"CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR=${setupDiscriminator}",
134134
"OTA_PERIODIC_TIMEOUT=${OTA_periodic_query_timeout}",
@@ -175,7 +175,6 @@ efr32_executable("light_switch_app") {
175175

176176
sources = [
177177
"${examples_plat_dir}/BaseApplication.cpp",
178-
"${examples_plat_dir}/LEDWidget.cpp",
179178
"${examples_plat_dir}/efr32_utils.cpp",
180179
"${examples_plat_dir}/heap_4_silabs.c",
181180
"${examples_plat_dir}/init_efrPlatform.cpp",
@@ -186,6 +185,10 @@ efr32_executable("light_switch_app") {
186185
"src/main.cpp",
187186
]
188187

188+
if (use_wstk_leds) {
189+
sources += [ "${examples_plat_dir}/LEDWidget.cpp" ]
190+
}
191+
189192
if (chip_enable_pw_rpc || chip_build_libshell || enable_openthread_cli ||
190193
use_wf200 || use_rs911x) {
191194
sources += [ "${examples_plat_dir}/uart.cpp" ]
@@ -314,7 +317,7 @@ efr32_executable("light_switch_app") {
314317
defines += [ "HEAP_MONITORING" ]
315318
}
316319

317-
ldscript = "${examples_plat_dir}/ldscripts/${efr32_family}.ld"
320+
ldscript = "${examples_plat_dir}/ldscripts/${silabs_family}.ld"
318321

319322
inputs = [ ldscript ]
320323

examples/light-switch-app/efr32/src/AppTask.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,12 @@
2424
#include "AppTask.h"
2525
#include "AppConfig.h"
2626
#include "AppEvent.h"
27-
#include "LEDWidget.h"
2827
#include "binding-handler.h"
28+
29+
#ifdef ENABLE_WSTK_LEDS
30+
#include "LEDWidget.h"
2931
#include "sl_simple_led_instances.h"
32+
#endif // ENABLE_WSTK_LEDS
3033

3134
#ifdef DISPLAY_ENABLED
3235
#include "lcd.h"

examples/lighting-app/efr32/BUILD.gn

+10-7
Original file line numberDiff line numberDiff line change
@@ -85,17 +85,17 @@ if (chip_enable_wifi) {
8585
enable_openthread_cli = false
8686
}
8787

88-
# ThunderBoards and Explorer Kit (No LCD)
89-
if (efr32_board == "BRD4166A" || efr32_board == "BRD2601B" ||
90-
efr32_board == "BRD2703A") {
88+
# ThunderBoards, Explorer Kit and MGM240L do not support LCD (No LCD)
89+
if (silabs_board == "BRD4166A" || silabs_board == "BRD2601B" ||
90+
silabs_board == "BRD2703A" || silabs_board == "BRD4319A") {
9191
show_qr_code = false
9292
disable_lcd = true
9393
}
9494

9595
# WiFi settings
9696
if (chip_enable_wifi) {
9797
# disabling LCD for MG24 for wifi
98-
if (efr32_board == "BRD4186A" || efr32_board == "BRD4187A") {
98+
if (silabs_board == "BRD4186A" || silabs_board == "BRD4187A") {
9999
show_qr_code = false
100100
disable_lcd = true
101101
}
@@ -133,7 +133,7 @@ efr32_sdk("sdk") {
133133
]
134134

135135
defines = [
136-
"BOARD_ID=${efr32_board}",
136+
"BOARD_ID=${silabs_board}",
137137
"CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE=${setupPinCode}",
138138
"CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR=${setupDiscriminator}",
139139
"OTA_PERIODIC_TIMEOUT=${OTA_periodic_query_timeout}",
@@ -180,7 +180,6 @@ efr32_executable("lighting_app") {
180180

181181
sources = [
182182
"${examples_plat_dir}/BaseApplication.cpp",
183-
"${examples_plat_dir}/LEDWidget.cpp",
184183
"${examples_plat_dir}/efr32_utils.cpp",
185184
"${examples_plat_dir}/heap_4_silabs.c",
186185
"${examples_plat_dir}/init_efrPlatform.cpp",
@@ -191,6 +190,10 @@ efr32_executable("lighting_app") {
191190
"src/main.cpp",
192191
]
193192

193+
if (use_wstk_leds) {
194+
sources += [ "${examples_plat_dir}/LEDWidget.cpp" ]
195+
}
196+
194197
if (chip_enable_pw_rpc || chip_build_libshell || enable_openthread_cli ||
195198
use_wf200 || use_rs911x) {
196199
sources += [ "${examples_plat_dir}/uart.cpp" ]
@@ -324,7 +327,7 @@ efr32_executable("lighting_app") {
324327
defines += [ "HEAP_MONITORING" ]
325328
}
326329

327-
ldscript = "${examples_plat_dir}/ldscripts/${efr32_family}.ld"
330+
ldscript = "${examples_plat_dir}/ldscripts/${silabs_family}.ld"
328331

329332
inputs = [ ldscript ]
330333

examples/lighting-app/efr32/src/AppTask.cpp

+15-1
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,12 @@
2020
#include "AppTask.h"
2121
#include "AppConfig.h"
2222
#include "AppEvent.h"
23-
#include "LEDWidget.h"
2423

24+
#ifdef ENABLE_WSTK_LEDS
25+
#include "LEDWidget.h"
2526
#include "sl_simple_led_instances.h"
27+
#endif // ENABLE_WSTK_LEDS
28+
2629
#include <app-common/zap-generated/attribute-id.h>
2730
#include <app-common/zap-generated/attribute-type.h>
2831
#include <app-common/zap-generated/cluster-id.h>
@@ -43,16 +46,22 @@
4346

4447
#include <platform/CHIPDeviceLayer.h>
4548

49+
#ifdef ENABLE_WSTK_LEDS
4650
#define SYSTEM_STATE_LED &sl_led_led0
4751
#define LIGHT_LED &sl_led_led1
52+
#endif // ENABLE_WSTK_LEDS
53+
4854
#define APP_FUNCTION_BUTTON &sl_button_btn0
4955
#define APP_LIGHT_SWITCH &sl_button_btn1
5056

5157
using namespace chip;
5258
using namespace ::chip::DeviceLayer;
5359

5460
namespace {
61+
62+
#ifdef ENABLE_WSTK_LEDS
5563
LEDWidget sLightLED;
64+
#endif // ENABLE_WSTK_LEDS
5665

5766
EmberAfIdentifyEffectIdentifier sIdentifyEffect = EMBER_ZCL_IDENTIFY_EFFECT_IDENTIFIER_STOP_EFFECT;
5867

@@ -147,8 +156,10 @@ CHIP_ERROR AppTask::Init()
147156

148157
LightMgr().SetCallbacks(ActionInitiated, ActionCompleted);
149158

159+
#ifdef ENABLE_WSTK_LEDS
150160
sLightLED.Init(LIGHT_LED);
151161
sLightLED.Set(LightMgr().IsLightOn());
162+
#endif // ENABLE_WSTK_LEDS
152163

153164
return err;
154165
}
@@ -266,7 +277,10 @@ void AppTask::ActionInitiated(LightingManager::Action_t aAction, int32_t aActor)
266277
// Action initiated, update the light led
267278
bool lightOn = aAction == LightingManager::ON_ACTION;
268279
EFR32_LOG("Turning light %s", (lightOn) ? "On" : "Off")
280+
281+
#ifdef ENABLE_WSTK_LEDS
269282
sLightLED.Set(lightOn);
283+
#endif // ENABLE_WSTK_LEDS
270284

271285
#ifdef DISPLAY_ENABLED
272286
sAppTask.GetLCD().WriteDemoUI(lightOn);

examples/lock-app/efr32/BUILD.gn

+9-6
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ if (chip_enable_wifi) {
8585
enable_openthread_cli = false
8686
}
8787

88-
# ThunderBoards and Explorer Kit (No LCD)
89-
if (efr32_board == "BRD4166A" || efr32_board == "BRD2601B" ||
90-
efr32_board == "BRD2703A") {
88+
# ThunderBoards, Explorer Kit and MGM240L do not support LCD (No LCD)
89+
if (silabs_board == "BRD4166A" || silabs_board == "BRD2601B" ||
90+
silabs_board == "BRD2703A" || silabs_board == "BRD4319A") {
9191
show_qr_code = false
9292
disable_lcd = true
9393
}
@@ -128,7 +128,7 @@ efr32_sdk("sdk") {
128128
]
129129

130130
defines = [
131-
"BOARD_ID=${efr32_board}",
131+
"BOARD_ID=${silabs_board}",
132132
"CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE=${setupPinCode}",
133133
"CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR=${setupDiscriminator}",
134134
"OTA_PERIODIC_TIMEOUT=${OTA_periodic_query_timeout}",
@@ -174,7 +174,6 @@ efr32_executable("lock_app") {
174174

175175
sources = [
176176
"${examples_plat_dir}/BaseApplication.cpp",
177-
"${examples_plat_dir}/LEDWidget.cpp",
178177
"${examples_plat_dir}/efr32_utils.cpp",
179178
"${examples_plat_dir}/heap_4_silabs.c",
180179
"${examples_plat_dir}/init_efrPlatform.cpp",
@@ -185,6 +184,10 @@ efr32_executable("lock_app") {
185184
"src/main.cpp",
186185
]
187186

187+
if (use_wstk_leds) {
188+
sources += [ "${examples_plat_dir}/LEDWidget.cpp" ]
189+
}
190+
188191
if (chip_enable_pw_rpc || chip_build_libshell || enable_openthread_cli ||
189192
use_wf200 || use_rs911x) {
190193
sources += [ "${examples_plat_dir}/uart.cpp" ]
@@ -315,7 +318,7 @@ efr32_executable("lock_app") {
315318
defines += [ "HEAP_MONITORING" ]
316319
}
317320

318-
ldscript = "${examples_plat_dir}/ldscripts/${efr32_family}.ld"
321+
ldscript = "${examples_plat_dir}/ldscripts/${silabs_family}.ld"
319322

320323
inputs = [ ldscript ]
321324

0 commit comments

Comments
 (0)