summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlessandro Gatti <a.gatti@frob.it>2025-11-10 21:12:37 +0100
committerDamien George <damien@micropython.org>2025-12-19 17:06:53 +1100
commitd938d5af4e1d4a860c80d3ecfbe0288c60858cb9 (patch)
tree9e2b98ed1b8cec11ef4c771af20a84dae41e47fd
parentcb9d8fcc3162b6a4935200c73f58661e9d55888b (diff)
qemu/Makefile: Allow usage of a custom QEMU binary to run code.
This commit introduces a new optional makefile variable to let the build system know that, when running code, a custom QEMU binary must be used instead of the one provided by the system's PATH. Given that the CI machine won't keep up with QEMU updates unless its base image tracks a new version of QEMU itself, sometimes it is needed to use a custom QEMU build to be able to test new code in an emulated context rather than having to perform on-device testing during development. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
-rw-r--r--ports/qemu/Makefile3
-rw-r--r--ports/qemu/README.md4
2 files changed, 6 insertions, 1 deletions
diff --git a/ports/qemu/Makefile b/ports/qemu/Makefile
index ba9c53841..c8ce3de87 100644
--- a/ports/qemu/Makefile
+++ b/ports/qemu/Makefile
@@ -153,7 +153,8 @@ endif
################################################################################
# Project specific settings and compiler/linker flags
-QEMU_SYSTEM = qemu-system-$(QEMU_ARCH)
+QEMU_BASE ?= qemu-system-
+QEMU_SYSTEM = $(QEMU_BASE)$(QEMU_ARCH)
QEMU_ARGS += -machine $(QEMU_MACHINE) -nographic -monitor null -semihosting
QEMU_ARGS += $(QEMU_EXTRA)
diff --git a/ports/qemu/README.md b/ports/qemu/README.md
index bf5788961..a7134d0eb 100644
--- a/ports/qemu/README.md
+++ b/ports/qemu/README.md
@@ -157,6 +157,10 @@ The following options can be specified on the `make` command line:
- `CFLAGS_EXTRA`: pass in extra flags for the compiler.
- `RUN_TESTS_EXTRA`: pass in extra flags for `run-tests.py` and `run-natmodtests.py`
when invoked via `make test` or `make test_natmod`.
+- `QEMU_BASE`: pass an optional partial path of the qemu binary to run code with, eg.
+ `/opt/custom-directory/qemu/bin/qemu-system-`, similar to how a cross compiler name
+ is passed to the MicroPython makefile. By default it will use the appropriate QEMU
+ binary found through the system's PATH environment variable.
- `QEMU_DEBUG=1`: when running qemu (via `repl`, `run` or `test` target), qemu
will block until a debugger is connected. By default it waits for a gdb connection
on TCP port 1234.