Skip to content

Commit

Permalink
Add rps generation from s37
Browse files Browse the repository at this point in the history
  • Loading branch information
mkardous-silabs committed Nov 14, 2023
1 parent a54a5e0 commit 5b1c84f
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 21 deletions.
6 changes: 6 additions & 0 deletions build/toolchain/flashable_executable.gni
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,12 @@ template("flashable_executable") {
} else {
flashing_options = []
}

# Allows to set a different image name in flasher script
if (defined(invoker.flashing_image_name)) {
image_name = invoker.flashing_image_name
}

flashing_options += [
"--application",
rebase_path(image_name, root_out_dir, root_out_dir),
Expand Down
31 changes: 18 additions & 13 deletions scripts/examples/gn_silabs_example.sh
Original file line number Diff line number Diff line change
Expand Up @@ -338,29 +338,35 @@ else
#print stats
arm-none-eabi-size -A "$BUILD_DIR"/*.out

# Generate RPS file from .s37 for 917 SoC builds
# if ["USE_RPS_EXTENSION" == true]; then
# fi
# Get .s37 path and name
binName="$(find "$BUILD_DIR" -type f -name "*.s37")"

# set commander path
if [ -z "$COMMANDER_PATH" ]; then
commanderPath="commander"
else
commanderPath="$COMMANDER_PATH"
fi

# # Generate RPS file from .s37 for 917 SoC builds
if [ "$USE_RPS_EXTENSION" == true ]; then

# Create .rps
rpsName=$(sed 's/[^\.]*$/rps/' <<< "$binName")
"$commanderPath" rps create "$rpsName" --app "$binName"
fi

# add bootloader to generated image
if [ "$USE_BOOTLOADER" == true ]; then

binName=""
InternalBootloaderBoards=("BRD4337A" "BRD2704A" "BRD2703A" "BRD4319A")
bootloaderPath=""
commanderPath=""

# find the matter root folder
if [ -z "$MATTER_ROOT" ]; then
MATTER_ROOT="$CHIP_ROOT"
fi

# set commander path
if [ -z "$COMMANDER_PATH" ]; then
commanderPath="commander"
else
commanderPath="$COMMANDER_PATH"
fi

# search bootloader directory for the respective bootloaders for the input board
bootloaderFiles=("$(find "$MATTER_ROOT/third_party/silabs/matter_support/matter/efr32/bootloader_binaries/" -maxdepth 1 -name "*$SILABS_BOARD*" | tr '\n' ' ')")

Expand All @@ -378,7 +384,6 @@ else
bootloaderPath="${bootloaderFiles[0]}"
fi
echo "$bootloaderPath"
binName="$(find "$BUILD_DIR" -type f -name "*.s37")"
echo "$binName"
"$commanderPath" convert "$binName" "$bootloaderPath" -o "$binName"
fi
Expand Down
14 changes: 6 additions & 8 deletions third_party/silabs/silabs_executable.gni
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,7 @@ import("silabs_board.gni")

template("silabs_executable") {
output_base_name = get_path_info(invoker.output_name, "name")

if (use_rps_extension) {
extension = ".rps"
} else {
extension = ".s37"
}

extension = ".s37"
objcopy_image_name = output_base_name + extension
objcopy_image_format = "srec"
objcopy = "arm-none-eabi-objcopy"
Expand All @@ -35,6 +29,10 @@ template("silabs_executable") {
# even if the build and flashing steps take place on different machines
# or in different containers.

if (use_rps_extension) {
flashing_image_name = output_base_name + ".rps"
}

flashing_runtime_target = target_name + ".flashing_runtime"
flashing_script_inputs = [
"${chip_root}/scripts/flashing/silabs_firmware_utils.py",
Expand All @@ -48,7 +46,7 @@ template("silabs_executable") {
flashing_script_generator =
"${chip_root}/scripts/flashing/gen_flashing_script.py"
flashing_script_name = output_base_name + ".flash.py"
flashing_options = [ "efr32" ]
flashing_options = [ "silabs" ]

flash_target_name = target_name + ".flash_executable"
flashbundle_name = "${target_name}.flashbundle.txt"
Expand Down

0 comments on commit 5b1c84f

Please sign in to comment.