File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed
variants/arduino_uno_q_stm32u585xx/scripts Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+
3+ # This script sets the micro of the Arduino UNO Q in RAM mode, and allow to flash it
4+ # with menu option flash=ram.
5+ # This is necessary because a flash in RAM mode is possible only if the micro
6+ # isn't running any other sketch (in flash mode).
7+ # The RAM mode is volatile, so after a power cycle the micro will not execute
8+ # the sketch anymore.
9+ # This is used by the arduino-app-cli when uploading sketches to the Arduino UNO Q.
10+
11+ # Requirements:
12+ # - arduino-cli
13+ # - jq
14+
15+ # Usage:
16+ # ./set-to-ram-mode.sh [port]
17+
18+
19+ tmpdir=$( mktemp -d)
20+ trap ' rm -rf "$tmpdir"' EXIT
21+
22+ sketch_path=" ${tmpdir} /empty"
23+ mkdir ${sketch_path}
24+
25+ bin_path=" ${sketch_path} /empty.ino.elf-zsk.bin"
26+ dd if=/dev/zero of=${bin_path} bs=50 count=1 > /dev/null 2>&1
27+
28+ if [ -z " $1 " ]; then
29+ port=$( arduino-cli board list --format json | jq -r ' .detected_ports[] | select(.matching_boards[]?.fqbn == "arduino:zephyr:unoq") | .port.address' )
30+ else
31+ port=" $1 "
32+ fi
33+
34+ arduino-cli upload -p ${port} --input-dir ${sketch_path} -b arduino:zephyr:unoq
You can’t perform that action at this time.
0 commit comments