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

Add bootloader to silabs artifacts #29918

Merged
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
49 changes: 48 additions & 1 deletion scripts/examples/gn_silabs_example.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ USE_GIT_SHA_FOR_VERSION=true
USE_SLC=false
GN_PATH=gn
GN_PATH_PROVIDED=false

USE_BOOTLOADER=false
DOTFILE=".gn"

SILABS_THREAD_TARGET=\""../silabs:ot-efr32-cert"\"
Expand Down Expand Up @@ -138,6 +138,9 @@ if [ "$#" == "0" ]; then
Generate files with SLC for current board and options Requires an SLC-CLI installation or running in Docker.
--slc_reuse_files
Use generated files without running slc again.
--bootloader
Add bootloader to the generated image.


"
elif [ "$#" -lt "2" ]; then
Expand Down Expand Up @@ -218,6 +221,10 @@ else
optArgs+="is_debug=false disable_lcd=true chip_build_libshell=false enable_openthread_cli=false use_external_flash=false chip_logging=false silabs_log_enabled=false "
shift
;;
--bootloader)
USE_BOOTLOADER=true
shift
;;
--docker)
optArgs+="efr32_sdk_root=\"$GSDK_ROOT\" "
USE_DOCKER=true
Expand Down Expand Up @@ -327,4 +334,44 @@ else
#print stats
arm-none-eabi-size -A "$BUILD_DIR"/*.out

# 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' ' ')")

if [ "${#bootloaderFiles[@]}" -gt 1 ]; then
for i in "${!bootloaderFiles[@]}"; do
# if a variant of the bootloader that uses external flash exists, use that one.
if [[ "${bootloaderFiles[$i]}" =~ .*"spiflash".* ]]; then
bootloaderPath="${bootloaderFiles[$i]}"
break
fi
done
elif [ "${#bootloaderFiles[@]}" -eq 0 ]; then
echo "A bootloader for the $SILABS_BOARD currently doesn't exist!"
else
bootloaderPath="${bootloaderFiles[0]}"
fi
echo "$bootloaderPath"
binName="$(find "$BUILD_DIR" -type f -name "*.s37")"
echo "$binName"
"$commanderPath" convert "$binName" "$bootloaderPath" -o "$binName"
fi
fi