Skip to content

Commit 85db1da

Browse files
[Silabs] Add user configurable paths for board configuration files (project-chip#28019)
* Add option of user to configure silabs_pre_gen or slc_gen paths * slc_gen_path can be in efr32_sdk.gni * Fix pathing issue, use the active python3 installation on any env. Make sure slc has a configured and trusted gsdk set
1 parent f7736dd commit 85db1da

File tree

6 files changed

+36
-14
lines changed

6 files changed

+36
-14
lines changed

.github/workflows/examples-efr32.yaml

+6-6
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,12 @@ jobs:
5555
with:
5656
gh-context: ${{ toJson(github) }}
5757

58-
# - name: Test SLC gen
59-
# timeout-minutes: 30
60-
# run: |
61-
# scripts/examples/gn_silabs_example.sh examples/lighting-app/silabs ./out/light-app BRD4187C --slc_generate --docker
62-
# scripts/examples/gn_silabs_example.sh examples/lighting-app/silabs ./out/light-app BRD4164A --slc_generate --docker
63-
# rm -rf ./out/
58+
- name: Test SLC gen
59+
timeout-minutes: 30
60+
run: |
61+
scripts/examples/gn_silabs_example.sh examples/lighting-app/silabs ./out/light-app BRD4187C --slc_generate --docker
62+
scripts/examples/gn_silabs_example.sh examples/lighting-app/silabs ./out/light-app BRD4164A --slc_generate --docker
63+
rm -rf ./out/
6464
- name: Build some BRD4187C variants
6565
run: |
6666
./scripts/run_in_build_env.sh \

examples/lighting-app/silabs/BUILD.gn

+1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ if (slc_generate) {
6060
"${use_wstk_leds}",
6161
"${use_external_flash}",
6262
"${silabs_mcu}",
63+
rebase_path(slc_gen_path),
6364
],
6465
"list lines"))
6566
}

examples/smoke-co-alarm-app/silabs/BUILD.gn

+1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ if (slc_generate) {
6060
"${use_wstk_leds}",
6161
"${use_external_flash}",
6262
"${silabs_mcu}",
63+
rebase_path(slc_gen_path),
6364
],
6465
"list lines"))
6566
}

scripts/examples/gn_silabs_example.sh

+7-2
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,12 @@ if [ "$#" == "0" ]; then
9898
Periodic query timeout variable for OTA in seconds
9999
rs91x_wpa3_transition
100100
Support for WPA3 transition mode on RS91x
101+
slc_gen_path
102+
Allow users to define a path where slc generates board files. (requires --slc_generate or --slc_reuse_files)
103+
(default: /third_party/silabs/slc_gen/<board>/)
104+
sl_pre_gen_path
105+
Allow users to define a path to pre-generated board files
106+
(default: /third_party/silabs/matter_support/matter/<family>/<board>/)
101107
sl_matter_version
102108
Use provided software version at build time
103109
sl_matter_version_str
@@ -281,17 +287,16 @@ else
281287
fi
282288

283289
if [ "$USE_SLC" == true ]; then
284-
PYTHON_PATH="/usr/bin/python3"
285290
if [ "$GN_PATH_PROVIDED" == false ]; then
286291
GN_PATH=./.environment/cipd/packages/pigweed/gn
287292
fi
288293
elif [ "$USE_SLC" == false ]; then
289294
# Activation needs to be after SLC generation which is done in gn gen.
290295
# Zap generation requires activation and is done in the build phase
291296
source "$CHIP_ROOT/scripts/activate.sh"
292-
PYTHON_PATH=$VIRTUAL_ENV"/bin/python3"
293297
fi
294298

299+
PYTHON_PATH="$(which python3)"
295300
BUILD_DIR=$OUTDIR/$SILABS_BOARD
296301
echo BUILD_DIR="$BUILD_DIR"
297302

third_party/silabs/efr32_sdk.gni

+9-4
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ declare_args() {
5656
# Argument to enable IPv4 for wifi
5757
# aligning to match chip_inet_config_enable_ipv4 default configuration
5858
chip_enable_wifi_ipv4 = false
59-
silabs_gen_folder = ""
6059

6160
# Calls SLC-CLI at run time
6261
slc_generate = false
@@ -72,14 +71,20 @@ declare_args() {
7271
sl_ot_efr32_root =
7372
"${efr32_sdk_root}/protocol/openthread/platform-abstraction/efr32"
7473
sl_openthread_root = "${efr32_sdk_root}/util/third_party/openthread"
74+
75+
# board related pre-generated files path (default)
76+
sl_pre_gen_path =
77+
"${sdk_support_root}/matter/efr32/${silabs_family}/${silabs_board}/"
78+
79+
# board related generated files path (used if slc_generate or slc_reuse_files is set)
80+
slc_gen_path = "${chip_root}/third_party/silabs/slc_gen/${silabs_board}/"
7581
}
7682

7783
if (slc_generate || slc_reuse_files) {
78-
silabs_gen_folder = "${chip_root}/third_party/silabs/slc_gen/${silabs_board}/"
84+
silabs_gen_folder = slc_gen_path
7985
} else {
8086
print("Using pre-generate files")
81-
silabs_gen_folder =
82-
"${sdk_support_root}/matter/efr32/${silabs_family}/${silabs_board}/"
87+
silabs_gen_folder = sl_pre_gen_path
8388
}
8489

8590
# Defines an efr32 SDK build target.

third_party/silabs/slc_gen/run_slc.py

+12-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import subprocess
55
import sys
66

7-
if len(sys.argv) != 8:
7+
if len(sys.argv) != 9:
88
print("wrong number of arguments")
99
sys.exit(1)
1010

@@ -27,10 +27,10 @@ def isMG24(partnumber):
2727
use_wstk_leds = asBoolean(sys.argv[5])
2828
use_external_flash = asBoolean(sys.argv[6])
2929
silabs_mcu = str(sys.argv[7])
30+
output_path = str(sys.argv[8])
3031

3132
slcp_file_path = os.path.join(root_path, "examples/platform/silabs/matter-platform.slcp")
3233
template_path = os.path.join(root_path, "third_party/silabs/slc_gen/")
33-
output_path = template_path + sys.argv[2] + '/'
3434

3535
slc_arguments = ""
3636

@@ -58,6 +58,16 @@ def isMG24(partnumber):
5858

5959
print(slc_arguments)
6060

61+
if "GSDK_ROOT" in os.environ:
62+
gsdk_root = os.getenv('GSDK_ROOT')
63+
else:
64+
# If no gsdk path is set in the environment, use the standard path to the submodule
65+
gsdk_root = os.path.join(root_path, "third_party/silabs/gecko_sdk/")
66+
67+
# make sure we have a configured and trusted gsdk in slc
68+
subprocess.run(["slc", "configuration", "--sdk", gsdk_root], check=True)
69+
subprocess.run(["slc", "signature", "trust", "--sdk", gsdk_root], check=True)
70+
6171
subprocess.run(["slc", "generate", slcp_file_path, "-d", output_path, "--with", slc_arguments], check=True)
6272

6373
# cleanup of unwanted files

0 commit comments

Comments
 (0)