summaryrefslogtreecommitdiff
path: root/examples/build_system/make
diff options
context:
space:
mode:
Diffstat (limited to 'examples/build_system/make')
-rw-r--r--examples/build_system/make/cpu/cortex-m85.mk27
-rw-r--r--examples/build_system/make/make.mk41
-rw-r--r--examples/build_system/make/rules.mk5
-rw-r--r--examples/build_system/make/toolchain/gcc_common.mk1
4 files changed, 70 insertions, 4 deletions
diff --git a/examples/build_system/make/cpu/cortex-m85.mk b/examples/build_system/make/cpu/cortex-m85.mk
new file mode 100644
index 000000000..75e8f3aaf
--- /dev/null
+++ b/examples/build_system/make/cpu/cortex-m85.mk
@@ -0,0 +1,27 @@
+ifeq ($(TOOLCHAIN),gcc)
+ CFLAGS += \
+ -mthumb \
+ -mcpu=cortex-m85 \
+ -mfloat-abi=hard \
+ -mfpu=fpv5-d16 \
+
+else ifeq ($(TOOLCHAIN),clang)
+ CFLAGS += \
+ --target=arm-none-eabi \
+ -mcpu=cortex-m85 \
+ -mfpu=fpv5-d16 \
+
+else ifeq ($(TOOLCHAIN),iar)
+ CFLAGS += \
+ --cpu cortex-m85 \
+ --fpu VFPv5_D16 \
+
+ ASFLAGS += \
+ --cpu cortex-m85 \
+ --fpu VFPv5_D16 \
+
+else
+ $(error "TOOLCHAIN is not supported")
+endif
+
+FREERTOS_PORTABLE_SRC ?= $(FREERTOS_PORTABLE_PATH)/ARM_CM85_NTZ/non_secure
diff --git a/examples/build_system/make/make.mk b/examples/build_system/make/make.mk
index 1500a51e0..3101b66b9 100644
--- a/examples/build_system/make/make.mk
+++ b/examples/build_system/make/make.mk
@@ -6,7 +6,6 @@
# Toolchain
# Can be changed via TOOLCHAIN=gcc|iar or CC=arm-none-eabi-gcc|iccarm|clang
#-------------------------------------------------------------
-
ifneq (,$(findstring clang,$(CC)))
TOOLCHAIN = clang
else ifneq (,$(findstring iccarm,$(CC)))
@@ -65,7 +64,9 @@ BUILD := _build/$(BOARD)
PROJECT := $(notdir $(CURDIR))
BIN := $(TOP)/_bin/$(BOARD)/$(notdir $(CURDIR))
-#-------------- Select the board to build for. ------------
+#-------------------------------------------------------------
+# Board / Family
+#-------------------------------------------------------------
# Board without family
ifneq ($(wildcard $(TOP)/hw/bsp/$(BOARD)/board.mk),)
@@ -93,7 +94,9 @@ else
SRC_C += $(subst $(TOP)/,,$(wildcard $(TOP)/$(FAMILY_PATH)/*.c))
endif
-#-------------- Source files and compiler flags --------------
+#-------------------------------------------------------------
+# Source files and compiler flags
+#-------------------------------------------------------------
# tinyusb makefile
include $(TOP)/src/tinyusb.mk
SRC_C += $(TINYUSB_SRC_C)
@@ -148,7 +151,37 @@ endif
# toolchain specific
include ${TOP}/examples/build_system/make/toolchain/arm_$(TOOLCHAIN).mk
-# Handy check parameter function
+#---------------------- FreeRTOS -----------------------
+FREERTOS_SRC = lib/FreeRTOS-Kernel
+FREERTOS_PORTABLE_PATH = $(FREERTOS_SRC)/portable/$(if $(findstring iar,$(TOOLCHAIN)),IAR,GCC)
+
+ifeq ($(RTOS),freertos)
+ SRC_C += \
+ $(FREERTOS_SRC)/list.c \
+ $(FREERTOS_SRC)/queue.c \
+ $(FREERTOS_SRC)/tasks.c \
+ $(FREERTOS_SRC)/timers.c \
+ $(subst $(TOP)/,,$(wildcard $(TOP)/$(FREERTOS_PORTABLE_SRC)/*.c))
+
+ SRC_S += $(subst $(TOP)/,,$(wildcard $(TOP)/$(FREERTOS_PORTABLE_SRC)/*.s))
+ INC += \
+ $(TOP)/hw/bsp/$(FAMILY)/FreeRTOSConfig \
+ $(TOP)/$(FREERTOS_SRC)/include \
+ $(TOP)/$(FREERTOS_PORTABLE_SRC)
+
+ CFLAGS += -DCFG_TUSB_OS=OPT_OS_FREERTOS
+
+ # Suppress FreeRTOSConfig.h warnings
+ CFLAGS_GCC += -Wno-error=redundant-decls
+
+ # Suppress FreeRTOS source warnings
+ CFLAGS_GCC += -Wno-error=cast-qual
+
+ # FreeRTOS (lto + Os) linker issue
+ LDFLAGS_GCC += -Wl,--undefined=vTaskSwitchContext
+endif
+
+#---------------- Helper ----------------
check_defined = \
$(strip $(foreach 1,$1, \
$(call __check_defined,$1,$(strip $(value 2)))))
diff --git a/examples/build_system/make/rules.mk b/examples/build_system/make/rules.mk
index f322dbae6..86de17b6c 100644
--- a/examples/build_system/make/rules.mk
+++ b/examples/build_system/make/rules.mk
@@ -166,6 +166,11 @@ flash-bmp: $(BUILD)/$(PROJECT).elf
debug-bmp: $(BUILD)/$(PROJECT).elf
$(GDB) -ex 'target extended-remote $(BMP)' -ex 'monitor swdp_scan' -ex 'attach 1' $<
+# --------------- TI Uniflash -----------------
+DSLITE ?= dslite.sh
+flash-uniflash: $(BUILD)/$(PROJECT).hex
+ ${DSLITE} ${UNIFLASH_OPTION} -f $<
+
#-------------- Artifacts --------------
# Create binary directory
diff --git a/examples/build_system/make/toolchain/gcc_common.mk b/examples/build_system/make/toolchain/gcc_common.mk
index 6986d8bba..0cbb6774d 100644
--- a/examples/build_system/make/toolchain/gcc_common.mk
+++ b/examples/build_system/make/toolchain/gcc_common.mk
@@ -31,6 +31,7 @@ CFLAGS += \
-Wreturn-type \
-Wredundant-decls \
+# -Wmissing-prototypes \
# conversion is too strict for most mcu driver, may be disable sign/int/arith-conversion
# -Wconversion