Skip to content

Commit

Permalink
add rps ext to flasher tools
Browse files Browse the repository at this point in the history
  • Loading branch information
mkardous-silabs committed Nov 13, 2023
1 parent 6d9cb39 commit a54a5e0
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 6 deletions.
8 changes: 7 additions & 1 deletion scripts/examples/gn_silabs_example.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ fi
set -x
env
USE_WIFI=false
USE_RPS_EXTENSION=false
USE_DOCKER=false
USE_GIT_SHA_FOR_VERSION=true
USE_SLC=false
Expand Down Expand Up @@ -281,9 +282,10 @@ else
fi

# 917 exception. TODO find a more generic way
if [ "$SILABS_BOARD" == "BRD4325B" ] || [ "$SILABS_BOARD" == "BRD4325C" ] || [ "$SILABS_BOARD" == "BRD4338A" ]; then
if [ "$SILABS_BOARD" == "BRD4325B" ] || [ "$SILABS_BOARD" == "BRD4325C" ] || [ "$SILABS_BOARD" == "BRD4338A" ] || [ "$SILABS_BOARD" == "BRD4325G" ]; then
echo "Compiling for 917 WiFi SOC"
USE_WIFI=true
USE_RPS_EXTENSION=true
optArgs+="chip_device_platform =\"SiWx917\" "
fi

Expand Down Expand Up @@ -336,6 +338,10 @@ 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

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
For `Flasher`, see the class documentation. For the parse_command()
interface or standalone execution:
usage: efr32_firmware_utils.py [-h] [--verbose] [--erase] [--application FILE]
usage: silabs_firmware_utils.py [-h] [--verbose] [--erase] [--application FILE]
[--verify_application] [--reset] [--skip_reset]
[--commander FILE] [--device DEVICE]
[--serialno SERIAL] [--ip ADDRESS]
Expand Down Expand Up @@ -49,6 +49,7 @@
Do not reset device after flashing
"""

import os
import sys

import firmware_utils
Expand Down Expand Up @@ -133,9 +134,18 @@ def verify(self, image):

def flash(self, image):
"""Flash image."""
ext = os.path.splitext(image)[-1].lower()

if ext == ".rps":
# rps load command for .rps files
arguments = ['rps', 'load']
else:
# flash command for .s37 files
arguments = ['flash']

return self.run_tool(
'commander',
['flash', self.DEVICE_ARGUMENTS, image],
[arguments, self.DEVICE_ARGUMENTS, image],
name='Flash')

def reset(self):
Expand Down
7 changes: 7 additions & 0 deletions third_party/silabs/silabs_board.gni
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ declare_args() {

# Self-provision enabled
use_provision_channel = false

# Board required .rps file to flash instead of .s37
use_rps_extension = false
}

declare_args() {
Expand Down Expand Up @@ -111,6 +114,7 @@ if (silabs_board == "BRD4304A") {
show_qr_code = false
wifi_soc = true
silabs_board_lower = "brd4325b"
use_rps_extension = true
} else if (silabs_board == "BRD4325C") {
silabs_family = "SiWx917-common"
silabs_mcu = "SiWG917M111MGTBA"
Expand All @@ -119,6 +123,7 @@ if (silabs_board == "BRD4304A") {
wifi_soc = true
wifi_soc_common_flash = true
silabs_board_lower = "brd4325c"
use_rps_extension = true
} else if (silabs_board == "BRD4325G") {
silabs_family = "SiWx917-common"
silabs_mcu = "SiWG917M111MGTBA"
Expand All @@ -127,6 +132,7 @@ if (silabs_board == "BRD4304A") {
wifi_soc = true
wifi_soc_common_flash = true
silabs_board_lower = "brd4325g"
use_rps_extension = true
} else if (silabs_board == "BRD4338A") {
silabs_family = "SiWx917-common"
silabs_mcu = "SiWG917M111MGTBA"
Expand All @@ -135,6 +141,7 @@ if (silabs_board == "BRD4304A") {
wifi_soc = true
wifi_soc_common_flash = true
silabs_board_lower = "brd4338a"
use_rps_extension = true
} else if (silabs_board == "BRD4180A") {
assert(
false,
Expand Down
12 changes: 9 additions & 3 deletions third_party/silabs/silabs_executable.gni
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,19 @@

import("//build_overrides/build.gni")
import("//build_overrides/chip.gni")

import("${build_root}/toolchain/flashable_executable.gni")
import("silabs_board.gni")

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

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

objcopy_image_name = output_base_name + extension
objcopy_image_format = "srec"
objcopy = "arm-none-eabi-objcopy"

Expand All @@ -31,7 +37,7 @@ template("silabs_executable") {

flashing_runtime_target = target_name + ".flashing_runtime"
flashing_script_inputs = [
"${chip_root}/scripts/flashing/efr32_firmware_utils.py",
"${chip_root}/scripts/flashing/silabs_firmware_utils.py",
"${chip_root}/scripts/flashing/firmware_utils.py",
]
copy(flashing_runtime_target) {
Expand Down

0 comments on commit a54a5e0

Please sign in to comment.