mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-13 11:29:58 +03:00
Adding GDB support to the makefile. Use the build option
DEBUG=GDB to have the .elf file contain debugging symbols. git-svn-id: https://afrodevices.googlecode.com/svn/trunk/baseflight@303 7c89a4a9-59b9-e629-4cfe-3a2d53b20e61
This commit is contained in:
parent
f2a931d248
commit
f2c7ad585a
1 changed files with 14 additions and 2 deletions
16
Makefile
16
Makefile
|
@ -20,6 +20,9 @@ TARGET ?= NAZE
|
||||||
# Compile-time options
|
# Compile-time options
|
||||||
OPTIONS ?=
|
OPTIONS ?=
|
||||||
|
|
||||||
|
# Debugger optons, must be empty or GDB
|
||||||
|
DEBUG ?=
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# Things that need to be maintained as the source changes
|
# Things that need to be maintained as the source changes
|
||||||
#
|
#
|
||||||
|
@ -114,10 +117,9 @@ INCLUDE_DIRS = $(SRC_DIR) \
|
||||||
$(CMSIS_DIR)/CM3/DeviceSupport/ST/STM32F10x \
|
$(CMSIS_DIR)/CM3/DeviceSupport/ST/STM32F10x \
|
||||||
|
|
||||||
ARCH_FLAGS = -mthumb -mcpu=cortex-m3
|
ARCH_FLAGS = -mthumb -mcpu=cortex-m3
|
||||||
CFLAGS = $(ARCH_FLAGS) \
|
BASE_CFLAGS = $(ARCH_FLAGS) \
|
||||||
$(addprefix -D,$(OPTIONS)) \
|
$(addprefix -D,$(OPTIONS)) \
|
||||||
$(addprefix -I,$(INCLUDE_DIRS)) \
|
$(addprefix -I,$(INCLUDE_DIRS)) \
|
||||||
-Os \
|
|
||||||
-Wall \
|
-Wall \
|
||||||
-ffunction-sections \
|
-ffunction-sections \
|
||||||
-fdata-sections \
|
-fdata-sections \
|
||||||
|
@ -148,6 +150,16 @@ ifeq ($(filter $(TARGET),$(VALID_TARGETS)),)
|
||||||
$(error Target '$(TARGET)' is not valid, must be one of $(VALID_TARGETS))
|
$(error Target '$(TARGET)' is not valid, must be one of $(VALID_TARGETS))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(DEBUG),GDB)
|
||||||
|
CFLAGS = $(BASE_CFLAGS) \
|
||||||
|
-ggdb \
|
||||||
|
-O0
|
||||||
|
else
|
||||||
|
CFLAGS = $(BASE_CFLAGS) \
|
||||||
|
-Os
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
TARGET_HEX = $(BIN_DIR)/baseflight_$(TARGET).hex
|
TARGET_HEX = $(BIN_DIR)/baseflight_$(TARGET).hex
|
||||||
TARGET_ELF = $(BIN_DIR)/baseflight_$(TARGET).elf
|
TARGET_ELF = $(BIN_DIR)/baseflight_$(TARGET).elf
|
||||||
TARGET_OBJS = $(addsuffix .o,$(addprefix $(OBJECT_DIR)/$(TARGET)/,$(basename $($(TARGET)_SRC))))
|
TARGET_OBJS = $(addsuffix .o,$(addprefix $(OBJECT_DIR)/$(TARGET)/,$(basename $($(TARGET)_SRC))))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue