77WORKSPACE=/spaceinvader
88cd $WORKSPACE
99
10- # make a directory for hexadecimal files
10+ # Make directories for hexadecimal files and the final binary
1111mkdir $WORKSPACE /hex
12+ mkdir $WORKSPACE /dist
1213
1314# Initialize and update git submodules
1415git submodule init
1516git submodule update
1617
1718# Compile micro-ecc library
18- cd $WORKSPACE /apps/secure_bootloader/micro-ecc-build
19- make
19+ make --directory=$WORKSPACE /apps/secure_bootloader/micro-ecc-build
2020
2121# Set the public key for the secure bootloader
2222sed -i " s/\/\* PUBLIC_KEY_PLACEHOLDER \*\//$PUBLIC_KEY_HEX /" $WORKSPACE /apps/firmware/dfu_images/public_key.c
2323
2424# Compile secure bootloader
25- cd $WORKSPACE /apps/secure_bootloader/build
26- make
27- cp $WORKSPACE /apps/secure_bootloader/build/_build/secure_bootloader_moko.hex $WORKSPACE /hex
25+ make --directory=$WORKSPACE /apps/secure_bootloader/build
26+ mv $WORKSPACE /apps/secure_bootloader/build/_build/secure_bootloader_moko.hex $WORKSPACE /hex
2827
2928# Compile firmware
30- cd $WORKSPACE /apps/firmware/build
31- make
32- cp $WORKSPACE /apps/firmware/build/_build/nrf52810_xxaa.hex $WORKSPACE /hex
29+ make --directory=$WORKSPACE /apps/firmware/build
30+ mv $WORKSPACE /apps/firmware/build/_build/nrf52810_xxaa.hex $WORKSPACE /hex
3331
3432# Make hexadecimal files
3533cd $WORKSPACE /hex
@@ -39,7 +37,7 @@ nrfutil settings generate --family NRF52810 --application nrf52810_xxaa.hex --ap
3937
4038# Merge hex files
4139cp $WORKSPACE /nRF5_SDK_17.0.2_d674dde/components/softdevice/s112/hex/s112_nrf52_7.2.0_softdevice.hex $WORKSPACE /hex
42- mergehex -m bl_settings.hex secure_bootloader_moko.hex nrf52810_xxaa.hex s112_nrf52_7.2.0_softdevice.hex --output full_dfu .hex
40+ mergehex --merge bl_settings.hex secure_bootloader_moko.hex nrf52810_xxaa.hex s112_nrf52_7.2.0_softdevice.hex --output firmware .hex
4341
4442# Convert the HEX file to a BIN file
45- arm-none-eabi-objcopy -I ihex -O binary full_dfu .hex $WORKSPACE /firmware.bin
43+ arm-none-eabi-objcopy --input-target= ihex --output-target= binary firmware .hex $WORKSPACE /dist /firmware.bin
0 commit comments