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

[Silabs] Add user configurable paths for board configuration files #28019

Merged
merged 3 commits into from
Jul 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 6 additions & 6 deletions .github/workflows/examples-efr32.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ jobs:
with:
gh-context: ${{ toJson(github) }}

# - name: Test SLC gen
# timeout-minutes: 30
# run: |
# scripts/examples/gn_silabs_example.sh examples/lighting-app/silabs ./out/light-app BRD4187C --slc_generate --docker
# scripts/examples/gn_silabs_example.sh examples/lighting-app/silabs ./out/light-app BRD4164A --slc_generate --docker
# rm -rf ./out/
- name: Test SLC gen
timeout-minutes: 30
run: |
scripts/examples/gn_silabs_example.sh examples/lighting-app/silabs ./out/light-app BRD4187C --slc_generate --docker
scripts/examples/gn_silabs_example.sh examples/lighting-app/silabs ./out/light-app BRD4164A --slc_generate --docker
rm -rf ./out/
- name: Build some BRD4187C variants
run: |
./scripts/run_in_build_env.sh \
Expand Down
1 change: 1 addition & 0 deletions examples/lighting-app/silabs/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ if (slc_generate) {
"${use_wstk_leds}",
"${use_external_flash}",
"${silabs_mcu}",
rebase_path(slc_gen_path),
],
"list lines"))
}
Expand Down
1 change: 1 addition & 0 deletions examples/smoke-co-alarm-app/silabs/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ if (slc_generate) {
"${use_wstk_leds}",
"${use_external_flash}",
"${silabs_mcu}",
rebase_path(slc_gen_path),
],
"list lines"))
}
Expand Down
9 changes: 7 additions & 2 deletions scripts/examples/gn_silabs_example.sh
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,12 @@ if [ "$#" == "0" ]; then
Periodic query timeout variable for OTA in seconds
rs91x_wpa3_transition
Support for WPA3 transition mode on RS91x
slc_gen_path
Allow users to define a path where slc generates board files. (requires --slc_generate or --slc_reuse_files)
(default: /third_party/silabs/slc_gen/<board>/)
sl_pre_gen_path
Allow users to define a path to pre-generated board files
(default: /third_party/silabs/matter_support/matter/<family>/<board>/)
sl_matter_version
Use provided software version at build time
sl_matter_version_str
Expand Down Expand Up @@ -281,17 +287,16 @@ else
fi

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

PYTHON_PATH="$(which python3)"
BUILD_DIR=$OUTDIR/$SILABS_BOARD
echo BUILD_DIR="$BUILD_DIR"

Expand Down
13 changes: 9 additions & 4 deletions third_party/silabs/efr32_sdk.gni
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ declare_args() {
# Argument to enable IPv4 for wifi
# aligning to match chip_inet_config_enable_ipv4 default configuration
chip_enable_wifi_ipv4 = false
silabs_gen_folder = ""

# Calls SLC-CLI at run time
slc_generate = false
Expand All @@ -72,14 +71,20 @@ declare_args() {
sl_ot_efr32_root =
"${efr32_sdk_root}/protocol/openthread/platform-abstraction/efr32"
sl_openthread_root = "${efr32_sdk_root}/util/third_party/openthread"

# board related pre-generated files path (default)
sl_pre_gen_path =
"${sdk_support_root}/matter/efr32/${silabs_family}/${silabs_board}/"

# board related generated files path (used if slc_generate or slc_reuse_files is set)
slc_gen_path = "${chip_root}/third_party/silabs/slc_gen/${silabs_board}/"
}

if (slc_generate || slc_reuse_files) {
silabs_gen_folder = "${chip_root}/third_party/silabs/slc_gen/${silabs_board}/"
silabs_gen_folder = slc_gen_path
} else {
print("Using pre-generate files")
silabs_gen_folder =
"${sdk_support_root}/matter/efr32/${silabs_family}/${silabs_board}/"
silabs_gen_folder = sl_pre_gen_path
}

# Defines an efr32 SDK build target.
Expand Down
14 changes: 12 additions & 2 deletions third_party/silabs/slc_gen/run_slc.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import subprocess
import sys

if len(sys.argv) != 8:
if len(sys.argv) != 9:
print("wrong number of arguments")
sys.exit(1)

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

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

slc_arguments = ""

Expand Down Expand Up @@ -58,6 +58,16 @@ def isMG24(partnumber):

print(slc_arguments)

if "GSDK_ROOT" in os.environ:
gsdk_root = os.getenv('GSDK_ROOT')
else:
# If no gsdk path is set in the environment, use the standard path to the submodule
gsdk_root = os.path.join(root_path, "third_party/silabs/gecko_sdk/")

# make sure we have a configured and trusted gsdk in slc
subprocess.run(["slc", "configuration", "--sdk", gsdk_root], check=True)
subprocess.run(["slc", "signature", "trust", "--sdk", gsdk_root], check=True)

subprocess.run(["slc", "generate", slcp_file_path, "-d", output_path, "--with", slc_arguments], check=True)

# cleanup of unwanted files
Expand Down