1515# Build dela update version 3 and flash to external (also reprograms internal flash)
1616# ./tools/scripts/nrf5340/build_flash.sh --delta
1717
18- # import config for IMAGE_HEADER_SIZE and WOLFBOOT_SECTOR_SIZE
19- . config/examples/nrf5340.config
18+ # import IMAGE_HEADER_SIZE and WOLFBOOT_SECTOR_SIZE
19+ IMAGE_HEADER_SIZE=" $( awk -F ' ?=|:=|=' ' $1 == "IMAGE_HEADER_SIZE" { print $2 }' config/examples/nrf5340.config) "
20+ WOLFBOOT_SECTOR_SIZE=" $( awk -F ' ?=|:=|=' ' $1 == "WOLFBOOT_SECTOR_SIZE" { print $2 }' config/examples/nrf5340.config) "
2021
2122# Defaults
2223MAKE_ARGS=" DEBUG_SYMBOLS=1"
4748
4849while test $# -gt 0; do
4950 case " $1 " in
50- -h|--help|-? )
51+ -h|--help|-\ ? )
5152 echo " nRF5340 build / flash script"
5253 echo " "
5354 echo " default: build, erase and program"
5455 echo " "
5556 echo " options:"
56- echo " -h, --help show brief help"
57- echo " -c, --clean cleanup build artifacts"
58- echo " -b, --build build release with symbols"
59- echo " -d, --debug build debug"
60- echo " -v, --verbose build verbose"
61- echo " --version use custom version"
62- echo " -e, --erase do erase of internal/external flash"
63- echo " -p, --program program images built"
64- echo " -u, --update build update, sign and program external flash"
65- echo " -t, --delta build update, sign delta and program external flash"
57+ echo " -h, --help show brief help"
58+ echo " -c, --clean cleanup build artifacts"
59+ echo " -b, --build build release with symbols"
60+ echo " -d, --debug build debug"
61+ echo " -v, --verbose build verbose"
62+ echo " --version use custom version"
63+ echo " -e, --erase do erase of internal/external flash"
64+ echo " -ei, --erase-int do erase of internal flash"
65+ echo " -ee, --erase-ext do erase of external flash"
66+ echo " -p, --program program images built"
67+ echo " -pi, --program-int program internal image (boot)"
68+ echo " -pe, --program-ext program external image (update)"
69+ echo " -u, --update build update, sign and program external flash"
70+ echo " -t, --delta build update, sign delta and program external flash"
6671 exit 0
6772 ;;
6873 -c|--clean)
@@ -93,12 +98,32 @@ while test $# -gt 0; do
9398 echo " Do erase"
9499 shift
95100 ;;
101+ -ei|--erase-int)
102+ DO_ERASE_INT=1
103+ echo " Do erase internal"
104+ shift
105+ ;;
106+ -ee|--erase-ext)
107+ DO_ERASE_EXT=1
108+ echo " Do erase external"
109+ shift
110+ ;;
96111 -p|--program)
97112 DO_PROGRAM_INT=1
98113 DO_PROGRAM_EXT=1
99114 echo " Do program"
100115 shift
101116 ;;
117+ -pi|--program-int)
118+ DO_PROGRAM_INT=1
119+ echo " Do program internal"
120+ shift
121+ ;;
122+ -pe|--program-ext)
123+ DO_PROGRAM_EXT=1
124+ echo " Do program external"
125+ shift
126+ ;;
102127 --version)
103128 UPDATE_VERSION=" $2 "
104129 echo " Use version ${UPDATE_VERSION} "
@@ -148,6 +173,8 @@ if [[ $DO_BUILD == 1 ]]; then
148173 make clean
149174 make $MAKE_ARGS
150175 cp test-app/image.bin tools/scripts/nrf5340/image_net.bin
176+ cp wolfboot.elf tools/scripts/nrf5340/wolfboot_net.elf
177+ cp test-app/image.elf tools/scripts/nrf5340/image_net.elf
151178 if [ ! -f tools/scripts/nrf5340/factory_net.bin ]; then
152179 cp test-app/image_v1_signed.bin tools/scripts/nrf5340/image_net_v1_signed.bin
153180 cp factory.bin tools/scripts/nrf5340/factory_net.bin
@@ -158,6 +185,8 @@ if [[ $DO_BUILD == 1 ]]; then
158185 make clean
159186 make $MAKE_ARGS
160187 cp test-app/image.bin tools/scripts/nrf5340/image_app.bin
188+ cp wolfboot.elf tools/scripts/nrf5340/wolfboot_app.elf
189+ cp test-app/image.elf tools/scripts/nrf5340/image_app.elf
161190 if [ ! -f tools/scripts/nrf5340/factory_app.bin ]; then
162191 cp test-app/image_v1_signed.bin tools/scripts/nrf5340/image_app_v1_signed.bin
163192 cp factory.bin tools/scripts/nrf5340/factory_app.bin
0 commit comments