Allow files to compiled without optimization.
This is required when trying to see what the optimizer is doing to the assembly or in aiding debugging CPU IMPRECISE bus fault errors.
This commit is contained in:
parent
fefa2a83e4
commit
e35d8a25d3
35
Makefile
35
Makefile
|
@ -211,6 +211,7 @@ CC_DEBUG_OPTIMISATION := $(OPTIMISE_DEFAULT)
|
|||
CC_DEFAULT_OPTIMISATION := $(OPTIMISATION_BASE) $(OPTIMISE_DEFAULT)
|
||||
CC_SPEED_OPTIMISATION := $(OPTIMISATION_BASE) $(OPTIMISE_SPEED)
|
||||
CC_SIZE_OPTIMISATION := $(OPTIMISATION_BASE) $(OPTIMISE_SIZE)
|
||||
CC_NO_OPTIMISATION :=
|
||||
|
||||
CFLAGS += $(ARCH_FLAGS) \
|
||||
$(addprefix -D,$(OPTIONS)) \
|
||||
|
@ -310,19 +311,33 @@ $(TARGET_ELF): $(TARGET_OBJS)
|
|||
ifeq ($(DEBUG),GDB)
|
||||
$(OBJECT_DIR)/$(TARGET)/%.o: %.c
|
||||
$(V1) mkdir -p $(dir $@)
|
||||
$(V1) echo "%% (debug) $(notdir $<)" "$(STDOUT)" && \
|
||||
$(CROSS_CC) -c -o $@ $(CFLAGS) $(CC_DEBUG_OPTIMISATION) $<
|
||||
$(V1) $(if $(findstring $<,$(NOT_OPTIMISED_SRC)), \
|
||||
echo "%% (not optimised) $<" "$(STDOUT)" && \
|
||||
$(CROSS_CC) -c -o $@ $(CFLAGS) $(CC_NO_OPTIMISATION) $< \
|
||||
, \
|
||||
echo "%% (debug) $<" "$(STDOUT)" && \
|
||||
$(CROSS_CC) -c -o $@ $(CFLAGS) $(CC_DEBUG_OPTIMISATION) $< \
|
||||
)
|
||||
else
|
||||
$(OBJECT_DIR)/$(TARGET)/%.o: %.c
|
||||
$(V1) mkdir -p $(dir $@)
|
||||
$(V1) $(if $(findstring $(subst ./src/main/,,$<),$(SPEED_OPTIMISED_SRC)), \
|
||||
echo "%% (speed optimised) $(notdir $<)" "$(STDOUT)" && \
|
||||
$(CROSS_CC) -c -o $@ $(CFLAGS) $(CC_SPEED_OPTIMISATION) $<, \
|
||||
$(if $(findstring $(subst ./src/main/,,$<),$(SIZE_OPTIMISED_SRC)), \
|
||||
echo "%% (size optimised) $(notdir $<)" "$(STDOUT)" && \
|
||||
$(CROSS_CC) -c -o $@ $(CFLAGS) $(CC_SIZE_OPTIMISATION) $<, \
|
||||
echo "%% $(notdir $<)" "$(STDOUT)" && \
|
||||
$(CROSS_CC) -c -o $@ $(CFLAGS) $(CC_DEFAULT_OPTIMISATION) $<))
|
||||
$(V1) $(if $(findstring $<,$(NOT_OPTIMISED_SRC)), \
|
||||
echo "%% (not optimised) $<" "$(STDOUT)" && \
|
||||
$(CROSS_CC) -c -o $@ $(CFLAGS) $(CC_NO_OPTIMISATION) $< \
|
||||
, \
|
||||
$(if $(findstring $(subst ./src/main/,,$<),$(SPEED_OPTIMISED_SRC)), \
|
||||
echo "%% (speed optimised) $<" "$(STDOUT)" && \
|
||||
$(CROSS_CC) -c -o $@ $(CFLAGS) $(CC_SPEED_OPTIMISATION) $< \
|
||||
, \
|
||||
$(if $(findstring $(subst ./src/main/,,$<),$(SIZE_OPTIMISED_SRC)), \
|
||||
echo "%% (size optimised) $<" "$(STDOUT)" && \
|
||||
$(CROSS_CC) -c -o $@ $(CFLAGS) $(CC_SIZE_OPTIMISATION) $< \
|
||||
, \
|
||||
echo "%% (optimised) $<" "$(STDOUT)" && \
|
||||
$(CROSS_CC) -c -o $@ $(CFLAGS) $(CC_DEFAULT_OPTIMISATION) $< \
|
||||
) \
|
||||
) \
|
||||
)
|
||||
endif
|
||||
|
||||
# Assemble
|
||||
|
|
|
@ -333,6 +333,10 @@ endif #!F1
|
|||
# check if target.mk supplied
|
||||
SRC := $(STARTUP_SRC) $(MCU_COMMON_SRC) $(TARGET_SRC) $(VARIANT_SRC)
|
||||
|
||||
# Files that should not be optimized, useful for debugging IMPRECISE cpu faults.
|
||||
# Specify FULL PATH, e.g. "./lib/main/STM32F7/Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_ll_sdmmc.c"
|
||||
NOT_OPTIMISED_SRC := $(NOT_OPTIMISED_SRC) \
|
||||
|
||||
ifneq ($(DSP_LIB),)
|
||||
|
||||
INCLUDE_DIRS += $(DSP_LIB)/Include
|
||||
|
|
Loading…
Reference in New Issue