diff options
| author | hathach <[email protected]> | 2025-10-14 15:14:43 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2025-10-14 15:14:43 +0700 |
| commit | 9bf18d080b202e8e09bd76f32272b1dbfabfa3b9 (patch) | |
| tree | 73a0d88f3e70e6a1b16cbff0e6c2be6728f05eba /examples | |
| parent | 38255ffc3879e9aef12796ce25b58a2c654ce67d (diff) | |
move make.mk to hw/bsp/family_support.mk
Diffstat (limited to 'examples')
40 files changed, 39 insertions, 229 deletions
diff --git a/examples/build_system/make/make.mk b/examples/build_system/make/make.mk deleted file mode 100644 index 4f5d3242e..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/device/audio_4_channel_mic/Makefile b/examples/device/audio_4_channel_mic/Makefile index 2c825bbf7..4cf2d9e49 100644 --- a/examples/device/audio_4_channel_mic/Makefile +++ b/examples/device/audio_4_channel_mic/Makefile @@ -1,4 +1,4 @@ -include ../../build_system/make/make.mk +include ../../../hw/bsp/family_support.mk INC += \ src \ diff --git a/examples/device/audio_4_channel_mic_freertos/Makefile b/examples/device/audio_4_channel_mic_freertos/Makefile index bd625b345..13c637977 100644 --- a/examples/device/audio_4_channel_mic_freertos/Makefile +++ b/examples/device/audio_4_channel_mic_freertos/Makefile @@ -1,5 +1,5 @@ RTOS = freertos -include ../../build_system/make/make.mk +include ../../../hw/bsp/family_support.mk INC += \ src \ diff --git a/examples/device/audio_test/Makefile b/examples/device/audio_test/Makefile index 7fa475da5..e8cacd359 100644 --- a/examples/device/audio_test/Makefile +++ b/examples/device/audio_test/Makefile @@ -1,4 +1,4 @@ -include ../../build_system/make/make.mk +include ../../../hw/bsp/family_support.mk INC += \ src \ diff --git a/examples/device/audio_test_freertos/Makefile b/examples/device/audio_test_freertos/Makefile index bd625b345..13c637977 100644 --- a/examples/device/audio_test_freertos/Makefile +++ b/examples/device/audio_test_freertos/Makefile @@ -1,5 +1,5 @@ RTOS = freertos -include ../../build_system/make/make.mk +include ../../../hw/bsp/family_support.mk INC += \ src \ diff --git a/examples/device/audio_test_multi_rate/Makefile b/examples/device/audio_test_multi_rate/Makefile index 7fa475da5..e8cacd359 100644 --- a/examples/device/audio_test_multi_rate/Makefile +++ b/examples/device/audio_test_multi_rate/Makefile @@ -1,4 +1,4 @@ -include ../../build_system/make/make.mk +include ../../../hw/bsp/family_support.mk INC += \ src \ diff --git a/examples/device/board_test/Makefile b/examples/device/board_test/Makefile index 7fa475da5..e8cacd359 100644 --- a/examples/device/board_test/Makefile +++ b/examples/device/board_test/Makefile @@ -1,4 +1,4 @@ -include ../../build_system/make/make.mk +include ../../../hw/bsp/family_support.mk INC += \ src \ diff --git a/examples/device/cdc_dual_ports/Makefile b/examples/device/cdc_dual_ports/Makefile index 7fa475da5..e8cacd359 100644 --- a/examples/device/cdc_dual_ports/Makefile +++ b/examples/device/cdc_dual_ports/Makefile @@ -1,4 +1,4 @@ -include ../../build_system/make/make.mk +include ../../../hw/bsp/family_support.mk INC += \ src \ diff --git a/examples/device/cdc_msc/Makefile b/examples/device/cdc_msc/Makefile index 0c2e37180..eb548f018 100644 --- a/examples/device/cdc_msc/Makefile +++ b/examples/device/cdc_msc/Makefile @@ -1,4 +1,4 @@ -include ../../build_system/make/make.mk +include ../../../hw/bsp/family_support.mk INC += \ src \ diff --git a/examples/device/cdc_msc_freertos/Makefile b/examples/device/cdc_msc_freertos/Makefile index 10cff57a0..41960e64c 100644 --- a/examples/device/cdc_msc_freertos/Makefile +++ b/examples/device/cdc_msc_freertos/Makefile @@ -1,5 +1,5 @@ RTOS = freertos -include ../../build_system/make/make.mk +include ../../../hw/bsp/family_support.mk INC += \ src \ diff --git a/examples/device/cdc_uac2/Makefile b/examples/device/cdc_uac2/Makefile index 21dcdb0b2..539077d6c 100644 --- a/examples/device/cdc_uac2/Makefile +++ b/examples/device/cdc_uac2/Makefile @@ -1,4 +1,4 @@ -include ../../build_system/make/make.mk +include ../../../hw/bsp/family_support.mk INC += \ src \ diff --git a/examples/device/dfu/Makefile b/examples/device/dfu/Makefile index 52a24cdb0..ad7a37b79 100644 --- a/examples/device/dfu/Makefile +++ b/examples/device/dfu/Makefile @@ -1,4 +1,4 @@ -include ../../build_system/make/make.mk +include ../../../hw/bsp/family_support.mk INC += \ src \ diff --git a/examples/device/dfu_runtime/Makefile b/examples/device/dfu_runtime/Makefile index 1b4d398cf..72bd56ede 100644 --- a/examples/device/dfu_runtime/Makefile +++ b/examples/device/dfu_runtime/Makefile @@ -1,4 +1,4 @@ -include ../../build_system/make/make.mk +include ../../../hw/bsp/family_support.mk INC += \ src \ diff --git a/examples/device/dynamic_configuration/Makefile b/examples/device/dynamic_configuration/Makefile index 1b4d398cf..72bd56ede 100644 --- a/examples/device/dynamic_configuration/Makefile +++ b/examples/device/dynamic_configuration/Makefile @@ -1,4 +1,4 @@ -include ../../build_system/make/make.mk +include ../../../hw/bsp/family_support.mk INC += \ src \ diff --git a/examples/device/hid_boot_interface/Makefile b/examples/device/hid_boot_interface/Makefile index 52a24cdb0..ad7a37b79 100644 --- a/examples/device/hid_boot_interface/Makefile +++ b/examples/device/hid_boot_interface/Makefile @@ -1,4 +1,4 @@ -include ../../build_system/make/make.mk +include ../../../hw/bsp/family_support.mk INC += \ src \ diff --git a/examples/device/hid_composite/Makefile b/examples/device/hid_composite/Makefile index 1b4d398cf..72bd56ede 100644 --- a/examples/device/hid_composite/Makefile +++ b/examples/device/hid_composite/Makefile @@ -1,4 +1,4 @@ -include ../../build_system/make/make.mk +include ../../../hw/bsp/family_support.mk INC += \ src \ diff --git a/examples/device/hid_composite_freertos/Makefile b/examples/device/hid_composite_freertos/Makefile index bd625b345..13c637977 100644 --- a/examples/device/hid_composite_freertos/Makefile +++ b/examples/device/hid_composite_freertos/Makefile @@ -1,5 +1,5 @@ RTOS = freertos -include ../../build_system/make/make.mk +include ../../../hw/bsp/family_support.mk INC += \ src \ diff --git a/examples/device/hid_generic_inout/Makefile b/examples/device/hid_generic_inout/Makefile index 1b4d398cf..72bd56ede 100644 --- a/examples/device/hid_generic_inout/Makefile +++ b/examples/device/hid_generic_inout/Makefile @@ -1,4 +1,4 @@ -include ../../build_system/make/make.mk +include ../../../hw/bsp/family_support.mk INC += \ src \ diff --git a/examples/device/hid_multiple_interface/Makefile b/examples/device/hid_multiple_interface/Makefile index 1b4d398cf..72bd56ede 100644 --- a/examples/device/hid_multiple_interface/Makefile +++ b/examples/device/hid_multiple_interface/Makefile @@ -1,4 +1,4 @@ -include ../../build_system/make/make.mk +include ../../../hw/bsp/family_support.mk INC += \ src \ diff --git a/examples/device/midi_test/Makefile b/examples/device/midi_test/Makefile index 7fa475da5..e8cacd359 100644 --- a/examples/device/midi_test/Makefile +++ b/examples/device/midi_test/Makefile @@ -1,4 +1,4 @@ -include ../../build_system/make/make.mk +include ../../../hw/bsp/family_support.mk INC += \ src \ diff --git a/examples/device/midi_test_freertos/Makefile b/examples/device/midi_test_freertos/Makefile index 26cd83486..704d319d2 100644 --- a/examples/device/midi_test_freertos/Makefile +++ b/examples/device/midi_test_freertos/Makefile @@ -1,5 +1,5 @@ RTOS = freertos -include ../../build_system/make/make.mk +include ../../../hw/bsp/family_support.mk INC += \ src \ diff --git a/examples/device/msc_dual_lun/Makefile b/examples/device/msc_dual_lun/Makefile index 7fa475da5..e8cacd359 100644 --- a/examples/device/msc_dual_lun/Makefile +++ b/examples/device/msc_dual_lun/Makefile @@ -1,4 +1,4 @@ -include ../../build_system/make/make.mk +include ../../../hw/bsp/family_support.mk INC += \ src \ diff --git a/examples/device/mtp/Makefile b/examples/device/mtp/Makefile index 7fa475da5..e8cacd359 100644 --- a/examples/device/mtp/Makefile +++ b/examples/device/mtp/Makefile @@ -1,4 +1,4 @@ -include ../../build_system/make/make.mk +include ../../../hw/bsp/family_support.mk INC += \ src \ diff --git a/examples/device/net_lwip_webserver/Makefile b/examples/device/net_lwip_webserver/Makefile index 4ad110dec..82c946b14 100644 --- a/examples/device/net_lwip_webserver/Makefile +++ b/examples/device/net_lwip_webserver/Makefile @@ -1,4 +1,4 @@ -include ../../build_system/make/make.mk +include ../../../hw/bsp/family_support.mk # suppress warning caused by lwip CFLAGS_GCC += \ diff --git a/examples/device/uac2_headset/Makefile b/examples/device/uac2_headset/Makefile index 7fa475da5..e8cacd359 100644 --- a/examples/device/uac2_headset/Makefile +++ b/examples/device/uac2_headset/Makefile @@ -1,4 +1,4 @@ -include ../../build_system/make/make.mk +include ../../../hw/bsp/family_support.mk INC += \ src \ diff --git a/examples/device/uac2_speaker_fb/Makefile b/examples/device/uac2_speaker_fb/Makefile index 7fa475da5..e8cacd359 100644 --- a/examples/device/uac2_speaker_fb/Makefile +++ b/examples/device/uac2_speaker_fb/Makefile @@ -1,4 +1,4 @@ -include ../../build_system/make/make.mk +include ../../../hw/bsp/family_support.mk INC += \ src \ diff --git a/examples/device/usbtmc/Makefile b/examples/device/usbtmc/Makefile index 1b4d398cf..72bd56ede 100644 --- a/examples/device/usbtmc/Makefile +++ b/examples/device/usbtmc/Makefile @@ -1,4 +1,4 @@ -include ../../build_system/make/make.mk +include ../../../hw/bsp/family_support.mk INC += \ src \ diff --git a/examples/device/video_capture/Makefile b/examples/device/video_capture/Makefile index d698a848d..288e9ffc3 100644 --- a/examples/device/video_capture/Makefile +++ b/examples/device/video_capture/Makefile @@ -1,4 +1,4 @@ -include ../../build_system/make/make.mk +include ../../../hw/bsp/family_support.mk ifeq ($(DISABLE_MJPEG),1) CFLAGS += -DCFG_EXAMPLE_VIDEO_DISABLE_MJPEG diff --git a/examples/device/video_capture_2ch/Makefile b/examples/device/video_capture_2ch/Makefile index d698a848d..288e9ffc3 100644 --- a/examples/device/video_capture_2ch/Makefile +++ b/examples/device/video_capture_2ch/Makefile @@ -1,4 +1,4 @@ -include ../../build_system/make/make.mk +include ../../../hw/bsp/family_support.mk ifeq ($(DISABLE_MJPEG),1) CFLAGS += -DCFG_EXAMPLE_VIDEO_DISABLE_MJPEG diff --git a/examples/device/webusb_serial/Makefile b/examples/device/webusb_serial/Makefile index 7fa475da5..e8cacd359 100644 --- a/examples/device/webusb_serial/Makefile +++ b/examples/device/webusb_serial/Makefile @@ -1,4 +1,4 @@ -include ../../build_system/make/make.mk +include ../../../hw/bsp/family_support.mk INC += \ src \ diff --git a/examples/dual/host_hid_to_device_cdc/Makefile b/examples/dual/host_hid_to_device_cdc/Makefile index 474ae9814..76c6db0ac 100644 --- a/examples/dual/host_hid_to_device_cdc/Makefile +++ b/examples/dual/host_hid_to_device_cdc/Makefile @@ -1,4 +1,4 @@ -include ../../build_system/make/make.mk +include ../../../hw/bsp/family_support.mk INC += \ src \ diff --git a/examples/dual/host_info_to_device_cdc/Makefile b/examples/dual/host_info_to_device_cdc/Makefile index 083c9169a..071185c88 100644 --- a/examples/dual/host_info_to_device_cdc/Makefile +++ b/examples/dual/host_info_to_device_cdc/Makefile @@ -1,4 +1,4 @@ -include ../../build_system/make/make.mk +include ../../../hw/bsp/family_support.mk INC += \ src \ diff --git a/examples/host/bare_api/Makefile b/examples/host/bare_api/Makefile index 0235e08c3..e6408c77a 100644 --- a/examples/host/bare_api/Makefile +++ b/examples/host/bare_api/Makefile @@ -1,4 +1,4 @@ -include ../../build_system/make/make.mk +include ../../../hw/bsp/family_support.mk INC += \ src \ diff --git a/examples/host/cdc_msc_hid/Makefile b/examples/host/cdc_msc_hid/Makefile index 213c02f9c..b6036fa26 100644 --- a/examples/host/cdc_msc_hid/Makefile +++ b/examples/host/cdc_msc_hid/Makefile @@ -1,4 +1,4 @@ -include ../../build_system/make/make.mk +include ../../../hw/bsp/family_support.mk INC += \ src \ diff --git a/examples/host/cdc_msc_hid_freertos/Makefile b/examples/host/cdc_msc_hid_freertos/Makefile index 178341f81..4e8c8b116 100644 --- a/examples/host/cdc_msc_hid_freertos/Makefile +++ b/examples/host/cdc_msc_hid_freertos/Makefile @@ -1,5 +1,5 @@ RTOS = freertos -include ../../build_system/make/make.mk +include ../../../hw/bsp/family_support.mk INC += \ src \ diff --git a/examples/host/device_info/Makefile b/examples/host/device_info/Makefile index 0235e08c3..e6408c77a 100644 --- a/examples/host/device_info/Makefile +++ b/examples/host/device_info/Makefile @@ -1,4 +1,4 @@ -include ../../build_system/make/make.mk +include ../../../hw/bsp/family_support.mk INC += \ src \ diff --git a/examples/host/hid_controller/Makefile b/examples/host/hid_controller/Makefile index 1377f1f90..f82054e8c 100644 --- a/examples/host/hid_controller/Makefile +++ b/examples/host/hid_controller/Makefile @@ -1,4 +1,4 @@ -include ../../build_system/make/make.mk +include ../../../hw/bsp/family_support.mk INC += \ src \ diff --git a/examples/host/midi_rx/Makefile b/examples/host/midi_rx/Makefile index 0235e08c3..e6408c77a 100644 --- a/examples/host/midi_rx/Makefile +++ b/examples/host/midi_rx/Makefile @@ -1,4 +1,4 @@ -include ../../build_system/make/make.mk +include ../../../hw/bsp/family_support.mk INC += \ src \ diff --git a/examples/host/msc_file_explorer/Makefile b/examples/host/msc_file_explorer/Makefile index f0872376f..0f87d848d 100644 --- a/examples/host/msc_file_explorer/Makefile +++ b/examples/host/msc_file_explorer/Makefile @@ -1,4 +1,4 @@ -include ../../build_system/make/make.mk +include ../../../hw/bsp/family_support.mk FATFS_PATH = lib/fatfs/source diff --git a/examples/typec/power_delivery/Makefile b/examples/typec/power_delivery/Makefile index 7fa475da5..e8cacd359 100644 --- a/examples/typec/power_delivery/Makefile +++ b/examples/typec/power_delivery/Makefile @@ -1,4 +1,4 @@ -include ../../build_system/make/make.mk +include ../../../hw/bsp/family_support.mk INC += \ src \ |
