mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-15 08:30:02 +00:00
Merge pull request #715 from rowr111/tools-bao_apps-name-change-and-send-boot-cmd
tools-bao: app->apps name change, send boot cmd to be used by ext for build-flash-run, default baud rate
This commit is contained in:
commit
e75713e08e
3 changed files with 43 additions and 3 deletions
|
|
@ -9,6 +9,7 @@ from commands.monitor import cmd_monitor
|
|||
from commands.flash import cmd_flash
|
||||
from commands.doctor import cmd_doctor
|
||||
from commands.artifacts import cmd_artifacts
|
||||
from commands.boot import cmd_boot
|
||||
|
||||
VERSION = "0.1.1"
|
||||
|
||||
|
|
@ -33,7 +34,7 @@ def main():
|
|||
# monitor
|
||||
m = sub.add_parser("monitor", help="Open a serial monitor")
|
||||
m.add_argument("-p", "--port", required=True, help="Serial port (e.g., COM5, /dev/ttyUSB0)")
|
||||
m.add_argument("-b", "--baud", type=int, default=115200, help="Baud rate")
|
||||
m.add_argument("-b", "--baud", type=int, default=1000000, help="Baud rate")
|
||||
m.add_argument("--ts", action="store_true", help="Show timestamps on received lines")
|
||||
m.add_argument("--save", help="Append output to a file")
|
||||
m.add_argument("--reset", action="store_true", help="Toggle DTR/RTS on open")
|
||||
|
|
@ -55,6 +56,12 @@ def main():
|
|||
f.add_argument("files", nargs="+", help="One or more UF2 files to copy (e.g., loader.uf2 xous.uf2 apps.uf2)")
|
||||
f.set_defaults(func=cmd_flash)
|
||||
|
||||
# boot
|
||||
boot = sub.add_parser("boot", help="Send 'boot' to the bootloader serial port to start run mode")
|
||||
boot.add_argument("-p", "--port", required=True, help="Bootloader serial port (e.g., COM7, /dev/ttyACM0)")
|
||||
boot.add_argument("-b", "--baud", type=int, default=1000000, help="Baud rate (default 1000000)")
|
||||
boot.set_defaults(func=cmd_boot)
|
||||
|
||||
args = ap.parse_args()
|
||||
|
||||
log_level = logging.DEBUG if getattr(args, "verbose", False) else logging.WARNING
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ Outputs JSON if --json is set:
|
|||
"images": [
|
||||
{ "path": ".../loader.uf2", "role": "loader" },
|
||||
{ "path": ".../xous.uf2", "role": "xous" },
|
||||
{ "path": ".../apps.uf2", "role": "app" }
|
||||
{ "path": ".../apps.uf2", "role": "apps" }
|
||||
]
|
||||
}
|
||||
|
||||
|
|
@ -26,7 +26,7 @@ TRIPLE: str = "riscv32imac-unknown-xous-elf"
|
|||
FILENAMES: List[Tuple[str, str]] = [
|
||||
("loader.uf2", "loader"),
|
||||
("xous.uf2", "xous"),
|
||||
("apps.uf2", "app"),
|
||||
("apps.uf2", "apps"),
|
||||
]
|
||||
|
||||
EXIT_OK = 0
|
||||
|
|
|
|||
33
tools-bao/commands/boot.py
Normal file
33
tools-bao/commands/boot.py
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
import sys
|
||||
import time
|
||||
import logging
|
||||
import serial
|
||||
|
||||
def cmd_boot(args) -> None:
|
||||
port = args.port
|
||||
baud = args.baud
|
||||
try:
|
||||
ser = serial.Serial(port, baud, timeout=0.2)
|
||||
except Exception as e:
|
||||
logging.error(f"[bao] cannot open {port}: {e}")
|
||||
sys.exit(2)
|
||||
|
||||
try:
|
||||
with ser:
|
||||
try:
|
||||
ser.reset_input_buffer()
|
||||
ser.reset_output_buffer()
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# Send the boot command to leave bootloader mode and start firmware (run mode)
|
||||
ser.write(b"boot\r\n")
|
||||
ser.flush()
|
||||
# tiny grace period to ensure the device processes it
|
||||
time.sleep(0.1)
|
||||
except Exception as e:
|
||||
logging.error(f"[bao] boot command failed on {port}: {e}")
|
||||
sys.exit(1)
|
||||
|
||||
print(f"[bao] sent 'boot' on {port}")
|
||||
sys.exit(0)
|
||||
Loading…
Reference in a new issue