summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxengineering <me@xengineering.eu>2025-03-21 22:25:19 +0100
committerxengineering <me@xengineering.eu>2025-03-21 22:25:19 +0100
commit0ec1b2088df75e0bed587acdd25e00a69edf3556 (patch)
treea2a948ad4a1ebe7fe82f364f00ac5a0540c38d98
parent690f38b8212b2638ec323d19869cc0c14487375e (diff)
downloadiot-contact-0ec1b2088df75e0bed587acdd25e00a69edf3556.tar
iot-contact-0ec1b2088df75e0bed587acdd25e00a69edf3556.tar.zst
iot-contact-0ec1b2088df75e0bed587acdd25e00a69edf3556.zip
fw: Add nucleo.sh
This script allows to easily: - build for real hardware - flash to the microcontroller - open the Zephyr shell UART
-rwxr-xr-xfw/nucleo.sh39
1 files changed, 39 insertions, 0 deletions
diff --git a/fw/nucleo.sh b/fw/nucleo.sh
new file mode 100755
index 0000000..8bff4a0
--- /dev/null
+++ b/fw/nucleo.sh
@@ -0,0 +1,39 @@
+#!/bin/sh
+
+
+# This Source Code Form is subject to the terms of the Mozilla Public License,
+# v. 2.0. If a copy of the MPL was not distributed with this file, You can
+# obtain one at https://mozilla.org/MPL/2.0/.
+
+
+# nucleo.sh
+#
+# This script builds the firmware for the ST Nucleo F767ZI board instead of the
+# native_sim board. After the build it flashes it to the target and opens the
+# serial console.
+#
+# This may be used to quickly test the current simulation-based development
+# state on real hardware.
+
+
+set -euf
+
+
+SCRIPT="$(realpath "$0")"
+FW="$(dirname "$SCRIPT")"
+ROOT="$(dirname "$FW")"
+BUILD="${ROOT}/nucleo"
+FIRMWARE="${BUILD}/fw/zephyr/zephyr.bin"
+FLASH_ADDRESS='0x8000000'
+BOARD='nucleo_f767zi'
+BAUDRATE='115200'
+SERIAL_PORT='/dev/ttyACM0'
+
+
+set -x
+
+rm -rf "$BUILD"
+cmake "-B${BUILD}" -GNinja -DBOARD="$BOARD"
+ninja -C "$BUILD"
+st-flash --connect-under-reset write "$FIRMWARE" "$FLASH_ADDRESS"
+picocom -b "$BAUDRATE" "$SERIAL_PORT"