Skip to content

Commit

Permalink
♻️ (firmware): Rename application by application_os
Browse files Browse the repository at this point in the history
application_os: "application" is the term used by MCUBoot, "os" is the term used by Leka
  • Loading branch information
YannLocatelli authored and ladislas committed Jan 11, 2023
1 parent 4c5814d commit 624a69e
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 56 deletions.
45 changes: 45 additions & 0 deletions tools/firmware/build_application_os.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/bash

# ? application_os: "application" is the term used by MCUBoot, "os" is the term used by Leka

mkdir -p _tmp
mkdir -p _release

# Variables
RECOMPILE_APPLICATION_OS="$1"

APPLICATION_OS_HEX_SOURCE="_build/LEKA_V1_2_DEV/app/os/LekaOS.hex"
APPLICATION_OS_HEX_DESTINATION="$2"

APPLICATION_OS_VERSION="$3"
APPLICATION_OS_HEX="_tmp/LekaOS.hex"
APPLICATION_OS_SIGNED_HEX=$APPLICATION_OS_HEX_DESTINATION
APPLICATION_OS_SIGNED_BIN="_release/LekaOS-$APPLICATION_OS_VERSION.bin"

if [ -z "$APPLICATION_OS_VERSION" ]; then
echo "APPLICATION_OS_VERSION is unset"
exit 1
fi

if [ -z "$APPLICATION_OS_HEX_DESTINATION" ]; then
echo "APPLICATION_OS_HEX_DESTINATION is unset"
exit 1
fi

# Compile application_os
if [ "$RECOMPILE_APPLICATION_OS" = "true" ];
then
make deep_clean
make config BUILD_TARGETS_TO_USE_WITH_BOOTLOADER=ON
fi;

make

# Get application_os binary
cp $APPLICATION_OS_HEX_SOURCE $APPLICATION_OS_HEX

# Sign application_os with private key
imgtool sign -k signing-keys.pem --align 4 -v $APPLICATION_OS_VERSION --header-size 4096 --pad-header -S 0x180000 $APPLICATION_OS_HEX $APPLICATION_OS_SIGNED_HEX

# Convert in binary
arm-none-eabi-objcopy -I ihex -O binary $APPLICATION_OS_SIGNED_HEX $APPLICATION_OS_SIGNED_BIN
28 changes: 15 additions & 13 deletions tools/firmware/build_firmware.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

# ? application_os: "application" is the term used by MCUBoot, "os" is the term used by Leka

mkdir -p _tmp
mkdir -p _release

Expand All @@ -9,23 +11,23 @@ while getopts rv: flag
do
case "${flag}" in
r) RECOMPILE_BOOTLOADER="true";;
v) APPLICATION_VERSION=$OPTARG;;
v) APPLICATION_OS_VERSION=$OPTARG;;
esac
done

if [ -z "$APPLICATION_VERSION" ]; then
echo "APPLICATION_VERSION is unset"
if [ -z "$APPLICATION_OS_VERSION" ]; then
echo "APPLICATION_OS_VERSION is unset"
exit 1
fi

BUILD_NUMBER=$(date +%s)
APPLICATION_VERSION="$APPLICATION_VERSION+$BUILD_NUMBER"
APPLICATION_OS_VERSION="$APPLICATION_OS_VERSION+$BUILD_NUMBER"

BOOTLOADER_HEX="_tmp/bootloader.hex"
APPLICATION_HEX="_tmp/LekaOS-$APPLICATION_VERSION.hex"
APPLICATION_OS_HEX="_tmp/LekaOS-$APPLICATION_OS_VERSION.hex"

FIRMWARE_HEX="_release/Firmware-$APPLICATION_VERSION.hex"
FIRMWARE_BIN="_release/Firmware-$APPLICATION_VERSION.bin"
FIRMWARE_HEX="_release/Firmware-$APPLICATION_OS_VERSION.hex"
FIRMWARE_BIN="_release/Firmware-$APPLICATION_OS_VERSION.bin"

# Get bootloader
if [ "$RECOMPILE_BOOTLOADER" = "true" ];
Expand All @@ -34,13 +36,13 @@ then
./tools/firmware/build_bootloader.sh $BOOTLOADER_HEX
fi;

# Get application
echo "Build application"
./tools/firmware/build_os.sh $RECOMPILE_BOOTLOADER $APPLICATION_HEX $APPLICATION_VERSION
# Get application_os
echo "Build application_os"
./tools/firmware/build_application_os.sh $RECOMPILE_BOOTLOADER $APPLICATION_OS_HEX $APPLICATION_OS_VERSION

# Merge bootloader and application
echo "Merge bootloader & application"
hexmerge.py -o $FIRMWARE_HEX --no-start-addr $BOOTLOADER_HEX $APPLICATION_HEX
# Merge bootloader and application_os
echo "Merge bootloader & application_os"
hexmerge.py -o $FIRMWARE_HEX --no-start-addr $BOOTLOADER_HEX $APPLICATION_OS_HEX

# Convert in binary
arm-none-eabi-objcopy -I ihex -O binary $FIRMWARE_HEX $FIRMWARE_BIN
43 changes: 0 additions & 43 deletions tools/firmware/build_os.sh

This file was deleted.

0 comments on commit 624a69e

Please sign in to comment.