mirror of https://github.com/wolfSSL/wolfBoot.git
Improve the nRF5340 build script to support arguments.
parent
ab59175427
commit
1a38293d47
|
@ -4,18 +4,74 @@
|
|||
|
||||
# run from wolfBoot root
|
||||
# ./tools/scripts/nrf5340/build_flash.sh
|
||||
# optionally run with "erase" argument to rease both internal and external flash
|
||||
# or provide make arguments "DEBUG=1"
|
||||
|
||||
# optionally run with "--erase" argument to rease both internal and external flash
|
||||
|
||||
if [ "$1" == "erase" ]; then
|
||||
DO_ERASE=1
|
||||
MAKE_ARGS="$2"
|
||||
else
|
||||
# Defaults
|
||||
MAKE_ARGS=
|
||||
DO_BUILD=0
|
||||
DO_BUILD_DEBUG=0
|
||||
DO_ERASE=0
|
||||
MAKE_ARGS="$1"
|
||||
DO_PROGRAM=0
|
||||
if [[ $# -eq 0 ]] ; then
|
||||
DO_BUILD=1
|
||||
DO_BUILD_DEBUG=0
|
||||
DO_ERASE=1
|
||||
DO_PROGRAM=1
|
||||
echo "Build release with symbols, erase and program"
|
||||
fi
|
||||
|
||||
while test $# -gt 0; do
|
||||
case "$1" in
|
||||
-h|--help|-?)
|
||||
echo "nRF5340 build / flash script"
|
||||
echo " "
|
||||
echo "default: build, erase and program"
|
||||
echo " "
|
||||
echo "options:"
|
||||
echo "-h, --help show brief help"
|
||||
echo "-b, --build build release with symbols"
|
||||
echo "-d, --debug build debug"
|
||||
echo "-v, --verbose build verbose"
|
||||
echo "-e, --erase do erase of internal/external flash"
|
||||
echo "-p, --program program images built"
|
||||
exit 0
|
||||
;;
|
||||
-b|--build)
|
||||
DO_BUILD=1
|
||||
MAKE_ARGS+=" DEBUG_SYMBOLS=1"
|
||||
echo "Build release with symbols"
|
||||
shift
|
||||
;;
|
||||
-d|--debug)
|
||||
DO_BUILD=1
|
||||
MAKE_ARGS+=" DEBUG=1"
|
||||
echo "Build with debug"
|
||||
shift
|
||||
;;
|
||||
-v|--verbose)
|
||||
DO_BUILD=1
|
||||
MAKE_ARGS+=" V=1"
|
||||
echo "Build with verbose output"
|
||||
shift
|
||||
;;
|
||||
-e|--erase)
|
||||
DO_ERASE=1
|
||||
echo "Do erase"
|
||||
shift
|
||||
;;
|
||||
-p|--program)
|
||||
DO_PROGRAM=1
|
||||
echo "Do program"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ $DO_BUILD == 1 ]]; then
|
||||
rm -f ./tools/scripts/nrf5340/*.bin
|
||||
rm -f ./tools/scripts/nrf5340/*.hex
|
||||
|
||||
|
@ -54,13 +110,14 @@ arm-none-eabi-objcopy -I binary -O ihex --change-addresses 0x01000000 tools/scri
|
|||
|
||||
arm-none-eabi-objcopy -I binary -O ihex --change-addresses 0x10000000 tools/scripts/nrf5340/update_app_v2.bin tools/scripts/nrf5340/update_app_v2.hex
|
||||
arm-none-eabi-objcopy -I binary -O ihex --change-addresses 0x10100000 tools/scripts/nrf5340/image_v2_signed_net.bin tools/scripts/nrf5340/image_v2_signed_net.hex
|
||||
fi
|
||||
|
||||
|
||||
if [ "$DO_ERASE" == "1" ]; then
|
||||
if [[ $DO_ERASE == 1 ]]; then
|
||||
nrfjprog -f nrf53 --recover
|
||||
nrfjprog -f nrf53 --qspieraseall
|
||||
fi
|
||||
|
||||
if [[ $DO_PROGRAM == 1 ]]; then
|
||||
# Program external flash
|
||||
nrfjprog -f nrf53 --program tools/scripts/nrf5340/update_app_v2.hex --verify
|
||||
nrfjprog -f nrf53 --program tools/scripts/nrf5340/image_v2_signed_net.hex --verify
|
||||
|
@ -71,3 +128,4 @@ nrfjprog -f nrf53 --program tools/scripts/nrf5340/image_v2_signed_net.hex --veri
|
|||
#nrfjprog -f nrf53 --program tools/scripts/nrf5340/factory_net.hex --verify --coprocessor CP_NETWORK
|
||||
JLinkExe -CommandFile tools/scripts/nrf5340/flash_net.jlink
|
||||
JLinkExe -CommandFile tools/scripts/nrf5340/flash_app.jlink
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue