diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 51e530ec51..c5410cb309 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -2,6 +2,7 @@ "recommendations": [ "marus25.cortex-debug", "Gruntfuggly.todo-tree", - "ms-vscode.cpptools" + "ms-vscode.cpptools", + "vadimcn.vscode-lldb" ] } \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json index 375a6017cc..a29299bfb8 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -5,7 +5,7 @@ "version": "0.2.0", "configurations": [ { - "name": "Debug Unit Tests", + "name": "Debug Unit Tests (gdb)", "type": "cppdbg", "request": "launch", "program": "${workspaceFolder}/unit_tests/build/rusefi_test", @@ -24,6 +24,14 @@ } ] }, + { + "name": "Debug Unit Tests (lldb)", + "type": "lldb", + "request": "launch", + "program": "${workspaceFolder}/unit_tests/build/rusefi_test", + "args": [], + "cwd": "${workspaceFolder}/unit_tests/build/", + }, { "name": "Debug F40x", "type": "cortex-debug", diff --git a/unit_tests/Makefile b/unit_tests/Makefile index d1da8c3cfd..b2d250f716 100644 --- a/unit_tests/Makefile +++ b/unit_tests/Makefile @@ -18,16 +18,12 @@ include $(PROJECT_DIR)/rusefi_rules.mk # Compiler options here. ifeq ($(USE_OPT),) -# As of Jan 2016 we are producing 64 bit unit tests on Windows which needs 64 bit GDB -# Previouslyt we had to download 32 bit version of GDB maybe from http://www.equation.com/servlet/equation.cmd?fa=gdb -# # -O2 is needed for mingw, without it there is a linking issue to isnanf?!?! #USE_OPT = $(RFLAGS) -O2 -fgnu89-inline -ggdb -fomit-frame-pointer -falign-functions=16 -std=gnu99 -Werror-implicit-function-declaration -Werror -Wno-error=pointer-sign -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=sign-compare -Wno-error=unused-parameter -Wno-error=missing-field-initializers USE_OPT = -c -Wall -O0 -ggdb -g3 USE_OPT += -fprofile-arcs -ftest-coverage USE_OPT += -Werror=missing-field-initializers USE_OPT += -Wno-unused-parameter -Wno-unused-function - USE_OPT += -fsingle-precision-constant endif @@ -297,7 +293,7 @@ ULIBDIR = # List all user libraries here ULIBS = -lm -ULIBS += -lgcov --coverage +ULIBS += --coverage # # End of user defines diff --git a/unit_tests/rules.mk b/unit_tests/rules.mk index 5e93b3e311..8d775c6ce0 100644 --- a/unit_tests/rules.mk +++ b/unit_tests/rules.mk @@ -54,16 +54,33 @@ ADEFS = $(DADEFS) $(UADEFS) LIBS = $(DLIBS) $(ULIBS) # Various settings -#MCFLAGS = -mcpu=$(MCU) -ODFLAGS = -x --syms -ASFLAGS = $(MCFLAGS) -Wa,-amhls=$(LSTDIR)/$(notdir $(<:.s=.lst)) $(ADEFS) -ASXFLAGS = $(MCFLAGS) -Wa,-amhls=$(LSTDIR)/$(notdir $(<:.S=.lst)) $(ADEFS) -CFLAGS = $(MCFLAGS) $(OPT) $(COPT) $(CWARN) -Wa,-alms=$(LSTDIR)/$(notdir $(<:.c=.lst)) $(DEFS) -CPPFLAGS = $(MCFLAGS) $(OPT) $(CPPOPT) $(CPPWARN) -Wa,-alms=$(LSTDIR)/$(notdir $(<:.cpp=.lst)) $(DEFS) -ifeq ($(USE_LINK_GC),yes) - LDFLAGS = $(MCFLAGS) -Wl,-Map=$(BUILDDIR)/$(PROJECT).map,--cref,--no-warn-mismatch,--gc-sections $(LLIBDIR) +IS_MAC = no +ifneq ($(OS),Windows_NT) + UNAME_S := $(shell uname -s) + ifeq ($(UNAME_S),Darwin) + IS_MAC = yes + endif +endif + +ifeq ($(IS_MAC),yes) + ODFLAGS = -x --syms + ASFLAGS = $(MCFLAGS) -Wa,-amhls=$(LSTDIR)/$(notdir $(<:.s=.lst)) $(ADEFS) + ASXFLAGS = $(MCFLAGS) -Wa,-amhls=$(LSTDIR)/$(notdir $(<:.S=.lst)) $(ADEFS) + CFLAGS = $(MCFLAGS) $(OPT) $(COPT) $(CWARN) $(DEFS) + CPPFLAGS = $(MCFLAGS) $(OPT) $(CPPOPT) $(CPPWARN) $(DEFS) + LDFLAGS = $(MCFLAGS) $(LLIBDIR) else - LDFLAGS = $(MCFLAGS) -Wl,-Map=$(BUILDDIR)/$(PROJECT).map,--cref,--no-warn-mismatch $(LLIBDIR) + # not mac + ODFLAGS = -x --syms + ASFLAGS = $(MCFLAGS) -Wa,-amhls=$(LSTDIR)/$(notdir $(<:.s=.lst)) $(ADEFS) + ASXFLAGS = $(MCFLAGS) -Wa,-amhls=$(LSTDIR)/$(notdir $(<:.S=.lst)) $(ADEFS) + CFLAGS = $(MCFLAGS) $(OPT) $(COPT) $(CWARN) -Wa,-alms=$(LSTDIR)/$(notdir $(<:.c=.lst)) $(DEFS) + CPPFLAGS = $(MCFLAGS) $(OPT) $(CPPOPT) $(CPPWARN) -Wa,-alms=$(LSTDIR)/$(notdir $(<:.cpp=.lst)) $(DEFS) + ifeq ($(USE_LINK_GC),yes) + LDFLAGS = $(MCFLAGS) -Wl,-Map=$(BUILDDIR)/$(PROJECT).map,--cref,--no-warn-mismatch,--gc-sections $(LLIBDIR) + else + LDFLAGS = $(MCFLAGS) -Wl,-Map=$(BUILDDIR)/$(PROJECT).map,--cref,--no-warn-mismatch $(LLIBDIR) + endif endif # Generate dependency information