Skip to content

Commit

Permalink
Apply comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jepenven-silabs committed Mar 24, 2023
1 parent bd90b70 commit e995b00
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 27 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/examples-efr32.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ jobs:
timeout-minutes: 30
run: |
scripts/examples/gn_efr32_example.sh examples/lighting-app/silabs/efr32 ./out/light-app BRD4187C --slc_generate
scripts/examples/gn_efr32_example.sh examples/lighting-app/silabs/efr32 ./out/light-app BRD4161A --slc_generate
rm -rf ./out/
- name: Build some BRD4187C variants
timeout-minutes: 90
run: |
Expand Down
2 changes: 1 addition & 1 deletion examples/lighting-app/silabs/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ declare_args() {
chip_print_memory_usage = false
}

if (generate_slc) {
if (slc_generate) {
# Generate Project Specific config (Board, hardware used etc..)
print(exec_script("${chip_root}/third_party/silabs/slc_gen/run_slc.py",
[
Expand Down
1 change: 0 additions & 1 deletion examples/lighting-app/silabs/efr32/args.gni
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import("${chip_root}/config/standalone/args.gni")
import("${chip_root}/src/platform/silabs/efr32/args.gni")

efr32_sdk_target = get_label_info(":sdk", "label_no_toolchain")
efr32_project_dir = "${chip_root}/examples/lighting-app/silabs/efr32"

app_data_model =
"${chip_root}/examples/lighting-app/silabs/efr32/data_model:silabs-lighting"
Expand Down
15 changes: 13 additions & 2 deletions examples/platform/silabs/matter-platform.slcp
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,16 @@ component:
- {id: brd4002a}
- {id: rail_util_pti}
- {id: bluetooth_feature_gatt}
- instance: [vcom]
id: uartdrv_usart
- {id: bluetooth_feature_connection}
- {id: psa_crypto}
- {id: rail_lib_multiprotocol}
- {id: bluetooth_feature_system}
- {id: bluetooth_feature_scanner}
- instance: [vcom]
id: uartdrv_usart
- instance: [vcom]
id: uartdrv_eusart


config_file:
- override:
Expand All @@ -74,6 +77,14 @@ configuration:
- {name: SL_HEAP_SIZE, value: '16384'}
- {name: SL_STACK_SIZE, value: '4608'}

requires:
- condition: [device_series_1]
name: uartdrv_usart
- condition: [device_series_2]
name: uartdrv_eusart
- condition: [device_series_2]
name: device_init_dpll

ui_hints:
highlight:
- {path: ./README.md, focus: true}
24 changes: 18 additions & 6 deletions scripts/examples/gn_efr32_example.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ USE_DOCKER=false
USE_GIT_SHA_FOR_VERSION=true
USE_SLC=false
GN_PATH=gn
GN_PATH_PROVIDED=false

SILABS_THREAD_TARGET=\""../silabs:ot-efr32-cert"\"
USAGE="./scripts/examples/gn_efr32_example.sh <AppRootFolder> <outputFolder> <silabs_board_name> [<Build options>]"
Expand Down Expand Up @@ -125,7 +126,7 @@ if [ "$#" == "0" ]; then
Change GSDK root for docker builds
--slc_generate
Generate files with SLC for current board and options Requires an SLC-CLI installation or running in Docker.
--use_slc_files
--slc_reuse_files
Use generated files without running slc again.
"
Expand Down Expand Up @@ -208,15 +209,26 @@ else
shift
;;
--slc_generate)
optArgs+="generate_slc=true "
optArgs+="slc_generate=true "
USE_SLC=true
shift
;;
--use_slc_files)
optArgs+="use_slc_files=true "
--slc_reuse_files)
optArgs+="slc_reuse_files=true "
USE_SLC=true
shift
;;
--gn_path)
if [ -z "$2" ]; then
echo "--gn_path requires a path to GN"
exit 1
else
GN_PATH="$2"
fi
GN_PATH_PROVIDED=true
shift
shift
;;
*"sl_matter_version_str="*)
optArgs+="$1 "
USE_GIT_SHA_FOR_VERSION=false
Expand Down Expand Up @@ -246,7 +258,7 @@ else
} &>/dev/null
fi

if [ "$USE_SLC" == true ]; then
if [ "$USE_SLC" == true ] && [ "$GN_PATH_PROVIDED" == false ]; then
GN_PATH=./.environment/cipd/packages/pigweed/gn
fi

Expand Down Expand Up @@ -276,7 +288,7 @@ else
source "$CHIP_ROOT/scripts/activate.sh"

ninja -v -C "$BUILD_DIR"/
# #print stats
#print stats
arm-none-eabi-size -A "$BUILD_DIR"/*.out

fi
20 changes: 9 additions & 11 deletions third_party/silabs/efr32_sdk.gni
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ declare_args() {
silabs_gen_folder = ""

# Calls SLC-CLI at run time
generate_slc = false
slc_generate = false

# Use SLC generated files
use_slc_files = false
slc_reuse_files = false
}

assert(efr32_sdk_root != "", "efr32_sdk_root must be specified")
Expand All @@ -72,7 +72,7 @@ declare_args() {
sl_openthread_root = "${efr32_sdk_root}/util/third_party/openthread"
}

if (generate_slc || use_slc_files) {
if (slc_generate || slc_reuse_files) {
silabs_gen_folder = "${chip_root}/third_party/silabs/slc_gen/${silabs_board}/"
} else {
print("Using pre-generate files")
Expand Down Expand Up @@ -175,7 +175,7 @@ template("efr32_sdk") {
"${silabs_gen_folder}/autogen",
]

if (generate_slc || use_slc_files) {
if (slc_generate || slc_reuse_files) {
_include_dirs +=
[ "${efr32_sdk_root}/hardware/driver/configuration_over_swo/inc/" ]
}
Expand Down Expand Up @@ -697,7 +697,7 @@ template("efr32_sdk") {
]
}

if (generate_slc || use_slc_files) {
if (slc_generate || slc_reuse_files) {
sources += [
"${efr32_sdk_root}/hardware/driver/configuration_over_swo/src/sl_cos.c",
"${efr32_sdk_root}/platform/driver/debug/src/sl_debug_swo.c",
Expand Down Expand Up @@ -945,12 +945,10 @@ template("efr32_sdk") {
]
}

if (!use_slc_files && !generate_slc) {
if (silabs_board == "BRD4186A" || silabs_board == "BRD4186C" ||
silabs_board == "BRD4187A" || silabs_board == "BRD4187C" ||
silabs_board == "BRD2704A") {
sources += [ "${efr32_sdk_root}/platform/service/device_init/src/sl_device_init_dpll_s2.c" ]
}
if (silabs_board == "BRD4186A" || silabs_board == "BRD4186C" ||
silabs_board == "BRD4187A" || silabs_board == "BRD4187C" ||
silabs_board == "BRD2704A") {
sources += [ "${efr32_sdk_root}/platform/service/device_init/src/sl_device_init_dpll_s2.c" ]
}

if (silabs_board == "BRD2704A" || silabs_board == "BRD4318A") {
Expand Down
9 changes: 3 additions & 6 deletions third_party/silabs/slc_gen/run_slc.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@


def asBoolean(valueToTest):
if valueToTest == "true":
return True
else:
return False
return ("true" == valueToTest)


root_path = sys.argv[1]
Expand Down Expand Up @@ -55,12 +52,12 @@ def asBoolean(valueToTest):
try:
os.remove(filePath)
except OSError:
print("failed to remove file")
print("failed to remove file: {}".format(filePath))

try:
os.remove(os.path.join(output_path, "vscode.conf"))
except OSError:
print("failed to remove file")
print("failed to remove file: {}".format(filePath))


# Create a Build.gn files with all of the sources
Expand Down

0 comments on commit e995b00

Please sign in to comment.