Skip to content

Commit

Permalink
Pull request project-chip#142: Cherry-Pick Modules Support to silabs_1.0
Browse files Browse the repository at this point in the history
Merge in WMN_TOOLS/matter from cherry_pick/module_support to silabs_1.0

Squashed commit of the following:

commit c15cb2cacb01bc32e8e9df8f9df23009d81e5d50
Author: Mathieu Kardous <mathieu.kardous@silabs.com>
Date:   Wed Oct 5 14:58:43 2022 -0400

    Add Modules to jenkins files

commit 16bb8eb8b5cc31e52cdef6821a7f1aa768bddcde
Author: Mathieu Kardous <mathieu.kardous@silabs.com>
Date:   Fri Sep 30 14:11:27 2022 -0400

    Fix build argument for custom examples

commit aaf606cbdc7379205df0f1e2e4fdb09a1f4ae651
Author: mkardous-silabs <84793247+mkardous-silabs@users.noreply.github.com>
Date:   Mon Sep 26 09:29:04 2022 -0400

    [Silabs] Add Support for Modules for Matter (project-chip#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>
  • Loading branch information
mkardous-silabs authored and jmartinez-silabs committed Oct 7, 2022
1 parent 665805a commit 0722485
Show file tree
Hide file tree
Showing 49 changed files with 829 additions and 348 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/examples-efr32.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ concurrency:
jobs:
efr32:
name: EFR32
timeout-minutes: 110
timeout-minutes: 110

env:
EFR32_BOARD: BRD4161A
SILABS_BOARD: BRD4161A
BUILD_TYPE: gn_efr32

runs-on: ubuntu-latest
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release_artifacts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
efr32:
name: EFR32
env:
EFR32_BOARD: BRD4161A
SILABS_BOARD: BRD4161A
BUILD_DIRECTORY: out/lock_app_debug/BRD4161A

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

- name: Upload artifact
run: |
Expand All @@ -110,4 +110,4 @@ jobs:
--release-tag "${{ github.event.inputs.releaseTag }}" \
--bundle-files $BUILD_DIRECTORY/lock_app.flashbundle.txt \
--working-directory $BUILD_DIRECTORY \
--bundle-name efr32-$EFR32_BOARD-chip-lock-example
--bundle-name efr32-$SILABS_BOARD-chip-lock-example
4 changes: 2 additions & 2 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -791,9 +791,9 @@ def pipeline()

// Build only for release candidate branch
if (env.BRANCH_NAME.startsWith('RC_')) {
openThreadBoards = ["BRD4161A", "BRD4162A", "BRD4163A", "BRD4164A", "BRD4166A", "BRD4186C", "BRD4187C", "BRD2703A"]
openThreadBoards = ["BRD4161A", "BRD4162A", "BRD4163A", "BRD4164A", "BRD4166A", "BRD4186C", "BRD4187C", "BRD2703A", "BRD4316A", "BRD4317A", "BRD319A"]
} else {
openThreadBoards = ["BRD4161A", "BRD4166A", "BRD4187C", "BRD2703A" ]
openThreadBoards = ["BRD4161A", "BRD4166A", "BRD4187C", "BRD2703A", "BRD4316A", "BRD4319A"]
}
def openThreadApps = ["lighting-app", "lock-app", "light-switch-app", "window-app"]

Expand Down
12 changes: 6 additions & 6 deletions examples/chef/chef.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def load_config() -> None:
config["silabs-thread"]["GECKO_SDK"] = f"{_REPO_BASE_PATH}third_party/efr32_sdk/repo"
config["silabs-thread"]["TTY"] = None
config["silabs-thread"]["CU"] = None
config["silabs-thread"]["EFR32_BOARD"] = None
config["silabs-thread"]["SILABS_BOARD"] = None
config["ameba"]["AMEBA_SDK"] = None
config["ameba"]["MATTER_SDK"] = None
config["ameba"]["MODEL"] = 'D'
Expand Down Expand Up @@ -493,11 +493,11 @@ def main() -> int:
pass
elif options.build_target == "silabs-thread":
flush_print('Path to gecko sdk is configured within Matter.')
if 'EFR32_BOARD' not in config['silabs-thread'] or config['silabs-thread']['EFR32_BOARD'] is None:
if 'SILABS_BOARD' not in config['silabs-thread'] or config['silabs-thread']['SILABS_BOARD'] is None:
flush_print(
'EFR32_BOARD was not configured. Make sure silabs-thread.EFR32_BOARD is set on your config.yaml file')
'SILABS_BOARD was not configured. Make sure silabs-thread.SILABS_BOARD is set on your config.yaml file')
exit(1)
efr32_board = config['silabs-thread']['EFR32_BOARD']
silabs_board = config['silabs-thread']['SILABS_BOARD']
elif options.build_target == "ameba":
if config['ameba']['AMEBA_SDK'] is None:
flush_print(
Expand Down Expand Up @@ -669,7 +669,7 @@ def main() -> int:
f'{_REPO_BASE_PATH}/scripts/examples/gn_efr32_example.sh')
efr32_cmd_args.append('./')
efr32_cmd_args.append(f'out/{options.sample_device_type_name}')
efr32_cmd_args.append(f'{efr32_board}')
efr32_cmd_args.append(f'{silabs_board}')
efr32_cmd_args.append(
f'\'sample_name=\"{options.sample_device_type_name}\"\'')
if sw_ver_string:
Expand Down Expand Up @@ -808,7 +808,7 @@ def main() -> int:
elif (options.build_target == "silabs-thread") or (options.build_target == "silabs-wifi"):
shell.run_cmd(f"cd {_CHEF_SCRIPT_PATH}/efr32")
shell.run_cmd(
f"python3 out/{options.sample_device_type_name}/{efr32_board}/chip-efr32-chef-example.flash.py")
f"python3 out/{options.sample_device_type_name}/{silabs_board}/chip-efr32-chef-example.flash.py")

shell.run_cmd(f"cd {_CHEF_SCRIPT_PATH}")
elif (options.build_target == "ameba"):
Expand Down
15 changes: 9 additions & 6 deletions examples/chef/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ chip_data_model("chef-common") {
is_server = true
}

# ThunderBoards and Explorer Kit (No LCD)
if (efr32_board == "BRD4166A" || efr32_board == "BRD2601B" ||
efr32_board == "BRD2703A") {
# ThunderBoards, Explorer Kit and MGM240L do not support LCD (No LCD)
if (silabs_board == "BRD4166A" || silabs_board == "BRD2601B" ||
silabs_board == "BRD2703A" || silabs_board == "BRD4319A") {
show_qr_code = false
disable_lcd = true
}
Expand Down Expand Up @@ -131,7 +131,7 @@ efr32_sdk("sdk") {
]

defines = [
"BOARD_ID=${efr32_board}",
"BOARD_ID=${silabs_board}",
"OTA_PERIODIC_TIMEOUT=${OTA_periodic_query_timeout}",
]

Expand Down Expand Up @@ -176,7 +176,6 @@ efr32_executable("chef_app") {

sources = [
"${examples_plat_dir}/BaseApplication.cpp",
"${examples_plat_dir}/LEDWidget.cpp",
"${examples_plat_dir}/efr32_utils.cpp",
"${examples_plat_dir}/heap_4_silabs.c",
"${examples_plat_dir}/init_efrPlatform.cpp",
Expand All @@ -187,6 +186,10 @@ efr32_executable("chef_app") {
"src/main.cpp",
]

if (use_wstk_leds) {
sources += [ "${examples_plat_dir}/LEDWidget.cpp" ]
}

if (chip_enable_pw_rpc || chip_build_libshell || enable_openthread_cli ||
use_wf200 || use_rs911x) {
sources += [ "${examples_plat_dir}/uart.cpp" ]
Expand Down Expand Up @@ -306,7 +309,7 @@ efr32_executable("chef_app") {
defines += [ "HEAP_MONITORING" ]
}

ldscript = "${examples_plat_dir}/ldscripts/${efr32_family}.ld"
ldscript = "${examples_plat_dir}/ldscripts/${silabs_family}.ld"

inputs = [ ldscript ]

Expand Down
6 changes: 6 additions & 0 deletions examples/chef/efr32/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,11 @@
#include "AppTask.h"
#include "AppConfig.h"
#include "AppEvent.h"

#ifdef ENABLE_WSTK_LEDS
#include "LEDWidget.h"
#include "sl_simple_led_instances.h"
#endif // ENABLE_WSTK_LEDS

#ifdef DISPLAY_ENABLED
#include "lcd.h"
Expand Down Expand Up @@ -52,7 +55,10 @@

#include <platform/CHIPDeviceLayer.h>

#ifdef ENABLE_WSTK_LEDS
#define SYSTEM_STATE_LED &sl_led_led0
#endif // ENABLE_WSTK_LEDS

#define APP_FUNCTION_BUTTON &sl_button_btn0

using namespace chip;
Expand Down
15 changes: 9 additions & 6 deletions examples/light-switch-app/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ if (chip_enable_wifi) {
enable_openthread_cli = false
}

# ThunderBoards and Explorer Kit (No LCD)
if (efr32_board == "BRD4166A" || efr32_board == "BRD2601B" ||
efr32_board == "BRD2703A") {
# ThunderBoards, Explorer Kit and MGM240L do not support LCD (No LCD)
if (silabs_board == "BRD4166A" || silabs_board == "BRD2601B" ||
silabs_board == "BRD2703A" || silabs_board == "BRD4319A") {
show_qr_code = false
disable_lcd = true
}
Expand Down Expand Up @@ -124,7 +124,7 @@ efr32_sdk("sdk") {
]

defines = [
"BOARD_ID=${efr32_board}",
"BOARD_ID=${silabs_board}",
"OTA_PERIODIC_TIMEOUT=${OTA_periodic_query_timeout}",
]

Expand Down Expand Up @@ -169,7 +169,6 @@ efr32_executable("light_switch_app") {

sources = [
"${examples_plat_dir}/BaseApplication.cpp",
"${examples_plat_dir}/LEDWidget.cpp",
"${examples_plat_dir}/efr32_utils.cpp",
"${examples_plat_dir}/heap_4_silabs.c",
"${examples_plat_dir}/init_efrPlatform.cpp",
Expand All @@ -180,6 +179,10 @@ efr32_executable("light_switch_app") {
"src/main.cpp",
]

if (use_wstk_leds) {
sources += [ "${examples_plat_dir}/LEDWidget.cpp" ]
}

if (chip_enable_pw_rpc || chip_build_libshell || enable_openthread_cli ||
use_wf200 || use_rs911x) {
sources += [ "${examples_plat_dir}/uart.cpp" ]
Expand Down Expand Up @@ -313,7 +316,7 @@ efr32_executable("light_switch_app") {
defines += [ "HEAP_MONITORING" ]
}

ldscript = "${examples_plat_dir}/ldscripts/${efr32_family}.ld"
ldscript = "${examples_plat_dir}/ldscripts/${silabs_family}.ld"

inputs = [ ldscript ]

Expand Down
5 changes: 4 additions & 1 deletion examples/light-switch-app/efr32/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,12 @@
#include "AppTask.h"
#include "AppConfig.h"
#include "AppEvent.h"
#include "LEDWidget.h"
#include "binding-handler.h"

#ifdef ENABLE_WSTK_LEDS
#include "LEDWidget.h"
#include "sl_simple_led_instances.h"
#endif // ENABLE_WSTK_LEDS

#ifdef DISPLAY_ENABLED
#include "lcd.h"
Expand Down
17 changes: 10 additions & 7 deletions examples/lighting-app/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -81,17 +81,17 @@ if (chip_enable_wifi) {
enable_openthread_cli = false
}

# ThunderBoards and Explorer Kit (No LCD)
if (efr32_board == "BRD4166A" || efr32_board == "BRD2601B" ||
efr32_board == "BRD2703A") {
# ThunderBoards, Explorer Kit and MGM240L do not support LCD (No LCD)
if (silabs_board == "BRD4166A" || silabs_board == "BRD2601B" ||
silabs_board == "BRD2703A" || silabs_board == "BRD4319A") {
show_qr_code = false
disable_lcd = true
}

# WiFi settings
if (chip_enable_wifi) {
# disabling LCD for MG24 for wifi
if (efr32_board == "BRD4186A" || efr32_board == "BRD4187A") {
if (silabs_board == "BRD4186A" || silabs_board == "BRD4187A") {
show_qr_code = false
disable_lcd = true
}
Expand Down Expand Up @@ -129,7 +129,7 @@ efr32_sdk("sdk") {
]

defines = [
"BOARD_ID=${efr32_board}",
"BOARD_ID=${silabs_board}",
"OTA_PERIODIC_TIMEOUT=${OTA_periodic_query_timeout}",
]

Expand Down Expand Up @@ -174,7 +174,6 @@ efr32_executable("lighting_app") {

sources = [
"${examples_plat_dir}/BaseApplication.cpp",
"${examples_plat_dir}/LEDWidget.cpp",
"${examples_plat_dir}/efr32_utils.cpp",
"${examples_plat_dir}/heap_4_silabs.c",
"${examples_plat_dir}/init_efrPlatform.cpp",
Expand All @@ -185,6 +184,10 @@ efr32_executable("lighting_app") {
"src/main.cpp",
]

if (use_wstk_leds) {
sources += [ "${examples_plat_dir}/LEDWidget.cpp" ]
}

if (chip_enable_pw_rpc || chip_build_libshell || enable_openthread_cli ||
use_wf200 || use_rs911x) {
sources += [ "${examples_plat_dir}/uart.cpp" ]
Expand Down Expand Up @@ -318,7 +321,7 @@ efr32_executable("lighting_app") {
defines += [ "HEAP_MONITORING" ]
}

ldscript = "${examples_plat_dir}/ldscripts/${efr32_family}.ld"
ldscript = "${examples_plat_dir}/ldscripts/${silabs_family}.ld"

inputs = [ ldscript ]

Expand Down
16 changes: 15 additions & 1 deletion examples/lighting-app/efr32/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,12 @@
#include "AppTask.h"
#include "AppConfig.h"
#include "AppEvent.h"
#include "LEDWidget.h"

#ifdef ENABLE_WSTK_LEDS
#include "LEDWidget.h"
#include "sl_simple_led_instances.h"
#endif // ENABLE_WSTK_LEDS

#include <app-common/zap-generated/attribute-id.h>
#include <app-common/zap-generated/attribute-type.h>
#include <app-common/zap-generated/cluster-id.h>
Expand All @@ -43,16 +46,22 @@

#include <platform/CHIPDeviceLayer.h>

#ifdef ENABLE_WSTK_LEDS
#define SYSTEM_STATE_LED &sl_led_led0
#define LIGHT_LED &sl_led_led1
#endif // ENABLE_WSTK_LEDS

#define APP_FUNCTION_BUTTON &sl_button_btn0
#define APP_LIGHT_SWITCH &sl_button_btn1

using namespace chip;
using namespace ::chip::DeviceLayer;

namespace {

#ifdef ENABLE_WSTK_LEDS
LEDWidget sLightLED;
#endif // ENABLE_WSTK_LEDS

EmberAfIdentifyEffectIdentifier sIdentifyEffect = EMBER_ZCL_IDENTIFY_EFFECT_IDENTIFIER_STOP_EFFECT;

Expand Down Expand Up @@ -147,8 +156,10 @@ CHIP_ERROR AppTask::Init()

LightMgr().SetCallbacks(ActionInitiated, ActionCompleted);

#ifdef ENABLE_WSTK_LEDS
sLightLED.Init(LIGHT_LED);
sLightLED.Set(LightMgr().IsLightOn());
#endif // ENABLE_WSTK_LEDS

return err;
}
Expand Down Expand Up @@ -266,7 +277,10 @@ void AppTask::ActionInitiated(LightingManager::Action_t aAction, int32_t aActor)
// Action initiated, update the light led
bool lightOn = aAction == LightingManager::ON_ACTION;
EFR32_LOG("Turning light %s", (lightOn) ? "On" : "Off")

#ifdef ENABLE_WSTK_LEDS
sLightLED.Set(lightOn);
#endif // ENABLE_WSTK_LEDS

#ifdef DISPLAY_ENABLED
sAppTask.GetLCD().WriteDemoUI(lightOn);
Expand Down
15 changes: 9 additions & 6 deletions examples/lock-app/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ if (chip_enable_wifi) {
enable_openthread_cli = false
}

# ThunderBoards and Explorer Kit (No LCD)
if (efr32_board == "BRD4166A" || efr32_board == "BRD2601B" ||
efr32_board == "BRD2703A") {
# ThunderBoards, Explorer Kit and MGM240L do not support LCD (No LCD)
if (silabs_board == "BRD4166A" || silabs_board == "BRD2601B" ||
silabs_board == "BRD2703A" || silabs_board == "BRD4319A") {
show_qr_code = false
disable_lcd = true
}
Expand Down Expand Up @@ -124,7 +124,7 @@ efr32_sdk("sdk") {
]

defines = [
"BOARD_ID=${efr32_board}",
"BOARD_ID=${silabs_board}",
"OTA_PERIODIC_TIMEOUT=${OTA_periodic_query_timeout}",
]

Expand Down Expand Up @@ -168,7 +168,6 @@ efr32_executable("lock_app") {

sources = [
"${examples_plat_dir}/BaseApplication.cpp",
"${examples_plat_dir}/LEDWidget.cpp",
"${examples_plat_dir}/efr32_utils.cpp",
"${examples_plat_dir}/heap_4_silabs.c",
"${examples_plat_dir}/init_efrPlatform.cpp",
Expand All @@ -179,6 +178,10 @@ efr32_executable("lock_app") {
"src/main.cpp",
]

if (use_wstk_leds) {
sources += [ "${examples_plat_dir}/LEDWidget.cpp" ]
}

if (chip_enable_pw_rpc || chip_build_libshell || enable_openthread_cli ||
use_wf200 || use_rs911x) {
sources += [ "${examples_plat_dir}/uart.cpp" ]
Expand Down Expand Up @@ -309,7 +312,7 @@ efr32_executable("lock_app") {
defines += [ "HEAP_MONITORING" ]
}

ldscript = "${examples_plat_dir}/ldscripts/${efr32_family}.ld"
ldscript = "${examples_plat_dir}/ldscripts/${silabs_family}.ld"

inputs = [ ldscript ]

Expand Down
Loading

0 comments on commit 0722485

Please sign in to comment.