Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
ifeq ($(OS),Windows_NT)
# Pure Windows (e.g. MSYS2/MinGW). Note that in WSL, $(OS) is *not* Windows_NT.
GDBCMD = gdb-multiarch
GDBCMD = gdb-multiarch
GDBTARGET = $(shell hostname).local:2331
else
# We are in a Unix-like environment (Linux or macOS or WSL). Here, $(OS) is not defined.
UNAME_S := $(shell uname -s)
UNAME_R := $(shell uname -r)

ifeq ($(UNAME_S),Darwin)
# macOS
GDBCMD = gdb
GDBCMD = gdb
GDBTARGET = localhost:2331
else ifeq ($(UNAME_S),Linux)
# Linux or WSL. Check if it's WSL by searching "microsoft" in uname -r
ifneq (,$(findstring microsoft,$(UNAME_R)))
# WSL
GDBCMD = gdb
GDBCMD = gdb
GDBTARGET = localhost:2331
else
# "Pure" Linux
GDBCMD = gdb-multiarch
GDBCMD = gdb-multiarch
GDBTARGET = localhost:2331
endif
else
$(error Unknown or unsupported OS)
Expand Down Expand Up @@ -54,7 +58,7 @@ connect:
-ex "add-symbol-file bootloader/bootloader2.elf" \
-ex "add-symbol-file bootloader/bootloader3.elf" \
-ex "set confirm on" \
-ex "target remote localhost:2331" \
-ex "target remote $(GDBTARGET)" \
-ex "monitor reset" \
-ex "break go_to_app" \
-ex "continue" \
Expand All @@ -71,7 +75,7 @@ connect_bl:
-ex "add-symbol-file bootloader/bootloader2.elf" \
-ex "add-symbol-file bootloader/bootloader3.elf" \
-ex "set confirm on" \
-ex "target remote localhost:2331" \
-ex "target remote $(GDBTARGET)" \
-ex "monitor reset" \
bootloader/bootloader1.elf

Expand Down