Skip to content

Commit a47ee06

Browse files
committed
wip: giga: use iConfiguration to automatically reflash the loader if needed
Requires arduino/arduino-cli#3171 and arduino/serial-discovery#116 (and, transitively, bugst/go-serial#215) TODO: * replace the shell script with a proper version check utility * check if other uploaders need different methods
1 parent 195fa3d commit a47ee06

3 files changed

Lines changed: 14 additions & 0 deletions

File tree

boards.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ giga.upload.vid=0x2341
4646
giga.upload.pid=0x0366
4747
giga.upload.interface=0
4848
giga.upload.use_1200bps_touch=true
49+
giga.upload.use_pre_upload_check=true
4950
giga.upload.wait_for_upload_port=true
5051
giga.upload.native_usb=true
5152
giga.upload.maximum_size=1966080

platform.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,10 @@ tools.stm32flash.erase.pattern="{path}/{cmd}" {serial.port} -e 1024 -b 2400
225225
# DFU_UTIL
226226
#
227227

228+
tools.dfu-util.pre_cmd.linux={build.variant.path}/check_loader_version.sh
229+
tools.dfu-util.pre_upload_check.pattern="{pre_cmd}" {upload.port.properties.configuration}
230+
tools.dfu-util.pre_upload.pattern="{path}/{cmd}" --device ,{bootloader.vid}:{bootloader.pid} -D "{runtime.platform.path}/firmwares/{bootloader.file}" -a{bootloader.interface} --dfuse-address={bootloader.address}
231+
228232
upload.dfuse=--dfuse-address={upload.address}:leave
229233
bootloader.dfuse=--dfuse-address={bootloader.address}:leave
230234

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
3+
DIR=$(dirname "$(readlink -f "$0")")
4+
VERSION=$(grep "define BUILD_VERSION" ${DIR}/llext-edk/include/zephyr/include/generated/zephyr/version.h | cut -f3 -d " ")
5+
if [ "$VERSION" != "$1" ]; then
6+
echo "Loader version mismatch: expected $1, got $VERSION, reflashing loader"
7+
exit 1
8+
fi
9+
exit 0

0 commit comments

Comments
 (0)