feat(modules): port renode module (AUR + arduino-sim + wokwi-cli) to Go
This commit is contained in:
54
internal/modules/renode/assets/arduino-sim.tmpl
Normal file
54
internal/modules/renode/assets/arduino-sim.tmpl
Normal file
@@ -0,0 +1,54 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
usage() {
|
||||
echo "Usage: arduino-sim <firmware.elf> [platform]"
|
||||
echo ""
|
||||
echo "Launch Renode with a GDB server for debugging firmware."
|
||||
echo "Connect nvim-dap or gdb to localhost:3333"
|
||||
echo ""
|
||||
echo "Platforms:"
|
||||
{{range .Platforms}} echo " {{.Name}} {{.Machine}}"
|
||||
{{end}} exit 1
|
||||
}
|
||||
|
||||
[[ $# -lt 1 ]] && usage
|
||||
|
||||
ELF="$1"
|
||||
PLATFORM="${2:-{{(index .Platforms 0).Name}}}"
|
||||
|
||||
[[ ! -f "$ELF" ]] && echo "Error: $ELF not found" && exit 1
|
||||
|
||||
case "$PLATFORM" in
|
||||
{{range .Platforms}} {{.Name}})
|
||||
RENODE_PLATFORM="{{.ReplPath}}"
|
||||
MACHINE="{{.Machine}}"
|
||||
;;
|
||||
{{end}} *)
|
||||
echo "Unknown platform: $PLATFORM"
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
|
||||
RESC=$(mktemp /tmp/renode-XXXXXX.resc)
|
||||
cat >"$RESC" <<EOF
|
||||
using sysbus
|
||||
|
||||
mach create "$MACHINE"
|
||||
machine LoadPlatformDescription @$RENODE_PLATFORM
|
||||
|
||||
sysbus LoadELF @$(realpath "$ELF")
|
||||
|
||||
machine StartGdbServer 3333
|
||||
|
||||
showAnalyzer sysbus.uart0 Antmicro.Renode.Analyzers.LoggingUartAnalyzer
|
||||
|
||||
start
|
||||
EOF
|
||||
|
||||
echo "Starting Renode ($MACHINE) with GDB server on :3333"
|
||||
echo "Connect debugger: nvim → <leader>ds or gdb → target remote :3333"
|
||||
echo ""
|
||||
|
||||
renode --disable-xwt "$RESC"
|
||||
rm -f "$RESC"
|
||||
Reference in New Issue
Block a user