universalisos/microkernel/gdb-connect.sh
Fábio Coutada 98ed638f3c WIP: emergency commit — ESP32 GDB stub, boot chain work, docs, AGENTS.md rules
All uncommitted work from ESP32 GDB stub development session.
Includes:
- GDB stub (uos_gdbstub.c/.h/_entry.S)
- Startup vector table rewrite
- ESP32 HAL integration files
- Boot chain design docs
- AGENTS.md absolute rules (commit before refactor, no unauthorized changes)
- All prior deepseek session work

This commit prevents further data loss. No claims of correctness.
2026-07-17 01:36:58 +01:00

37 lines
1.4 KiB
Bash

#!/bin/bash
# Build, sign, flash, wait for stub, attach GDB.
set -e
M=/home/fabiorafaelcoutada/portugalfuturista/universalisos/microkernel
G=/home/fabiorafaelcoutada/.espressif/tools/xtensa-esp-elf-gdb/16.3_20250913/xtensa-esp-elf-gdb/bin/xtensa-esp32-elf-gdb
MCUBOOT=/home/fabiorafaelcoutada/portugalfuturista/mcuboot
UBOOT_TOOLS=/home/fabiorafaelcoutada/portugalfuturista/universalis-uboot/tools
cd "$M"
make TARGET=esp32 -j$(nproc)
python3 "$UBOOT_TOOLS/mk_esp_mcuboot_image.py" build/esp32/universalisos.elf build/esp32/uos_esp.bin
imgtool sign --key "$MCUBOOT/root-ec-p256.pem" --align 1 --version 1.0.0 \
--header-size 0x20 --pad-header --slot-size 0x180000 \
build/esp32/uos_esp.bin build/esp32/uos_esp_signed.bin
esptool --chip esp32 --port /dev/ttyACM0 --baud 460800 write-flash \
0x1000 "$MCUBOOT/build_esp32/mcuboot_esp32.bin" \
0x20000 build/esp32/uos_esp_signed.bin
# Wait for MCUboot + UOS break (no UART spam from UOS)
sleep 6
# Drain residual MCUboot logs so GDB sees a clean stream
stty -F /dev/ttyACM0 115200 raw -echo -ixon -ixoff 2>/dev/null || true
timeout 1 cat /dev/ttyACM0 >/dev/null 2>&1 || true
exec "$G" -n \
-ex "set confirm off" \
-ex "set remotetimeout 10" \
-ex "set architecture xtensa" \
-ex "file $M/build/esp32/universalisos.elf" \
-ex "target remote /dev/ttyACM0" \
-ex "p/x \$pc" \
-ex "p/x \$a1" \
-ex "info registers a0 a1 a2 pc ps" \
-ex "bt" \
-ex "x/8i \$pc"