summaryrefslogtreecommitdiff
path: root/examples/build_system
diff options
context:
space:
mode:
authorZixun LI <[email protected]>2025-11-25 10:59:43 +0100
committerZixun LI <[email protected]>2025-11-25 10:59:43 +0100
commitdc083e4d9c87658498a3bd0b527d25bc88dd1ed6 (patch)
tree0523e934e5a1b1fe8331b28990ddf2e2f4478077 /examples/build_system
parente59b2c40fc9e655918629d73cc8c54b86b4a70c1 (diff)
parentfee2d2a034d65aa625bc1a8b32c3b7a51292a39f (diff)
Merge remote-tracking branch 'tinyusb/master' into n6_build
Signed-off-by: Zixun LI <[email protected]>
Diffstat (limited to 'examples/build_system')
-rw-r--r--examples/build_system/cmake/toolchain/arm_clang.cmake2
-rw-r--r--examples/build_system/cmake/toolchain/arm_iar.cmake14
-rw-r--r--examples/build_system/cmake/toolchain/common.cmake23
-rw-r--r--examples/build_system/cmake/toolchain/cstat_sel_checks.txt247
-rw-r--r--examples/build_system/make/make.mk190
-rw-r--r--examples/build_system/make/rules.mk195
6 files changed, 270 insertions, 401 deletions
diff --git a/examples/build_system/cmake/toolchain/arm_clang.cmake b/examples/build_system/cmake/toolchain/arm_clang.cmake
index fe3c2b453..dba637367 100644
--- a/examples/build_system/cmake/toolchain/arm_clang.cmake
+++ b/examples/build_system/cmake/toolchain/arm_clang.cmake
@@ -7,6 +7,8 @@ if (NOT DEFINED CMAKE_CXX_COMPILER)
endif ()
set(CMAKE_ASM_COMPILER ${CMAKE_C_COMPILER})
+set(TOOLCHAIN_ASM_FLAGS "-x assembler-with-cpp")
+
find_program(CMAKE_SIZE llvm-size)
find_program(CMAKE_OBJCOPY llvm-objcopy)
find_program(CMAKE_OBJDUMP llvm-objdump)
diff --git a/examples/build_system/cmake/toolchain/arm_iar.cmake b/examples/build_system/cmake/toolchain/arm_iar.cmake
index 083815715..0b7e0b585 100644
--- a/examples/build_system/cmake/toolchain/arm_iar.cmake
+++ b/examples/build_system/cmake/toolchain/arm_iar.cmake
@@ -14,4 +14,18 @@ find_program(CMAKE_SIZE size)
find_program(CMAKE_OBJCOPY ielftool)
find_program(CMAKE_OBJDUMP iefdumparm)
+find_program(CMAKE_IAR_CSTAT icstat)
+find_program(CMAKE_IAR_CHECKS ichecks)
+find_program(CMAKE_IAR_REPORT ireport)
+
+if (IAR_CSTAT)
+cmake_minimum_required(VERSION 4.1)
+set(CMAKE_C_ICSTAT ${CMAKE_IAR_CSTAT}
+ --checks=${CMAKE_CURRENT_LIST_DIR}/cstat_sel_checks.txt
+ --db=${CMAKE_BINARY_DIR}/cstat.db
+ --sarif_dir=${CMAKE_BINARY_DIR}/cstat_sarif
+ --exclude ${TOP}/hw/mcu --exclude ${TOP}/lib
+ )
+endif ()
+
include(${CMAKE_CURRENT_LIST_DIR}/common.cmake)
diff --git a/examples/build_system/cmake/toolchain/common.cmake b/examples/build_system/cmake/toolchain/common.cmake
index 4c181137b..14449b01d 100644
--- a/examples/build_system/cmake/toolchain/common.cmake
+++ b/examples/build_system/cmake/toolchain/common.cmake
@@ -20,11 +20,11 @@ include(${CMAKE_CURRENT_LIST_DIR}/../cpu/${CMAKE_SYSTEM_CPU}.cmake)
# ----------------------------------------------------------------------------
# Compile flags
# ----------------------------------------------------------------------------
-if (TOOLCHAIN STREQUAL "gcc")
+if (TOOLCHAIN STREQUAL "gcc" OR TOOLCHAIN STREQUAL "clang")
list(APPEND TOOLCHAIN_COMMON_FLAGS
-fdata-sections
-ffunction-sections
- -fsingle-precision-constant
+# -fsingle-precision-constant # not supported by clang
-fno-strict-aliasing
)
list(APPEND TOOLCHAIN_EXE_LINKER_FLAGS
@@ -32,24 +32,10 @@ if (TOOLCHAIN STREQUAL "gcc")
-Wl,--gc-sections
-Wl,--cref
)
-
elseif (TOOLCHAIN STREQUAL "iar")
- #list(APPEND TOOLCHAIN_COMMON_FLAGS)
list(APPEND TOOLCHAIN_EXE_LINKER_FLAGS
--diag_suppress=Li065
)
-
-elseif (TOOLCHAIN STREQUAL "clang")
- list(APPEND TOOLCHAIN_COMMON_FLAGS
- -fdata-sections
- -ffunction-sections
- -fno-strict-aliasing
- )
- list(APPEND TOOLCHAIN_EXE_LINKER_FLAGS
- -Wl,--print-memory-usage
- -Wl,--gc-sections
- -Wl,--cref
- )
endif ()
# join the toolchain flags into a single string
@@ -61,5 +47,10 @@ foreach (LANG IN ITEMS C CXX ASM)
#set(CMAKE_${LANG}_FLAGS_DEBUG_INIT "-O0")
endforeach ()
+# Assembler
+if (DEFINED TOOLCHAIN_ASM_FLAGS)
+ set(CMAKE_ASM_FLAGS_INIT "${CMAKE_ASM_FLAGS_INIT} ${TOOLCHAIN_ASM_FLAGS}")
+endif ()
+
# Linker
list(JOIN TOOLCHAIN_EXE_LINKER_FLAGS " " CMAKE_EXE_LINKER_FLAGS_INIT)
diff --git a/examples/build_system/cmake/toolchain/cstat_sel_checks.txt b/examples/build_system/cmake/toolchain/cstat_sel_checks.txt
new file mode 100644
index 000000000..b7efba4ad
--- /dev/null
+++ b/examples/build_system/cmake/toolchain/cstat_sel_checks.txt
@@ -0,0 +1,247 @@
+# IAR C-STAT Checks Manifest Handler V2.7.5.562
+#
+MISRAC2012-Dir-4.3
+MISRAC2012-Dir-4.7_c
+MISRAC2012-Dir-4.10
+MISRAC2012-Dir-4.11_a
+MISRAC2012-Dir-4.11_b
+MISRAC2012-Dir-4.11_c
+MISRAC2012-Dir-4.11_d
+MISRAC2012-Dir-4.11_e
+MISRAC2012-Dir-4.11_f
+MISRAC2012-Dir-4.11_g
+MISRAC2012-Dir-4.11_h
+MISRAC2012-Dir-4.11_i
+MISRAC2012-Dir-4.12
+MISRAC2012-Dir-4.14_a
+MISRAC2012-Dir-4.14_b
+MISRAC2012-Dir-4.14_c
+MISRAC2012-Dir-4.14_d
+MISRAC2012-Dir-4.14_e
+MISRAC2012-Dir-4.14_f
+MISRAC2012-Dir-4.14_g
+MISRAC2012-Dir-4.14_h
+MISRAC2012-Dir-4.14_i
+MISRAC2012-Dir-4.14_j
+MISRAC2012-Dir-4.14_l
+MISRAC2012-Dir-4.14_m
+MISRAC2012-Dir-4.15
+MISRAC2012-Rule-1.3_a
+MISRAC2012-Rule-1.3_b
+MISRAC2012-Rule-1.3_c
+MISRAC2012-Rule-1.3_d
+MISRAC2012-Rule-1.3_e
+MISRAC2012-Rule-1.3_f
+MISRAC2012-Rule-1.3_g
+MISRAC2012-Rule-1.3_h
+MISRAC2012-Rule-1.3_i
+MISRAC2012-Rule-1.3_j
+MISRAC2012-Rule-1.3_k
+MISRAC2012-Rule-1.3_l
+MISRAC2012-Rule-1.3_m
+MISRAC2012-Rule-1.3_n
+MISRAC2012-Rule-1.3_o
+MISRAC2012-Rule-1.3_p
+MISRAC2012-Rule-1.3_q
+MISRAC2012-Rule-1.3_r
+MISRAC2012-Rule-1.3_s
+MISRAC2012-Rule-1.3_t
+MISRAC2012-Rule-1.3_u
+MISRAC2012-Rule-1.3_v
+MISRAC2012-Rule-1.4
+MISRAC2012-Rule-1.5_b
+MISRAC2012-Rule-1.5_c
+MISRAC2012-Rule-1.5_d
+MISRAC2012-Rule-1.5_e
+MISRAC2012-Rule-1.5_f
+MISRAC2012-Rule-1.5_g
+MISRAC2012-Rule-2.1_a
+MISRAC2012-Rule-2.1_b
+MISRAC2012-Rule-2.2_a
+MISRAC2012-Rule-2.2_b
+MISRAC2012-Rule-2.2_c
+MISRAC2012-Rule-3.1
+MISRAC2012-Rule-3.2
+MISRAC2012-Rule-5.1
+MISRAC2012-Rule-5.2_c89
+MISRAC2012-Rule-5.2_c99
+MISRAC2012-Rule-5.3_c89
+MISRAC2012-Rule-5.3_c99
+MISRAC2012-Rule-5.4_c89
+MISRAC2012-Rule-5.4_c99
+MISRAC2012-Rule-5.5_c89
+MISRAC2012-Rule-5.5_c99
+MISRAC2012-Rule-5.6
+MISRAC2012-Rule-5.7
+MISRAC2012-Rule-5.8
+MISRAC2012-Rule-6.1
+MISRAC2012-Rule-6.2
+MISRAC2012-Rule-6.3
+MISRAC2012-Rule-7.1
+MISRAC2012-Rule-7.2
+MISRAC2012-Rule-7.3
+MISRAC2012-Rule-7.4_a
+MISRAC2012-Rule-7.4_b
+MISRAC2012-Rule-7.5
+MISRAC2012-Rule-7.6
+MISRAC2012-Rule-8.1
+MISRAC2012-Rule-8.2_a
+MISRAC2012-Rule-8.2_b
+MISRAC2012-Rule-8.3
+MISRAC2012-Rule-8.4
+MISRAC2012-Rule-8.5_a
+MISRAC2012-Rule-8.5_b
+MISRAC2012-Rule-8.10
+MISRAC2012-Rule-8.12
+MISRAC2012-Rule-8.14
+MISRAC2012-Rule-8.15
+MISRAC2012-Rule-9.1_a
+MISRAC2012-Rule-9.1_b
+MISRAC2012-Rule-9.1_d
+MISRAC2012-Rule-9.1_e
+MISRAC2012-Rule-9.2
+MISRAC2012-Rule-9.3
+MISRAC2012-Rule-9.4
+MISRAC2012-Rule-9.5_a
+MISRAC2012-Rule-9.5_b
+MISRAC2012-Rule-9.6
+MISRAC2012-Rule-9.7
+MISRAC2012-Rule-10.1_R2
+MISRAC2012-Rule-10.1_R3
+MISRAC2012-Rule-10.1_R4
+MISRAC2012-Rule-10.1_R5
+MISRAC2012-Rule-10.1_R6
+MISRAC2012-Rule-10.1_R7
+MISRAC2012-Rule-10.1_R8
+MISRAC2012-Rule-10.1_R10
+MISRAC2012-Rule-10.2
+MISRAC2012-Rule-10.3
+MISRAC2012-Rule-10.4_a
+MISRAC2012-Rule-10.4_b
+MISRAC2012-Rule-10.6
+MISRAC2012-Rule-10.7
+MISRAC2012-Rule-10.8
+MISRAC2012-Rule-11.1
+MISRAC2012-Rule-11.2
+MISRAC2012-Rule-11.3
+MISRAC2012-Rule-11.6
+MISRAC2012-Rule-11.7
+MISRAC2012-Rule-11.8
+MISRAC2012-Rule-11.9
+MISRAC2012-Rule-11.10
+MISRAC2012-Rule-12.2
+MISRAC2012-Rule-12.5
+MISRAC2012-Rule-12.6
+MISRAC2012-Rule-13.1
+MISRAC2012-Rule-13.2_a
+MISRAC2012-Rule-13.2_b
+MISRAC2012-Rule-13.2_c
+MISRAC2012-Rule-13.5
+MISRAC2012-Rule-13.6
+MISRAC2012-Rule-14.1_a
+MISRAC2012-Rule-14.1_b
+MISRAC2012-Rule-14.2
+MISRAC2012-Rule-14.3_a
+MISRAC2012-Rule-14.3_b
+MISRAC2012-Rule-14.4_a
+MISRAC2012-Rule-14.4_b
+MISRAC2012-Rule-14.4_c
+MISRAC2012-Rule-14.4_d
+MISRAC2012-Rule-15.2
+MISRAC2012-Rule-15.3
+MISRAC2012-Rule-15.6_a
+MISRAC2012-Rule-15.6_b
+MISRAC2012-Rule-15.6_c
+MISRAC2012-Rule-15.6_d
+MISRAC2012-Rule-15.6_e
+MISRAC2012-Rule-15.7
+MISRAC2012-Rule-16.1
+MISRAC2012-Rule-16.2
+MISRAC2012-Rule-16.3
+MISRAC2012-Rule-16.4
+MISRAC2012-Rule-16.5
+MISRAC2012-Rule-16.6
+MISRAC2012-Rule-16.7
+MISRAC2012-Rule-17.1
+MISRAC2012-Rule-17.2_a
+MISRAC2012-Rule-17.2_b
+MISRAC2012-Rule-17.3
+MISRAC2012-Rule-17.4
+MISRAC2012-Rule-17.5
+MISRAC2012-Rule-17.6
+MISRAC2012-Rule-17.7
+MISRAC2012-Rule-17.13
+MISRAC2012-Rule-18.1_a
+MISRAC2012-Rule-18.1_b
+MISRAC2012-Rule-18.1_c
+MISRAC2012-Rule-18.1_d
+MISRAC2012-Rule-18.2
+MISRAC2012-Rule-18.3
+MISRAC2012-Rule-18.4
+MISRAC2012-Rule-18.6_a
+MISRAC2012-Rule-18.6_b
+MISRAC2012-Rule-18.6_c
+MISRAC2012-Rule-18.6_d
+MISRAC2012-Rule-18.7
+MISRAC2012-Rule-18.8
+MISRAC2012-Rule-18.9
+MISRAC2012-Rule-18.10
+MISRAC2012-Rule-19.1
+MISRAC2012-Rule-20.2
+MISRAC2012-Rule-20.4_c89
+MISRAC2012-Rule-20.4_c99
+MISRAC2012-Rule-20.6_a
+MISRAC2012-Rule-20.6_b
+MISRAC2012-Rule-20.7
+MISRAC2012-Rule-21.1
+MISRAC2012-Rule-21.2
+MISRAC2012-Rule-21.3
+MISRAC2012-Rule-21.4
+MISRAC2012-Rule-21.5
+MISRAC2012-Rule-21.6
+MISRAC2012-Rule-21.7
+MISRAC2012-Rule-21.8
+MISRAC2012-Rule-21.9
+MISRAC2012-Rule-21.10
+MISRAC2012-Rule-21.12_a
+MISRAC2012-Rule-21.12_b
+MISRAC2012-Rule-21.12_c
+MISRAC2012-Rule-21.13
+MISRAC2012-Rule-21.14
+MISRAC2012-Rule-21.15
+MISRAC2012-Rule-21.16
+MISRAC2012-Rule-21.17_a
+MISRAC2012-Rule-21.17_b
+MISRAC2012-Rule-21.17_c
+MISRAC2012-Rule-21.17_d
+MISRAC2012-Rule-21.17_e
+MISRAC2012-Rule-21.17_f
+MISRAC2012-Rule-21.18_a
+MISRAC2012-Rule-21.18_b
+MISRAC2012-Rule-21.19_a
+MISRAC2012-Rule-21.19_b
+MISRAC2012-Rule-21.20
+MISRAC2012-Rule-21.21
+MISRAC2012-Rule-21.22
+MISRAC2012-Rule-21.23
+MISRAC2012-Rule-21.24
+MISRAC2012-Rule-21.25
+MISRAC2012-Rule-22.1_a
+MISRAC2012-Rule-22.1_b
+MISRAC2012-Rule-22.2_a
+MISRAC2012-Rule-22.2_b
+MISRAC2012-Rule-22.2_c
+MISRAC2012-Rule-22.3
+MISRAC2012-Rule-22.4
+MISRAC2012-Rule-22.5_a
+MISRAC2012-Rule-22.5_b
+MISRAC2012-Rule-22.6
+MISRAC2012-Rule-22.7_a
+MISRAC2012-Rule-22.7_b
+MISRAC2012-Rule-22.8
+MISRAC2012-Rule-22.9
+MISRAC2012-Rule-22.10
+MISRAC2012-Rule-23.2
+MISRAC2012-Rule-23.4
+MISRAC2012-Rule-23.6
+MISRAC2012-Rule-23.8
diff --git a/examples/build_system/make/make.mk b/examples/build_system/make/make.mk
deleted file mode 100644
index f70748d34..000000000
--- a/examples/build_system/make/make.mk
+++ /dev/null
@@ -1,190 +0,0 @@
-# ---------------------------------------
-# Common make definition for all examples
-# ---------------------------------------
-
-# upper helper function
-to_upper = $(subst a,A,$(subst b,B,$(subst c,C,$(subst d,D,$(subst e,E,$(subst f,F,$(subst g,G,$(subst h,H,$(subst i,I,$(subst j,J,$(subst k,K,$(subst l,L,$(subst m,M,$(subst n,N,$(subst o,O,$(subst p,P,$(subst q,Q,$(subst r,R,$(subst s,S,$(subst t,T,$(subst u,U,$(subst v,V,$(subst w,W,$(subst x,X,$(subst y,Y,$(subst z,Z,$(subst -,_,$(1))))))))))))))))))))))))))))
-
-#-------------------------------------------------------------
-# 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)))
- TOOLCHAIN = iar
-else ifneq (,$(findstring gcc,$(CC)))
- TOOLCHAIN = gcc
-endif
-
-# Default to GCC
-ifndef TOOLCHAIN
- TOOLCHAIN = gcc
-endif
-
-#-------------- TOP and CURRENT_PATH ------------
-
-# Set TOP to be the path to get from the current directory (where make was invoked) to the top of the tree.
-# $(lastword $(MAKEFILE_LIST)) returns the name of this makefile relative to where make was invoked.
-THIS_MAKEFILE := $(lastword $(MAKEFILE_LIST))
-
-# strip off /examples/build_system/make to get for example ../../..
-# and Set TOP to an absolute path
-TOP = $(abspath $(subst make.mk,../../..,$(THIS_MAKEFILE)))
-
-# Set CURRENT_PATH to the relative path from TOP to the current directory, ie examples/device/cdc_msc_freertos
-CURRENT_PATH = $(subst $(TOP)/,,$(abspath .))
-
-#-------------- Linux/Windows ------------
-
-# Detect whether shell style is windows or not
-# https://stackoverflow.com/questions/714100/os-detecting-makefile/52062069#52062069
-ifeq '$(findstring ;,$(PATH))' ';'
-# PATH contains semicolon - so we're definitely on Windows.
-CMDEXE := 1
-
-# makefile shell commands should use syntax for DOS CMD, not unix sh
-# Force DOS command shell on Windows.
-SHELL := cmd.exe
-endif
-
-ifeq ($(CMDEXE),1)
- CP = copy
- RM = del
- MKDIR = mkdir
- PYTHON = python
-else
- CP = cp
- RM = rm
- MKDIR = mkdir
- PYTHON = python3
-endif
-
-
-# Build directory
-BUILD := _build/$(BOARD)
-
-PROJECT := $(notdir $(CURDIR))
-BIN := $(TOP)/_bin/$(BOARD)/$(notdir $(CURDIR))
-
-#-------------------------------------------------------------
-# Board / Family
-#-------------------------------------------------------------
-
-# Board without family
-ifneq ($(wildcard $(TOP)/hw/bsp/$(BOARD)/board.mk),)
- BOARD_PATH := hw/bsp/$(BOARD)
- FAMILY :=
-endif
-
-# Board within family
-ifeq ($(BOARD_PATH),)
- BOARD_PATH := $(subst $(TOP)/,,$(wildcard $(TOP)/hw/bsp/*/boards/$(BOARD)))
- FAMILY := $(word 3, $(subst /, ,$(BOARD_PATH)))
- FAMILY_PATH = hw/bsp/$(FAMILY)
-endif
-
-ifeq ($(BOARD_PATH),)
- $(info You must provide a BOARD parameter with 'BOARD=')
- $(error Invalid BOARD specified)
-endif
-
-ifeq ($(FAMILY),)
- include $(TOP)/hw/bsp/$(BOARD)/board.mk
-else
- # Include Family and Board specific defs
- include $(TOP)/$(FAMILY_PATH)/family.mk
- SRC_C += $(subst $(TOP)/,,$(wildcard $(TOP)/$(FAMILY_PATH)/*.c))
-endif
-
-#-------------------------------------------------------------
-# Source files and compiler flags
-#-------------------------------------------------------------
-# tinyusb makefile
-include $(TOP)/src/tinyusb.mk
-SRC_C += $(TINYUSB_SRC_C)
-
-# Include all source C in family & board folder
-SRC_C += hw/bsp/board.c
-SRC_C += $(subst $(TOP)/,,$(wildcard $(TOP)/$(BOARD_PATH)/*.c))
-
-INC += \
- $(TOP)/$(FAMILY_PATH) \
- $(TOP)/src \
-
-BOARD_UPPER = $(call to_upper,$(BOARD))
-CFLAGS += -DBOARD_$(BOARD_UPPER)
-
-ifdef CFLAGS_CLI
- CFLAGS += $(CFLAGS_CLI)
-endif
-
-# use max3421 as host controller
-ifeq (${MAX3421_HOST},1)
- SRC_C += src/portable/analog/max3421/hcd_max3421.c
- CFLAGS += -DCFG_TUH_MAX3421=1
-endif
-
-# Log level is mapped to TUSB DEBUG option
-ifneq ($(LOG),)
- CFLAGS += -DCFG_TUSB_DEBUG=$(LOG)
-endif
-
-# Logger: default is uart, can be set to rtt or swo
-ifeq ($(LOGGER),rtt)
- CFLAGS += -DLOGGER_RTT
- #CFLAGS += -DSEGGER_RTT_MODE_DEFAULT=SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL
- INC += $(TOP)/$(lib/SEGGER_RTT)/RTT
- SRC_C += $(lib/SEGGER_RTT)/RTT/SEGGER_RTT.c
-endif
-ifeq ($(LOGGER),swo)
- CFLAGS += -DLOGGER_SWO
-else
- CFLAGS += -DLOGGER_UART
-endif
-
-# CPU specific flags
-ifdef CPU_CORE
- include ${TOP}/examples/build_system/make/cpu/$(CPU_CORE).mk
-endif
-
-# toolchain specific
-include ${TOP}/examples/build_system/make/toolchain/arm_$(TOOLCHAIN).mk
-
-#---------------------- 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)))))
-__check_defined = \
- $(if $(value $1),, \
- $(error Undefined make flag: $1$(if $2, ($2))))
diff --git a/examples/build_system/make/rules.mk b/examples/build_system/make/rules.mk
deleted file mode 100644
index 86de17b6c..000000000
--- a/examples/build_system/make/rules.mk
+++ /dev/null
@@ -1,195 +0,0 @@
-# ---------------------------------------
-# Common make rules for all examples
-# ---------------------------------------
-
-# Set all as default goal
-.DEFAULT_GOAL := all
-
-# ---------------- GNU Make Start -----------------------
-# ESP32-Sx and RP2040 has its own CMake build system
-ifeq (,$(findstring $(FAMILY),espressif rp2040))
-
-# ---------------------------------------
-# Rules
-# ---------------------------------------
-
-all: $(BUILD)/$(PROJECT).bin $(BUILD)/$(PROJECT).hex size
-
-uf2: $(BUILD)/$(PROJECT).uf2
-
-# We set vpath to point to the top of the tree so that the source files
-# can be located. By following this scheme, it allows a single build rule
-# to be used to compile all .c files.
-vpath %.c . $(TOP)
-vpath %.s . $(TOP)
-vpath %.S . $(TOP)
-
-include ${TOP}/examples/build_system/make/toolchain/$(TOOLCHAIN)_rules.mk
-
-# ---------------------------------------
-# Compiler Flags
-# ---------------------------------------
-
-CFLAGS += $(addprefix -I,$(INC))
-
-# Verbose mode
-ifeq ("$(V)","1")
-$(info CFLAGS $(CFLAGS) ) $(info )
-$(info LDFLAGS $(LDFLAGS)) $(info )
-$(info ASFLAGS $(ASFLAGS)) $(info )
-endif
-
-
-OBJ_DIRS = $(sort $(dir $(OBJ)))
-$(OBJ): | $(OBJ_DIRS)
-$(OBJ_DIRS):
-ifeq ($(CMDEXE),1)
- -@$(MKDIR) $(subst /,\,$@)
-else
- @$(MKDIR) -p $@
-endif
-
-# UF2 generation, iMXRT need to strip to text only before conversion
-ifneq ($(FAMILY),imxrt)
-$(BUILD)/$(PROJECT).uf2: $(BUILD)/$(PROJECT).hex
- @echo CREATE $@
- $(PYTHON) $(TOP)/tools/uf2/utils/uf2conv.py -f $(UF2_FAMILY_ID) -c -o $@ $^
-endif
-
-copy-artifact: $(BUILD)/$(PROJECT).bin $(BUILD)/$(PROJECT).hex $(BUILD)/$(PROJECT).uf2
-
-endif
-# ---------------- GNU Make End -----------------------
-
-.PHONY: clean
-clean:
-ifeq ($(CMDEXE),1)
- rd /S /Q $(subst /,\,$(BUILD))
-else
- $(RM) -rf $(BUILD)
-endif
-
-# get depenecies
-.PHONY: get-deps
-get-deps:
- $(PYTHON) $(TOP)/tools/get_deps.py ${FAMILY}
-
-.PHONY: size
-size: $(BUILD)/$(PROJECT).elf
- -@echo ''
- @$(SIZE) $<
- -@echo ''
-
-# linkermap must be install previously at https://github.com/hathach/linkermap
-linkermap: $(BUILD)/$(PROJECT).elf
- @linkermap -v $<.map
-
-# ---------------------------------------
-# Flash Targets
-# ---------------------------------------
-
-# --------------- Jlink -----------------
-ifeq ($(OS),Windows_NT)
- JLINKEXE = JLink.exe
-else
- JLINKEXE = JLinkExe
-endif
-
-# Jlink Interface
-JLINK_IF ?= swd
-
-# Jlink script
-$(BUILD)/$(BOARD).jlink: $(BUILD)/$(PROJECT).hex
- @echo halt > $@
- @echo loadfile $^ >> $@
- @echo r >> $@
- @echo go >> $@
- @echo exit >> $@
-
-# Flash using jlink
-flash-jlink: $(BUILD)/$(BOARD).jlink
- $(JLINKEXE) -device $(JLINK_DEVICE) -if $(JLINK_IF) -JTAGConf -1,-1 -speed auto -CommandFile $<
-
-# --------------- stm32 cube programmer -----------------
-# Flash STM32 MCU using stlink with STM32 Cube Programmer CLI
-flash-stlink: $(BUILD)/$(PROJECT).elf
- STM32_Programmer_CLI --connect port=swd --write $< --go
-
-# --------------- xfel -----------------
-$(BUILD)/$(PROJECT)-sunxi.bin: $(BUILD)/$(PROJECT).bin
- $(PYTHON) $(TOP)/tools/mksunxi.py $< $@
-
-flash-xfel: $(BUILD)/$(PROJECT)-sunxi.bin
- xfel spinor write 0 $<
- xfel reset
-
-# --------------- pyocd -----------------
-PYOCD_OPTION ?=
-flash-pyocd: $(BUILD)/$(PROJECT).hex
- pyocd flash -t $(PYOCD_TARGET) $(PYOCD_OPTION) $<
- #pyocd reset -t $(PYOCD_TARGET)
-
-# --------------- openocd -----------------
-OPENOCD_OPTION ?=
-flash-openocd: $(BUILD)/$(PROJECT).elf
- openocd $(OPENOCD_OPTION) -c "program $< verify reset exit"
-
-# --------------- openocd-wch -----------------
-# wch-linke is not supported yet in official openOCD yet. We need to either use
-# 1. download openocd as part of mounriver studio http://www.mounriver.com/download or
-# 2. compiled from https://github.com/hathach/riscv-openocd-wch or
-# https://github.com/dragonlock2/miscboards/blob/main/wch/SDK/riscv-openocd.tar.xz
-# with ./configure --disable-werror --enable-wlinke --enable-ch347=no
-OPENOCD_WCH ?= /home/${USER}/app/riscv-openocd-wch/src/openocd
-OPENOCD_WCH_OPTION ?=
-flash-openocd-wch: $(BUILD)/$(PROJECT).elf
- $(OPENOCD_WCH) $(OPENOCD_WCH_OPTION) -c init -c halt -c "flash write_image $<" -c reset -c exit
-
-# --------------- wlink-rs -----------------
-# flash with https://github.com/ch32-rs/wlink
-WLINK_RS ?= wlink
-flash-wlink-rs: $(BUILD)/$(PROJECT).elf
- $(WLINK_RS) flash $<
-
-# --------------- dfu-util -----------------
-DFU_UTIL_OPTION ?= -a 0
-flash-dfu-util: $(BUILD)/$(PROJECT).bin
- dfu-util -R $(DFU_UTIL_OPTION) -D $<
-
-# --------------- Black Magic -----------------
-# This symlink is created by https://github.com/blacksphere/blackmagic/blob/master/driver/99-blackmagic.rules
-BMP ?= /dev/ttyBmpGdb
-
-flash-bmp: $(BUILD)/$(PROJECT).elf
- $(GDB) --batch -ex 'target extended-remote $(BMP)' -ex 'monitor swdp_scan' -ex 'attach 1' -ex load $<
-
-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
-$(BIN):
-ifeq ($(CMDEXE),1)
- @$(MKDIR) $(subst /,\,$@)
-else
- @$(MKDIR) -p $@
-endif
-
-# Copy binaries .elf, .bin, .hex, .uf2 to BIN for upload
-# due to large size of combined artifacts, only uf2 is uploaded for now
-copy-artifact: $(BIN)
- @$(CP) $(BUILD)/$(PROJECT).uf2 $(BIN)
- #@$(CP) $(BUILD)/$(PROJECT).bin $(BIN)
- #@$(CP) $(BUILD)/$(PROJECT).hex $(BIN)
- #@$(CP) $(BUILD)/$(PROJECT).elf $(BIN)
-
-# Print out the value of a make variable.
-# https://stackoverflow.com/questions/16467718/how-to-print-out-a-variable-in-makefile
-print-%:
- @echo $* = $($*)