Skip to content

Commit 82880ee

Browse files
committed
make nanolib linking explicitly by each family/board
1 parent 1a98f53 commit 82880ee

File tree

58 files changed

+131
-685
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+131
-685
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
ifeq ($(TOOLCHAIN),gcc)
2+
CFLAGS += \
3+
-mthumb \
4+
-mcpu=cortex-m23 \
5+
-mfloat-abi=soft \
6+
7+
else ifeq ($(TOOLCHAIN),iar)
8+
# IAR Flags
9+
CFLAGS += --cpu cortex-m23
10+
ASFLAGS += --cpu cortex-m23
11+
endif
12+
13+
# For freeRTOS port source
14+
FREERTOS_PORTABLE_SRC ?= $(FREERTOS_PORTABLE_PATH)/ARM_CM23

examples/build_system/make/toolchain/arm_gcc_rules.mk

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,6 @@ ifdef LD_FILE_GCC
3131
LDFLAGS += -Wl,-T,$(TOP)/$(LD_FILE_GCC)
3232
endif
3333

34-
ifneq ($(SKIP_NANOLIB), 1)
35-
LDFLAGS += --specs=nosys.specs --specs=nano.specs
36-
endif
37-
3834
ASFLAGS += $(CFLAGS)
3935

4036
LIBS_GCC ?= -lgcc -lm -lnosys

hw/bsp/ch32v307/family.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ CFLAGS += \
2828
-Xlinker --gc-sections \
2929
-DBOARD_TUD_MAX_SPEED=OPT_MODE_HIGH_SPEED
3030

31+
LDFLAGS_GCC += -specs=nosys.specs -specs=nano.specs
32+
3133
SRC_C += \
3234
src/portable/wch/ch32v307/dcd_usbhs.c \
3335
$(CH32V307_SDK_SRC)/Core/core_riscv.c \

hw/bsp/da14695_dk_usb/board.mk

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
MCU_FAMILY_DIR = hw/mcu/dialog/da1469x
2+
13
CFLAGS += \
24
-flto \
35
-mthumb \
@@ -11,7 +13,7 @@ CFLAGS += \
1113
-DCFG_TUSB_MCU=OPT_MCU_DA1469X \
1214
-DCFG_TUD_ENDPOINT0_SIZE=8\
1315

14-
MCU_FAMILY_DIR = hw/mcu/dialog/da1469x
16+
LDFLAGS_GCC += -specs=nosys.specs -specs=nano.specs
1517

1618
# All source paths should be relative to the top level.
1719
LD_FILE = hw/bsp/$(BOARD)/da1469x.ld

hw/bsp/da1469x_dk_pro/board.mk

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
MCU_FAMILY_DIR = hw/mcu/dialog/da1469x
2+
13
CFLAGS += \
24
-flto \
35
-mthumb \
@@ -11,7 +13,7 @@ CFLAGS += \
1113
-DCFG_TUSB_MCU=OPT_MCU_DA1469X \
1214
-DCFG_TUD_ENDPOINT0_SIZE=8\
1315

14-
MCU_FAMILY_DIR = hw/mcu/dialog/da1469x
16+
LDFLAGS_GCC += -specs=nosys.specs -specs=nano.specs
1517

1618
# All source paths should be relative to the top level.
1719
LD_FILE = hw/bsp/$(BOARD)/da1469x.ld

hw/bsp/f1c100s/board.mk

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
MCU_DIR = hw/mcu/allwinner/f1c100s
12
DEPS_SUBMODULES += hw/mcu/allwinner
2-
33
DEFINES += -D__ARM32_ARCH__=5 -D__ARM926EJS__
44

55
CFLAGS += \
@@ -18,8 +18,8 @@ CFLAGS += \
1818
$(DEFINES)
1919

2020
LD_FILE = hw/mcu/allwinner/f1c100s/f1c100s.ld
21-
LDFLAGS += -nostdlib -lgcc
22-
MCU_DIR = hw/mcu/allwinner/f1c100s
21+
# TODO may skip nanolib
22+
LDFLAGS += -nostdlib -lgcc -specs=nosys.specs -specs=nano.specs
2323

2424
SRC_C += \
2525
src/portable/sunxi/dcd_sunxi_musb.c \

hw/bsp/fomu/family.mk

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1+
# Toolchain from https://github.com/xpack-dev-tools/riscv-none-embed-gcc-xpack
2+
CROSS_COMPILE = riscv-none-embed-
3+
14
CFLAGS += \
25
-flto \
36
-march=rv32i \
47
-mabi=ilp32 \
58
-nostdlib \
69
-DCFG_TUSB_MCU=OPT_MCU_VALENTYUSB_EPTRI
710

8-
# Toolchain from https://github.com/xpack-dev-tools/riscv-none-embed-gcc-xpack
9-
CROSS_COMPILE = riscv-none-embed-
11+
LDFLAGS_GCC += -specs=nosys.specs -specs=nano.specs
1012

1113
# All source paths should be relative to the top level.
1214
LD_FILE = $(FAMILY_PATH)/fomu.ld

hw/bsp/imxrt/family.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ DEPS_SUBMODULES += $(SDK_DIR) lib/CMSIS_5
55
include $(TOP)/$(BOARD_PATH)/board.mk
66

77
CPU_CORE ?= cortex-m7
8-
98
MCU_VARIANT_WITH_CORE = ${MCU_VARIANT}${MCU_CORE}
9+
MCU_DIR = $(SDK_DIR)/devices/$(MCU_VARIANT)
1010

1111
CFLAGS += \
1212
-D__ARMVFP__=0 \
@@ -26,7 +26,7 @@ endif
2626
# mcu driver cause following warnings
2727
CFLAGS += -Wno-error=unused-parameter -Wno-error=implicit-fallthrough -Wno-error=redundant-decls
2828

29-
MCU_DIR = $(SDK_DIR)/devices/$(MCU_VARIANT)
29+
LDFLAGS_GCC += -specs=nosys.specs -specs=nano.specs
3030

3131
# All source paths should be relative to the top level.
3232
LD_FILE ?= $(MCU_DIR)/gcc/$(MCU_VARIANT)xxxxx${MCU_CORE}_flexspi_nor.ld

hw/bsp/kinetis_k32l2/family.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ CPU_CORE ?= cortex-m0plus
99
CFLAGS += \
1010
-DCFG_TUSB_MCU=OPT_MCU_KINETIS_K32L
1111

12+
LDFLAGS_GCC += -specs=nosys.specs -specs=nano.specs
13+
1214
SRC_C += \
1315
src/portable/nxp/khci/dcd_khci.c \
1416
src/portable/nxp/khci/hcd_khci.c \

hw/bsp/kinetis_kl/family.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ CFLAGS += \
99
-DCFG_TUSB_MCU=OPT_MCU_KINETIS_KL \
1010

1111
LDFLAGS += \
12+
-specs=nosys.specs -specs=nano.specs \
1213
-Wl,--defsym,__stack_size__=0x400 \
1314
-Wl,--defsym,__heap_size__=0
1415

0 commit comments

Comments
 (0)