File tree Expand file tree Collapse file tree 2 files changed +16
-5
lines changed Expand file tree Collapse file tree 2 files changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,16 @@ include $(TOP)/extmod/extmod.mk
28
28
29
29
QEMU_SYSTEM = qemu-system-$(QEMU_ARCH )
30
30
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
31
41
32
42
INC += -I.
33
43
INC += -I$(TOP )
@@ -144,11 +154,6 @@ repl: $(BUILD)/firmware.elf
144
154
run : $(BUILD ) /firmware.elf
145
155
$(QEMU_SYSTEM ) $(QEMU_ARGS ) -serial pty -kernel $<
146
156
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
-
152
157
.PHONY : test
153
158
test : $(BUILD ) /firmware.elf
154
159
$(eval DIRNAME=ports/$(notdir $(CURDIR ) ) )
Original file line number Diff line number Diff line change @@ -104,3 +104,9 @@ The following options can be specified on the `make` command line:
104
104
- ` CFLAGS_EXTRA ` : pass in extra flags for the compiler.
105
105
- ` RUN_TESTS_EXTRA ` : pass in extra flags for ` run-tests.py ` when invoked via
106
106
` 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.
You can’t perform that action at this time.
0 commit comments