Skip to content

Commit 6128328

Browse files
committed
qemu-arm/Makefile: Add support to run qemu in debugging mode.
Signed-off-by: Damien George <damien@micropython.org>
1 parent 221fe7b commit 6128328

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

ports/qemu-arm/Makefile

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,16 @@ include $(TOP)/extmod/extmod.mk
2828

2929
QEMU_SYSTEM = qemu-system-$(QEMU_ARCH)
3030
QEMU_ARGS += -machine $(QEMU_MACHINE) -nographic -monitor null -semihosting
31+
QEMU_ARGS += $(QEMU_EXTRA)
32+
33+
# `-gdb` command line parameters should go here (ie -gdb tcp::3333),
34+
# defaults to put gdb behind TCP port 1234
35+
36+
# Specifying QEMU_DEBUG=1 will block qemu until a debugger is connected.
37+
ifeq ($(QEMU_DEBUG),1)
38+
QEMU_DEBUG_ARGS ?= -s
39+
QEMU_ARGS += -S $(QEMU_DEBUG_ARGS) $(QEMU_DEBUG_EXTRA)
40+
endif
3141

3242
INC += -I.
3343
INC += -I$(TOP)
@@ -144,11 +154,6 @@ repl: $(BUILD)/firmware.elf
144154
run: $(BUILD)/firmware.elf
145155
$(QEMU_SYSTEM) $(QEMU_ARGS) -serial pty -kernel $<
146156

147-
# `make debug` will block QEMU until a debugger is connected to port 1234.
148-
.PHONY: debug
149-
debug: $(BUILD)/firmware.elf
150-
$(QEMU_SYSTEM) $(QEMU_ARGS) -serial mon:stdio -S -s -kernel $<
151-
152157
.PHONY: test
153158
test: $(BUILD)/firmware.elf
154159
$(eval DIRNAME=ports/$(notdir $(CURDIR)))

ports/qemu-arm/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,3 +104,9 @@ The following options can be specified on the `make` command line:
104104
- `CFLAGS_EXTRA`: pass in extra flags for the compiler.
105105
- `RUN_TESTS_EXTRA`: pass in extra flags for `run-tests.py` when invoked via
106106
`make test`.
107+
- `QEMU_DEBUG=1`: when running qemu (via `repl`, `run` or `test` target), qemu
108+
will block until a debugger is connected. By default it waits for a gdb connection
109+
on TCP port 1234.
110+
- `QEMU_DEBUG_ARGS`: defaults to `-s` (gdb on TCP port 1234), but can be overridden
111+
with different qemu gdb arguments.
112+
- `QEMU_DEBUG_EXTRA`: extra options to pass to qemu when `QEMU_DEBUG=1` is used.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy