summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithpac@amazon.com>2023-03-02 12:47:05 -0800
committerPaul Bartell <paul.bartell@gmail.com>2023-03-30 12:32:55 -0700
commit0a1db4b00c949a91ec5d0a9dade76f201700cb6c (patch)
tree421f79f6ee39c4738d6043dbe008b935fce080fd
parent68ef270215b0b27598111f3ef0158bd2d9fe0dd9 (diff)
downloadfreertos-git-0a1db4b00c949a91ec5d0a9dade76f201700cb6c.tar.gz
Demo/CORTEX_M3_MPS2_QEMU_GCC: Fix use of -ffunction-sections -fdata-sections
For these options to be of any use, they must be passed to the compiler when building object files and then the --gc-sections flag must be passed to the linker. Add -ffunction-sections -fdata-sections to CFLAGS and then add -Wl,--gc-sections to LDFLAGS. Signed-off-by: Keith Packard <keithpac@amazon.com>
-rw-r--r--FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/Makefile4
1 files changed, 3 insertions, 1 deletions
diff --git a/FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/Makefile b/FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/Makefile
index bc7b74c46..9b5f240b9 100644
--- a/FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/Makefile
+++ b/FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/Makefile
@@ -68,10 +68,12 @@ DEFINES := -DQEMU_SOC_MPS2 -DHEAP3
LDFLAGS = -T ./scripts/mps2_m3.ld -specs=nano.specs --specs=rdimon.specs -lc -lrdimon
LDFLAGS += -Xlinker -Map=${BUILD_DIR}/output.map
+LDFLAGS += -Wl,--gc-sections
CFLAGS += -nostartfiles -mthumb -mcpu=cortex-m3 -Wno-error=implicit-function-declaration
CFLAGS += -Wno-builtin-declaration-mismatch -Werror
CFLAGS += -Wall -Wextra
+CFLAGS += -ffunction-sections -fdata-sections
ifeq ($(DEBUG), 1)
CFLAGS += -ggdb3 -Og
@@ -88,7 +90,7 @@ CFLAGS += $(INCLUDE_DIRS)
.PHONY: clean
$(BUILD_DIR)/$(BIN) : $(OBJ_FILES)
- $(CC) -ffunction-sections -fdata-sections $(CFLAGS) $(LDFLAGS) $+ -o $(@)
+ $(CC) $(CFLAGS) $(LDFLAGS) $+ -o $(@)
%.d: %.c
@set -e; rm -f $@; \