From 85aae6c07bfafe097cbeffd4b85633ce7d3e6752 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Thu, 11 Jul 2024 09:22:28 -0500 Subject: [PATCH 1/4] Switch default upload protocol to nrfutil so that pio generates zip deploy packages --- variants/wio-sdk-wm1110/platformio.ini | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/variants/wio-sdk-wm1110/platformio.ini b/variants/wio-sdk-wm1110/platformio.ini index dc7d47310c..e75d4c4ef5 100644 --- a/variants/wio-sdk-wm1110/platformio.ini +++ b/variants/wio-sdk-wm1110/platformio.ini @@ -7,7 +7,7 @@ board = wio-sdk-wm1110 build_unflags = ${nrf52840_base:build_unflags} -DUSBCON -DUSE_TINYUSB ; platform = https://github.com/maxgerhardt/platform-nordicnrf52#cac6fcf943a41accd2aeb4f3659ae297a73f422e -build_flags = ${nrf52840_base.build_flags} -Ivariants/wio-sdk-wm1110 -Isrc/platform/nrf52/softdevice -Isrc/platform/nrf52/softdevice/nrf52 -DWIO_WM1110 +build_flags = ${nrf52840_base.build_flags} -Ivariants/wio-sdk-wm1110 -Isrc/platform/nrf52/softdevice -Isrc/platform/nrf52/softdevice/nrf52 -DWIO_WM1110 -DWIO_WM1110_SDK -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m4/fpv4-sp-d16-hard" -DGPS_POWER_TOGGLE ; comment this line to disable triple press function on the user button to turn off gps entirely. board_build.ldscript = src/platform/nrf52/nrf52840_s140_v7.ld @@ -20,7 +20,7 @@ debug_tool = jlink ; No need to reflash if the binary hasn't changed debug_load_mode = modified ; If not set we will default to uploading over serial (first it forces bootloader entry by talking 1200bps to cdcacm) -upload_protocol = jlink +upload_protocol = nrfutil ;upload_protocol = stlink ; we prefer to stop in setup() because we are an 'ardiuno' app debug_init_break = tbreak setup From 1252160c778beca1dc1410828fd1dbf6deff0bf2 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Thu, 11 Jul 2024 09:23:50 -0500 Subject: [PATCH 2/4] Enter serial DFU on SDK board --- src/platform/nrf52/main-nrf52.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/platform/nrf52/main-nrf52.cpp b/src/platform/nrf52/main-nrf52.cpp index c5b217f0e3..5b11b0a46e 100644 --- a/src/platform/nrf52/main-nrf52.cpp +++ b/src/platform/nrf52/main-nrf52.cpp @@ -286,5 +286,10 @@ void clearBonds() void enterDfuMode() { +// SDK kit does not have native USB like almost all other NRF52 boards +#ifdef WIO_WM1110_SDK + enterSerialDfu(); +#else enterUf2Dfu(); +#endif } \ No newline at end of file From 756fdb0e52d36dcd2167e3e5654c7276c15be07d Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Thu, 11 Jul 2024 09:25:42 -0500 Subject: [PATCH 3/4] Remove guard for DFU zip from SDK build --- bin/build-nrf52.sh | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/bin/build-nrf52.sh b/bin/build-nrf52.sh index 077e2af35a..cf4ca60cb2 100755 --- a/bin/build-nrf52.sh +++ b/bin/build-nrf52.sh @@ -25,13 +25,9 @@ pio run --environment $1 # -v SRCELF=.pio/build/$1/firmware.elf cp $SRCELF $OUTDIR/$basename.elf -if (echo $1 | grep -q "wio-sdk-wm1110"); then - echo "Skipping dfu file" -else - echo "Generating NRF52 dfu file" - DFUPKG=.pio/build/$1/firmware.zip - cp $DFUPKG $OUTDIR/$basename-ota.zip -fi +echo "Generating NRF52 dfu file" +DFUPKG=.pio/build/$1/firmware.zip +cp $DFUPKG $OUTDIR/$basename-ota.zip echo "Generating NRF52 uf2 file" SRCHEX=.pio/build/$1/firmware.hex From d8f2f54d27e903417f676e69be7802cd2ab90bae Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Thu, 11 Jul 2024 10:34:09 -0500 Subject: [PATCH 4/4] NRF_USE_SERIAL_DFU macro instead --- src/platform/nrf52/main-nrf52.cpp | 2 +- variants/wio-sdk-wm1110/platformio.ini | 2 +- variants/wio-sdk-wm1110/variant.h | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/platform/nrf52/main-nrf52.cpp b/src/platform/nrf52/main-nrf52.cpp index 5b11b0a46e..7334f3a041 100644 --- a/src/platform/nrf52/main-nrf52.cpp +++ b/src/platform/nrf52/main-nrf52.cpp @@ -287,7 +287,7 @@ void clearBonds() void enterDfuMode() { // SDK kit does not have native USB like almost all other NRF52 boards -#ifdef WIO_WM1110_SDK +#ifdef NRF_USE_SERIAL_DFU enterSerialDfu(); #else enterUf2Dfu(); diff --git a/variants/wio-sdk-wm1110/platformio.ini b/variants/wio-sdk-wm1110/platformio.ini index e75d4c4ef5..7667174289 100644 --- a/variants/wio-sdk-wm1110/platformio.ini +++ b/variants/wio-sdk-wm1110/platformio.ini @@ -7,7 +7,7 @@ board = wio-sdk-wm1110 build_unflags = ${nrf52840_base:build_unflags} -DUSBCON -DUSE_TINYUSB ; platform = https://github.com/maxgerhardt/platform-nordicnrf52#cac6fcf943a41accd2aeb4f3659ae297a73f422e -build_flags = ${nrf52840_base.build_flags} -Ivariants/wio-sdk-wm1110 -Isrc/platform/nrf52/softdevice -Isrc/platform/nrf52/softdevice/nrf52 -DWIO_WM1110 -DWIO_WM1110_SDK +build_flags = ${nrf52840_base.build_flags} -Ivariants/wio-sdk-wm1110 -Isrc/platform/nrf52/softdevice -Isrc/platform/nrf52/softdevice/nrf52 -DWIO_WM1110 -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m4/fpv4-sp-d16-hard" -DGPS_POWER_TOGGLE ; comment this line to disable triple press function on the user button to turn off gps entirely. board_build.ldscript = src/platform/nrf52/nrf52840_s140_v7.ld diff --git a/variants/wio-sdk-wm1110/variant.h b/variants/wio-sdk-wm1110/variant.h index 8ad8c769af..8f66b1f8c8 100644 --- a/variants/wio-sdk-wm1110/variant.h +++ b/variants/wio-sdk-wm1110/variant.h @@ -107,6 +107,8 @@ extern "C" { #define LR1110_GNSS_ANT_PIN (32 + 5) // P1.05 37 +#define NRF_USE_SERIAL_DFU + #ifdef __cplusplus } #endif