summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHa Thach <[email protected]>2021-12-31 19:22:52 +0700
committerGitHub <[email protected]>2021-12-31 19:22:52 +0700
commit868948f67c90fa7c2553cdcd604b52862cf55720 (patch)
treeab857cd1f33d23c506f9feedd81ba963c29db58b
parentc8641ee940f2c87e00ce2cfba2acf26180373513 (diff)
parent5c5ecea6f17aae16808533aa248671069cdc5fa5 (diff)
Merge pull request #1264 from kasjer/kasjer/make-files-for-xc32
build system: Changes for xc32 compiler
-rw-r--r--examples/make.mk4
-rw-r--r--examples/rules.mk10
2 files changed, 11 insertions, 3 deletions
diff --git a/examples/make.mk b/examples/make.mk
index 793c40aa2..bed46d02b 100644
--- a/examples/make.mk
+++ b/examples/make.mk
@@ -54,6 +54,8 @@ endif
#-------------- Cross Compiler ------------
# Can be set by board, default to ARM GCC
CROSS_COMPILE ?= arm-none-eabi-
+# Allow for -Os to be changed by board makefiles in case -Os is not allowed
+CFLAGS_OPTIMIZED ?= -Os
CC = $(CROSS_COMPILE)gcc
CXX = $(CROSS_COMPILE)g++
@@ -112,7 +114,7 @@ CFLAGS += \
ifeq ($(DEBUG), 1)
CFLAGS += -Og
else
- CFLAGS += -Os
+ CFLAGS += $(CFLAGS_OPTIMIZED)
endif
# Log level is mapped to TUSB DEBUG option
diff --git a/examples/rules.mk b/examples/rules.mk
index 4cc35cb22..95a9c9879 100644
--- a/examples/rules.mk
+++ b/examples/rules.mk
@@ -12,8 +12,10 @@ ifeq (,$(findstring $(FAMILY),esp32s2 esp32s3 rp2040))
# Compiler Flags
# ---------------------------------------
+LIBS_GCC ?= -lgcc -lm -lnosys
+
# libc
-LIBS += -lgcc -lm -lnosys
+LIBS += $(LIBS_GCC)
ifneq ($(BOARD), spresense)
LIBS += -lc
@@ -49,7 +51,11 @@ ifeq ($(NO_LTO),1)
CFLAGS := $(filter-out -flto,$(CFLAGS))
endif
-LDFLAGS += $(CFLAGS) -Wl,-T,$(TOP)/$(LD_FILE) -Wl,[email protected] -Wl,-cref -Wl,-gc-sections
+ifneq ($(LD_FILE),)
+LDFLAGS_LD_FILE ?= -Wl,-T,$(TOP)/$(LD_FILE)
+endif
+
+LDFLAGS += $(CFLAGS) $(LDFLAGS_LD_FILE) -Wl,[email protected] -Wl,-cref -Wl,-gc-sections
ifneq ($(SKIP_NANOLIB), 1)
LDFLAGS += -specs=nosys.specs -specs=nano.specs
endif