From 9bf18d080b202e8e09bd76f32272b1dbfabfa3b9 Mon Sep 17 00:00:00 2001 From: hathach Date: Tue, 14 Oct 2025 15:14:43 +0700 Subject: move make.mk to hw/bsp/family_support.mk --- examples/build_system/make/make.mk | 190 ------------------------------------- 1 file changed, 190 deletions(-) delete mode 100644 examples/build_system/make/make.mk (limited to 'examples/build_system') 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)))) -- cgit v1.3.1 From 47b13f6b102ea981b79588158dca436ebc21f1ae Mon Sep 17 00:00:00 2001 From: hathach Date: Tue, 14 Oct 2025 17:13:28 +0700 Subject: improve cmake warning flags, fix various warnings in examples --- examples/build_system/cmake/toolchain/common.cmake | 17 +----- examples/device/cdc_uac2/src/common.h | 3 ++ examples/device/cdc_uac2/src/main.c | 3 -- examples/device/net_lwip_webserver/src/main.c | 3 +- examples/device/usbtmc/src/main.c | 1 + examples/device/usbtmc/src/usbtmc_app.c | 1 + examples/device/video_capture_2ch/src/main.c | 5 +- examples/device/webusb_serial/src/main.c | 2 +- examples/host/cdc_msc_hid/src/app.h | 32 ++++++++++++ examples/host/cdc_msc_hid/src/cdc_app.c | 1 + examples/host/cdc_msc_hid/src/hid_app.c | 1 + examples/host/cdc_msc_hid/src/main.c | 3 +- examples/host/cdc_msc_hid_freertos/src/app.h | 33 ++++++++++++ examples/host/cdc_msc_hid_freertos/src/cdc_app.c | 1 + examples/host/cdc_msc_hid_freertos/src/hid_app.c | 3 +- examples/host/cdc_msc_hid_freertos/src/main.c | 4 +- examples/host/cdc_msc_hid_freertos/src/msc_app.c | 1 + examples/host/hid_controller/src/app.h | 31 +++++++++++ examples/host/hid_controller/src/hid_app.c | 1 + examples/host/hid_controller/src/main.c | 20 ++----- hw/bsp/board.c | 6 ++- hw/bsp/family_support.cmake | 61 ++++++++++++---------- lib/networking/dhserver.c | 4 +- lib/networking/rndis_reports.c | 7 ++- src/class/audio/audio_device.h | 1 + src/class/net/ecm_rndis_device.c | 2 - src/class/net/net_device.h | 7 +++ 27 files changed, 174 insertions(+), 80 deletions(-) create mode 100644 examples/host/cdc_msc_hid/src/app.h create mode 100644 examples/host/cdc_msc_hid_freertos/src/app.h create mode 100644 examples/host/hid_controller/src/app.h (limited to 'examples/build_system') diff --git a/examples/build_system/cmake/toolchain/common.cmake b/examples/build_system/cmake/toolchain/common.cmake index 4c181137b..fa3034e6f 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 @@ -34,22 +34,9 @@ if (TOOLCHAIN STREQUAL "gcc") ) 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 diff --git a/examples/device/cdc_uac2/src/common.h b/examples/device/cdc_uac2/src/common.h index f281024c7..ff8b7a953 100644 --- a/examples/device/cdc_uac2/src/common.h +++ b/examples/device/cdc_uac2/src/common.h @@ -31,4 +31,7 @@ enum VOLUME_CTRL_SILENCE = 0x8000, }; +void led_blinking_task(void); +void audio_task(void); + #endif diff --git a/examples/device/cdc_uac2/src/main.c b/examples/device/cdc_uac2/src/main.c index bc87f6e3c..22c462be7 100644 --- a/examples/device/cdc_uac2/src/main.c +++ b/examples/device/cdc_uac2/src/main.c @@ -38,9 +38,6 @@ extern uint32_t blink_interval_ms; #include "pico/stdlib.h" #endif -void led_blinking_task(void); -void audio_task(void); - /*------------- MAIN -------------*/ int main(void) { diff --git a/examples/device/net_lwip_webserver/src/main.c b/examples/device/net_lwip_webserver/src/main.c index dd9f213ae..867cf2812 100644 --- a/examples/device/net_lwip_webserver/src/main.c +++ b/examples/device/net_lwip_webserver/src/main.c @@ -58,6 +58,7 @@ try changing the first byte of tud_network_mac_address[] below from 0x02 to 0x00 #include "lwip/ethip6.h" #include "lwip/init.h" #include "lwip/timeouts.h" +#include "lwip/sys.h" #ifdef INCLUDE_IPERF #include "lwip/apps/lwiperf.h" @@ -172,7 +173,7 @@ static void init_lwip(void) { } /* handle any DNS requests from dns-server */ -bool dns_query_proc(const char *name, ip4_addr_t *addr) { +static bool dns_query_proc(const char *name, ip4_addr_t *addr) { if (0 == strcmp(name, "tiny.usb")) { *addr = ipaddr; return true; diff --git a/examples/device/usbtmc/src/main.c b/examples/device/usbtmc/src/main.c index f78cce91f..5cbbb85ef 100644 --- a/examples/device/usbtmc/src/main.c +++ b/examples/device/usbtmc/src/main.c @@ -29,6 +29,7 @@ #include "bsp/board_api.h" #include "tusb.h" +#include "main.h" #include "usbtmc_app.h" //--------------------------------------------------------------------+ // MACRO CONSTANT TYPEDEF PROTYPES diff --git a/examples/device/usbtmc/src/usbtmc_app.c b/examples/device/usbtmc/src/usbtmc_app.c index e738f1008..4c3724ac4 100644 --- a/examples/device/usbtmc/src/usbtmc_app.c +++ b/examples/device/usbtmc/src/usbtmc_app.c @@ -28,6 +28,7 @@ #include "tusb.h" #include "bsp/board_api.h" #include "main.h" +#include "usbtmc_app.h" #if (CFG_TUD_USBTMC_ENABLE_488) static usbtmc_response_capabilities_488_t const diff --git a/examples/device/video_capture_2ch/src/main.c b/examples/device/video_capture_2ch/src/main.c index f56738f67..a63efa82d 100644 --- a/examples/device/video_capture_2ch/src/main.c +++ b/examples/device/video_capture_2ch/src/main.c @@ -180,7 +180,7 @@ static void fill_color_bar(uint8_t* buffer, unsigned start_position) { } #endif -size_t get_framebuf(uint_fast8_t ctl_idx, uint_fast8_t stm_idx, size_t fnum, void **fb) { +static size_t get_framebuf(uint_fast8_t ctl_idx, uint_fast8_t stm_idx, size_t fnum, void **fb) { uint32_t idx = ctl_idx + stm_idx; if (idx == 0) { @@ -205,8 +205,7 @@ size_t get_framebuf(uint_fast8_t ctl_idx, uint_fast8_t stm_idx, size_t fnum, voi //--------------------------------------------------------------------+ // //--------------------------------------------------------------------+ - -void video_send_frame(uint_fast8_t ctl_idx, uint_fast8_t stm_idx) { +static void video_send_frame(uint_fast8_t ctl_idx, uint_fast8_t stm_idx) { static unsigned start_ms[CFG_TUD_VIDEO_STREAMING] = {0, }; static unsigned already_sent = 0; diff --git a/examples/device/webusb_serial/src/main.c b/examples/device/webusb_serial/src/main.c index 4a724f45e..0c2acd94e 100644 --- a/examples/device/webusb_serial/src/main.c +++ b/examples/device/webusb_serial/src/main.c @@ -107,7 +107,7 @@ int main(void) { } // send characters to both CDC and WebUSB -void echo_all(const uint8_t buf[], uint32_t count) { +static void echo_all(const uint8_t buf[], uint32_t count) { // echo to web serial if (web_serial_connected) { tud_vendor_write(buf, count); diff --git a/examples/host/cdc_msc_hid/src/app.h b/examples/host/cdc_msc_hid/src/app.h new file mode 100644 index 000000000..bf15c7bea --- /dev/null +++ b/examples/host/cdc_msc_hid/src/app.h @@ -0,0 +1,32 @@ +/* + * The MIT License (MIT) + * + * Copyright (c) 2025 Ha Thach (tinyusb.org) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * This file is part of the TinyUSB stack. + */ +#ifndef TUSB_TINYUSB_EXAMPLES_APP_H +#define TUSB_TINYUSB_EXAMPLES_APP_H + +void cdc_app_task(void); +void hid_app_task(void); + +#endif diff --git a/examples/host/cdc_msc_hid/src/cdc_app.c b/examples/host/cdc_msc_hid/src/cdc_app.c index 97f1a96d6..d3daedffc 100644 --- a/examples/host/cdc_msc_hid/src/cdc_app.c +++ b/examples/host/cdc_msc_hid/src/cdc_app.c @@ -26,6 +26,7 @@ #include "tusb.h" #include "bsp/board_api.h" +#include "app.h" static size_t get_console_inputs(uint8_t* buf, size_t bufsize) { size_t count = 0; diff --git a/examples/host/cdc_msc_hid/src/hid_app.c b/examples/host/cdc_msc_hid/src/hid_app.c index 6f01d6f45..f6a83aeed 100644 --- a/examples/host/cdc_msc_hid/src/hid_app.c +++ b/examples/host/cdc_msc_hid/src/hid_app.c @@ -25,6 +25,7 @@ #include "bsp/board_api.h" #include "tusb.h" +#include "app.h" //--------------------------------------------------------------------+ // MACRO TYPEDEF CONSTANT ENUM DECLARATION diff --git a/examples/host/cdc_msc_hid/src/main.c b/examples/host/cdc_msc_hid/src/main.c index e2dd6e5d2..c309a7cae 100644 --- a/examples/host/cdc_msc_hid/src/main.c +++ b/examples/host/cdc_msc_hid/src/main.c @@ -29,13 +29,12 @@ #include "bsp/board_api.h" #include "tusb.h" +#include "app.h" //--------------------------------------------------------------------+ // MACRO CONSTANT TYPEDEF PROTOTYPES //--------------------------------------------------------------------+ void led_blinking_task(void); -extern void cdc_app_task(void); -extern void hid_app_task(void); /*------------- MAIN -------------*/ int main(void) { diff --git a/examples/host/cdc_msc_hid_freertos/src/app.h b/examples/host/cdc_msc_hid_freertos/src/app.h new file mode 100644 index 000000000..960f7e8cc --- /dev/null +++ b/examples/host/cdc_msc_hid_freertos/src/app.h @@ -0,0 +1,33 @@ +/* + * The MIT License (MIT) + * + * Copyright (c) 2025 Ha Thach (tinyusb.org) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * This file is part of the TinyUSB stack. + */ +#ifndef TUSB_TINYUSB_EXAMPLES_APP_H +#define TUSB_TINYUSB_EXAMPLES_APP_H + +void cdc_app_init(void); +void hid_app_init(void); +void msc_app_init(void); + +#endif diff --git a/examples/host/cdc_msc_hid_freertos/src/cdc_app.c b/examples/host/cdc_msc_hid_freertos/src/cdc_app.c index d99760a02..279efe7b7 100644 --- a/examples/host/cdc_msc_hid_freertos/src/cdc_app.c +++ b/examples/host/cdc_msc_hid_freertos/src/cdc_app.c @@ -26,6 +26,7 @@ #include "tusb.h" #include "bsp/board_api.h" +#include "app.h" #ifdef ESP_PLATFORM #define CDC_STACK_SZIE 2048 diff --git a/examples/host/cdc_msc_hid_freertos/src/hid_app.c b/examples/host/cdc_msc_hid_freertos/src/hid_app.c index 9ea5c1be0..0b4ee2c78 100644 --- a/examples/host/cdc_msc_hid_freertos/src/hid_app.c +++ b/examples/host/cdc_msc_hid_freertos/src/hid_app.c @@ -25,6 +25,7 @@ #include "bsp/board_api.h" #include "tusb.h" +#include "app.h" //--------------------------------------------------------------------+ // MACRO TYPEDEF CONSTANT ENUM DECLARATION @@ -160,7 +161,7 @@ static void process_kbd_report(hid_keyboard_report_t const *report) { // Mouse //--------------------------------------------------------------------+ -void cursor_movement(int8_t x, int8_t y, int8_t wheel) { +static void cursor_movement(int8_t x, int8_t y, int8_t wheel) { #if USE_ANSI_ESCAPE // Move X using ansi escape if ( x < 0) { diff --git a/examples/host/cdc_msc_hid_freertos/src/main.c b/examples/host/cdc_msc_hid_freertos/src/main.c index d498c1b57..5dab2bed0 100644 --- a/examples/host/cdc_msc_hid_freertos/src/main.c +++ b/examples/host/cdc_msc_hid_freertos/src/main.c @@ -29,6 +29,7 @@ #include "bsp/board_api.h" #include "tusb.h" +#include "app.h" #ifdef ESP_PLATFORM #define USBH_STACK_SIZE 4096 @@ -65,9 +66,6 @@ TimerHandle_t blinky_tm; static void led_blinky_cb(TimerHandle_t xTimer); static void usb_host_task(void* param); -extern void cdc_app_init(void); -extern void hid_app_init(void); -extern void msc_app_init(void); /*------------- MAIN -------------*/ int main(void) { diff --git a/examples/host/cdc_msc_hid_freertos/src/msc_app.c b/examples/host/cdc_msc_hid_freertos/src/msc_app.c index 6439495a8..a6e3ed4ee 100644 --- a/examples/host/cdc_msc_hid_freertos/src/msc_app.c +++ b/examples/host/cdc_msc_hid_freertos/src/msc_app.c @@ -24,6 +24,7 @@ */ #include "tusb.h" +#include "app.h" // define the buffer to be place in USB/DMA memory with correct alignment/cache line size CFG_TUH_MEM_SECTION static struct { diff --git a/examples/host/hid_controller/src/app.h b/examples/host/hid_controller/src/app.h new file mode 100644 index 000000000..1f9015cd2 --- /dev/null +++ b/examples/host/hid_controller/src/app.h @@ -0,0 +1,31 @@ +/* + * The MIT License (MIT) + * + * Copyright (c) 2025 Ha Thach (tinyusb.org) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * This file is part of the TinyUSB stack. + */ +#ifndef TUSB_TINYUSB_EXAMPLES_APP_H +#define TUSB_TINYUSB_EXAMPLES_APP_H + +void hid_app_task(void); + +#endif diff --git a/examples/host/hid_controller/src/hid_app.c b/examples/host/hid_controller/src/hid_app.c index 1d6ca8b07..f8c3d029b 100644 --- a/examples/host/hid_controller/src/hid_app.c +++ b/examples/host/hid_controller/src/hid_app.c @@ -25,6 +25,7 @@ #include "bsp/board_api.h" #include "tusb.h" +#include "app.h" /* From https://www.kernel.org/doc/html/latest/input/gamepad.html ____________________________ __ diff --git a/examples/host/hid_controller/src/main.c b/examples/host/hid_controller/src/main.c index f3244db95..fa70d7d1a 100644 --- a/examples/host/hid_controller/src/main.c +++ b/examples/host/hid_controller/src/main.c @@ -34,18 +34,15 @@ #include "bsp/board_api.h" #include "tusb.h" +#include "app.h" //--------------------------------------------------------------------+ // MACRO CONSTANT TYPEDEF PROTYPES //--------------------------------------------------------------------+ void led_blinking_task(void); -extern void cdc_task(void); -extern void hid_app_task(void); - /*------------- MAIN -------------*/ -int main(void) -{ +int main(void) { board_init(); printf("TinyUSB Host HID Controller Example\r\n"); @@ -60,19 +57,11 @@ int main(void) board_init_after_tusb(); - while (1) - { + while (1) { // tinyusb host task tuh_task(); led_blinking_task(); - -#if CFG_TUH_CDC - cdc_task(); -#endif - -#if CFG_TUH_HID hid_app_task(); -#endif } } @@ -83,8 +72,7 @@ int main(void) //--------------------------------------------------------------------+ // Blinking Task //--------------------------------------------------------------------+ -void led_blinking_task(void) -{ +void led_blinking_task(void) { const uint32_t interval_ms = 1000; static uint32_t start_ms = 0; diff --git a/hw/bsp/board.c b/hw/bsp/board.c index e141664da..a51978479 100644 --- a/hw/bsp/board.c +++ b/hw/bsp/board.c @@ -180,9 +180,11 @@ uint32_t tusb_time_millis_api(void) { // FreeRTOS hooks //-------------------------------------------------------------------- #if CFG_TUSB_OS == OPT_OS_FREERTOS && !defined(ESP_PLATFORM) + #include "FreeRTOS.h" #include "task.h" +void vApplicationMallocFailedHook(void); // missing prototype void vApplicationMallocFailedHook(void) { taskDISABLE_INTERRUPTS(); TU_ASSERT(false, ); @@ -199,7 +201,7 @@ void vApplicationStackOverflowHook(xTaskHandle pxTask, char *pcTaskName) { /* configSUPPORT_STATIC_ALLOCATION is set to 1, so the application must provide an * implementation of vApplicationGetIdleTaskMemory() to provide the memory that is * used by the Idle task. */ -void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint32_t *pulIdleTaskStackSize ) { +void vApplicationGetIdleTaskMemory(StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint32_t *pulIdleTaskStackSize) { /* If the buffers to be provided to the Idle task are declared inside this * function then they must be declared static - otherwise they will be allocated on * the stack and so not exists after this function exits. */ @@ -243,6 +245,8 @@ void vApplicationGetTimerTaskMemory( StaticTask_t **ppxTimerTaskTCBBuffer, Stack } #if CFG_TUSB_MCU == OPT_MCU_RX63X || CFG_TUSB_MCU == OPT_MCU_RX65X +void vApplicationSetupTimerInterrupt(void); + #include "iodefine.h" void vApplicationSetupTimerInterrupt(void) { /* Enable CMT0 */ diff --git a/hw/bsp/family_support.cmake b/hw/bsp/family_support.cmake index 9ec80df91..daabed81b 100644 --- a/hw/bsp/family_support.cmake +++ b/hw/bsp/family_support.cmake @@ -38,6 +38,35 @@ if (NOT DEFINED TOOLCHAIN) set(TOOLCHAIN gcc) endif () +set(WARN_FLAGS_GNU + -Wall + -Wextra + -Werror + -Wfatal-errors + -Wdouble-promotion + -Wstrict-prototypes + -Wstrict-overflow + -Werror-implicit-function-declaration + -Wfloat-equal + -Wundef + -Wshadow + -Wwrite-strings + -Wsign-compare + -Wmissing-format-attribute + -Wunreachable-code + -Wcast-align + -Wcast-function-type + -Wcast-qual + -Wnull-dereference + -Wuninitialized + -Wunused + -Wunused-function + -Wreturn-type + -Wredundant-decls + -Wmissing-prototypes + ) +set(WARN_FLAGS_Clang ${WARN_FLAGS_GNU}) + # Optimization if (NOT DEFINED CMAKE_BUILD_TYPE OR CMAKE_BUILD_TYPE STREQUAL "") set(CMAKE_BUILD_TYPE MinSizeRel CACHE STRING "Build type" FORCE) @@ -48,8 +77,8 @@ endif () #------------------------------------------------------------- if (NOT DEFINED FAMILY) if (NOT DEFINED BOARD) - message(FATAL_ERROR "You must set a FAMILY variable for the build (e.g. rp2040, espressif). - You can do this via -DFAMILY=xxx on the cmake command line") + message(FATAL_ERROR "You must set a BOARD variable for the build (e.g. metro_m4_express, raspberry_pi_pico). + You can do this via -DBOARD=xxx on the cmake command line") endif () # Find path contains BOARD @@ -226,33 +255,7 @@ function(family_configure_common TARGET RTOS) endif () if (CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "Clang") - target_compile_options(${TARGET} PRIVATE - -Wall - -Wextra - #-Werror - -Wfatal-errors - -Wdouble-promotion - -Wstrict-prototypes - -Wstrict-overflow - -Werror-implicit-function-declaration - -Wfloat-equal - -Wundef - -Wshadow - -Wwrite-strings - -Wsign-compare - -Wmissing-format-attribute - -Wunreachable-code - -Wcast-align - -Wcast-function-type - -Wcast-qual - -Wnull-dereference - -Wuninitialized - -Wunused - -Wunused-function - -Wreturn-type - -Wredundant-decls - -Wmissing-prototypes - ) + target_compile_options(${TARGET} PRIVATE ${WARN_FLAGS_${CMAKE_C_COMPILER_ID}}) target_link_options(${TARGET} PUBLIC "LINKER:-Map=$.map") if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 12.0 AND NO_WARN_RWX_SEGMENTS_SUPPORTED AND (NOT RTOS STREQUAL zephyr)) diff --git a/lib/networking/dhserver.c b/lib/networking/dhserver.c index 9dedf87e2..87a63c5de 100644 --- a/lib/networking/dhserver.c +++ b/lib/networking/dhserver.c @@ -145,7 +145,7 @@ static __inline void free_entry(dhcp_entry_t *entry) memset(entry->mac, 0, 6); } -uint8_t *find_dhcp_option(uint8_t *attrs, int size, uint8_t attr) +static uint8_t *find_dhcp_option(uint8_t *attrs, int size, uint8_t attr) { int i = 0; while ((i + 1) < size) @@ -159,7 +159,7 @@ uint8_t *find_dhcp_option(uint8_t *attrs, int size, uint8_t attr) return NULL; } -int fill_options(void *dest, +static int fill_options(void *dest, uint8_t msg_type, const char *domain, ip4_addr_t dns, diff --git a/lib/networking/rndis_reports.c b/lib/networking/rndis_reports.c index 451d5405b..e2849fb10 100644 --- a/lib/networking/rndis_reports.c +++ b/lib/networking/rndis_reports.c @@ -29,7 +29,10 @@ #include #include -#include "class/net/net_device.h" +#include "tusb.h" + +#if CFG_TUD_ECM_RNDIS + #include "rndis_protocol.h" #include "netif/ethernet.h" @@ -299,3 +302,5 @@ void rndis_class_set_handler(uint8_t *data, int size) break; } } + +#endif diff --git a/src/class/audio/audio_device.h b/src/class/audio/audio_device.h index fd47c649d..00948767e 100644 --- a/src/class/audio/audio_device.h +++ b/src/class/audio/audio_device.h @@ -360,6 +360,7 @@ bool tud_audio_feedback_format_correction_cb(uint8_t func_id); #if CFG_TUD_AUDIO_ENABLE_INTERRUPT_EP void tud_audio_int_done_cb(uint8_t rhport); +void tud_audio_int_xfer_cb(uint8_t rhport); #endif // Invoked when audio set interface request received diff --git a/src/class/net/ecm_rndis_device.c b/src/class/net/ecm_rndis_device.c index 299eb97c8..7dff66823 100644 --- a/src/class/net/ecm_rndis_device.c +++ b/src/class/net/ecm_rndis_device.c @@ -35,8 +35,6 @@ #include "net_device.h" #include "rndis_protocol.h" -extern void rndis_class_set_handler(uint8_t *data, int size); /* found in ./misc/networking/rndis_reports.c */ - #define CFG_TUD_NET_PACKET_PREFIX_LEN sizeof(rndis_data_packet_t) #define CFG_TUD_NET_PACKET_SUFFIX_LEN 0 diff --git a/src/class/net/net_device.h b/src/class/net/net_device.h index fff2623b7..ef5ecffc8 100644 --- a/src/class/net/net_device.h +++ b/src/class/net/net_device.h @@ -55,6 +55,13 @@ typedef enum extern "C" { #endif +//--------------------------------------------------------------------+ +// Implemented by Application +//--------------------------------------------------------------------+ +#if CFG_TUD_ECM_RNDIS +extern void rndis_class_set_handler(uint8_t *data, int size); +#endif + //--------------------------------------------------------------------+ // Application API //--------------------------------------------------------------------+ -- cgit v1.3.1 From c48bbfab5e9ae9a417e30b0f9c0280d6f662b01c Mon Sep 17 00:00:00 2001 From: hathach Date: Tue, 14 Oct 2025 17:53:55 +0700 Subject: more make refactor --- examples/build_system/make/rules.mk | 195 --------------------- examples/device/audio_4_channel_mic/Makefile | 6 +- .../device/audio_4_channel_mic_freertos/Makefile | 6 +- examples/device/audio_test/Makefile | 6 +- examples/device/audio_test_freertos/Makefile | 6 +- examples/device/audio_test_multi_rate/Makefile | 6 +- examples/device/board_test/Makefile | 6 +- examples/device/cdc_dual_ports/Makefile | 6 +- examples/device/cdc_msc/Makefile | 6 +- examples/device/cdc_msc_freertos/Makefile | 6 +- examples/device/cdc_uac2/Makefile | 6 +- examples/device/dfu/Makefile | 6 +- examples/device/dfu_runtime/Makefile | 6 +- examples/device/dynamic_configuration/Makefile | 6 +- examples/device/hid_boot_interface/Makefile | 6 +- examples/device/hid_composite/Makefile | 6 +- examples/device/hid_composite_freertos/Makefile | 6 +- examples/device/hid_generic_inout/Makefile | 6 +- examples/device/hid_multiple_interface/Makefile | 6 +- examples/device/midi_test/Makefile | 6 +- examples/device/midi_test_freertos/Makefile | 6 +- examples/device/msc_dual_lun/Makefile | 6 +- examples/device/mtp/Makefile | 6 +- examples/device/net_lwip_webserver/Makefile | 5 +- examples/device/uac2_headset/Makefile | 6 +- examples/device/uac2_speaker_fb/Makefile | 6 +- examples/device/usbtmc/Makefile | 6 +- examples/device/video_capture/Makefile | 6 +- examples/device/video_capture_2ch/Makefile | 6 +- examples/device/webusb_serial/Makefile | 6 +- examples/dual/host_hid_to_device_cdc/Makefile | 6 +- examples/dual/host_info_to_device_cdc/Makefile | 6 +- examples/host/bare_api/Makefile | 6 +- examples/host/cdc_msc_hid/Makefile | 6 +- examples/host/cdc_msc_hid_freertos/Makefile | 6 +- examples/host/device_info/Makefile | 6 +- examples/host/hid_controller/Makefile | 6 +- examples/host/midi_rx/Makefile | 6 +- examples/host/msc_file_explorer/Makefile | 5 +- examples/typec/power_delivery/Makefile | 10 +- hw/bsp/family_rules.mk | 177 +++++++++++++++++++ hw/bsp/family_support.mk | 8 +- test/fuzz/device/cdc/Makefile | 6 +- test/fuzz/device/msc/Makefile | 6 +- test/fuzz/device/net/Makefile | 5 +- test/fuzz/make.mk | 6 +- 46 files changed, 310 insertions(+), 329 deletions(-) delete mode 100644 examples/build_system/make/rules.mk create mode 100644 hw/bsp/family_rules.mk (limited to 'examples/build_system') 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 $* = $($*) diff --git a/examples/device/audio_4_channel_mic/Makefile b/examples/device/audio_4_channel_mic/Makefile index 4cf2d9e49..31e2c6f44 100644 --- a/examples/device/audio_4_channel_mic/Makefile +++ b/examples/device/audio_4_channel_mic/Makefile @@ -2,13 +2,13 @@ include ../../../hw/bsp/family_support.mk INC += \ src \ - $(TOP)/hw \ + # Example source EXAMPLE_SOURCE += \ src/main.c \ src/usb_descriptors.c \ -SRC_C += $(addprefix $(CURRENT_PATH)/, $(EXAMPLE_SOURCE)) +SRC_C += $(addprefix $(EXAMPLE_PATH)/, $(EXAMPLE_SOURCE)) -include ../../build_system/make/rules.mk +include ../../../hw/bsp/family_rules.mk diff --git a/examples/device/audio_4_channel_mic_freertos/Makefile b/examples/device/audio_4_channel_mic_freertos/Makefile index 13c637977..3c421af74 100644 --- a/examples/device/audio_4_channel_mic_freertos/Makefile +++ b/examples/device/audio_4_channel_mic_freertos/Makefile @@ -3,13 +3,13 @@ include ../../../hw/bsp/family_support.mk INC += \ src \ - $(TOP)/hw \ + # Example source EXAMPLE_SOURCE = \ src/main.c \ src/usb_descriptors.c -SRC_C += $(addprefix $(CURRENT_PATH)/, $(EXAMPLE_SOURCE)) +SRC_C += $(addprefix $(EXAMPLE_PATH)/, $(EXAMPLE_SOURCE)) -include ../../build_system/make/rules.mk +include ../../../hw/bsp/family_rules.mk diff --git a/examples/device/audio_test/Makefile b/examples/device/audio_test/Makefile index e8cacd359..035e90308 100644 --- a/examples/device/audio_test/Makefile +++ b/examples/device/audio_test/Makefile @@ -2,10 +2,10 @@ include ../../../hw/bsp/family_support.mk INC += \ src \ - $(TOP)/hw \ + # Example source EXAMPLE_SOURCE += $(wildcard src/*.c) -SRC_C += $(addprefix $(CURRENT_PATH)/, $(EXAMPLE_SOURCE)) +SRC_C += $(addprefix $(EXAMPLE_PATH)/, $(EXAMPLE_SOURCE)) -include ../../build_system/make/rules.mk +include ../../../hw/bsp/family_rules.mk diff --git a/examples/device/audio_test_freertos/Makefile b/examples/device/audio_test_freertos/Makefile index 13c637977..3c421af74 100644 --- a/examples/device/audio_test_freertos/Makefile +++ b/examples/device/audio_test_freertos/Makefile @@ -3,13 +3,13 @@ include ../../../hw/bsp/family_support.mk INC += \ src \ - $(TOP)/hw \ + # Example source EXAMPLE_SOURCE = \ src/main.c \ src/usb_descriptors.c -SRC_C += $(addprefix $(CURRENT_PATH)/, $(EXAMPLE_SOURCE)) +SRC_C += $(addprefix $(EXAMPLE_PATH)/, $(EXAMPLE_SOURCE)) -include ../../build_system/make/rules.mk +include ../../../hw/bsp/family_rules.mk diff --git a/examples/device/audio_test_multi_rate/Makefile b/examples/device/audio_test_multi_rate/Makefile index e8cacd359..035e90308 100644 --- a/examples/device/audio_test_multi_rate/Makefile +++ b/examples/device/audio_test_multi_rate/Makefile @@ -2,10 +2,10 @@ include ../../../hw/bsp/family_support.mk INC += \ src \ - $(TOP)/hw \ + # Example source EXAMPLE_SOURCE += $(wildcard src/*.c) -SRC_C += $(addprefix $(CURRENT_PATH)/, $(EXAMPLE_SOURCE)) +SRC_C += $(addprefix $(EXAMPLE_PATH)/, $(EXAMPLE_SOURCE)) -include ../../build_system/make/rules.mk +include ../../../hw/bsp/family_rules.mk diff --git a/examples/device/board_test/Makefile b/examples/device/board_test/Makefile index e8cacd359..035e90308 100644 --- a/examples/device/board_test/Makefile +++ b/examples/device/board_test/Makefile @@ -2,10 +2,10 @@ include ../../../hw/bsp/family_support.mk INC += \ src \ - $(TOP)/hw \ + # Example source EXAMPLE_SOURCE += $(wildcard src/*.c) -SRC_C += $(addprefix $(CURRENT_PATH)/, $(EXAMPLE_SOURCE)) +SRC_C += $(addprefix $(EXAMPLE_PATH)/, $(EXAMPLE_SOURCE)) -include ../../build_system/make/rules.mk +include ../../../hw/bsp/family_rules.mk diff --git a/examples/device/cdc_dual_ports/Makefile b/examples/device/cdc_dual_ports/Makefile index e8cacd359..035e90308 100644 --- a/examples/device/cdc_dual_ports/Makefile +++ b/examples/device/cdc_dual_ports/Makefile @@ -2,10 +2,10 @@ include ../../../hw/bsp/family_support.mk INC += \ src \ - $(TOP)/hw \ + # Example source EXAMPLE_SOURCE += $(wildcard src/*.c) -SRC_C += $(addprefix $(CURRENT_PATH)/, $(EXAMPLE_SOURCE)) +SRC_C += $(addprefix $(EXAMPLE_PATH)/, $(EXAMPLE_SOURCE)) -include ../../build_system/make/rules.mk +include ../../../hw/bsp/family_rules.mk diff --git a/examples/device/cdc_msc/Makefile b/examples/device/cdc_msc/Makefile index eb548f018..de50d118f 100644 --- a/examples/device/cdc_msc/Makefile +++ b/examples/device/cdc_msc/Makefile @@ -2,7 +2,7 @@ include ../../../hw/bsp/family_support.mk INC += \ src \ - $(TOP)/hw \ + # Example source EXAMPLE_SOURCE += \ @@ -10,6 +10,6 @@ EXAMPLE_SOURCE += \ src/msc_disk.c \ src/usb_descriptors.c \ -SRC_C += $(addprefix $(CURRENT_PATH)/, $(EXAMPLE_SOURCE)) +SRC_C += $(addprefix $(EXAMPLE_PATH)/, $(EXAMPLE_SOURCE)) -include ../../build_system/make/rules.mk +include ../../../hw/bsp/family_rules.mk diff --git a/examples/device/cdc_msc_freertos/Makefile b/examples/device/cdc_msc_freertos/Makefile index 41960e64c..dbab13395 100644 --- a/examples/device/cdc_msc_freertos/Makefile +++ b/examples/device/cdc_msc_freertos/Makefile @@ -3,7 +3,7 @@ include ../../../hw/bsp/family_support.mk INC += \ src \ - $(TOP)/hw \ + # Example source EXAMPLE_SOURCE = \ @@ -11,6 +11,6 @@ EXAMPLE_SOURCE = \ src/msc_disk.c \ src/usb_descriptors.c -SRC_C += $(addprefix $(CURRENT_PATH)/, $(EXAMPLE_SOURCE)) +SRC_C += $(addprefix $(EXAMPLE_PATH)/, $(EXAMPLE_SOURCE)) -include ../../build_system/make/rules.mk +include ../../../hw/bsp/family_rules.mk diff --git a/examples/device/cdc_uac2/Makefile b/examples/device/cdc_uac2/Makefile index 539077d6c..6276be8d0 100644 --- a/examples/device/cdc_uac2/Makefile +++ b/examples/device/cdc_uac2/Makefile @@ -2,7 +2,7 @@ include ../../../hw/bsp/family_support.mk INC += \ src \ - $(TOP)/hw \ + # Example source EXAMPLE_SOURCE += \ @@ -11,6 +11,6 @@ EXAMPLE_SOURCE += \ src/uac2_app.c \ src/usb_descriptors.c \ -SRC_C += $(addprefix $(CURRENT_PATH)/, $(EXAMPLE_SOURCE)) +SRC_C += $(addprefix $(EXAMPLE_PATH)/, $(EXAMPLE_SOURCE)) -include ../../build_system/make/rules.mk +include ../../../hw/bsp/family_rules.mk diff --git a/examples/device/dfu/Makefile b/examples/device/dfu/Makefile index ad7a37b79..9e1eab4a2 100644 --- a/examples/device/dfu/Makefile +++ b/examples/device/dfu/Makefile @@ -2,13 +2,13 @@ include ../../../hw/bsp/family_support.mk INC += \ src \ - $(TOP)/hw \ + # Example source EXAMPLE_SOURCE = \ src/main.c \ src/usb_descriptors.c -SRC_C += $(addprefix $(CURRENT_PATH)/, $(EXAMPLE_SOURCE)) +SRC_C += $(addprefix $(EXAMPLE_PATH)/, $(EXAMPLE_SOURCE)) -include ../../build_system/make/rules.mk +include ../../../hw/bsp/family_rules.mk diff --git a/examples/device/dfu_runtime/Makefile b/examples/device/dfu_runtime/Makefile index 72bd56ede..1a4b428dc 100644 --- a/examples/device/dfu_runtime/Makefile +++ b/examples/device/dfu_runtime/Makefile @@ -2,10 +2,10 @@ include ../../../hw/bsp/family_support.mk INC += \ src \ - $(TOP)/hw \ + # Example source EXAMPLE_SOURCE += $(wildcard src/*.c) -SRC_C += $(addprefix $(CURRENT_PATH)/, $(EXAMPLE_SOURCE)) +SRC_C += $(addprefix $(EXAMPLE_PATH)/, $(EXAMPLE_SOURCE)) -include ../../build_system/make/rules.mk +include ../../../hw/bsp/family_rules.mk diff --git a/examples/device/dynamic_configuration/Makefile b/examples/device/dynamic_configuration/Makefile index 72bd56ede..1a4b428dc 100644 --- a/examples/device/dynamic_configuration/Makefile +++ b/examples/device/dynamic_configuration/Makefile @@ -2,10 +2,10 @@ include ../../../hw/bsp/family_support.mk INC += \ src \ - $(TOP)/hw \ + # Example source EXAMPLE_SOURCE += $(wildcard src/*.c) -SRC_C += $(addprefix $(CURRENT_PATH)/, $(EXAMPLE_SOURCE)) +SRC_C += $(addprefix $(EXAMPLE_PATH)/, $(EXAMPLE_SOURCE)) -include ../../build_system/make/rules.mk +include ../../../hw/bsp/family_rules.mk diff --git a/examples/device/hid_boot_interface/Makefile b/examples/device/hid_boot_interface/Makefile index ad7a37b79..9e1eab4a2 100644 --- a/examples/device/hid_boot_interface/Makefile +++ b/examples/device/hid_boot_interface/Makefile @@ -2,13 +2,13 @@ include ../../../hw/bsp/family_support.mk INC += \ src \ - $(TOP)/hw \ + # Example source EXAMPLE_SOURCE = \ src/main.c \ src/usb_descriptors.c -SRC_C += $(addprefix $(CURRENT_PATH)/, $(EXAMPLE_SOURCE)) +SRC_C += $(addprefix $(EXAMPLE_PATH)/, $(EXAMPLE_SOURCE)) -include ../../build_system/make/rules.mk +include ../../../hw/bsp/family_rules.mk diff --git a/examples/device/hid_composite/Makefile b/examples/device/hid_composite/Makefile index 72bd56ede..1a4b428dc 100644 --- a/examples/device/hid_composite/Makefile +++ b/examples/device/hid_composite/Makefile @@ -2,10 +2,10 @@ include ../../../hw/bsp/family_support.mk INC += \ src \ - $(TOP)/hw \ + # Example source EXAMPLE_SOURCE += $(wildcard src/*.c) -SRC_C += $(addprefix $(CURRENT_PATH)/, $(EXAMPLE_SOURCE)) +SRC_C += $(addprefix $(EXAMPLE_PATH)/, $(EXAMPLE_SOURCE)) -include ../../build_system/make/rules.mk +include ../../../hw/bsp/family_rules.mk diff --git a/examples/device/hid_composite_freertos/Makefile b/examples/device/hid_composite_freertos/Makefile index 13c637977..3c421af74 100644 --- a/examples/device/hid_composite_freertos/Makefile +++ b/examples/device/hid_composite_freertos/Makefile @@ -3,13 +3,13 @@ include ../../../hw/bsp/family_support.mk INC += \ src \ - $(TOP)/hw \ + # Example source EXAMPLE_SOURCE = \ src/main.c \ src/usb_descriptors.c -SRC_C += $(addprefix $(CURRENT_PATH)/, $(EXAMPLE_SOURCE)) +SRC_C += $(addprefix $(EXAMPLE_PATH)/, $(EXAMPLE_SOURCE)) -include ../../build_system/make/rules.mk +include ../../../hw/bsp/family_rules.mk diff --git a/examples/device/hid_generic_inout/Makefile b/examples/device/hid_generic_inout/Makefile index 72bd56ede..1a4b428dc 100644 --- a/examples/device/hid_generic_inout/Makefile +++ b/examples/device/hid_generic_inout/Makefile @@ -2,10 +2,10 @@ include ../../../hw/bsp/family_support.mk INC += \ src \ - $(TOP)/hw \ + # Example source EXAMPLE_SOURCE += $(wildcard src/*.c) -SRC_C += $(addprefix $(CURRENT_PATH)/, $(EXAMPLE_SOURCE)) +SRC_C += $(addprefix $(EXAMPLE_PATH)/, $(EXAMPLE_SOURCE)) -include ../../build_system/make/rules.mk +include ../../../hw/bsp/family_rules.mk diff --git a/examples/device/hid_multiple_interface/Makefile b/examples/device/hid_multiple_interface/Makefile index 72bd56ede..1a4b428dc 100644 --- a/examples/device/hid_multiple_interface/Makefile +++ b/examples/device/hid_multiple_interface/Makefile @@ -2,10 +2,10 @@ include ../../../hw/bsp/family_support.mk INC += \ src \ - $(TOP)/hw \ + # Example source EXAMPLE_SOURCE += $(wildcard src/*.c) -SRC_C += $(addprefix $(CURRENT_PATH)/, $(EXAMPLE_SOURCE)) +SRC_C += $(addprefix $(EXAMPLE_PATH)/, $(EXAMPLE_SOURCE)) -include ../../build_system/make/rules.mk +include ../../../hw/bsp/family_rules.mk diff --git a/examples/device/midi_test/Makefile b/examples/device/midi_test/Makefile index e8cacd359..035e90308 100644 --- a/examples/device/midi_test/Makefile +++ b/examples/device/midi_test/Makefile @@ -2,10 +2,10 @@ include ../../../hw/bsp/family_support.mk INC += \ src \ - $(TOP)/hw \ + # Example source EXAMPLE_SOURCE += $(wildcard src/*.c) -SRC_C += $(addprefix $(CURRENT_PATH)/, $(EXAMPLE_SOURCE)) +SRC_C += $(addprefix $(EXAMPLE_PATH)/, $(EXAMPLE_SOURCE)) -include ../../build_system/make/rules.mk +include ../../../hw/bsp/family_rules.mk diff --git a/examples/device/midi_test_freertos/Makefile b/examples/device/midi_test_freertos/Makefile index 704d319d2..ebacfecdf 100644 --- a/examples/device/midi_test_freertos/Makefile +++ b/examples/device/midi_test_freertos/Makefile @@ -3,13 +3,13 @@ include ../../../hw/bsp/family_support.mk INC += \ src \ - $(TOP)/hw \ + # Example source EXAMPLE_SOURCE += \ src/main.c \ src/usb_descriptors.c \ -SRC_C += $(addprefix $(CURRENT_PATH)/, $(EXAMPLE_SOURCE)) +SRC_C += $(addprefix $(EXAMPLE_PATH)/, $(EXAMPLE_SOURCE)) -include ../../build_system/make/rules.mk +include ../../../hw/bsp/family_rules.mk diff --git a/examples/device/msc_dual_lun/Makefile b/examples/device/msc_dual_lun/Makefile index e8cacd359..035e90308 100644 --- a/examples/device/msc_dual_lun/Makefile +++ b/examples/device/msc_dual_lun/Makefile @@ -2,10 +2,10 @@ include ../../../hw/bsp/family_support.mk INC += \ src \ - $(TOP)/hw \ + # Example source EXAMPLE_SOURCE += $(wildcard src/*.c) -SRC_C += $(addprefix $(CURRENT_PATH)/, $(EXAMPLE_SOURCE)) +SRC_C += $(addprefix $(EXAMPLE_PATH)/, $(EXAMPLE_SOURCE)) -include ../../build_system/make/rules.mk +include ../../../hw/bsp/family_rules.mk diff --git a/examples/device/mtp/Makefile b/examples/device/mtp/Makefile index e8cacd359..035e90308 100644 --- a/examples/device/mtp/Makefile +++ b/examples/device/mtp/Makefile @@ -2,10 +2,10 @@ include ../../../hw/bsp/family_support.mk INC += \ src \ - $(TOP)/hw \ + # Example source EXAMPLE_SOURCE += $(wildcard src/*.c) -SRC_C += $(addprefix $(CURRENT_PATH)/, $(EXAMPLE_SOURCE)) +SRC_C += $(addprefix $(EXAMPLE_PATH)/, $(EXAMPLE_SOURCE)) -include ../../build_system/make/rules.mk +include ../../../hw/bsp/family_rules.mk diff --git a/examples/device/net_lwip_webserver/Makefile b/examples/device/net_lwip_webserver/Makefile index 82c946b14..9d8e8ec77 100644 --- a/examples/device/net_lwip_webserver/Makefile +++ b/examples/device/net_lwip_webserver/Makefile @@ -8,7 +8,6 @@ CFLAGS_GCC += \ INC += \ src \ - $(TOP)/hw \ $(TOP)/lib/lwip/src/include \ $(TOP)/lib/lwip/src/include/ipv4 \ $(TOP)/lib/lwip/src/include/lwip/apps \ @@ -16,7 +15,7 @@ INC += \ # Example source EXAMPLE_SOURCE += $(wildcard src/*.c) -SRC_C += $(addprefix $(CURRENT_PATH)/, $(EXAMPLE_SOURCE)) +SRC_C += $(addprefix $(EXAMPLE_PATH)/, $(EXAMPLE_SOURCE)) # lwip sources SRC_C += \ @@ -66,4 +65,4 @@ SRC_C += \ lib/networking/dnserver.c \ lib/networking/rndis_reports.c -include ../../build_system/make/rules.mk +include ../../../hw/bsp/family_rules.mk diff --git a/examples/device/uac2_headset/Makefile b/examples/device/uac2_headset/Makefile index e8cacd359..035e90308 100644 --- a/examples/device/uac2_headset/Makefile +++ b/examples/device/uac2_headset/Makefile @@ -2,10 +2,10 @@ include ../../../hw/bsp/family_support.mk INC += \ src \ - $(TOP)/hw \ + # Example source EXAMPLE_SOURCE += $(wildcard src/*.c) -SRC_C += $(addprefix $(CURRENT_PATH)/, $(EXAMPLE_SOURCE)) +SRC_C += $(addprefix $(EXAMPLE_PATH)/, $(EXAMPLE_SOURCE)) -include ../../build_system/make/rules.mk +include ../../../hw/bsp/family_rules.mk diff --git a/examples/device/uac2_speaker_fb/Makefile b/examples/device/uac2_speaker_fb/Makefile index e8cacd359..035e90308 100644 --- a/examples/device/uac2_speaker_fb/Makefile +++ b/examples/device/uac2_speaker_fb/Makefile @@ -2,10 +2,10 @@ include ../../../hw/bsp/family_support.mk INC += \ src \ - $(TOP)/hw \ + # Example source EXAMPLE_SOURCE += $(wildcard src/*.c) -SRC_C += $(addprefix $(CURRENT_PATH)/, $(EXAMPLE_SOURCE)) +SRC_C += $(addprefix $(EXAMPLE_PATH)/, $(EXAMPLE_SOURCE)) -include ../../build_system/make/rules.mk +include ../../../hw/bsp/family_rules.mk diff --git a/examples/device/usbtmc/Makefile b/examples/device/usbtmc/Makefile index 72bd56ede..1a4b428dc 100644 --- a/examples/device/usbtmc/Makefile +++ b/examples/device/usbtmc/Makefile @@ -2,10 +2,10 @@ include ../../../hw/bsp/family_support.mk INC += \ src \ - $(TOP)/hw \ + # Example source EXAMPLE_SOURCE += $(wildcard src/*.c) -SRC_C += $(addprefix $(CURRENT_PATH)/, $(EXAMPLE_SOURCE)) +SRC_C += $(addprefix $(EXAMPLE_PATH)/, $(EXAMPLE_SOURCE)) -include ../../build_system/make/rules.mk +include ../../../hw/bsp/family_rules.mk diff --git a/examples/device/video_capture/Makefile b/examples/device/video_capture/Makefile index 288e9ffc3..6c248ab7b 100644 --- a/examples/device/video_capture/Makefile +++ b/examples/device/video_capture/Makefile @@ -9,10 +9,10 @@ endif INC += \ src \ - $(TOP)/hw \ + # Example source EXAMPLE_SOURCE += $(wildcard src/*.c) -SRC_C += $(addprefix $(CURRENT_PATH)/, $(EXAMPLE_SOURCE)) +SRC_C += $(addprefix $(EXAMPLE_PATH)/, $(EXAMPLE_SOURCE)) -include ../../build_system/make/rules.mk +include ../../../hw/bsp/family_rules.mk diff --git a/examples/device/video_capture_2ch/Makefile b/examples/device/video_capture_2ch/Makefile index 288e9ffc3..6c248ab7b 100644 --- a/examples/device/video_capture_2ch/Makefile +++ b/examples/device/video_capture_2ch/Makefile @@ -9,10 +9,10 @@ endif INC += \ src \ - $(TOP)/hw \ + # Example source EXAMPLE_SOURCE += $(wildcard src/*.c) -SRC_C += $(addprefix $(CURRENT_PATH)/, $(EXAMPLE_SOURCE)) +SRC_C += $(addprefix $(EXAMPLE_PATH)/, $(EXAMPLE_SOURCE)) -include ../../build_system/make/rules.mk +include ../../../hw/bsp/family_rules.mk diff --git a/examples/device/webusb_serial/Makefile b/examples/device/webusb_serial/Makefile index e8cacd359..035e90308 100644 --- a/examples/device/webusb_serial/Makefile +++ b/examples/device/webusb_serial/Makefile @@ -2,10 +2,10 @@ include ../../../hw/bsp/family_support.mk INC += \ src \ - $(TOP)/hw \ + # Example source EXAMPLE_SOURCE += $(wildcard src/*.c) -SRC_C += $(addprefix $(CURRENT_PATH)/, $(EXAMPLE_SOURCE)) +SRC_C += $(addprefix $(EXAMPLE_PATH)/, $(EXAMPLE_SOURCE)) -include ../../build_system/make/rules.mk +include ../../../hw/bsp/family_rules.mk diff --git a/examples/dual/host_hid_to_device_cdc/Makefile b/examples/dual/host_hid_to_device_cdc/Makefile index 76c6db0ac..a51251bf9 100644 --- a/examples/dual/host_hid_to_device_cdc/Makefile +++ b/examples/dual/host_hid_to_device_cdc/Makefile @@ -2,11 +2,11 @@ include ../../../hw/bsp/family_support.mk INC += \ src \ - $(TOP)/hw \ + # Example source EXAMPLE_SOURCE += $(wildcard src/*.c) -SRC_C += $(addprefix $(CURRENT_PATH)/, $(EXAMPLE_SOURCE)) +SRC_C += $(addprefix $(EXAMPLE_PATH)/, $(EXAMPLE_SOURCE)) CFLAGS_GCC += -Wno-error=cast-align -Wno-error=null-dereference @@ -15,4 +15,4 @@ SRC_C += \ src/host/hub.c \ src/host/usbh.c -include ../../build_system/make/rules.mk +include ../../../hw/bsp/family_rules.mk diff --git a/examples/dual/host_info_to_device_cdc/Makefile b/examples/dual/host_info_to_device_cdc/Makefile index 071185c88..659cf6ff9 100644 --- a/examples/dual/host_info_to_device_cdc/Makefile +++ b/examples/dual/host_info_to_device_cdc/Makefile @@ -2,11 +2,11 @@ include ../../../hw/bsp/family_support.mk INC += \ src \ - $(TOP)/hw \ + # Example source EXAMPLE_SOURCE += $(wildcard src/*.c) -SRC_C += $(addprefix $(CURRENT_PATH)/, $(EXAMPLE_SOURCE)) +SRC_C += $(addprefix $(EXAMPLE_PATH)/, $(EXAMPLE_SOURCE)) CFLAGS_GCC += -Wno-error=cast-align -Wno-error=null-dereference @@ -14,4 +14,4 @@ SRC_C += \ src/host/hub.c \ src/host/usbh.c -include ../../build_system/make/rules.mk +include ../../../hw/bsp/family_rules.mk diff --git a/examples/host/bare_api/Makefile b/examples/host/bare_api/Makefile index e6408c77a..f8292385e 100644 --- a/examples/host/bare_api/Makefile +++ b/examples/host/bare_api/Makefile @@ -2,12 +2,12 @@ include ../../../hw/bsp/family_support.mk INC += \ src \ - $(TOP)/hw \ + # Example source EXAMPLE_SOURCE += \ src/main.c -SRC_C += $(addprefix $(CURRENT_PATH)/, $(EXAMPLE_SOURCE)) +SRC_C += $(addprefix $(EXAMPLE_PATH)/, $(EXAMPLE_SOURCE)) -include ../../build_system/make/rules.mk +include ../../../hw/bsp/family_rules.mk diff --git a/examples/host/cdc_msc_hid/Makefile b/examples/host/cdc_msc_hid/Makefile index b6036fa26..d72e91e74 100644 --- a/examples/host/cdc_msc_hid/Makefile +++ b/examples/host/cdc_msc_hid/Makefile @@ -2,7 +2,7 @@ include ../../../hw/bsp/family_support.mk INC += \ src \ - $(TOP)/hw \ + # Example source EXAMPLE_SOURCE = \ @@ -11,6 +11,6 @@ EXAMPLE_SOURCE = \ src/main.c \ src/msc_app.c \ -SRC_C += $(addprefix $(CURRENT_PATH)/, $(EXAMPLE_SOURCE)) +SRC_C += $(addprefix $(EXAMPLE_PATH)/, $(EXAMPLE_SOURCE)) -include ../../build_system/make/rules.mk +include ../../../hw/bsp/family_rules.mk diff --git a/examples/host/cdc_msc_hid_freertos/Makefile b/examples/host/cdc_msc_hid_freertos/Makefile index 4e8c8b116..2e323ed56 100644 --- a/examples/host/cdc_msc_hid_freertos/Makefile +++ b/examples/host/cdc_msc_hid_freertos/Makefile @@ -3,7 +3,7 @@ include ../../../hw/bsp/family_support.mk INC += \ src \ - $(TOP)/hw \ + # Example source EXAMPLE_SOURCE = \ @@ -12,6 +12,6 @@ EXAMPLE_SOURCE = \ src/main.c \ src/msc_app.c \ -SRC_C += $(addprefix $(CURRENT_PATH)/, $(EXAMPLE_SOURCE)) +SRC_C += $(addprefix $(EXAMPLE_PATH)/, $(EXAMPLE_SOURCE)) -include ../../build_system/make/rules.mk +include ../../../hw/bsp/family_rules.mk diff --git a/examples/host/device_info/Makefile b/examples/host/device_info/Makefile index e6408c77a..f8292385e 100644 --- a/examples/host/device_info/Makefile +++ b/examples/host/device_info/Makefile @@ -2,12 +2,12 @@ include ../../../hw/bsp/family_support.mk INC += \ src \ - $(TOP)/hw \ + # Example source EXAMPLE_SOURCE += \ src/main.c -SRC_C += $(addprefix $(CURRENT_PATH)/, $(EXAMPLE_SOURCE)) +SRC_C += $(addprefix $(EXAMPLE_PATH)/, $(EXAMPLE_SOURCE)) -include ../../build_system/make/rules.mk +include ../../../hw/bsp/family_rules.mk diff --git a/examples/host/hid_controller/Makefile b/examples/host/hid_controller/Makefile index f82054e8c..732520c63 100644 --- a/examples/host/hid_controller/Makefile +++ b/examples/host/hid_controller/Makefile @@ -2,13 +2,13 @@ include ../../../hw/bsp/family_support.mk INC += \ src \ - $(TOP)/hw \ + # Example source EXAMPLE_SOURCE += \ src/hid_app.c \ src/main.c -SRC_C += $(addprefix $(CURRENT_PATH)/, $(EXAMPLE_SOURCE)) +SRC_C += $(addprefix $(EXAMPLE_PATH)/, $(EXAMPLE_SOURCE)) -include ../../build_system/make/rules.mk +include ../../../hw/bsp/family_rules.mk diff --git a/examples/host/midi_rx/Makefile b/examples/host/midi_rx/Makefile index e6408c77a..f8292385e 100644 --- a/examples/host/midi_rx/Makefile +++ b/examples/host/midi_rx/Makefile @@ -2,12 +2,12 @@ include ../../../hw/bsp/family_support.mk INC += \ src \ - $(TOP)/hw \ + # Example source EXAMPLE_SOURCE += \ src/main.c -SRC_C += $(addprefix $(CURRENT_PATH)/, $(EXAMPLE_SOURCE)) +SRC_C += $(addprefix $(EXAMPLE_PATH)/, $(EXAMPLE_SOURCE)) -include ../../build_system/make/rules.mk +include ../../../hw/bsp/family_rules.mk diff --git a/examples/host/msc_file_explorer/Makefile b/examples/host/msc_file_explorer/Makefile index 0f87d848d..39d00d982 100644 --- a/examples/host/msc_file_explorer/Makefile +++ b/examples/host/msc_file_explorer/Makefile @@ -4,7 +4,6 @@ FATFS_PATH = lib/fatfs/source INC += \ src \ - $(TOP)/hw \ $(TOP)/$(FATFS_PATH) \ $(TOP)/lib/embedded-cli \ @@ -13,7 +12,7 @@ EXAMPLE_SOURCE = \ src/main.c \ src/msc_app.c \ -SRC_C += $(addprefix $(CURRENT_PATH)/, $(EXAMPLE_SOURCE)) +SRC_C += $(addprefix $(EXAMPLE_PATH)/, $(EXAMPLE_SOURCE)) # FatFS source SRC_C += \ @@ -24,4 +23,4 @@ SRC_C += \ # suppress warning caused by fatfs CFLAGS_GCC += -Wno-error=cast-qual -include ../../build_system/make/rules.mk +include ../../../hw/bsp/family_rules.mk diff --git a/examples/typec/power_delivery/Makefile b/examples/typec/power_delivery/Makefile index e8cacd359..7f65c689a 100644 --- a/examples/typec/power_delivery/Makefile +++ b/examples/typec/power_delivery/Makefile @@ -2,10 +2,12 @@ include ../../../hw/bsp/family_support.mk INC += \ src \ - $(TOP)/hw \ + # Example source -EXAMPLE_SOURCE += $(wildcard src/*.c) -SRC_C += $(addprefix $(CURRENT_PATH)/, $(EXAMPLE_SOURCE)) +EXAMPLE_SOURCE += \ + src/main.c + +SRC_C += $(addprefix $(EXAMPLE_PATH)/, $(EXAMPLE_SOURCE)) -include ../../build_system/make/rules.mk +include ../../../hw/bsp/family_rules.mk diff --git a/hw/bsp/family_rules.mk b/hw/bsp/family_rules.mk new file mode 100644 index 000000000..ccf49dd0e --- /dev/null +++ b/hw/bsp/family_rules.mk @@ -0,0 +1,177 @@ +# --------------------------------------- +# 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 $< + +# Print out the value of a make variable. +# https://stackoverflow.com/questions/16467718/how-to-print-out-a-variable-in-makefile +print-%: + @echo $* = $($*) diff --git a/hw/bsp/family_support.mk b/hw/bsp/family_support.mk index 757982b85..2e236dc4a 100644 --- a/hw/bsp/family_support.mk +++ b/hw/bsp/family_support.mk @@ -22,7 +22,7 @@ ifndef TOOLCHAIN TOOLCHAIN = gcc endif -#-------------- TOP and CURRENT_PATH ------------ +#-------------- TOP and EXAMPLE_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. @@ -31,8 +31,8 @@ THIS_MAKEFILE := $(lastword $(MAKEFILE_LIST)) # Set TOP to an absolute path TOP = $(abspath $(subst family_support.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 .)) +# Set EXAMPLE_PATH to the relative path from TOP to the current directory, ie examples/device/cdc_msc +EXAMPLE_PATH = $(subst $(TOP)/,,$(abspath .)) #-------------- Linux/Windows ------------ # Detect whether shell style is windows or not @@ -62,7 +62,6 @@ endif BUILD := _build/$(BOARD) PROJECT := $(notdir $(CURDIR)) -BIN := $(TOP)/_bin/$(BOARD)/$(notdir $(CURDIR)) #------------------------------------------------------------- # Board / Family @@ -108,6 +107,7 @@ SRC_C += $(subst $(TOP)/,,$(wildcard $(TOP)/$(BOARD_PATH)/*.c)) INC += \ $(TOP)/$(FAMILY_PATH) \ $(TOP)/src \ + $(TOP)/hw \ BOARD_UPPER = $(call to_upper,$(BOARD)) CFLAGS += -DBOARD_$(BOARD_UPPER) diff --git a/test/fuzz/device/cdc/Makefile b/test/fuzz/device/cdc/Makefile index 7071df057..d448907f0 100644 --- a/test/fuzz/device/cdc/Makefile +++ b/test/fuzz/device/cdc/Makefile @@ -2,10 +2,10 @@ include ../../make.mk INC += \ src \ - $(TOP)/hw \ + # Example source -SRC_C += $(addprefix $(CURRENT_PATH)/, $(wildcard src/*.c)) -SRC_CXX += $(addprefix $(CURRENT_PATH)/, $(wildcard src/*.cc)) +SRC_C += $(addprefix $(EXAMPLE_PATH)/, $(wildcard src/*.c)) +SRC_CXX += $(addprefix $(EXAMPLE_PATH)/, $(wildcard src/*.cc)) include ../../rules.mk diff --git a/test/fuzz/device/msc/Makefile b/test/fuzz/device/msc/Makefile index 7071df057..d448907f0 100644 --- a/test/fuzz/device/msc/Makefile +++ b/test/fuzz/device/msc/Makefile @@ -2,10 +2,10 @@ include ../../make.mk INC += \ src \ - $(TOP)/hw \ + # Example source -SRC_C += $(addprefix $(CURRENT_PATH)/, $(wildcard src/*.c)) -SRC_CXX += $(addprefix $(CURRENT_PATH)/, $(wildcard src/*.cc)) +SRC_C += $(addprefix $(EXAMPLE_PATH)/, $(wildcard src/*.c)) +SRC_CXX += $(addprefix $(EXAMPLE_PATH)/, $(wildcard src/*.cc)) include ../../rules.mk diff --git a/test/fuzz/device/net/Makefile b/test/fuzz/device/net/Makefile index 2161ad3f1..45c684eec 100644 --- a/test/fuzz/device/net/Makefile +++ b/test/fuzz/device/net/Makefile @@ -8,15 +8,14 @@ CFLAGS += \ INC += \ src \ - $(TOP)/hw \ $(TOP)/lib/lwip/src/include \ $(TOP)/lib/lwip/src/include/ipv4 \ $(TOP)/lib/lwip/src/include/lwip/apps \ $(TOP)/lib/networking # Example source -SRC_C += $(addprefix $(CURRENT_PATH)/, $(wildcard src/*.c)) -SRC_CXX += $(addprefix $(CURRENT_PATH)/, $(wildcard src/*.cc)) +SRC_C += $(addprefix $(EXAMPLE_PATH)/, $(wildcard src/*.c)) +SRC_CXX += $(addprefix $(EXAMPLE_PATH)/, $(wildcard src/*.cc)) # lwip sources SRC_C += \ diff --git a/test/fuzz/make.mk b/test/fuzz/make.mk index e9aa80bf1..733a57134 100644 --- a/test/fuzz/make.mk +++ b/test/fuzz/make.mk @@ -2,7 +2,7 @@ # Common make definition for all examples # --------------------------------------- -#-------------- TOP and CURRENT_PATH ------------ +#-------------- TOP and EXAMPLE_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 @@ -13,8 +13,8 @@ THIS_MAKEFILE := $(lastword $(MAKEFILE_LIST)) # 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 .)) +# Set EXAMPLE_PATH to the relative path from TOP to the current directory, ie examples/device/cdc_msc_freertos +EXAMPLE_PATH = $(subst $(TOP)/,,$(abspath .)) # Detect whether shell style is windows or not # https://stackoverflow.com/questions/714100/os-detecting-makefile/52062069#52062069 -- cgit v1.3.1 From 7c95d9bed5b39730c449e321cc72c4e690b17a6c Mon Sep 17 00:00:00 2001 From: hathach Date: Thu, 23 Oct 2025 16:59:04 +0700 Subject: force clang asm with -x assembler-with-cpp --- examples/build_system/cmake/toolchain/arm_clang.cmake | 2 ++ examples/build_system/cmake/toolchain/common.cmake | 6 +++++- hw/bsp/ch32v10x/family.cmake | 2 +- hw/bsp/lpc11/family.cmake | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) (limited to 'examples/build_system') 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/common.cmake b/examples/build_system/cmake/toolchain/common.cmake index fa3034e6f..14449b01d 100644 --- a/examples/build_system/cmake/toolchain/common.cmake +++ b/examples/build_system/cmake/toolchain/common.cmake @@ -32,7 +32,6 @@ if (TOOLCHAIN STREQUAL "gcc" OR TOOLCHAIN STREQUAL "clang") -Wl,--gc-sections -Wl,--cref ) - elseif (TOOLCHAIN STREQUAL "iar") list(APPEND TOOLCHAIN_EXE_LINKER_FLAGS --diag_suppress=Li065 @@ -48,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/hw/bsp/ch32v10x/family.cmake b/hw/bsp/ch32v10x/family.cmake index 1c9d41740..843b7f9d3 100644 --- a/hw/bsp/ch32v10x/family.cmake +++ b/hw/bsp/ch32v10x/family.cmake @@ -48,7 +48,7 @@ function(family_add_board BOARD_TARGET) update_board(${BOARD_TARGET}) if (CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "Clang") - target_compile_options(${TARGET} PUBLIC -mcmodel=medany) + target_compile_options(${BOARD_TARGET} PUBLIC -mcmodel=medany) endif() endfunction() diff --git a/hw/bsp/lpc11/family.cmake b/hw/bsp/lpc11/family.cmake index 42578d403..fceafcf61 100644 --- a/hw/bsp/lpc11/family.cmake +++ b/hw/bsp/lpc11/family.cmake @@ -79,7 +79,7 @@ function(family_configure_example TARGET RTOS) --specs=nosys.specs --specs=nano.specs ) elseif (CMAKE_C_COMPILER_ID STREQUAL "Clang") - target_link_options(${BOARD_TARGET} PUBLIC + target_link_options(${TARGET} PUBLIC "LINKER:--script=${LD_FILE_GNU}" ) elseif (CMAKE_C_COMPILER_ID STREQUAL "IAR") -- cgit v1.3.1 From 878c8f26c5c760ec683a8d4ee4aa1ee6678b8a12 Mon Sep 17 00:00:00 2001 From: hathach Date: Fri, 24 Oct 2025 09:58:46 +0700 Subject: enable IAR CState with IAR_CSTAT=1 --- .../build_system/cmake/toolchain/arm_iar.cmake | 8 + .../cmake/toolchain/cstat_sel_checks.txt | 247 +++++++++++++++++++++ hw/bsp/family_support.cmake | 36 +-- 3 files changed, 274 insertions(+), 17 deletions(-) create mode 100644 examples/build_system/cmake/toolchain/cstat_sel_checks.txt (limited to 'examples/build_system') diff --git a/examples/build_system/cmake/toolchain/arm_iar.cmake b/examples/build_system/cmake/toolchain/arm_iar.cmake index 083815715..42b057020 100644 --- a/examples/build_system/cmake/toolchain/arm_iar.cmake +++ b/examples/build_system/cmake/toolchain/arm_iar.cmake @@ -14,4 +14,12 @@ 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) +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) +endif () + include(${CMAKE_CURRENT_LIST_DIR}/common.cmake) 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/hw/bsp/family_support.cmake b/hw/bsp/family_support.cmake index 7df1b154a..79a9f459b 100644 --- a/hw/bsp/family_support.cmake +++ b/hw/bsp/family_support.cmake @@ -238,8 +238,10 @@ function(family_configure_common TARGET RTOS) if (NOT RTOS STREQUAL zephyr) if (NOT TARGET ${BOARD_TARGET}) family_add_board(${BOARD_TARGET}) - set_target_properties(${BOARD_TARGET} PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) - set_target_properties(${BOARD_TARGET} PROPERTIES SKIP_LINTING ON) + set_target_properties(${BOARD_TARGET} PROPERTIES + ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib + SKIP_LINTING ON # need cmake 4.2 + ) endif () target_link_libraries(${TARGET} PUBLIC ${BOARD_TARGET}) endif () @@ -273,9 +275,7 @@ function(family_configure_common TARGET RTOS) target_sources(${TARGET} PUBLIC ${TOP}/lib/SEGGER_RTT/RTT/SEGGER_RTT.c) target_include_directories(${TARGET} PUBLIC ${TOP}/lib/SEGGER_RTT/RTT) # target_compile_definitions(${TARGET} PUBLIC SEGGER_RTT_MODE_DEFAULT=SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL) - set_source_files_properties(${TOP}/lib/SEGGER_RTT/RTT/SEGGER_RTT.c PROPERTIES - SKIP_LINTING ON - ) + set_source_files_properties(${TOP}/lib/SEGGER_RTT/RTT/SEGGER_RTT.c PROPERTIES SKIP_LINTING ON) endif () else () target_compile_definitions(${TARGET} PUBLIC LOGGER_UART) @@ -291,18 +291,20 @@ function(family_configure_common TARGET RTOS) elseif (CMAKE_C_COMPILER_ID STREQUAL "IAR") target_link_options(${TARGET} PUBLIC "LINKER:--map=$.map") - # link time analysis with C-STAT -# add_custom_command(TARGET ${TARGET} POST_BUILD -# COMMAND ${CMAKE_C_ICSTAT} -# --db=${CMAKE_BINARY_DIR}/cstat.db -# link_analyze -- ${CMAKE_LINKER} $ -# COMMAND_EXPAND_LISTS -# ) -# # generate C-STAT report -# add_custom_command(TARGET ${TARGET} POST_BUILD -# COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/cstat_report -# COMMAND ireport --db=${CMAKE_BINARY_DIR}/cstat.db --full --project ${TARGET} --output ${CMAKE_CURRENT_BINARY_DIR}/cstat_report/${TARGET}.html -# ) + if (IAR_CSTAT) + # link time analysis with C-STAT + add_custom_command(TARGET ${TARGET} POST_BUILD + COMMAND ${CMAKE_C_ICSTAT} + --db=${CMAKE_BINARY_DIR}/cstat.db + link_analyze -- ${CMAKE_LINKER} $ + COMMAND_EXPAND_LISTS + ) + # generate C-STAT report + add_custom_command(TARGET ${TARGET} POST_BUILD + COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/cstat_report + COMMAND ireport --db=${CMAKE_BINARY_DIR}/cstat.db --full --project ${TARGET} --output ${CMAKE_CURRENT_BINARY_DIR}/cstat_report/index.html + ) + endif () endif () # run size after build -- cgit v1.3.1 From 42f000df8e52cfe0a46867a5e1fa5817cd58bc8a Mon Sep 17 00:00:00 2001 From: hathach Date: Sat, 25 Oct 2025 17:36:01 +0700 Subject: iar cstat require cmake at least 4.1 --- .github/workflows/static_analysis.yml | 19 +++++++++++++++---- examples/build_system/cmake/toolchain/arm_iar.cmake | 1 + hw/bsp/family_support.cmake | 8 ++++---- 3 files changed, 20 insertions(+), 8 deletions(-) (limited to 'examples/build_system') diff --git a/.github/workflows/static_analysis.yml b/.github/workflows/static_analysis.yml index e060dfbc9..0af8ac42c 100644 --- a/.github/workflows/static_analysis.yml +++ b/.github/workflows/static_analysis.yml @@ -202,23 +202,34 @@ jobs: with: toolchain: 'arm-iar' - - name: Run IAR C-STAT Analysis + - name: Install CMake 4.2 + run: | + # IAR CSTAT requires CMake >= 4.1 + wget -q https://github.com/Kitware/CMake/releases/download/v4.2.0-rc1/cmake-4.2.0-rc1-linux-x86_64.tar.gz + tar -xzf cmake-4.2.0-rc1-linux-x86_64.tar.gz + echo "${{ github.workspace }}/cmake-4.2.0-rc1-linux-x86_64/bin" >> $GITHUB_PATH + + - name: Build and run IAR C-STAT Analysis env: IAR_LMS_BEARER_TOKEN: ${{ secrets.IAR_LMS_BEARER_TOKEN }} run: | # CMake run post build to generate C-STAT SARIF report + cmake --version mkdir -p build - cmake examples -B build -G Ninja -DBOARD=${{ matrix.board }} -DTOOLCHAIN=iar -DIAR_CSTAT=1 -DCMAKE_BUILD_TYPE=MinSizeRel + cmake examples/device/cdc_msc -B build -G Ninja -DBOARD=${{ matrix.board }} -DTOOLCHAIN=iar -DIAR_CSTAT=1 -DCMAKE_BUILD_TYPE=MinSizeRel cmake --build build + # Merge sarif files for codeql upload + npm i -g @microsoft/sarif-multitool + npx @microsoft/sarif-multitool merge --merge-runs --output-file iar-cstat-${{ matrix.board }}.sarif build/cstat_sarif/*.sarif - name: Upload SARIF uses: github/codeql-action/upload-sarif@v4 with: - sarif_file: build/cstat_sarif + sarif_file: iar-cstat-${{ matrix.board }}.sarif category: IAR-CStat - name: Upload artifact uses: actions/upload-artifact@v5 with: name: iar-cstat-${{ matrix.board }} - path: build/cstat_sarif + path: iar-cstat-${{ matrix.board }}.sarif diff --git a/examples/build_system/cmake/toolchain/arm_iar.cmake b/examples/build_system/cmake/toolchain/arm_iar.cmake index 42b057020..f4c0a500e 100644 --- a/examples/build_system/cmake/toolchain/arm_iar.cmake +++ b/examples/build_system/cmake/toolchain/arm_iar.cmake @@ -19,6 +19,7 @@ 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) endif () diff --git a/hw/bsp/family_support.cmake b/hw/bsp/family_support.cmake index 79a9f459b..912e0f4d7 100644 --- a/hw/bsp/family_support.cmake +++ b/hw/bsp/family_support.cmake @@ -300,10 +300,10 @@ function(family_configure_common TARGET RTOS) COMMAND_EXPAND_LISTS ) # generate C-STAT report - add_custom_command(TARGET ${TARGET} POST_BUILD - COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/cstat_report - COMMAND ireport --db=${CMAKE_BINARY_DIR}/cstat.db --full --project ${TARGET} --output ${CMAKE_CURRENT_BINARY_DIR}/cstat_report/index.html - ) +# add_custom_command(TARGET ${TARGET} POST_BUILD +# COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/cstat_report +# COMMAND ireport --db=${CMAKE_BINARY_DIR}/cstat.db --full --project ${TARGET} --output ${CMAKE_CURRENT_BINARY_DIR}/cstat_report/index.html +# ) endif () endif () -- cgit v1.3.1 From f35c4216a88247cbc00f63e3caf8f202f96d4b83 Mon Sep 17 00:00:00 2001 From: hathach Date: Tue, 28 Oct 2025 15:56:25 +0700 Subject: IAR C-Stat exclude mcu folder --- examples/build_system/cmake/toolchain/arm_iar.cmake | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'examples/build_system') diff --git a/examples/build_system/cmake/toolchain/arm_iar.cmake b/examples/build_system/cmake/toolchain/arm_iar.cmake index f4c0a500e..0b7e0b585 100644 --- a/examples/build_system/cmake/toolchain/arm_iar.cmake +++ b/examples/build_system/cmake/toolchain/arm_iar.cmake @@ -20,7 +20,12 @@ 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) +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) -- cgit v1.3.1 From e59b2c40fc9e655918629d73cc8c54b86b4a70c1 Mon Sep 17 00:00:00 2001 From: Zixun LI Date: Tue, 25 Nov 2025 10:49:07 +0100 Subject: Fix N6 build Signed-off-by: Zixun LI --- examples/build_system/cmake/cpu/cortex-m55.cmake | 2 ++ hw/bsp/stm32n6/family.cmake | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'examples/build_system') diff --git a/examples/build_system/cmake/cpu/cortex-m55.cmake b/examples/build_system/cmake/cpu/cortex-m55.cmake index a7a57957c..d5f6fa74a 100644 --- a/examples/build_system/cmake/cpu/cortex-m55.cmake +++ b/examples/build_system/cmake/cpu/cortex-m55.cmake @@ -13,6 +13,7 @@ elseif (TOOLCHAIN STREQUAL "clang") --target=arm-none-eabi -mcpu=cortex-m55 -mfpu=fpv5-d16 + -mcmse ) set(FREERTOS_PORT GCC_ARM_CM55_NTZ_NONSECURE CACHE INTERNAL "") @@ -20,6 +21,7 @@ elseif (TOOLCHAIN STREQUAL "iar") set(TOOLCHAIN_COMMON_FLAGS --cpu cortex-m55 --fpu VFPv5_D16 + --cmse ) set(FREERTOS_PORT IAR_ARM_CM55_NTZ_NONSECURE CACHE INTERNAL "") diff --git a/hw/bsp/stm32n6/family.cmake b/hw/bsp/stm32n6/family.cmake index 76763937e..89e4989ad 100644 --- a/hw/bsp/stm32n6/family.cmake +++ b/hw/bsp/stm32n6/family.cmake @@ -52,11 +52,11 @@ function(add_board_target BOARD_TARGET) set(STARTUP_FILE_IAR ${ST_CMSIS}/Source/Templates/iar/startup_${MCU_VARIANT}.s) if(NOT DEFINED LD_FILE_GNU) - set(LD_FILE_GNU ${ST_CMSIS}/Source/Templates/gcc/linker/${MCU_VARIANT}_flash.ld) + set(LD_FILE_GNU ${ST_CMSIS}/Source/Templates/gcc/linker/${MCU_VARIANT}_axisram2_fsbl.ld) endif() set(LD_FILE_Clang ${LD_FILE_GNU}) if(NOT DEFINED LD_FILE_IAR) - set(LD_FILE_IAR ${ST_CMSIS}/Source/Templates/iar/linker/${MCU_VARIANT}_flash.icf) + set(LD_FILE_IAR ${ST_CMSIS}/Source/Templates/iar/linker/${MCU_VARIANT}_axisram2_fsbl.icf) endif() add_library(${BOARD_TARGET} STATIC -- cgit v1.3.1 From df6f13600324b42710ae71d5320a9f2eae8303a5 Mon Sep 17 00:00:00 2001 From: hathach Date: Mon, 1 Dec 2025 14:39:45 +0700 Subject: add linkermap to deps and linkermap taget --- .gitignore | 1 + .idea/cmake.xml | 1 + examples/build_system/cmake/toolchain/arm_iar.cmake | 3 ++- hw/bsp/family_support.cmake | 15 +++++++++++++++ src/portable/synopsys/dwc2/dwc2_info.py | 1 - test/hil/hil_test.py | 2 +- tools/get_deps.py | 3 +++ 7 files changed, 23 insertions(+), 3 deletions(-) (limited to 'examples/build_system') diff --git a/.gitignore b/.gitignore index 977911dff..93d13503f 100644 --- a/.gitignore +++ b/.gitignore @@ -42,6 +42,7 @@ cov-int *-build-dir /_bin/ __pycache__ +cmake-build/ cmake-build-* sdkconfig .PVS-Studio diff --git a/.idea/cmake.xml b/.idea/cmake.xml index 677aaa662..0754253ad 100644 --- a/.idea/cmake.xml +++ b/.idea/cmake.xml @@ -124,6 +124,7 @@ + diff --git a/examples/build_system/cmake/toolchain/arm_iar.cmake b/examples/build_system/cmake/toolchain/arm_iar.cmake index 0b7e0b585..67d100bbc 100644 --- a/examples/build_system/cmake/toolchain/arm_iar.cmake +++ b/examples/build_system/cmake/toolchain/arm_iar.cmake @@ -24,7 +24,8 @@ 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 + --exclude=${TOP}/hw/mcu + --exclude=${TOP}/lib ) endif () diff --git a/hw/bsp/family_support.cmake b/hw/bsp/family_support.cmake index 2b9612186..5afec32c2 100644 --- a/hw/bsp/family_support.cmake +++ b/hw/bsp/family_support.cmake @@ -9,6 +9,7 @@ set(TOP "${CMAKE_CURRENT_LIST_DIR}/../..") get_filename_component(TOP ${TOP} ABSOLUTE) set(UF2CONV_PY ${TOP}/tools/uf2/utils/uf2conv.py) +set(LINKERMAP_PY ${TOP}/tools/linkermap/linkermap.py) function(family_resolve_board BOARD_NAME BOARD_PATH_OUT) if ("${BOARD_NAME}" STREQUAL "") @@ -223,6 +224,18 @@ function(family_initialize_project PROJECT DIR) endif() endfunction() +# Add linkermap target (https://github.com/hathach/linkermap) +function(family_add_linkermap TARGET) + set(LINKERMAP_OPTION "") + if (ARGC GREATER 1) + set(LINKERMAP_OPTION "${ARGV1}") + endif () + add_custom_target(${TARGET}-linkermap + COMMAND python ${LINKERMAP_PY} -j -m ${LINKERMAP_OPTION} $.map + VERBATIM + ) +endfunction() + #------------------------------------------------------------- # Common Target Configure # Most families use these settings except rp2040 and espressif @@ -332,6 +345,8 @@ function(family_configure_common TARGET RTOS) endif () endif () + family_add_linkermap(${TARGET}) + # run size after build # find_program(SIZE_EXE ${CMAKE_SIZE}) # if(NOT ${SIZE_EXE} STREQUAL SIZE_EXE-NOTFOUND) diff --git a/src/portable/synopsys/dwc2/dwc2_info.py b/src/portable/synopsys/dwc2/dwc2_info.py index f6bd2785a..8fbbc00a0 100755 --- a/src/portable/synopsys/dwc2/dwc2_info.py +++ b/src/portable/synopsys/dwc2/dwc2_info.py @@ -2,7 +2,6 @@ import ctypes import argparse -import click import pandas as pd # hex value for register: guid, gsnpsid, ghwcfg1, ghwcfg2, ghwcfg3, ghwcfg4 diff --git a/test/hil/hil_test.py b/test/hil/hil_test.py index ba0826bd3..b2e883119 100755 --- a/test/hil/hil_test.py +++ b/test/hil/hil_test.py @@ -662,7 +662,7 @@ def test_example(board, f1, example): print(f'Flashing {fw_name}.elf') # flash firmware. It may fail randomly, retry a few times - max_rety = 1 + max_rety = 3 start_s = time.time() for i in range(max_rety): ret = globals()[f'flash_{board["flasher"]["name"].lower()}'](board, fw_name) diff --git a/tools/get_deps.py b/tools/get_deps.py index d749e4c84..c60766e50 100755 --- a/tools/get_deps.py +++ b/tools/get_deps.py @@ -14,6 +14,9 @@ deps_mandatory = { 'lib/lwip': ['https://github.com/lwip-tcpip/lwip.git', '159e31b689577dbf69cf0683bbaffbd71fa5ee10', 'all'], + 'tools/linkermap': ['https://github.com/hathach/linkermap.git', + 'e1a7a990fcd6eb1dbae13c2eb9fb0ca9db7ac483', + 'all'], 'tools/uf2': ['https://github.com/microsoft/uf2.git', 'c594542b2faa01cc33a2b97c9fbebc38549df80a', 'all'], -- cgit v1.3.1 From e7105b1fa3ccd8200fe7fb8b0759d00afc9b07c1 Mon Sep 17 00:00:00 2001 From: Ha Thach Date: Thu, 4 Dec 2025 21:34:10 +0700 Subject: fine tune ci to build more with circleci (#3386) * fine tune ci to build more with circleci * skip make for arm-iar, esp-idf * skip make + clang for circleci since llvm-objcopy got killed due to memory issue. --- .circleci/config.yml | 51 ++++++++++-------- .circleci/config2.yml | 15 +++++- .github/workflows/build.yml | 60 +++------------------- .github/workflows/build_util.yml | 3 ++ examples/build_system/make/toolchain/gcc_common.mk | 3 ++ hw/bsp/kinetis_k/family.mk | 6 ++- hw/bsp/kinetis_kl/family.mk | 6 ++- tools/build.py | 8 +-- tools/metrics.py | 19 +++---- 9 files changed, 74 insertions(+), 97 deletions(-) (limited to 'examples/build_system') diff --git a/.circleci/config.yml b/.circleci/config.yml index 580f5fe2e..d04a33959 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -18,25 +18,34 @@ jobs: MATRIX_JSON=$(python .github/workflows/ci_set_matrix.py) echo "MATRIX_JSON=$MATRIX_JSON" - BUILDSYSTEM_TOOLCHAIN=( - "cmake aarch64-gcc" - "cmake arm-clang" - "cmake arm-gcc" - "cmake esp-idf" - "cmake msp430-gcc" - "cmake riscv-gcc" + BUILDSYSTEM_LIST=( + "cmake" + "make" + ) + + TOOLCHAIN_LIST=( + "aarch64-gcc" + "arm-clang" + "arm-gcc" + "esp-idf" + "msp430-gcc" + "riscv-gcc" ) # only build IAR if not forked PR, since IAR token is not shared if [ -z $CIRCLE_PR_USERNAME ]; then - BUILDSYSTEM_TOOLCHAIN+=("cmake arm-iar") + TOOLCHAIN_LIST+=("arm-iar") fi gen_build_entry() { local build_system="$1" local toolchain="$2" local family="$3" - local resource_class="$4" + local build_args="" + + if [[ "$toolchain" == "arm-iar" || "$build_system" == "make" ]]; then + build_args="--one-per-family" + fi if [[ "$toolchain" == "esp-idf" ]]; then echo " - build-vm:" >> .circleci/config2.yml @@ -49,17 +58,21 @@ jobs: echo " build-system: ['$build_system']" >> .circleci/config2.yml echo " toolchain: ['$toolchain']" >> .circleci/config2.yml echo " family: $family" >> .circleci/config2.yml - echo " resource_class: ['$resource_class']" >> .circleci/config2.yml + echo " resource_class: ['large']" >> .circleci/config2.yml + echo " build-args: ['$build_args']" >> .circleci/config2.yml } - for e in "${BUILDSYSTEM_TOOLCHAIN[@]}"; do - e_arr=($e) - build_system="${e_arr[0]}" - toolchain="${e_arr[1]}" - FAMILY=$(echo $MATRIX_JSON | jq -r ".\"$toolchain\"") - echo "FAMILY_${toolchain}=$FAMILY" + for build_system in "${BUILDSYSTEM_LIST[@]}"; do + for toolchain in "${TOOLCHAIN_LIST[@]}"; do + # make does not support these toolchains + if [ "$build_system" == "make" ] && { [ "$toolchain" == "arm-clang" ] || [ "$toolchain" == "arm-iar" ] || [ "$toolchain" == "esp-idf" ]; }; then + continue + fi - gen_build_entry "$build_system" "$toolchain" "$FAMILY" "large" + FAMILY=$(echo $MATRIX_JSON | jq -r ".\"$toolchain\"") + echo "FAMILY_${toolchain}=$FAMILY" + gen_build_entry "$build_system" "$toolchain" "$FAMILY" + done done - continuation/continue: @@ -67,9 +80,5 @@ jobs: workflows: set-matrix: - # Only build PR here, Push will be built by github action. - when: - and: - - not: << pipeline.git.branch.is_default >> jobs: - set-matrix diff --git a/.circleci/config2.yml b/.circleci/config2.yml index 869597289..77bc4f790 100644 --- a/.circleci/config2.yml +++ b/.circleci/config2.yml @@ -66,6 +66,9 @@ commands: type: string family: type: string + build-args: + type: string + default: "" steps: - checkout @@ -107,7 +110,7 @@ commands: no_output_timeout: 20m command: | if [ << parameters.toolchain >> == esp-idf ]; then - docker run --rm -v $PWD:/project -w /project espressif/idf:v5.3.2 python tools/build.py << parameters.family >> + docker run --rm -v $PWD:/project -w /project espressif/idf:v5.3.2 python tools/build.py << parameters.build-args >> << parameters.family >> else # Toolchain option default is gcc if [ << parameters.toolchain >> == arm-clang ]; then @@ -121,7 +124,7 @@ commands: # circleci docker return $nproc as 36 core, limit parallel to 4 (resource-class = large) # Required for IAR, also prevent crashed/killed by docker - python tools/build.py -s << parameters.build-system >> $TOOLCHAIN_OPTION -j 4 << parameters.family >> + python tools/build.py -s << parameters.build-system >> $TOOLCHAIN_OPTION -j 4 << parameters.build-args >> << parameters.family >> fi jobs: @@ -137,6 +140,9 @@ jobs: type: string family: type: string + build-args: + type: string + default: "" docker: - image: cimg/base:current @@ -147,6 +153,7 @@ jobs: build-system: << parameters.build-system >> toolchain: << parameters.toolchain >> family: << parameters.family >> + build-args: << parameters.build-args >> # Build using VM build-vm: @@ -160,6 +167,9 @@ jobs: type: string family: type: string + build-args: + type: string + default: "" machine: image: ubuntu-2404:current @@ -170,6 +180,7 @@ jobs: build-system: << parameters.build-system >> toolchain: << parameters.toolchain >> family: << parameters.family >> + build-args: << parameters.build-args >> workflows: build: diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 77f2d573f..a1bacbc27 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -56,10 +56,11 @@ jobs: echo "hil_matrix=$HIL_MATRIX_JSON" echo "hil_matrix=$HIL_MATRIX_JSON" >> $GITHUB_OUTPUT - # --------------------------------------- - # Build CMake: only one-per-family. - # Full built is done by CircleCI in PR - # --------------------------------------- + # ------------------------------------------------------------------------------ + # CMake build: only one-per-family. Full built is done by CircleCI in PR + # Note: + # For Make and IAR build: will be done on CircleCI only (one-per-family too) + # ------------------------------------------------------------------------------ cmake: needs: set-matrix uses: ./.github/workflows/build_util.yml @@ -70,7 +71,7 @@ jobs: - 'aarch64-gcc' #- 'arm-clang' - 'arm-gcc' - - 'esp-idf' + #- 'esp-idf' - 'msp430-gcc' - 'riscv-gcc' with: @@ -137,52 +138,6 @@ jobs: header: code-metrics path: metrics_compare.md - - # --------------------------------------- - # Build Make: only build on push with one-per-family - # --------------------------------------- - make: - if: github.event_name == 'push' - needs: set-matrix - uses: ./.github/workflows/build_util.yml - strategy: - fail-fast: false - matrix: - toolchain: - - 'aarch64-gcc' - #- 'arm-clang' - - 'arm-gcc' - - 'msp430-gcc' - - 'riscv-gcc' - - 'rx-gcc' - with: - build-system: 'make' - toolchain: ${{ matrix.toolchain }} - build-args: ${{ toJSON(fromJSON(needs.set-matrix.outputs.json)[matrix.toolchain]) }} - one-per-family: true - - # --------------------------------------- - # Build IAR - # Since IAR Token secret is not passed to forked PR, only build non-forked PR with make. - # cmake is built by circle-ci. Due to IAR limit capacity, only build oe per family - # --------------------------------------- - arm-iar: - if: false # disable for now since we got reach capacity limit too often - #if: github.event_name == 'push' && github.repository_owner == 'hathach' - needs: set-matrix - uses: ./.github/workflows/build_util.yml - secrets: inherit - strategy: - fail-fast: false - matrix: - build-system: - - 'make' - with: - build-system: ${{ matrix.build-system }} - toolchain: 'arm-iar' - build-args: ${{ toJSON(fromJSON(needs.set-matrix.outputs.json)['arm-iar']) }} - one-per-family: true - # --------------------------------------- # Build Make/CMake on Windows/MacOS # --------------------------------------- @@ -193,10 +148,9 @@ jobs: fail-fast: false matrix: os: [ windows-latest, macos-latest ] - build-system: [ 'make', 'cmake' ] with: os: ${{ matrix.os }} - build-system: ${{ matrix.build-system }} + build-system: 'cmake-make' toolchain: 'arm-gcc-${{ matrix.os }}' build-args: '["stm32h7"]' one-per-family: true diff --git a/.github/workflows/build_util.yml b/.github/workflows/build_util.yml index 36043a1d5..2fc0eead0 100644 --- a/.github/workflows/build_util.yml +++ b/.github/workflows/build_util.yml @@ -68,6 +68,9 @@ jobs: run: | if [ "$TOOLCHAIN" == "esp-idf" ]; then docker run --rm -v $PWD:/project -w /project espressif/idf:tinyusb python tools/build.py ${{ matrix.arg }} + elif [ "${{ inputs.build-system }}" == "cmake-make" ] || [ "${{ inputs.build-system }}" == "make-cmake" ]; then + python tools/build.py -s make ${{ steps.setup-toolchain.outputs.build_option }} ${{ steps.set-one-per-family.outputs.build_option }} ${{ matrix.arg }} + python tools/build.py -s cmake ${{ steps.setup-toolchain.outputs.build_option }} ${{ steps.set-one-per-family.outputs.build_option }} ${{ matrix.arg }} else python tools/build.py -s ${{ inputs.build-system }} ${{ steps.setup-toolchain.outputs.build_option }} ${{ steps.set-one-per-family.outputs.build_option }} ${{ matrix.arg }} fi diff --git a/examples/build_system/make/toolchain/gcc_common.mk b/examples/build_system/make/toolchain/gcc_common.mk index 0cbb6774d..42fd01183 100644 --- a/examples/build_system/make/toolchain/gcc_common.mk +++ b/examples/build_system/make/toolchain/gcc_common.mk @@ -31,6 +31,9 @@ CFLAGS += \ -Wreturn-type \ -Wredundant-decls \ +CFLAGS_CLANG += \ + -Wno-error=unknown-warning-option + # -Wmissing-prototypes \ # conversion is too strict for most mcu driver, may be disable sign/int/arith-conversion # -Wconversion diff --git a/hw/bsp/kinetis_k/family.mk b/hw/bsp/kinetis_k/family.mk index e95cdb717..7a51a77d8 100644 --- a/hw/bsp/kinetis_k/family.mk +++ b/hw/bsp/kinetis_k/family.mk @@ -9,11 +9,13 @@ CFLAGS += \ -DCFG_TUSB_MCU=OPT_MCU_KINETIS_K \ LDFLAGS += \ - -nostartfiles \ - --specs=nosys.specs --specs=nano.specs \ -Wl,--defsym,__stack_size__=0x400 \ -Wl,--defsym,__heap_size__=0 +LDFLAGS_GCC += \ + -nostartfiles \ + --specs=nosys.specs --specs=nano.specs \ + SRC_C += \ src/portable/nxp/khci/dcd_khci.c \ src/portable/nxp/khci/hcd_khci.c \ diff --git a/hw/bsp/kinetis_kl/family.mk b/hw/bsp/kinetis_kl/family.mk index 8d113aecf..aec53d486 100644 --- a/hw/bsp/kinetis_kl/family.mk +++ b/hw/bsp/kinetis_kl/family.mk @@ -9,11 +9,13 @@ CFLAGS += \ -DCFG_TUSB_MCU=OPT_MCU_KINETIS_KL \ LDFLAGS += \ - -nostartfiles \ - -specs=nosys.specs -specs=nano.specs \ -Wl,--defsym,__stack_size__=0x400 \ -Wl,--defsym,__heap_size__=0 +LDFLAGS_GCC += \ + -nostartfiles \ + -specs=nosys.specs -specs=nano.specs \ + SRC_C += \ src/portable/nxp/khci/dcd_khci.c \ src/portable/nxp/khci/hcd_khci.c \ diff --git a/tools/build.py b/tools/build.py index e4909f45f..c4f1558c0 100755 --- a/tools/build.py +++ b/tools/build.py @@ -142,16 +142,12 @@ def make_one_example(example, board, make_option): r = 2 else: start_time = time.monotonic() - # skip -j for circleci - if not os.getenv('CIRCLECI'): - make_option += ' -j' - make_args = ["make", "-C", f"examples/{example}", f"BOARD={board}"] + make_args = ["make", "-C", f"examples/{example}", f"BOARD={board}", '-j', str(parallel_jobs)] if make_option: make_args += shlex.split(make_option) - make_args.append("all") if clean_build: run_cmd(make_args + ["clean"]) - build_result = run_cmd(make_args) + build_result = run_cmd(make_args + ['all']) r = 0 if build_result.returncode == 0 else 1 print_build_result(board, example, r, time.monotonic() - start_time) diff --git a/tools/metrics.py b/tools/metrics.py index bb84f803e..c3b366e42 100644 --- a/tools/metrics.py +++ b/tools/metrics.py @@ -195,17 +195,13 @@ def compare_maps(base_file, new_file, filters=None): def format_diff(base, new, diff): """Format a diff value with percentage.""" - if base == 0 and new == 0: - return "0" - if base == 0: - return f"{new} (new)" - if new == 0: - return f"{base} âž¡ 0" if diff == 0: - return f"{base} âž¡ {new}" + return f"{new}" + if base == 0 or new == 0: + return f"{base} âž™ {new}" pct = (diff / base) * 100 sign = "+" if diff > 0 else "" - return f"{base} âž¡ {new} ({sign}{diff}, {sign}{pct:.1f}%)" + return f"{base} âž™ {new} ({sign}{diff}, {sign}{pct:.1f}%)" def get_sort_key(sort_order): @@ -232,10 +228,11 @@ def write_compare_markdown(comparison, path, sort_order='size'): sections = comparison["sections"] md_lines = [ - "# TinyUSB Code Size Different Report", + "# Size Difference Report", "", - f"**Base:** `{comparison['base_file']}`", - f"**New:** `{comparison['new_file']}`", + "Because TinyUSB code size varies by port and configuration, the metrics below represent the averaged totals across all example builds." + "", + "Note: If there is no change, only one value is shown.", "", ] -- cgit v1.3.1 From 16c92b50b07f29bd0a9ea1feb927bdcb95be8281 Mon Sep 17 00:00:00 2001 From: hathach Date: Mon, 8 Dec 2025 16:27:39 +0700 Subject: update metrics to support bloaty --- examples/build_system/cmake/toolchain/common.cmake | 4 + hw/bsp/family_support.cmake | 45 +- src/common/tusb_compiler.h | 80 +-- tools/get_deps.py | 2 +- tools/metrics.py | 715 ++++++++++++--------- 5 files changed, 487 insertions(+), 359 deletions(-) (limited to 'examples/build_system') diff --git a/examples/build_system/cmake/toolchain/common.cmake b/examples/build_system/cmake/toolchain/common.cmake index 14449b01d..1ef04bc00 100644 --- a/examples/build_system/cmake/toolchain/common.cmake +++ b/examples/build_system/cmake/toolchain/common.cmake @@ -26,6 +26,7 @@ if (TOOLCHAIN STREQUAL "gcc" OR TOOLCHAIN STREQUAL "clang") -ffunction-sections # -fsingle-precision-constant # not supported by clang -fno-strict-aliasing + -g ) list(APPEND TOOLCHAIN_EXE_LINKER_FLAGS -Wl,--print-memory-usage @@ -33,6 +34,9 @@ if (TOOLCHAIN STREQUAL "gcc" OR TOOLCHAIN STREQUAL "clang") -Wl,--cref ) elseif (TOOLCHAIN STREQUAL "iar") + list(APPEND TOOLCHAIN_COMMON_FLAGS + --debug + ) list(APPEND TOOLCHAIN_EXE_LINKER_FLAGS --diag_suppress=Li065 ) diff --git a/hw/bsp/family_support.cmake b/hw/bsp/family_support.cmake index 15d9f1eae..62ec412e6 100644 --- a/hw/bsp/family_support.cmake +++ b/hw/bsp/family_support.cmake @@ -10,6 +10,7 @@ get_filename_component(TOP ${TOP} ABSOLUTE) set(UF2CONV_PY ${TOP}/tools/uf2/utils/uf2conv.py) set(LINKERMAP_PY ${TOP}/tools/linkermap/linkermap.py) +set(METRICS_PY ${TOP}/tools/metrics.py) function(family_resolve_board BOARD_NAME BOARD_PATH_OUT) if ("${BOARD_NAME}" STREQUAL "") @@ -224,6 +225,33 @@ function(family_initialize_project PROJECT DIR) endif() endfunction() +# Add bloaty (https://github.com/google/bloaty/) target, required compile with -g (debug) +function(family_add_bloaty TARGET) + find_program(BLOATY_EXE bloaty) + if (BLOATY_EXE STREQUAL BLOATY_EXE-NOTFOUND) + return() + endif () + + set(OPTION "--domain=vm -d compileunits") # add -d symbol if needed + if (DEFINED BLOATY_OPTION) + string(APPEND OPTION " ${BLOATY_OPTION}") + endif () + separate_arguments(OPTION_LIST UNIX_COMMAND ${OPTION}) + + add_custom_target(${TARGET}-bloaty + DEPENDS ${TARGET} + COMMAND ${BLOATY_EXE} ${OPTION_LIST} $ > $.bloaty.txt + COMMAND cat $.bloaty.txt + VERBATIM) + + # post build + add_custom_command(TARGET ${TARGET} POST_BUILD + COMMAND ${BLOATY_EXE} ${OPTION_LIST} $ > $.bloaty.txt + COMMAND cat $.bloaty.txt + VERBATIM + ) +endfunction() + # Add linkermap target (https://github.com/hathach/linkermap) function(family_add_linkermap TARGET) set(LINKERMAP_OPTION_LIST) @@ -232,14 +260,16 @@ function(family_add_linkermap TARGET) endif () add_custom_target(${TARGET}-linkermap - COMMAND python ${LINKERMAP_PY} -j ${LINKERMAP_OPTION_LIST} $.map + COMMAND python ${LINKERMAP_PY} ${LINKERMAP_OPTION_LIST} $.map VERBATIM ) - # post build - add_custom_command(TARGET ${TARGET} POST_BUILD - COMMAND python ${LINKERMAP_PY} -j ${LINKERMAP_OPTION_LIST} $.map - VERBATIM) + # post build if bloaty not exist + if (NOT TARGET ${TARGET}-bloaty) + add_custom_command(TARGET ${TARGET} POST_BUILD + COMMAND python ${LINKERMAP_PY} ${LINKERMAP_OPTION_LIST} $.map + VERBATIM) + endif () endfunction() #------------------------------------------------------------- @@ -352,8 +382,9 @@ function(family_configure_common TARGET RTOS) endif () if (NOT RTOS STREQUAL zephyr) - # Generate linkermap target and post build. LINKERMAP_OPTION can be set with -D to change default options - family_add_linkermap(${TARGET}) + # Analyze size with bloaty and linkermap + family_add_bloaty(${TARGET}) + family_add_linkermap(${TARGET}) # fall back to linkermap if bloaty not found endif () # run size after build diff --git a/src/common/tusb_compiler.h b/src/common/tusb_compiler.h index 7719790d1..c8108264f 100644 --- a/src/common/tusb_compiler.h +++ b/src/common/tusb_compiler.h @@ -24,21 +24,13 @@ * This file is part of the TinyUSB stack. */ -/** \ingroup Group_Common - * \defgroup Group_Compiler Compiler - * \brief Group_Compiler brief - * @{ */ - -#ifndef TUSB_COMPILER_H_ -#define TUSB_COMPILER_H_ +#pragma once #define TU_TOKEN(x) x #define TU_STRING(x) #x ///< stringify without expand #define TU_XSTRING(x) TU_STRING(x) ///< expand then stringify - #define TU_STRCAT(a, b) a##b ///< concat without expand #define TU_STRCAT3(a, b, c) a##b##c ///< concat without expand - #define TU_XSTRCAT(a, b) TU_STRCAT(a, b) ///< expand then concat #define TU_XSTRCAT3(a, b, c) TU_STRCAT3(a, b, c) ///< expand then concat 3 tokens @@ -139,18 +131,20 @@ #define TU_FUNC_OPTIONAL_ARG(func, ...) TU_XSTRCAT(func##_arg, TU_ARGS_NUM(__VA_ARGS__))(__VA_ARGS__) //--------------------------------------------------------------------+ -// Compiler porting with Attribute and Endian +// Compiler Attribute Abstraction //--------------------------------------------------------------------+ +#if defined(__GNUC__) || defined(__ICCARM__) || defined(__TI_COMPILER_VERSION__) + #if defined(__ICCARM__) + #include // for builtin functions + #endif -// TODO refactor since __attribute__ is supported across many compiler -#if defined(__GNUC__) - #define TU_ATTR_ALIGNED(Bytes) __attribute__ ((aligned(Bytes))) - #define TU_ATTR_SECTION(sec_name) __attribute__ ((section(#sec_name))) - #define TU_ATTR_PACKED __attribute__ ((packed)) - #define TU_ATTR_WEAK __attribute__ ((weak)) - // #define TU_ATTR_WEAK_ALIAS(f) __attribute__ ((weak, alias(#f))) - #ifndef TU_ATTR_ALWAYS_INLINE // allow to override for debug - #define TU_ATTR_ALWAYS_INLINE __attribute__ ((always_inline)) + #define TU_ATTR_ALIGNED(Bytes) __attribute__((aligned(Bytes))) + #define TU_ATTR_SECTION(sec_name) __attribute__((section(#sec_name))) + #define TU_ATTR_PACKED __attribute__((packed)) + #define TU_ATTR_WEAK __attribute__((weak)) +// #define TU_ATTR_WEAK_ALIAS(f) __attribute__ ((weak, alias(#f))) + #ifndef TU_ATTR_ALWAYS_INLINE // allow to override for debug + #define TU_ATTR_ALWAYS_INLINE __attribute__((always_inline)) #endif #define TU_ATTR_DEPRECATED(mess) __attribute__ ((deprecated(mess))) // warn if function with this attribute is used #define TU_ATTR_UNUSED __attribute__ ((unused)) // Function/Variable is meant to be possibly unused @@ -161,18 +155,17 @@ #define TU_ATTR_BIT_FIELD_ORDER_BEGIN #define TU_ATTR_BIT_FIELD_ORDER_END - #if __GNUC__ < 5 - #define TU_ATTR_FALLTHROUGH do {} while (0) /* fallthrough */ + #if (defined(__has_attribute) && __has_attribute(__fallthrough__)) || defined(__TI_COMPILER_VERSION__) + #define TU_ATTR_FALLTHROUGH __attribute__((fallthrough)) #else - #if __has_attribute(__fallthrough__) - #define TU_ATTR_FALLTHROUGH __attribute__((fallthrough)) - #else - #define TU_ATTR_FALLTHROUGH do {} while (0) /* fallthrough */ - #endif + #define TU_ATTR_FALLTHROUGH \ + do { \ + } while (0) /* fallthrough */ #endif - // Endian conversion use well-known host to network (big endian) naming - #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ +// Endian conversion use well-known host to network (big endian) naming +// For TI ARM compiler, __BYTE_ORDER__ is not defined for MSP430 but still LE + #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ || defined(__MSP430__) #define TU_BYTE_ORDER TU_LITTLE_ENDIAN #else #define TU_BYTE_ORDER TU_BIG_ENDIAN @@ -196,33 +189,6 @@ #pragma GCC poison tud_vendor_control_request_cb #endif -#elif defined(__TI_COMPILER_VERSION__) - #define TU_ATTR_ALIGNED(Bytes) __attribute__ ((aligned(Bytes))) - #define TU_ATTR_SECTION(sec_name) __attribute__ ((section(#sec_name))) - #define TU_ATTR_PACKED __attribute__ ((packed)) - #define TU_ATTR_WEAK __attribute__ ((weak)) - // #define TU_ATTR_WEAK_ALIAS(f) __attribute__ ((weak, alias(#f))) - #define TU_ATTR_ALWAYS_INLINE __attribute__ ((always_inline)) - #define TU_ATTR_DEPRECATED(mess) __attribute__ ((deprecated(mess))) // warn if function with this attribute is used - #define TU_ATTR_UNUSED __attribute__ ((unused)) // Function/Variable is meant to be possibly unused - #define TU_ATTR_USED __attribute__ ((used)) - #define TU_ATTR_FALLTHROUGH __attribute__((fallthrough)) - - #define TU_ATTR_PACKED_BEGIN - #define TU_ATTR_PACKED_END - #define TU_ATTR_BIT_FIELD_ORDER_BEGIN - #define TU_ATTR_BIT_FIELD_ORDER_END - - // __BYTE_ORDER is defined in the TI ARM compiler, but not MSP430 (which is little endian) - #if ((__BYTE_ORDER__) == (__ORDER_LITTLE_ENDIAN__)) || defined(__MSP430__) - #define TU_BYTE_ORDER TU_LITTLE_ENDIAN - #else - #define TU_BYTE_ORDER TU_BIG_ENDIAN - #endif - - #define TU_BSWAP16(u16) (__builtin_bswap16(u16)) - #define TU_BSWAP32(u32) (__builtin_bswap32(u32)) - #elif defined(__ICCARM__) #include #define TU_ATTR_ALIGNED(Bytes) __attribute__ ((aligned(Bytes))) @@ -316,7 +282,3 @@ #else #error Byte order is undefined #endif - -#endif /* TUSB_COMPILER_H_ */ - -/// @} diff --git a/tools/get_deps.py b/tools/get_deps.py index 635f6d59e..f11d8d51e 100755 --- a/tools/get_deps.py +++ b/tools/get_deps.py @@ -15,7 +15,7 @@ deps_mandatory = { '159e31b689577dbf69cf0683bbaffbd71fa5ee10', 'all'], 'tools/linkermap': ['https://github.com/hathach/linkermap.git', - '5f2956943beb76b98fec78d702d8197daa730117', + '23d1c4c84c4866b84cb821fb368bb9991633871d', 'all'], 'tools/uf2': ['https://github.com/microsoft/uf2.git', 'c594542b2faa01cc33a2b97c9fbebc38549df80a', diff --git a/tools/metrics.py b/tools/metrics.py index d0940c63a..f879a0d34 100644 --- a/tools/metrics.py +++ b/tools/metrics.py @@ -1,15 +1,14 @@ #!/usr/bin/env python3 -"""Calculate average size from multiple linker map files.""" +"""Calculate average sizes using bloaty output.""" import argparse +import csv import glob +import io import json -import sys import os - -# Add linkermap module to path -sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'linkermap')) -import linkermap +import sys +from collections import defaultdict def expand_files(file_patterns): @@ -30,60 +29,105 @@ def expand_files(file_patterns): return expanded -def combine_maps(map_files, filters=None): - """Combine multiple map files into a list of json_data. +def parse_bloaty_csv(csv_text, filters=None): + """Parse bloaty CSV text and return normalized JSON data structure.""" - Args: - map_files: List of paths to linker map files or JSON files - filters: List of path substrings to filter object files (default: []) - - Returns: - all_json_data: Dictionary with mapfiles list and data from each map file - """ filters = filters or [] - all_json_data = {"mapfiles": [], "data": []} + reader = csv.DictReader(io.StringIO(csv_text)) + size_by_unit = defaultdict(int) + symbols_by_unit: dict[str, defaultdict[str, int]] = defaultdict(lambda: defaultdict(int)) + sections_by_unit: dict[str, defaultdict[str, int]] = defaultdict(lambda: defaultdict(int)) + + for row in reader: + compile_unit = row.get("compileunits") or row.get("compileunit") or row.get("path") + if compile_unit is None: + continue - def _normalize_json(json_data): - """Flatten verbose linkermap JSON (per-symbol dicts) to per-section totals.""" + if str(compile_unit).upper() == "TOTAL": + continue - for f in json_data.get("files", []): - collapsed = {} - for section, val in f.get("sections", {}).items(): - collapsed[section] = sum(val.values()) if isinstance(val, dict) else val + if filters and not any(filt in compile_unit for filt in filters): + continue - # Replace sections with collapsed totals - f["sections"] = collapsed + try: + vmsize = int(row.get("vmsize", 0)) + except ValueError: + continue - # Ensure total is a number derived from sections - f["total"] = sum(collapsed.values()) + size_by_unit[compile_unit] += vmsize + symbol_name = row.get("symbols", "") + if symbol_name: + symbols_by_unit[compile_unit][symbol_name] += vmsize + section_name = row.get("sections") or row.get("section") + if section_name and vmsize: + sections_by_unit[compile_unit][section_name] += vmsize + + files = [] + for unit_path, total_size in size_by_unit.items(): + symbols = [ + {"name": sym, "size": sz} + for sym, sz in sorted(symbols_by_unit[unit_path].items(), key=lambda x: x[1], reverse=True) + ] + sections = {sec: sz for sec, sz in sections_by_unit[unit_path].items() if sz} + files.append( + { + "file": os.path.basename(unit_path) or unit_path, + "path": unit_path, + "size": total_size, + "total": total_size, + "symbols": symbols, + "sections": sections, + } + ) + + total_all = sum(size_by_unit.values()) + return {"files": files, "TOTAL": total_all} + + +def combine_files(input_files, filters=None): + """Combine multiple bloaty outputs into a single data set.""" - return json_data + filters = filters or [] + all_json_data = {"file_list": [], "data": []} - for map_file in map_files: - if not os.path.exists(map_file): - print(f"Warning: {map_file} not found, skipping", file=sys.stderr) + for fin in input_files: + if not os.path.exists(fin): + print(f"Warning: {fin} not found, skipping", file=sys.stderr) continue try: - if map_file.endswith('.json'): - with open(map_file, 'r', encoding='utf-8') as f: + if fin.endswith(".json"): + with open(fin, "r", encoding="utf-8") as f: json_data = json.load(f) - - json_data = _normalize_json(json_data) - - # Apply path filters to JSON data if filters: - filtered_files = [ - f for f in json_data.get("files", []) + json_data["files"] = [ + f + for f in json_data.get("files", []) if f.get("path") and any(filt in f["path"] for filt in filters) ] - json_data["files"] = filtered_files + elif fin.endswith(".csv"): + with open(fin, "r", encoding="utf-8") as f: + csv_text = f.read() + json_data = parse_bloaty_csv(csv_text, filters) else: - json_data = linkermap.analyze_map(map_file, filters=filters) - all_json_data["mapfiles"].append(map_file) + if fin.endswith(".elf"): + print(f"Warning: {fin} is an ELF; please run bloaty with --csv output first. Skipping.", + file=sys.stderr) + else: + print(f"Warning: {fin} is not a supported CSV or JSON metrics input. Skipping.", + file=sys.stderr) + continue + + # Drop any fake TOTAL entries that slipped in as files + json_data["files"] = [ + f for f in json_data.get("files", []) + if str(f.get("file", "")).upper() != "TOTAL" + ] + + all_json_data["file_list"].append(fin) all_json_data["data"].append(json_data) - except Exception as e: - print(f"Warning: Failed to analyze {map_file}: {e}", file=sys.stderr) + except Exception as e: # pragma: no cover - defensive + print(f"Warning: Failed to analyze {fin}: {e}", file=sys.stderr) continue return all_json_data @@ -93,7 +137,7 @@ def compute_avg(all_json_data): """Compute average sizes from combined json_data. Args: - all_json_data: Dictionary with mapfiles and data from combine_maps() + all_json_data: Dictionary with file_list and data from combine_files() Returns: json_average: Dictionary with averaged size data @@ -101,128 +145,133 @@ def compute_avg(all_json_data): if not all_json_data["data"]: return None - # Collect all sections preserving order - all_sections = [] - for json_data in all_json_data["data"]: - for s in json_data["sections"]: - if s not in all_sections: - all_sections.append(s) - # Merge files with the same 'file' value and compute averages - file_accumulator = {} # key: file name, value: {"sections": {section: [sizes]}, "totals": [totals]} + file_accumulator = {} # key: file name, value: {"sizes": [sizes], "totals": [totals], "symbols": {name: [sizes]}, "sections": {name: [sizes]}} for json_data in all_json_data["data"]: - for f in json_data["files"]: + for f in json_data.get("files", []): fname = f["file"] if fname not in file_accumulator: - file_accumulator[fname] = {"sections": {}, "totals": [], "path": f.get("path")} - file_accumulator[fname]["totals"].append(f["total"]) - for section, size in f["sections"].items(): - if section in file_accumulator[fname]["sections"]: - file_accumulator[fname]["sections"][section].append(size) - else: - file_accumulator[fname]["sections"][section] = [size] + file_accumulator[fname] = { + "sizes": [], + "totals": [], + "path": f.get("path"), + "symbols": defaultdict(list), + "sections": defaultdict(list), + } + size_val = f.get("size", f.get("total", 0)) + file_accumulator[fname]["sizes"].append(size_val) + file_accumulator[fname]["totals"].append(f.get("total", size_val)) + for sym in f.get("symbols", []): + name = sym.get("name") + if name is None: + continue + file_accumulator[fname]["symbols"][name].append(sym.get("size", 0)) + sections_map = f.get("sections") or {} + if isinstance(sections_map, list): + sections_map = { + s.get("name"): s.get("size", 0) + for s in sections_map + if isinstance(s, dict) and s.get("name") + } + for sname, ssize in sections_map.items(): + file_accumulator[fname]["sections"][sname].append(ssize) # Build json_average with averaged values files_average = [] for fname, data in file_accumulator.items(): - avg_total = round(sum(data["totals"]) / len(data["totals"])) - avg_sections = {} - for section, sizes in data["sections"].items(): - avg_sections[section] = round(sum(sizes) / len(sizes)) - files_average.append({ - "file": fname, - "path": data["path"], - "sections": avg_sections, - "total": avg_total - }) + avg_size = round(sum(data["sizes"]) / len(data["sizes"])) if data["sizes"] else 0 + symbols_avg = [] + for sym_name, sizes in data["symbols"].items(): + if not sizes: + continue + symbols_avg.append({"name": sym_name, "size": round(sum(sizes) / len(sizes))}) + symbols_avg.sort(key=lambda x: x["size"], reverse=True) + sections_avg = { + sec_name: round(sum(sizes) / len(sizes)) + for sec_name, sizes in data["sections"].items() + if sizes + } + files_average.append( + { + "file": fname, + "path": data["path"], + "size": avg_size, + "symbols": symbols_avg, + "sections": sections_avg, + } + ) + + totals_list = [d.get("TOTAL") for d in all_json_data["data"] if isinstance(d.get("TOTAL"), (int, float))] + total_size = round(sum(totals_list) / len(totals_list)) if totals_list else ( + sum(f["size"] for f in files_average) or 1) + + for f in files_average: + f["percent"] = (f["size"] / total_size) * 100 if total_size else 0 + for sym in f["symbols"]: + sym["percent"] = (sym["size"] / f["size"]) * 100 if f["size"] else 0 json_average = { - "mapfiles": all_json_data["mapfiles"], - "sections": all_sections, - "files": files_average + "file_list": all_json_data["file_list"], + "TOTAL": total_size, + "files": files_average, } return json_average -def compare_maps(base_file, new_file, filters=None): - """Compare two map/json files and generate difference report. - - Args: - base_file: Path to base map/json file - new_file: Path to new map/json file - filters: List of path substrings to filter object files - - Returns: - Dictionary with comparison data - """ +def compare_files(base_file, new_file, filters=None): + """Compare two CSV or JSON inputs and generate difference report.""" filters = filters or [] - # Load both files - base_data = combine_maps([base_file], filters) - new_data = combine_maps([new_file], filters) - - if not base_data["data"] or not new_data["data"]: - return None - - base_avg = compute_avg(base_data) - new_avg = compute_avg(new_data) + base_avg = compute_avg(combine_files([base_file], filters)) + new_avg = compute_avg(combine_files([new_file], filters)) if not base_avg or not new_avg: return None - # Collect all sections from both - all_sections = list(base_avg["sections"]) - for s in new_avg["sections"]: - if s not in all_sections: - all_sections.append(s) - - # Build file lookup base_files = {f["file"]: f for f in base_avg["files"]} new_files = {f["file"]: f for f in new_avg["files"]} - - # Get all file names all_file_names = set(base_files.keys()) | set(new_files.keys()) - # Build comparison data - comparison = [] + comparison_files = [] for fname in sorted(all_file_names): - base_f = base_files.get(fname) - new_f = new_files.get(fname) - - row = {"file": fname, "sections": {}, "total": {}} - - for section in all_sections: - base_val = base_f["sections"].get(section, 0) if base_f else 0 - new_val = new_f["sections"].get(section, 0) if new_f else 0 - row["sections"][section] = {"base": base_val, "new": new_val, "diff": new_val - base_val} - - base_total = base_f["total"] if base_f else 0 - new_total = new_f["total"] if new_f else 0 - row["total"] = {"base": base_total, "new": new_total, "diff": new_total - base_total} + b = base_files.get(fname, {}) + n = new_files.get(fname, {}) + b_size = b.get("size", 0) + n_size = n.get("size", 0) + + # Symbol diffs + b_syms = {s["name"]: s for s in b.get("symbols", [])} + n_syms = {s["name"]: s for s in n.get("symbols", [])} + all_syms = set(b_syms.keys()) | set(n_syms.keys()) + symbols = [] + for sym in all_syms: + sb = b_syms.get(sym, {}).get("size", 0) + sn = n_syms.get(sym, {}).get("size", 0) + symbols.append({"name": sym, "base": sb, "new": sn, "diff": sn - sb}) + symbols.sort(key=lambda x: abs(x["diff"]), reverse=True) + + comparison_files.append({ + "file": fname, + "size": {"base": b_size, "new": n_size, "diff": n_size - b_size}, + "symbols": symbols, + }) - comparison.append(row) + total = { + "base": base_avg.get("TOTAL", 0), + "new": new_avg.get("TOTAL", 0), + "diff": new_avg.get("TOTAL", 0) - base_avg.get("TOTAL", 0), + } return { "base_file": base_file, "new_file": new_file, - "sections": all_sections, - "files": comparison + "total": total, + "files": comparison_files, } -def format_diff(base, new, diff): - """Format a diff value with percentage.""" - if diff == 0: - return f"{new}" - if base == 0 or new == 0: - return f"{base} âž™ {new}" - pct = (diff / base) * 100 - sign = "+" if diff > 0 else "" - return f"{base} âž™ {new} ({sign}{diff}, {sign}{pct:.1f}%)" - - def get_sort_key(sort_order): """Get sort key function based on sort order. @@ -232,131 +281,148 @@ def get_sort_key(sort_order): Returns: Tuple of (key_func, reverse) """ + + def _size_val(entry): + if isinstance(entry.get('total'), int): + return entry.get('total', 0) + if isinstance(entry.get('total'), dict): + return entry['total'].get('new', 0) + return entry.get('size', 0) + if sort_order == 'size-': - return lambda x: x.get('total', 0) if isinstance(x.get('total'), int) else x['total']['new'], True + return _size_val, True elif sort_order == 'size+': - return lambda x: x.get('total', 0) if isinstance(x.get('total'), int) else x['total']['new'], False + return _size_val, False elif sort_order == 'name-': return lambda x: x.get('file', ''), True else: # name+ return lambda x: x.get('file', ''), False +def write_json_output(json_data, path): + """Write JSON output with indentation.""" + + with open(path, "w", encoding="utf-8") as outf: + json.dump(json_data, outf, indent=2) + + +def render_combine_table(json_data, sort_order='name+'): + """Render averaged sizes as markdown table lines (no title).""" + files = json_data.get("files", []) + if not files: + return ["No entries."] + + key_func, reverse = get_sort_key(sort_order) + files_sorted = sorted(files, key=key_func, reverse=reverse) + + total_size = json_data.get("TOTAL") or (sum(f.get("size", 0) for f in files_sorted) or 1) + + pct_strings = [ + f"{(f.get('percent') if f.get('percent') is not None else (f.get('size', 0) / total_size * 100 if total_size else 0)):.1f}%" + for f in files_sorted] + pct_width = 6 + size_width = max(len("size"), *(len(str(f.get("size", 0))) for f in files_sorted), len(str(total_size))) + file_width = max(len("File"), *(len(f.get("file", "")) for f in files_sorted), len("TOTAL")) + + # Build section totals on the fly from file data + sections_global = defaultdict(int) + for f in files_sorted: + for name, size in (f.get("sections") or {}).items(): + sections_global[name] += size + # Display sections in reverse alphabetical order for stable column layout + section_names = sorted(sections_global.keys(), reverse=True) + section_widths = {} + for name in section_names: + max_val = max((f.get("sections", {}).get(name, 0) for f in files_sorted), default=0) + section_widths[name] = max(len(name), len(str(max_val)), 1) + + if not section_names: + header = f"| {'File':<{file_width}} | {'size':>{size_width}} | {'%':>{pct_width}} |" + separator = f"| :{'-' * (file_width - 1)} | {'-' * (size_width - 1)}: | {'-' * (pct_width - 1)}: |" + else: + header_parts = [f"| {'File':<{file_width}} |"] + sep_parts = [f"| :{'-' * (file_width - 1)} |"] + for name in section_names: + header_parts.append(f" {name:>{section_widths[name]}} |") + sep_parts.append(f" {'-' * (section_widths[name] - 1)}: |") + header_parts.append(f" {'size':>{size_width}} | {'%':>{pct_width}} |") + sep_parts.append(f" {'-' * (size_width - 1)}: | {'-' * (pct_width - 1)}: |") + header = "".join(header_parts) + separator = "".join(sep_parts) + + lines = [header, separator] + + for f, pct_str in zip(files_sorted, pct_strings): + size_val = f.get("size", 0) + parts = [f"| {f.get('file', ''):<{file_width}} |"] + if section_names: + sections_map = f.get("sections") or {} + if isinstance(sections_map, list): + sections_map = { + s.get("name"): s.get("size", 0) + for s in sections_map + if isinstance(s, dict) and s.get("name") + } + for name in section_names: + parts.append(f" {sections_map.get(name, 0):>{section_widths[name]}} |") + parts.append(f" {size_val:>{size_width}} | {pct_str:>{pct_width}} |") + lines.append("".join(parts)) + + total_parts = [f"| {'TOTAL':<{file_width}} |"] + if section_names: + for name in section_names: + total_parts.append(f" {sections_global.get(name, 0):>{section_widths[name]}} |") + total_parts.append(f" {total_size:>{size_width}} | {'100.0%':>{pct_width}} |") + lines.append("".join(total_parts)) + return lines + + +def write_combine_markdown(json_data, path, sort_order='name+', title="TinyUSB Average Code Size Metrics"): + """Write averaged size data to a markdown file.""" + + md_lines = [f"# {title}", ""] + md_lines.extend(render_combine_table(json_data, sort_order)) + md_lines.append("") + + if json_data.get("file_list"): + md_lines.extend(["
", "Input files", ""]) + md_lines.extend([f"- {mf}" for mf in json_data["file_list"]]) + md_lines.extend(["", "
", ""]) + + with open(path, "w", encoding="utf-8") as f: + f.write("\n".join(md_lines)) + + def write_compare_markdown(comparison, path, sort_order='size'): """Write comparison data to markdown file.""" - sections = comparison["sections"] - md_lines = [ "# Size Difference Report", "", - "Because TinyUSB code size varies by port and configuration, the metrics below represent the averaged totals across all example builds." + "Because TinyUSB code size varies by port and configuration, the metrics below represent the averaged totals across all example builds.", "", "Note: If there is no change, only one value is shown.", "", ] - # Build header - header = "| File |" - separator = "|:-----|" - for s in sections: - header += f" {s} |" - separator += "-----:|" - header += " Total |" - separator += "------:|" - - def is_significant(file_row): - for s in sections: - sd = file_row["sections"][s] - diff = abs(sd["diff"]) - base = sd["base"] - if base == 0: - if diff != 0: - return True - else: - if (diff / base) * 100 > 1.0: - return True - return False - - # Sort files based on sort_order - if sort_order == 'size-': - key_func = lambda x: abs(x["total"]["diff"]) - reverse = True - elif sort_order in ('size', 'size+'): - key_func = lambda x: abs(x["total"]["diff"]) - reverse = False - elif sort_order == 'name-': - key_func = lambda x: x['file'] - reverse = True - else: # name or name+ - key_func = lambda x: x['file'] - reverse = False - sorted_files = sorted(comparison["files"], key=key_func, reverse=reverse) - - significant = [] - minor = [] - unchanged = [] - for f in sorted_files: - no_change = f["total"]["diff"] == 0 and all(f["sections"][s]["diff"] == 0 for s in sections) - if no_change: - unchanged.append(f) - else: - (significant if is_significant(f) else minor).append(f) + significant, minor, unchanged = _split_by_significance(comparison["files"], sort_order) - def render_table(title, rows, collapsed=False): + def render(title, rows, collapsed=False): if collapsed: md_lines.append(f"
{title}") md_lines.append("") else: md_lines.append(f"## {title}") - if not rows: - md_lines.append("No entries.") - md_lines.append("") - if collapsed: - md_lines.append("
") - md_lines.append("") - return - - md_lines.append(header) - md_lines.append(separator) - - sum_base = {s: 0 for s in sections} - sum_base["total"] = 0 - sum_new = {s: 0 for s in sections} - sum_new["total"] = 0 - - for f in rows: - row = f"| {f['file']} |" - for s in sections: - sd = f["sections"][s] - sum_base[s] += sd["base"] - sum_new[s] += sd["new"] - row += f" {format_diff(sd['base'], sd['new'], sd['diff'])} |" - - td = f["total"] - sum_base["total"] += td["base"] - sum_new["total"] += td["new"] - row += f" {format_diff(td['base'], td['new'], td['diff'])} |" - - md_lines.append(row) - - # Add sum row - sum_row = "| **SUM** |" - for s in sections: - diff = sum_new[s] - sum_base[s] - sum_row += f" {format_diff(sum_base[s], sum_new[s], diff)} |" - total_diff = sum_new["total"] - sum_base["total"] - sum_row += f" {format_diff(sum_base['total'], sum_new['total'], total_diff)} |" - md_lines.append(sum_row) + md_lines.extend(render_compare_table(_build_rows(rows, sort_order), include_sum=True)) md_lines.append("") if collapsed: md_lines.append("") md_lines.append("") - render_table("Changes >1% in any section", significant) - render_table("Changes <1% in all sections", minor) - render_table("No changes", unchanged, collapsed=True) + render("Changes >1% in size", significant) + render("Changes <1% in size", minor) + render("No changes", unchanged, collapsed=True) with open(path, "w", encoding="utf-8") as f: f.write("\n".join(md_lines)) @@ -365,14 +431,22 @@ def write_compare_markdown(comparison, path, sort_order='size'): def print_compare_summary(comparison, sort_order='name+'): """Print diff report to stdout in table form.""" - sections = comparison["sections"] files = comparison["files"] + rows = _build_rows(files, sort_order) + lines = render_compare_table(rows, include_sum=True) + for line in lines: + print(line) + + +def _build_rows(files, sort_order): + """Sort files and prepare printable fields.""" + def sort_key(file_row): if sort_order == 'size-': - return abs(file_row["total"]["diff"]) + return abs(file_row["size"]["diff"]) if sort_order in ('size', 'size+'): - return abs(file_row["total"]["diff"]) + return abs(file_row["size"]["diff"]) if sort_order == 'name-': return file_row['file'] return file_row['file'] @@ -380,63 +454,118 @@ def print_compare_summary(comparison, sort_order='name+'): reverse = sort_order in ('size-', 'name-') files_sorted = sorted(files, key=sort_key, reverse=reverse) - # Build formatted rows first to compute column widths precisely rows = [] - value_lengths = [] for f in files_sorted: - section_vals = {} - for s in sections: - sd = f["sections"][s] - text = format_diff(sd['base'], sd['new'], sd['diff']) - section_vals[s] = text - value_lengths.append(len(text)) - td = f["total"] - total_text = format_diff(td['base'], td['new'], td['diff']) - value_lengths.append(len(total_text)) - rows.append({"file": f['file'], "sections": section_vals, "total": total_text, "raw": f}) - - # Column widths - name_width = max(len(r["file"]) for r in rows) if rows else len("File") - name_width = max(name_width, len("File"), 3) # at least width of SUM - col_width = max(12, *(len(s) for s in sections), len("Total"), *(value_lengths or [0])) - - ffmt = '{:' + f'>{name_width}' + '} |' - col_fmt = '{:' + f'>{col_width}' + '}' - - header = ffmt.format('File') + ''.join(col_fmt.format(s) + ' |' for s in sections) + col_fmt.format('Total') - print(header) - print('-' * len(header)) - - sum_base = {s: 0 for s in sections} - sum_new = {s: 0 for s in sections} - - for row in rows: - line = ffmt.format(row['file']) - for s in sections: - sd = row["raw"]["sections"][s] - sum_base[s] += sd["base"] - sum_new[s] += sd["new"] - line += col_fmt.format(row['sections'][s]) + ' |' - - line += col_fmt.format(row['total']) - print(line) + sd = f["size"] + diff_val = sd['new'] - sd['base'] + if sd['base'] == 0: + pct_str = "n/a" + else: + pct_val = (diff_val / sd['base']) * 100 + pct_str = f"{pct_val:+.1f}%" + rows.append({ + "file": f['file'], + "base": sd['base'], + "new": sd['new'], + "diff": diff_val, + "pct": pct_str, + }) + return rows - # Sum row - sum_row = ffmt.format('SUM') - for s in sections: - diff = sum_new[s] - sum_base[s] - sum_row += col_fmt.format(format_diff(sum_base[s], sum_new[s], diff)) + ' |' - total_base = sum(sum_base.values()) - total_new = sum(sum_new.values()) - sum_row += col_fmt.format(format_diff(total_base, total_new, total_new - total_base)) - print('-' * len(header)) - print(sum_row) + +def _split_by_significance(files, sort_order): + """Split files into >1% changes, <1% changes, and no changes.""" + + def is_significant(file_row): + base = file_row["size"]["base"] + diff = abs(file_row["size"]["diff"]) + if base == 0: + return diff != 0 + return (diff / base) * 100 > 1.0 + + rows_sorted = sorted( + files, + key=lambda f: abs(f["size"]["diff"]) if sort_order.startswith("size") else f["file"], + reverse=sort_order in ('size-', 'name-'), + ) + + significant = [] + minor = [] + unchanged = [] + for f in rows_sorted: + if f["size"]["diff"] == 0: + unchanged.append(f) + else: + (significant if is_significant(f) else minor).append(f) + + return significant, minor, unchanged + + +def render_compare_table(rows, include_sum): + """Return markdown table lines for given rows.""" + if not rows: + return ["No entries.", ""] + + sum_base = sum(r["base"] for r in rows) + sum_new = sum(r["new"] for r in rows) + total_diff = sum_new - sum_base + total_pct = "n/a" if sum_base == 0 else f"{(total_diff / sum_base) * 100:+.1f}%" + + base_width = max(len("base"), *(len(str(r["base"])) for r in rows)) + new_width = max(len("new"), *(len(str(r["new"])) for r in rows)) + diff_width = max(len("diff"), *(len(f"{r['diff']:+}") for r in rows)) + pct_width = max(len("% diff"), *(len(r["pct"]) for r in rows)) + name_width = max(len("file"), *(len(r["file"]) for r in rows)) + + if include_sum: + base_width = max(base_width, len(str(sum_base))) + new_width = max(new_width, len(str(sum_new))) + diff_width = max(diff_width, len(f"{total_diff:+}")) + pct_width = max(pct_width, len(total_pct)) + name_width = max(name_width, len("TOTAL")) + + header = ( + f"| {'file':<{name_width}} | " + f"{'base':>{base_width}} | " + f"{'new':>{new_width}} | " + f"{'diff':>{diff_width}} | " + f"{'% diff':>{pct_width}} |" + ) + separator = ( + f"| :{'-' * (name_width - 1)} | " + f"{'-' * base_width}:| " + f"{'-' * new_width}:| " + f"{'-' * diff_width}:| " + f"{'-' * pct_width}:|" + ) + + lines = [header, separator] + + for r in rows: + diff_str = f"{r['diff']:+}" + lines.append( + f"| {r['file']:<{name_width}} | " + f"{str(r['base']):>{base_width}} | " + f"{str(r['new']):>{new_width}} | " + f"{diff_str:>{diff_width}} | " + f"{r['pct']:>{pct_width}} |" + ) + + if include_sum: + lines.append( + f"| {'TOTAL':<{name_width}} | " + f"{sum_base:>{base_width}} | " + f"{sum_new:>{new_width}} | " + f"{total_diff:+{diff_width}d} | " + f"{total_pct:>{pct_width}} |" + ) + return lines def cmd_combine(args): """Handle combine subcommand.""" - map_files = expand_files(args.files) - all_json_data = combine_maps(map_files, args.filters) + input_files = expand_files(args.files) + all_json_data = combine_files(input_files, args.filters) json_average = compute_avg(all_json_data) if json_average is None: @@ -444,17 +573,18 @@ def cmd_combine(args): sys.exit(1) if not args.quiet: - linkermap.print_summary(json_average, False, args.sort) + for line in render_combine_table(json_average, sort_order=args.sort): + print(line) if args.json_out: - linkermap.write_json(json_average, args.out + '.json') + write_json_output(json_average, args.out + '.json') if args.markdown_out: - linkermap.write_markdown(json_average, args.out + '.md', sort_opt=args.sort, - title="TinyUSB Average Code Size Metrics") + write_combine_markdown(json_average, args.out + '.md', sort_order=args.sort, + title="TinyUSB Average Code Size Metrics") def cmd_compare(args): """Handle compare subcommand.""" - comparison = compare_maps(args.base, args.new, args.filters) + comparison = compare_files(args.base, args.new, args.filters) if comparison is None: print("Failed to compare files", file=sys.stderr) @@ -472,10 +602,11 @@ def main(argv=None): subparsers = parser.add_subparsers(dest='command', required=True, help='Available commands') # Combine subcommand - combine_parser = subparsers.add_parser('combine', help='Combine and average multiple map files') - combine_parser.add_argument('files', nargs='+', help='Path to map file(s) or glob pattern(s)') + combine_parser = subparsers.add_parser('combine', help='Combine and average multiple bloaty outputs') + combine_parser.add_argument('files', nargs='+', + help='Path to bloaty CSV output or JSON file(s) or glob pattern(s)') combine_parser.add_argument('-f', '--filter', dest='filters', action='append', default=[], - help='Only include object files whose path contains this substring (can be repeated)') + help='Only include compile units whose path contains this substring (can be repeated)') combine_parser.add_argument('-o', '--out', dest='out', default='metrics', help='Output path basename for JSON and Markdown files (default: metrics)') combine_parser.add_argument('-j', '--json', dest='json_out', action='store_true', @@ -484,16 +615,16 @@ def main(argv=None): help='Write Markdown output file') combine_parser.add_argument('-q', '--quiet', dest='quiet', action='store_true', help='Suppress summary output') - combine_parser.add_argument('-S', '--sort', dest='sort', default='name+', + combine_parser.add_argument('-S', '--sort', dest='sort', default='size-', choices=['size', 'size-', 'size+', 'name', 'name-', 'name+'], - help='Sort order: size/size- (descending), size+ (ascending), name/name+ (ascending), name- (descending). Default: name+') + help='Sort order: size/size- (descending), size+ (ascending), name/name+ (ascending), name- (descending). Default: size-') # Compare subcommand - compare_parser = subparsers.add_parser('compare', help='Compare two map files') - compare_parser.add_argument('base', help='Base map/json file') - compare_parser.add_argument('new', help='New map/json file') + compare_parser = subparsers.add_parser('compare', help='Compare two bloaty outputs (CSV) or JSON inputs') + compare_parser.add_argument('base', help='Base CSV/JSON file') + compare_parser.add_argument('new', help='New CSV/JSON file') compare_parser.add_argument('-f', '--filter', dest='filters', action='append', default=[], - help='Only include object files whose path contains this substring (can be repeated)') + help='Only include compile units whose path contains this substring (can be repeated)') compare_parser.add_argument('-o', '--out', dest='out', default='metrics_compare', help='Output path basename for Markdown file (default: metrics_compare)') compare_parser.add_argument('-S', '--sort', dest='sort', default='name+', -- cgit v1.3.1 From 919ee4b1527469e327710cff936366328f97294a Mon Sep 17 00:00:00 2001 From: hathach Date: Tue, 9 Dec 2025 20:11:18 +0700 Subject: update metrics to support bloaty csv --- .circleci/config2.yml | 1 - .github/workflows/build.yml | 3 +- .../build_system/cmake/toolchain/arm_clang.cmake | 1 - examples/build_system/cmake/toolchain/common.cmake | 41 +++--- hw/bsp/family_support.cmake | 33 ++--- src/common/tusb_compiler.h | 6 +- src/portable/synopsys/dwc2/hcd_dwc2.c | 2 +- tools/get_deps.py | 2 +- tools/metrics.py | 152 ++++++++++++--------- 9 files changed, 124 insertions(+), 117 deletions(-) (limited to 'examples/build_system') diff --git a/.circleci/config2.yml b/.circleci/config2.yml index a39682067..352d0f4fa 100644 --- a/.circleci/config2.yml +++ b/.circleci/config2.yml @@ -227,7 +227,6 @@ jobs: name: Aggregate Code Metrics command: | python tools/get_deps.py - pip install tools/linkermap/ # Combine all metrics files from all toolchain subdirectories ls -R /tmp/metrics if ls /tmp/metrics/*/*.json 1> /dev/null 2>&1; then diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5017cb3cd..9d94a3b9b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -100,7 +100,6 @@ jobs: - name: Aggregate Code Metrics run: | python tools/get_deps.py - pip install tools/linkermap/ python tools/metrics.py combine -j -m -f tinyusb/src cmake-build/*/metrics.json - name: Upload Metrics Artifact @@ -124,7 +123,7 @@ jobs: if: github.event_name != 'push' run: | if [ -f base-metrics/metrics.json ]; then - python tools/metrics.py compare -f tinyusb/src base-metrics/metrics.json metrics.json + python tools/metrics.py compare -m -f tinyusb/src base-metrics/metrics.json metrics.json cat metrics_compare.md else echo "No base metrics found, skipping comparison" diff --git a/examples/build_system/cmake/toolchain/arm_clang.cmake b/examples/build_system/cmake/toolchain/arm_clang.cmake index dba637367..e5ca82fab 100644 --- a/examples/build_system/cmake/toolchain/arm_clang.cmake +++ b/examples/build_system/cmake/toolchain/arm_clang.cmake @@ -7,7 +7,6 @@ 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) diff --git a/examples/build_system/cmake/toolchain/common.cmake b/examples/build_system/cmake/toolchain/common.cmake index 1ef04bc00..e610a349b 100644 --- a/examples/build_system/cmake/toolchain/common.cmake +++ b/examples/build_system/cmake/toolchain/common.cmake @@ -20,41 +20,32 @@ include(${CMAKE_CURRENT_LIST_DIR}/../cpu/${CMAKE_SYSTEM_CPU}.cmake) # ---------------------------------------------------------------------------- # Compile flags # ---------------------------------------------------------------------------- +set(TOOLCHAIN_C_FLAGS) +set(TOOLCHAIN_ASM_FLAGS) +set(TOOLCHAIN_EXE_LINKER_FLAGS) + if (TOOLCHAIN STREQUAL "gcc" OR TOOLCHAIN STREQUAL "clang") list(APPEND TOOLCHAIN_COMMON_FLAGS -fdata-sections -ffunction-sections # -fsingle-precision-constant # not supported by clang -fno-strict-aliasing - -g - ) - list(APPEND TOOLCHAIN_EXE_LINKER_FLAGS - -Wl,--print-memory-usage - -Wl,--gc-sections - -Wl,--cref + -g # include debug info for bloaty ) + set(TOOLCHAIN_EXE_LINKER_FLAGS "-Wl,--print-memory-usage -Wl,--gc-sections -Wl,--cref") + + if (TOOLCHAIN STREQUAL clang) + set(TOOLCHAIN_ASM_FLAGS "-x assembler-with-cpp") + endif () elseif (TOOLCHAIN STREQUAL "iar") - list(APPEND TOOLCHAIN_COMMON_FLAGS - --debug - ) - list(APPEND TOOLCHAIN_EXE_LINKER_FLAGS - --diag_suppress=Li065 - ) + set(TOOLCHAIN_C_FLAGS --debug) + set(TOOLCHAIN_EXE_LINKER_FLAGS --diag_suppress=Li065) endif () # join the toolchain flags into a single string list(JOIN TOOLCHAIN_COMMON_FLAGS " " TOOLCHAIN_COMMON_FLAGS) -foreach (LANG IN ITEMS C CXX ASM) - set(CMAKE_${LANG}_FLAGS_INIT ${TOOLCHAIN_COMMON_FLAGS}) - # optimization flags for LOG, LOGGER ? - #set(CMAKE_${LANG}_FLAGS_RELEASE_INIT "-Os") - #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) +set(CMAKE_C_FLAGS_INIT "${TOOLCHAIN_COMMON_FLAGS} ${TOOLCHAIN_C_FLAGS}") +set(CMAKE_CXX_FLAGS_INIT "${TOOLCHAIN_COMMON_FLAGS} ${TOOLCHAIN_C_FLAGS}") +set(CMAKE_ASM_FLAGS_INIT "${TOOLCHAIN_COMMON_FLAGS} ${TOOLCHAIN_ASM_FLAGS}") +set(CMAKE_EXE_LINKER_FLAGS_INIT ${TOOLCHAIN_EXE_LINKER_FLAGS}) diff --git a/hw/bsp/family_support.cmake b/hw/bsp/family_support.cmake index 62ec412e6..5eadcdaa9 100644 --- a/hw/bsp/family_support.cmake +++ b/hw/bsp/family_support.cmake @@ -232,7 +232,7 @@ function(family_add_bloaty TARGET) return() endif () - set(OPTION "--domain=vm -d compileunits") # add -d symbol if needed + set(OPTION "--domain=vm -d compileunits,sections,symbols") if (DEFINED BLOATY_OPTION) string(APPEND OPTION " ${BLOATY_OPTION}") endif () @@ -240,36 +240,33 @@ function(family_add_bloaty TARGET) add_custom_target(${TARGET}-bloaty DEPENDS ${TARGET} - COMMAND ${BLOATY_EXE} ${OPTION_LIST} $ > $.bloaty.txt - COMMAND cat $.bloaty.txt + COMMAND ${BLOATY_EXE} ${OPTION_LIST} $ VERBATIM) # post build - add_custom_command(TARGET ${TARGET} POST_BUILD - COMMAND ${BLOATY_EXE} ${OPTION_LIST} $ > $.bloaty.txt - COMMAND cat $.bloaty.txt - VERBATIM - ) + # add_custom_command(TARGET ${TARGET} POST_BUILD + # COMMAND ${BLOATY_EXE} --csv ${OPTION_LIST} $ > ${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_bloaty.csv + # VERBATIM + # ) endfunction() # Add linkermap target (https://github.com/hathach/linkermap) function(family_add_linkermap TARGET) - set(LINKERMAP_OPTION_LIST) + set(OPTION "-j") if (DEFINED LINKERMAP_OPTION) - separate_arguments(LINKERMAP_OPTION_LIST UNIX_COMMAND ${LINKERMAP_OPTION}) + string(APPEND OPTION " ${LINKERMAP_OPTION}") endif () + separate_arguments(OPTION_LIST UNIX_COMMAND ${OPTION}) add_custom_target(${TARGET}-linkermap - COMMAND python ${LINKERMAP_PY} ${LINKERMAP_OPTION_LIST} $.map + COMMAND python ${LINKERMAP_PY} ${OPTION_LIST} $.map VERBATIM ) - # post build if bloaty not exist - if (NOT TARGET ${TARGET}-bloaty) - add_custom_command(TARGET ${TARGET} POST_BUILD - COMMAND python ${LINKERMAP_PY} ${LINKERMAP_OPTION_LIST} $.map - VERBATIM) - endif () + # post build + add_custom_command(TARGET ${TARGET} POST_BUILD + COMMAND python ${LINKERMAP_PY} ${OPTION_LIST} $.map + VERBATIM) endfunction() #------------------------------------------------------------- @@ -384,7 +381,7 @@ function(family_configure_common TARGET RTOS) if (NOT RTOS STREQUAL zephyr) # Analyze size with bloaty and linkermap family_add_bloaty(${TARGET}) - family_add_linkermap(${TARGET}) # fall back to linkermap if bloaty not found + family_add_linkermap(${TARGET}) endif () # run size after build diff --git a/src/common/tusb_compiler.h b/src/common/tusb_compiler.h index c8108264f..f20834cea 100644 --- a/src/common/tusb_compiler.h +++ b/src/common/tusb_compiler.h @@ -183,11 +183,11 @@ #define TU_BSWAP32(u32) (__builtin_bswap32(u32)) #endif - #ifndef __ARMCC_VERSION // List of obsolete callback function that is renamed and should not be defined. // Put it here since only gcc support this pragma - #pragma GCC poison tud_vendor_control_request_cb - #endif + #if !defined(__ARMCC_VERSION) && !defined(__ICCARM__) + #pragma GCC poison tud_vendor_control_request_cb + #endif #elif defined(__ICCARM__) #include diff --git a/src/portable/synopsys/dwc2/hcd_dwc2.c b/src/portable/synopsys/dwc2/hcd_dwc2.c index b92448685..fc748c85f 100644 --- a/src/portable/synopsys/dwc2/hcd_dwc2.c +++ b/src/portable/synopsys/dwc2/hcd_dwc2.c @@ -821,7 +821,7 @@ static void channel_xfer_in_retry(dwc2_regs_t* dwc2, uint8_t ch_id, uint32_t hci } } -#if CFG_TUSB_DEBUG +#if CFG_TUSB_DEBUG && 0 TU_ATTR_ALWAYS_INLINE static inline void print_hcint(uint32_t hcint) { const char* str[] = { "XFRC", "HALTED", "AHBERR", "STALL", diff --git a/tools/get_deps.py b/tools/get_deps.py index f11d8d51e..0d9c1a8f1 100755 --- a/tools/get_deps.py +++ b/tools/get_deps.py @@ -15,7 +15,7 @@ deps_mandatory = { '159e31b689577dbf69cf0683bbaffbd71fa5ee10', 'all'], 'tools/linkermap': ['https://github.com/hathach/linkermap.git', - '23d1c4c84c4866b84cb821fb368bb9991633871d', + '8e1f440fa15c567aceb5aa0d14f6d18c329cc67f', 'all'], 'tools/uf2': ['https://github.com/microsoft/uf2.git', 'c594542b2faa01cc33a2b97c9fbebc38549df80a', diff --git a/tools/metrics.py b/tools/metrics.py index f879a0d34..50709d5ba 100644 --- a/tools/metrics.py +++ b/tools/metrics.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -"""Calculate average sizes using bloaty output.""" +"""Calculate average sizes from bloaty CSV or TinyUSB metrics JSON outputs.""" import argparse import csv @@ -85,7 +85,7 @@ def parse_bloaty_csv(csv_text, filters=None): def combine_files(input_files, filters=None): - """Combine multiple bloaty outputs into a single data set.""" + """Combine multiple metrics inputs (bloaty CSV or metrics JSON) into a single data set.""" filters = filters or [] all_json_data = {"file_list": [], "data": []} @@ -168,12 +168,6 @@ def compute_avg(all_json_data): continue file_accumulator[fname]["symbols"][name].append(sym.get("size", 0)) sections_map = f.get("sections") or {} - if isinstance(sections_map, list): - sections_map = { - s.get("name"): s.get("size", 0) - for s in sections_map - if isinstance(s, dict) and s.get("name") - } for sname, ssize in sections_map.items(): file_accumulator[fname]["sections"][sname].append(ssize) @@ -240,6 +234,8 @@ def compare_files(base_file, new_file, filters=None): n = new_files.get(fname, {}) b_size = b.get("size", 0) n_size = n.get("size", 0) + base_sections = b.get("sections") or {} + new_sections = n.get("sections") or {} # Symbol diffs b_syms = {s["name"]: s for s in b.get("symbols", [])} @@ -256,6 +252,14 @@ def compare_files(base_file, new_file, filters=None): "file": fname, "size": {"base": b_size, "new": n_size, "diff": n_size - b_size}, "symbols": symbols, + "sections": { + name: { + "base": base_sections.get(name, 0), + "new": new_sections.get(name, 0), + "diff": new_sections.get(name, 0) - base_sections.get(name, 0), + } + for name in sorted(set(base_sections) | set(new_sections)) + }, }) total = { @@ -299,6 +303,17 @@ def get_sort_key(sort_order): return lambda x: x.get('file', ''), False +def format_diff(base, new, diff): + """Format a diff value with percentage.""" + if diff == 0: + return f"{new}" + if base == 0 or new == 0: + return f"{base} âž™ {new}" + pct = (diff / base) * 100 + sign = "+" if diff > 0 else "" + return f"{base} âž™ {new} ({sign}{diff}, {sign}{pct:.1f}%)" + + def write_json_output(json_data, path): """Write JSON output with indentation.""" @@ -315,7 +330,7 @@ def render_combine_table(json_data, sort_order='name+'): key_func, reverse = get_sort_key(sort_order) files_sorted = sorted(files, key=key_func, reverse=reverse) - total_size = json_data.get("TOTAL") or (sum(f.get("size", 0) for f in files_sorted) or 1) + total_size = json_data.get("TOTAL") or sum(f.get("size", 0) for f in files_sorted) pct_strings = [ f"{(f.get('percent') if f.get('percent') is not None else (f.get('size', 0) / total_size * 100 if total_size else 0)):.1f}%" @@ -357,12 +372,6 @@ def render_combine_table(json_data, sort_order='name+'): parts = [f"| {f.get('file', ''):<{file_width}} |"] if section_names: sections_map = f.get("sections") or {} - if isinstance(sections_map, list): - sections_map = { - s.get("name"): s.get("size", 0) - for s in sections_map - if isinstance(s, dict) and s.get("name") - } for name in section_names: parts.append(f" {sections_map.get(name, 0):>{section_widths[name]}} |") parts.append(f" {size_val:>{size_width}} | {pct_str:>{pct_width}} |") @@ -469,6 +478,7 @@ def _build_rows(files, sort_order): "new": sd['new'], "diff": diff_val, "pct": pct_str, + "sections": f.get("sections", {}), }) return rows @@ -506,59 +516,68 @@ def render_compare_table(rows, include_sum): if not rows: return ["No entries.", ""] + # collect section columns (reverse alpha) + section_names = sorted( + {name for r in rows for name in (r.get("sections") or {})}, + reverse=True, + ) + + def fmt_abs(val_old, val_new): + diff = val_new - val_old + if diff == 0: + return f"{val_new}" + sign = "+" if diff > 0 else "" + return f"{val_old} âž™ {val_new} ({sign}{diff})" + sum_base = sum(r["base"] for r in rows) sum_new = sum(r["new"] for r in rows) total_diff = sum_new - sum_base total_pct = "n/a" if sum_base == 0 else f"{(total_diff / sum_base) * 100:+.1f}%" - base_width = max(len("base"), *(len(str(r["base"])) for r in rows)) - new_width = max(len("new"), *(len(str(r["new"])) for r in rows)) - diff_width = max(len("diff"), *(len(f"{r['diff']:+}") for r in rows)) - pct_width = max(len("% diff"), *(len(r["pct"]) for r in rows)) - name_width = max(len("file"), *(len(r["file"]) for r in rows)) - - if include_sum: - base_width = max(base_width, len(str(sum_base))) - new_width = max(new_width, len(str(sum_new))) - diff_width = max(diff_width, len(f"{total_diff:+}")) - pct_width = max(pct_width, len(total_pct)) - name_width = max(name_width, len("TOTAL")) - - header = ( - f"| {'file':<{name_width}} | " - f"{'base':>{base_width}} | " - f"{'new':>{new_width}} | " - f"{'diff':>{diff_width}} | " - f"{'% diff':>{pct_width}} |" - ) - separator = ( - f"| :{'-' * (name_width - 1)} | " - f"{'-' * base_width}:| " - f"{'-' * new_width}:| " - f"{'-' * diff_width}:| " - f"{'-' * pct_width}:|" + file_width = max(len("file"), *(len(r["file"]) for r in rows), len("TOTAL")) + size_width = max( + len("size"), + *(len(fmt_abs(r["base"], r["new"])) for r in rows), + len(fmt_abs(sum_base, sum_new)), ) + pct_width = max(len("% diff"), *(len(r["pct"]) for r in rows), len(total_pct)) + section_widths = {} + for name in section_names: + max_val_len = 0 + for r in rows: + sec_entry = (r.get("sections") or {}).get(name, {"base": 0, "new": 0}) + max_val_len = max(max_val_len, len(fmt_abs(sec_entry.get("base", 0), sec_entry.get("new", 0)))) + section_widths[name] = max(len(name), max_val_len, 1) + + header_parts = [f"| {'file':<{file_width}} |"] + sep_parts = [f"| :{'-' * (file_width - 1)} |"] + for name in section_names: + header_parts.append(f" {name:>{section_widths[name]}} |") + sep_parts.append(f" {'-' * (section_widths[name] - 1)}: |") + header_parts.append(f" {'size':>{size_width}} | {'% diff':>{pct_width}} |") + sep_parts.append(f" {'-' * (size_width - 1)}: | {'-' * (pct_width - 1)}: |") + header = "".join(header_parts) + separator = "".join(sep_parts) lines = [header, separator] for r in rows: - diff_str = f"{r['diff']:+}" - lines.append( - f"| {r['file']:<{name_width}} | " - f"{str(r['base']):>{base_width}} | " - f"{str(r['new']):>{new_width}} | " - f"{diff_str:>{diff_width}} | " - f"{r['pct']:>{pct_width}} |" - ) + parts = [f"| {r['file']:<{file_width}} |"] + sections_map = r.get("sections") or {} + for name in section_names: + sec_entry = sections_map.get(name, {"base": 0, "new": 0}) + parts.append(f" {fmt_abs(sec_entry.get('base', 0), sec_entry.get('new', 0)):>{section_widths[name]}} |") + parts.append(f" {fmt_abs(r['base'], r['new']):>{size_width}} | {r['pct']:>{pct_width}} |") + lines.append("".join(parts)) if include_sum: - lines.append( - f"| {'TOTAL':<{name_width}} | " - f"{sum_base:>{base_width}} | " - f"{sum_new:>{new_width}} | " - f"{total_diff:+{diff_width}d} | " - f"{total_pct:>{pct_width}} |" - ) + total_parts = [f"| {'TOTAL':<{file_width}} |"] + for name in section_names: + total_base = sum((r.get("sections") or {}).get(name, {}).get("base", 0) for r in rows) + total_new = sum((r.get("sections") or {}).get(name, {}).get("new", 0) for r in rows) + total_parts.append(f" {fmt_abs(total_base, total_new):>{section_widths[name]}} |") + total_parts.append(f" {fmt_abs(sum_base, sum_new):>{size_width}} | {total_pct:>{pct_width}} |") + lines.append("".join(total_parts)) return lines @@ -592,9 +611,10 @@ def cmd_compare(args): if not args.quiet: print_compare_summary(comparison, args.sort) - write_compare_markdown(comparison, args.out + '.md', args.sort) - if not args.quiet: - print(f"Comparison written to {args.out}.md") + if args.markdown_out: + write_compare_markdown(comparison, args.out + '.md', args.sort) + if not args.quiet: + print(f"Comparison written to {args.out}.md") def main(argv=None): @@ -602,9 +622,9 @@ def main(argv=None): subparsers = parser.add_subparsers(dest='command', required=True, help='Available commands') # Combine subcommand - combine_parser = subparsers.add_parser('combine', help='Combine and average multiple bloaty outputs') + combine_parser = subparsers.add_parser('combine', help='Combine and average bloaty CSV outputs or metrics JSON files') combine_parser.add_argument('files', nargs='+', - help='Path to bloaty CSV output or JSON file(s) or glob pattern(s)') + help='Path to bloaty CSV output or TinyUSB metrics JSON file(s) (including linkermap-generated) or glob pattern(s)') combine_parser.add_argument('-f', '--filter', dest='filters', action='append', default=[], help='Only include compile units whose path contains this substring (can be repeated)') combine_parser.add_argument('-o', '--out', dest='out', default='metrics', @@ -620,13 +640,15 @@ def main(argv=None): help='Sort order: size/size- (descending), size+ (ascending), name/name+ (ascending), name- (descending). Default: size-') # Compare subcommand - compare_parser = subparsers.add_parser('compare', help='Compare two bloaty outputs (CSV) or JSON inputs') - compare_parser.add_argument('base', help='Base CSV/JSON file') - compare_parser.add_argument('new', help='New CSV/JSON file') + compare_parser = subparsers.add_parser('compare', help='Compare two metrics inputs (bloaty CSV or metrics JSON)') + compare_parser.add_argument('base', help='Base CSV/metrics JSON file') + compare_parser.add_argument('new', help='New CSV/metrics JSON file') compare_parser.add_argument('-f', '--filter', dest='filters', action='append', default=[], help='Only include compile units whose path contains this substring (can be repeated)') compare_parser.add_argument('-o', '--out', dest='out', default='metrics_compare', - help='Output path basename for Markdown file (default: metrics_compare)') + help='Output path basename for Markdown/JSON files (default: metrics_compare)') + compare_parser.add_argument('-m', '--markdown', dest='markdown_out', action='store_true', + help='Write Markdown output file') compare_parser.add_argument('-S', '--sort', dest='sort', default='name+', choices=['size', 'size-', 'size+', 'name', 'name-', 'name+'], help='Sort order: size/size- (descending), size+ (ascending), name/name+ (ascending), name- (descending). Default: name+') -- cgit v1.3.1 From 6b73d786b3ddddcb1fbed51909095a46d68d2449 Mon Sep 17 00:00:00 2001 From: Zhihong Chen Date: Mon, 8 Dec 2025 17:14:12 +0800 Subject: update risc-v march for gcc and clang toolchains - add `zifencei` option Signed-off-by: Zhihong Chen --- examples/build_system/cmake/cpu/rv32imac-ilp32.cmake | 4 ++-- examples/build_system/make/cpu/rv32imac-ilp32.mk | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'examples/build_system') diff --git a/examples/build_system/cmake/cpu/rv32imac-ilp32.cmake b/examples/build_system/cmake/cpu/rv32imac-ilp32.cmake index 584d90519..8c2538cee 100644 --- a/examples/build_system/cmake/cpu/rv32imac-ilp32.cmake +++ b/examples/build_system/cmake/cpu/rv32imac-ilp32.cmake @@ -1,13 +1,13 @@ if (TOOLCHAIN STREQUAL "gcc") set(TOOLCHAIN_COMMON_FLAGS - -march=rv32imac_zicsr + -march=rv32imac_zicsr_zifencei -mabi=ilp32 ) set(FREERTOS_PORT GCC_RISC_V CACHE INTERNAL "") elseif (TOOLCHAIN STREQUAL "clang") set(TOOLCHAIN_COMMON_FLAGS - -march=rv32imac_zicsr + -march=rv32imac_zicsr_zifencei -mabi=ilp32 ) set(FREERTOS_PORT GCC_RISC_V CACHE INTERNAL "") diff --git a/examples/build_system/make/cpu/rv32imac-ilp32.mk b/examples/build_system/make/cpu/rv32imac-ilp32.mk index 19c322ebc..a7b2258d7 100644 --- a/examples/build_system/make/cpu/rv32imac-ilp32.mk +++ b/examples/build_system/make/cpu/rv32imac-ilp32.mk @@ -1,11 +1,11 @@ ifeq ($(TOOLCHAIN),gcc) CFLAGS += \ - -march=rv32imac_zicsr \ + -march=rv32imac_zicsr_zifencei \ -mabi=ilp32 \ else ifeq ($(TOOLCHAIN),clang) CFLAGS += \ - -march=rv32imac_zicsr \ + -march=rv32imac_zicsr_zifencei \ -mabi=ilp32 \ else ifeq ($(TOOLCHAIN),iar) -- cgit v1.3.1 From 5a7e5db78770d6fd37992b5812f910c3546f2a72 Mon Sep 17 00:00:00 2001 From: Zixun LI Date: Tue, 16 Dec 2025 11:09:16 +0100 Subject: fix riscv toolchain Signed-off-by: Zixun LI --- examples/build_system/make/toolchain/riscv_gcc.mk | 2 +- hw/bsp/family_support.mk | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) (limited to 'examples/build_system') diff --git a/examples/build_system/make/toolchain/riscv_gcc.mk b/examples/build_system/make/toolchain/riscv_gcc.mk index 843aff38c..b5de12a83 100644 --- a/examples/build_system/make/toolchain/riscv_gcc.mk +++ b/examples/build_system/make/toolchain/riscv_gcc.mk @@ -1,7 +1,7 @@ # makefile for arm gcc toolchain # Can be set by family, default to ARM GCC -CROSS_COMPILE ?= riscv-none-embed- +CROSS_COMPILE ?= riscv-none-elf- CC = $(CROSS_COMPILE)gcc CXX = $(CROSS_COMPILE)g++ diff --git a/hw/bsp/family_support.mk b/hw/bsp/family_support.mk index db410a657..7122a7764 100644 --- a/hw/bsp/family_support.mk +++ b/hw/bsp/family_support.mk @@ -131,8 +131,21 @@ 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 +# toolchain specific - select based on CPU architecture +ifdef CPU_CORE + ifneq (,$(filter cortex% arm%,$(CPU_CORE))) + # ARM/Cortex architecture + include ${TOP}/examples/build_system/make/toolchain/arm_$(TOOLCHAIN).mk + else ifneq (,$(filter rv%,$(CPU_CORE))) + # RISC-V architecture + include ${TOP}/examples/build_system/make/toolchain/riscv_$(TOOLCHAIN).mk + else + $(error Unsupported CPU_CORE architecture: $(CPU_CORE). Must start with cortex, arm, or rv) + endif +else + # Default to ARM if CPU_CORE not specified + include ${TOP}/examples/build_system/make/toolchain/arm_$(TOOLCHAIN).mk +endif #---------------------- FreeRTOS ----------------------- FREERTOS_SRC = lib/FreeRTOS-Kernel -- cgit v1.3.1 From e2ead60107ce2e1324c7578fcee98efb8f0c5975 Mon Sep 17 00:00:00 2001 From: hathach Date: Fri, 13 Mar 2026 23:07:46 +0700 Subject: add ft9xx-gcc toolchain support to CI --- docs/reference/boards.rst | 95 ++++++++++++---------- docs/reference/dependencies.rst | 28 ++++--- examples/build_system/cmake/cpu/ft32.cmake | 13 +++ examples/build_system/cmake/cpu/rx610.cmake | 12 +++ examples/build_system/cmake/cpu/rx64m.cmake | 12 +++ .../build_system/cmake/toolchain/ft32_gcc.cmake | 22 +++++ examples/build_system/cmake/toolchain/rx_gcc.cmake | 26 ++++++ hw/bsp/hpmicro/boards/hpm6750evk2/board.h | 5 ++ 8 files changed, 160 insertions(+), 53 deletions(-) create mode 100644 examples/build_system/cmake/cpu/ft32.cmake create mode 100644 examples/build_system/cmake/cpu/rx610.cmake create mode 100644 examples/build_system/cmake/cpu/rx64m.cmake create mode 100644 examples/build_system/cmake/toolchain/ft32_gcc.cmake create mode 100644 examples/build_system/cmake/toolchain/rx_gcc.cmake (limited to 'examples/build_system') diff --git a/docs/reference/boards.rst b/docs/reference/boards.rst index e01ea9d23..ef53c66c1 100644 --- a/docs/reference/boards.rst +++ b/docs/reference/boards.rst @@ -90,6 +90,15 @@ Board Name Family URL sipeed_longan_nano Sipeed Longan Nano gd32vf103 https://longan.sipeed.com/en/ ================== ================== ========= ============================= ====== +HPMicro +------- + +=========== =========== ======== ========================================================================== ====== +Board Name Family URL Note +=========== =========== ======== ========================================================================== ====== +hpm6750evk2 HPM6750EVK2 hpmicro https://hpm-sdk.readthedocs.io/en/v1.6.0/boards/hpm6750evk2/README_en.html +=========== =========== ======== ========================================================================== ====== + Infineon -------- @@ -149,51 +158,51 @@ mm32f327x_pitaya_lite DshanMCU Pitaya Lite with MM32F3273G8P mm32 https:/ NXP --- -================== ========================================= ============= ========================================================================================================================================================================= ====== -Board Name Family URL Note -================== ========================================= ============= ========================================================================================================================================================================= ====== -metro_m7_1011 Adafruit Metro M7 1011 imxrt https://www.adafruit.com/product/5600 -metro_m7_1011_sd Adafruit Metro M7 1011 SD imxrt https://www.adafruit.com/product/5600 -mimxrt1010_evk i.MX RT1010 Evaluation Kit imxrt https://www.nxp.com/design/design-center/development-boards-and-designs/i-mx-evaluation-and-development-boards/i-mx-rt1010-evaluation-kit:MIMXRT1010-EVK -mimxrt1015_evk i.MX RT1015 Evaluation Kit imxrt https://www.nxp.com/design/design-center/development-boards-and-designs/MIMXRT1015-EVK -mimxrt1020_evk i.MX RT1020 Evaluation Kit imxrt https://www.nxp.com/design/design-center/development-boards-and-designs/MIMXRT1020-EVK -mimxrt1024_evk i.MX RT1024 Evaluation Kit imxrt https://www.nxp.com/design/design-center/development-boards-and-designs/i-mx-evaluation-and-development-boards/i-mx-rt1024-evaluation-kit:MIMXRT1024-EVK -mimxrt1050_evkb i.MX RT1050 Evaluation Kit revB imxrt https://www.nxp.com/part/IMXRT1050-EVKB -mimxrt1060_evk i.MX RT1060 Evaluation Kit revB imxrt https://www.nxp.com/design/design-center/development-boards-and-designs/MIMXRT1060-EVKB -mimxrt1064_evk i.MX RT1064 Evaluation Kit imxrt https://www.nxp.com/design/design-center/development-boards-and-designs/MIMXRT1064-EVK -mimxrt1170_evkb i.MX RT1070 Evaluation Kit imxrt https://www.nxp.com/design/design-center/development-boards-and-designs/i-mx-evaluation-and-development-boards/i-mx-rt1170-evaluation-kit:MIMXRT1170-EVKB -teensy_40 Teensy 4.0 imxrt https://www.pjrc.com/store/teensy40.html -teensy_41 Teensy 4.1 imxrt https://www.pjrc.com/store/teensy41.html -frdm_k64f Freedom K64F kinetis_k https://www.nxp.com/design/design-center/development-boards-and-designs/general-purpose-mcus/freedom-development-platform-for-kinetis-k64-k63-and-k24-mcus:FRDM-K64F -teensy_35 Teensy 3.5 kinetis_k https://www.pjrc.com/store/teensy35.html +================== ========================================= ============ ========================================================================================================================================================================= ====== +Board Name Family URL Note +================== ========================================= ============ ========================================================================================================================================================================= ====== +metro_m7_1011 Adafruit Metro M7 1011 imxrt https://www.adafruit.com/product/5600 +mimxrt1010_evk i.MX RT1010 Evaluation Kit imxrt https://www.nxp.com/design/design-center/development-boards-and-designs/i-mx-evaluation-and-development-boards/i-mx-rt1010-evaluation-kit:MIMXRT1010-EVK +mimxrt1015_evk i.MX RT1015 Evaluation Kit imxrt https://www.nxp.com/design/design-center/development-boards-and-designs/MIMXRT1015-EVK +mimxrt1020_evk i.MX RT1020 Evaluation Kit imxrt https://www.nxp.com/design/design-center/development-boards-and-designs/MIMXRT1020-EVK +mimxrt1024_evk i.MX RT1024 Evaluation Kit imxrt https://www.nxp.com/design/design-center/development-boards-and-designs/i-mx-evaluation-and-development-boards/i-mx-rt1024-evaluation-kit:MIMXRT1024-EVK +mimxrt1050_evkb i.MX RT1050 Evaluation Kit revB imxrt https://www.nxp.com/part/IMXRT1050-EVKB +mimxrt1060_evk i.MX RT1060 Evaluation Kit revB imxrt https://www.nxp.com/design/design-center/development-boards-and-designs/MIMXRT1060-EVKB +mimxrt1064_evk i.MX RT1064 Evaluation Kit imxrt https://www.nxp.com/design/design-center/development-boards-and-designs/MIMXRT1064-EVK +mimxrt1170_evkb i.MX RT1070 Evaluation Kit imxrt https://www.nxp.com/design/design-center/development-boards-and-designs/i-mx-evaluation-and-development-boards/i-mx-rt1170-evaluation-kit:MIMXRT1170-EVKB +teensy_40 Teensy 4.0 imxrt https://www.pjrc.com/store/teensy40.html +teensy_41 Teensy 4.1 imxrt https://www.pjrc.com/store/teensy41.html +frdm_k64f Freedom K64F kinetis_k https://www.nxp.com/design/design-center/development-boards-and-designs/general-purpose-mcus/freedom-development-platform-for-kinetis-k64-k63-and-k24-mcus:FRDM-K64F +teensy_35 Teensy 3.5 kinetis_k https://www.pjrc.com/store/teensy35.html frdm_k32l2a4s Freedom K32L2A4S kinetis_k32l https://www.nxp.com/design/design-center/development-boards-and-designs/FRDM-K32L2A4S frdm_k32l2b Freedom K32L2B3 kinetis_k32l https://www.nxp.com/design/design-center/development-boards-and-designs/general-purpose-mcus/nxp-freedom-development-platform-for-k32-l2b-mcus:FRDM-K32L2B3 kuiic Kuiic kinetis_k32l https://github.com/nxf58843/kuiic -frdm_kl25z fomu kinetis_kl https://www.nxp.com/design/design-center/development-boards-and-designs/general-purpose-mcus/freedom-development-platform-for-kinetis-kl14-kl15-kl24-kl25-mcus:FRDM-KL25Z -lpcxpresso11u37 LPCXpresso11U37 lpc11 https://www.nxp.com/design/design-center/development-boards-and-designs/OM13074 -lpcxpresso11u68 LPCXpresso11U68 lpc11 https://www.nxp.com/design/design-center/development-boards-and-designs/OM13058 -lpcxpresso1347 LPCXpresso1347 lpc13 https://www.nxp.com/products/no-longer-manufactured/lpcxpresso-board-for-lpc1347:OM13045 -lpcxpresso1549 LPCXpresso1549 lpc15 https://www.nxp.com/design/design-center/development-boards-and-designs/OM13056 -lpcxpresso1769 LPCXpresso1769 lpc17 https://www.nxp.com/design/design-center/development-boards-and-designs/OM13000 -mbed1768 mbed 1768 lpc17 https://www.nxp.com/products/processors-and-microcontrollers/arm-microcontrollers/general-purpose-mcus/lpc1700-arm-cortex-m3/arm-mbed-lpc1768-board:OM11043 -lpcxpresso18s37 LPCXpresso18s37 lpc18 https://www.nxp.com/design/design-center/software/development-software/mcuxpresso-software-and-tools-/lpcxpresso-boards/lpcxpresso18s37-development-board:OM13076 -mcb1800 Keil MCB1800 lpc18 https://www.keil.com/arm/mcb1800/ -ea4088_quickstart Embedded Artists LPC4088 QuickStart Board lpc40 https://www.embeddedartists.com/products/lpc4088-quickstart-board/ -ea4357 Embedded Artists LPC4357 Development Kit lpc43 https://www.embeddedartists.com/products/lpc4357-developers-kit/ -lpcxpresso43s67 LPCXpresso43S67 lpc43 https://www.nxp.com/design/design-center/software/development-software/mcuxpresso-software-and-tools-/lpcxpresso-boards/lpcxpresso43s67-development-board:OM13084 -lpcxpresso51u68 LPCXpresso51u68 lpc51 https://www.nxp.com/products/processors-and-microcontrollers/arm-microcontrollers/general-purpose-mcus/lpcxpresso51u68-for-the-lpc51u68-mcus:OM40005 -lpcxpresso54114 LPCXpresso54114 lpc54 https://www.nxp.com/design/design-center/software/development-software/mcuxpresso-software-and-tools-/lpcxpresso-boards/lpcxpresso54114-board:OM13089 -lpcxpresso54608 LPCXpresso54608 lpc54 https://www.nxp.com/design/design-center/software/development-software/mcuxpresso-software-and-tools-/lpcxpresso-development-board-for-lpc5460x-mcus:OM13092 -lpcxpresso54628 LPCXpresso54628 lpc54 https://www.nxp.com/design/design-center/software/development-software/mcuxpresso-software-and-tools-/lpcxpresso-boards/lpcxpresso54628-development-board:OM13098 -double_m33_express Double M33 Express lpc55 https://www.crowdsupply.com/steiert-solutions/double-m33-express -lpcxpresso55s28 LPCXpresso55s28 lpc55 https://www.nxp.com/design/design-center/software/development-software/mcuxpresso-software-and-tools-/lpcxpresso-boards/lpcxpresso55s28-development-board:LPC55S28-EVK -lpcxpresso55s69 LPCXpresso55s69 lpc55 https://www.nxp.com/design/design-center/software/development-software/mcuxpresso-software-and-tools-/lpcxpresso-boards/lpcxpresso55s69-development-board:LPC55S69-EVK -mcu_link MCU Link lpc55 https://www.nxp.com/design/design-center/software/development-software/mcuxpresso-software-and-tools-/mcu-link-debug-probe:MCU-LINK -frdm_mcxa153 Freedom MCXA153 mcx https://www.nxp.com/design/design-center/development-boards-and-designs/FRDM-MCXA153 -frdm_mcxa156 Freedom MCXA156 mcx https://www.nxp.com/design/design-center/development-boards-and-designs/FRDM-MCXA156 -frdm_mcxn947 Freedom MCXN947 mcx https://www.nxp.com/design/design-center/development-boards-and-designs/FRDM-MCXN947 -mcxn947brk MCXN947 Breakout mcx n/a -================== ========================================= ============= ========================================================================================================================================================================= ====== +frdm_kl25z fomu kinetis_kl https://www.nxp.com/design/design-center/development-boards-and-designs/general-purpose-mcus/freedom-development-platform-for-kinetis-kl14-kl15-kl24-kl25-mcus:FRDM-KL25Z +lpcxpresso11u37 LPCXpresso11U37 lpc11 https://www.nxp.com/design/design-center/development-boards-and-designs/OM13074 +lpcxpresso11u68 LPCXpresso11U68 lpc11 https://www.nxp.com/design/design-center/development-boards-and-designs/OM13058 +lpcxpresso1347 LPCXpresso1347 lpc13 https://www.nxp.com/products/no-longer-manufactured/lpcxpresso-board-for-lpc1347:OM13045 +lpcxpresso1549 LPCXpresso1549 lpc15 https://www.nxp.com/design/design-center/development-boards-and-designs/OM13056 +lpcxpresso1769 LPCXpresso1769 lpc17 https://www.nxp.com/design/design-center/development-boards-and-designs/OM13000 +mbed1768 mbed 1768 lpc17 https://www.nxp.com/products/processors-and-microcontrollers/arm-microcontrollers/general-purpose-mcus/lpc1700-arm-cortex-m3/arm-mbed-lpc1768-board:OM11043 +lpcxpresso18s37 LPCXpresso18s37 lpc18 https://www.nxp.com/design/design-center/software/development-software/mcuxpresso-software-and-tools-/lpcxpresso-boards/lpcxpresso18s37-development-board:OM13076 +mcb1800 Keil MCB1800 lpc18 https://www.keil.com/arm/mcb1800/ +ea4088_quickstart Embedded Artists LPC4088 QuickStart Board lpc40 https://www.embeddedartists.com/products/lpc4088-quickstart-board/ +ea4357 Embedded Artists LPC4357 Development Kit lpc43 https://www.embeddedartists.com/products/lpc4357-developers-kit/ +lpcxpresso43s67 LPCXpresso43S67 lpc43 https://www.nxp.com/design/design-center/software/development-software/mcuxpresso-software-and-tools-/lpcxpresso-boards/lpcxpresso43s67-development-board:OM13084 +lpcxpresso51u68 LPCXpresso51u68 lpc51 https://www.nxp.com/products/processors-and-microcontrollers/arm-microcontrollers/general-purpose-mcus/lpcxpresso51u68-for-the-lpc51u68-mcus:OM40005 +lpcxpresso54114 LPCXpresso54114 lpc54 https://www.nxp.com/design/design-center/software/development-software/mcuxpresso-software-and-tools-/lpcxpresso-boards/lpcxpresso54114-board:OM13089 +lpcxpresso54608 LPCXpresso54608 lpc54 https://www.nxp.com/design/design-center/software/development-software/mcuxpresso-software-and-tools-/lpcxpresso-development-board-for-lpc5460x-mcus:OM13092 +lpcxpresso54628 LPCXpresso54628 lpc54 https://www.nxp.com/design/design-center/software/development-software/mcuxpresso-software-and-tools-/lpcxpresso-boards/lpcxpresso54628-development-board:OM13098 +double_m33_express Double M33 Express lpc55 https://www.crowdsupply.com/steiert-solutions/double-m33-express +lpcxpresso55s28 LPCXpresso55s28 lpc55 https://www.nxp.com/design/design-center/software/development-software/mcuxpresso-software-and-tools-/lpcxpresso-boards/lpcxpresso55s28-development-board:LPC55S28-EVK +lpcxpresso55s69 LPCXpresso55s69 lpc55 https://www.nxp.com/design/design-center/software/development-software/mcuxpresso-software-and-tools-/lpcxpresso-boards/lpcxpresso55s69-development-board:LPC55S69-EVK +mcu_link MCU Link lpc55 https://www.nxp.com/design/design-center/software/development-software/mcuxpresso-software-and-tools-/mcu-link-debug-probe:MCU-LINK +frdm_mcxa153 Freedom MCXA153 mcx https://www.nxp.com/design/design-center/development-boards-and-designs/FRDM-MCXA153 +frdm_mcxa156 Freedom MCXA156 mcx https://www.nxp.com/design/design-center/development-boards-and-designs/FRDM-MCXA156 +frdm_mcxn947 Freedom MCXN947 mcx https://www.nxp.com/design/design-center/development-boards-and-designs/FRDM-MCXN947 +mcxn947brk MCXN947 Breakout mcx n/a +frdm_rw612 FRDM-RW612 rw61x https://www.nxp.com/design/design-center/development-boards-and-designs/FRDM-RW612 +================== ========================================= ============ ========================================================================================================================================================================= ====== Nordic Semiconductor -------------------- @@ -292,7 +301,7 @@ stm32h723nucleo STM32 H723 Nucleo stm32h7 https://www.s stm32h743eval STM32 H743 Eval stm32h7 https://www.st.com/en/evaluation-tools/stm32h743i-eval.html stm32h743nucleo STM32 H743 Nucleo stm32h7 https://www.st.com/en/evaluation-tools/nucleo-h743zi.html stm32h745disco STM32 H745 Discovery stm32h7 https://www.st.com/en/evaluation-tools/stm32h745i-disco.html -stm32h747disco STM32 H747 Discovery stm32h7 https://www.st.com/en/evaluation-tools/stm32h747i-disco.html +stm32h747disco STM32 H745 Discovery stm32h7 https://www.st.com/en/evaluation-tools/stm32h745i-disco.html stm32h750_weact STM32 H750 WeAct stm32h7 https://www.adafruit.com/product/5032 stm32h750bdk STM32 H750b Discovery Kit stm32h7 https://www.st.com/en/evaluation-tools/stm32h750b-dk.html waveshare_openh743i Waveshare Open H743i stm32h7 https://www.waveshare.com/openh743i-c-standard.htm diff --git a/docs/reference/dependencies.rst b/docs/reference/dependencies.rst index 16a43f479..450ec6a25 100644 --- a/docs/reference/dependencies.rst +++ b/docs/reference/dependencies.rst @@ -4,9 +4,9 @@ Dependencies MCU low-level peripheral drivers and external libraries for building TinyUSB examples -======================================== ================================================================ ======================================== ============================================================================================================================================================================================================================================================================================================================================================== +======================================== ================================================================ ======================================== =================================================================================================================================================================================================================================================================================================================================================== Local Path Repo Commit Required by -======================================== ================================================================ ======================================== ============================================================================================================================================================================================================================================================================================================================================================== +======================================== ================================================================ ======================================== =================================================================================================================================================================================================================================================================================================================================================== hw/mcu/allwinner https://github.com/hathach/allwinner_driver.git 8e5e89e8e132c0fd90e72d5422e5d3d68232b756 fc100s hw/mcu/analog/msdk https://github.com/analogdevicesinc/msdk.git b20b398d3e5e2007594e54a74ba3d2a2e50ddd75 maxim hw/mcu/artery/at32f402_405 https://github.com/ArteryTek/AT32F402_405_Firmware_Library.git 4424515c2663e82438654e0947695295df2abdfe at32f402_405 @@ -17,16 +17,22 @@ hw/mcu/artery/at32f423 https://github.com/ArteryTek/AT32F423_ hw/mcu/artery/at32f425 https://github.com/ArteryTek/AT32F425_Firmware_Library.git 620233e1357d5c1b7e2bde6b9dd5196822b91817 at32f425 hw/mcu/artery/at32f435_437 https://github.com/ArteryTek/AT32F435_437_Firmware_Library.git 25439cc6650a8ae0345934e8707a5f38c7ae41f8 at32f435_437 hw/mcu/artery/at32f45x https://github.com/ArteryTek/AT32F45x_Firmware_Library.git 3d4a1b38be8ebac292e2350ca53bc4bfa4430233 at32f45x -hw/mcu/bridgetek/ft9xx/ft90x-sdk https://github.com/BRTSG-FOSS/ft90x-sdk.git 91060164afe239fcb394122e8bf9eb24d3194eb1 ft9xx +hw/mcu/bridgetek/ft9xx/ft90x-sdk https://github.com/BRTSG-FOSS/ft90x-sdk.git 03f74eac84645178fdde7f2e5ca9acdcb7bd9dcd ft9xx hw/mcu/broadcom https://github.com/adafruit/broadcom-peripherals.git 08370086080759ed54ac1136d62d2ad24c6fa267 broadcom_32bit broadcom_64bit hw/mcu/gd/nuclei-sdk https://github.com/Nuclei-Software/nuclei-sdk.git 7eb7bfa9ea4fbeacfafe1d5f77d5a0e6ed3922e7 gd32vf103 +hw/mcu/hpmicro/hpm_sdk https://github.com/hpmicro/hpm_sdk 8d2af741ecc4aaa82d7ee395dc1ce25d7070c3ff hpmicro hw/mcu/infineon/mtb-xmclib-cat3 https://github.com/Infineon/mtb-xmclib-cat3.git daf5500d03cba23e68c2f241c30af79cd9d63880 xmc4000 -hw/mcu/microchip https://github.com/hathach/microchip_driver.git 9e8b37e307d8404033bb881623a113931e1edf27 sam3x samd11 samd21 samd51 samd5x_e5x same5x same7x saml2x samg +hw/mcu/microchip https://github.com/hathach/microchip_driver.git 9e8b37e307d8404033bb881623a113931e1edf27 sam3x samd11 samd21 samd51 samd5x_e5x same5x same7x samd2x_l2x samg hw/mcu/mindmotion/mm32sdk https://github.com/hathach/mm32sdk.git b93e856211060ae825216c6a1d6aa347ec758843 mm32 hw/mcu/nordic/nrfx https://github.com/NordicSemiconductor/nrfx.git 11f57e578c7feea13f21c79ea0efab2630ac68c7 nrf hw/mcu/nuvoton https://github.com/majbthrd/nuc_driver.git 2204191ec76283371419fbcec207da02e1bc22fa nuc100_120 nuc121_125 nuc126 nuc505 hw/mcu/nxp/lpcopen https://github.com/hathach/nxp_lpcopen.git b41cf930e65c734d8ec6de04f1d57d46787c76ae lpc11 lpc13 lpc15 lpc17 lpc18 lpc40 lpc43 -hw/mcu/nxp/mcux-sdk https://github.com/nxp-mcuxpresso/mcux-sdk a1bdae309a14ec95a4f64a96d3315a4f89c397c6 kinetis_k kinetis_k32l kinetis_kl lpc51 lpc54 lpc55 mcx imxrt +hw/mcu/nxp/mcux-devices-kinetis https://github.com/nxp-mcuxpresso/mcux-devices-kinetis 98a155e666c54f396e528ec3131f27a5d5b71f76 kinetis_k32l +hw/mcu/nxp/mcux-devices-lpc https://github.com/nxp-mcuxpresso/mcux-devices-lpc 8096b783ec09d0d1c8629025a5f9d8e7df26e520 lpc51 lpc55 +hw/mcu/nxp/mcux-devices-mcx https://github.com/nxp-mcuxpresso/mcux-devices-mcx ada1c97c761123ec0c179bb9bb9f744bf9a11475 mcx +hw/mcu/nxp/mcux-devices-rt https://github.com/nxp-mcuxpresso/mcux-devices-rt dba2b523c9df61f3330bd186242f8210a8e47c45 imxrt +hw/mcu/nxp/mcux-sdk https://github.com/nxp-mcuxpresso/mcux-sdk a1bdae309a14ec95a4f64a96d3315a4f89c397c6 kinetis_k kinetis_kl lpc54 rw61x +hw/mcu/nxp/mcuxsdk-core https://github.com/nxp-mcuxpresso/mcuxsdk-core 0c5c6b16deb211110e06bde896cdff59ab213e16 imxrt kinetis_k32l lpc51 lpc55 mcx hw/mcu/raspberry_pi/Pico-PIO-USB https://github.com/sekigon-gonnoc/Pico-PIO-USB.git 675543bcc9baa8170f868ab7ba316d418dbcf41f rp2040 hw/mcu/renesas/fsp https://github.com/renesas/fsp.git edcc97d684b6f716728a60d7a6fea049d9870bd6 ra hw/mcu/renesas/rx https://github.com/kkitayam/rx_device.git 706b4e0cf485605c32351e2f90f5698267996023 rx @@ -54,7 +60,7 @@ hw/mcu/st/cmsis_device_n6 https://github.com/STMicroelectronics/ hw/mcu/st/cmsis_device_u5 https://github.com/STMicroelectronics/cmsis_device_u5.git 6e67187dec98035893692ab2923914cb5f4e0117 stm32u5 hw/mcu/st/cmsis_device_wb https://github.com/STMicroelectronics/cmsis_device_wb.git cda2cb9fc4a5232ab18efece0bb06b0b60910083 stm32wb hw/mcu/st/stm32-mfxstm32l152 https://github.com/STMicroelectronics/stm32-mfxstm32l152.git 7f4389efee9c6a655b55e5df3fceef5586b35f9b stm32h7 -hw/mcu/st/stm32-tcpp0203 https://github.com/STMicroelectronics/stm32-tcpp0203.git 9918655bff176ac3046ccf378b5c7bbbc6a38d15 stm32h7rs stm32n6 +hw/mcu/st/stm32-tcpp0203 https://github.com/STMicroelectronics/stm32-tcpp0203.git 9918655bff176ac3046ccf378b5c7bbbc6a38d15 stm32h5 stm32h7rs stm32n6 hw/mcu/st/stm32c0xx_hal_driver https://github.com/STMicroelectronics/stm32c0xx_hal_driver.git c283b143bef6bdaacf64240ee6f15eb61dad6125 stm32c0 hw/mcu/st/stm32f0xx_hal_driver https://github.com/STMicroelectronics/stm32f0xx_hal_driver.git 94399697cb5eeaf8511b81b7f50dc62f0a5a3f6c stm32f0 hw/mcu/st/stm32f1xx_hal_driver https://github.com/STMicroelectronics/stm32f1xx_hal_driver.git 18074e3e5ecad0b380a5cf5a9131fe4b5ed1b2b7 stm32f1 @@ -76,15 +82,17 @@ hw/mcu/st/stm32u0xx_hal_driver https://github.com/STMicroelectronics/ hw/mcu/st/stm32u5xx_hal_driver https://github.com/STMicroelectronics/stm32u5xx_hal_driver.git 2c5e2568fbdb1900a13ca3b2901fdd302cac3444 stm32u5 hw/mcu/st/stm32wbaxx_hal_driver https://github.com/STMicroelectronics/stm32wbaxx_hal_driver.git 9442fbb71f855ff2e64fbf662b7726beba511a24 stm32wba hw/mcu/st/stm32wbxx_hal_driver https://github.com/STMicroelectronics/stm32wbxx_hal_driver.git d60dd46996876506f1d2e9abd6b1cc110c8004cd stm32wb -hw/mcu/ti https://github.com/hathach/ti_driver.git 143ed6cc20a7615d042b03b21e070197d473e6e5 msp430 msp432e4 tm4c +hw/mcu/ti https://github.com/hathach/ti_driver.git 083944907e7d08fcb1f614b47598ce45935b8da1 msp430 msp432e4 tm4c hw/mcu/wch/ch32f20x https://github.com/openwch/ch32f20x.git 77c4095087e5ed2c548ec9058e655d0b8757663b ch32f20x hw/mcu/wch/ch32v103 https://github.com/openwch/ch32v103.git 7578cae0b21f86dd053a1f781b2fc6ab99d0ec17 ch32v10x hw/mcu/wch/ch32v20x https://github.com/openwch/ch32v20x.git c4c38f507e258a4e69b059ccc2dc27dde33cea1b ch32v20x hw/mcu/wch/ch32v307 https://github.com/openwch/ch32v307.git 184f21b852cb95eed58e86e901837bc9fff68775 ch32v30x -lib/CMSIS_5 https://github.com/ARM-software/CMSIS_5.git 2b7495b8535bdcb306dac29b9ded4cfb679d7e5c imxrt kinetis_k32l kinetis_kl lpc51 lpc54 lpc55 mcx mm32 msp432e4 nrf saml2x lpc11 lpc13 lpc15 lpc17 lpc18 lpc40 lpc43 stm32c0 stm32f0 stm32f1 stm32f2 stm32f3 stm32f4 stm32f7 stm32g0 stm32g4 stm32h5 stm32h7 stm32h7rs stm32l0 stm32l1 stm32l4 stm32l5 stm32u0 stm32u5 stm32wb stm32wbasam3x samd11 samd21 samd51 samd5x_e5x same5x same7x saml2x samg tm4c -lib/CMSIS_6 https://github.com/ARM-software/CMSIS_6.git 6f0a58d01aa9bd2feba212097f9afe7acd991d52 ra stm32n6 +lib/CMSIS_5 https://github.com/ARM-software/CMSIS_5.git 2b7495b8535bdcb306dac29b9ded4cfb679d7e5c kinetis_k kinetis_kl lpc54 rw61x mm32 msp432e4 nrf samd2x_l2x lpc11 lpc13 lpc15 lpc17 lpc18 lpc40 lpc43 stm32c0 stm32f0 stm32f1 stm32f2 stm32f3 stm32f4 stm32f7 stm32g0 stm32g4 stm32h5 stm32h7 stm32h7rs stm32l0 stm32l1 stm32l4 stm32l5 stm32u0 stm32u5 stm32wb stm32wba sam3x samd11 samd21 samd51 samd5x_e5x same5x same7x samd2x_l2x samg tm4c +lib/CMSIS_6 https://github.com/ARM-software/CMSIS_6.git 6f0a58d01aa9bd2feba212097f9afe7acd991d52 imxrt kinetis_k32l ra stm32n6 lpc51 lpc55 mcx lib/FreeRTOS-Kernel https://github.com/FreeRTOS/FreeRTOS-Kernel.git cc0e0707c0c748713485b870bb980852b210877f all lib/lwip https://github.com/lwip-tcpip/lwip.git 159e31b689577dbf69cf0683bbaffbd71fa5ee10 all lib/sct_neopixel https://github.com/gsteiert/sct_neopixel.git e73e04ca63495672d955f9268e003cffe168fcd8 lpc55 +lib/threadx https://github.com/eclipse-threadx/threadx.git 4b6e8100d932a3a67b34c6eb17f84f3bffb9e2ae all +tools/linkermap https://github.com/hathach/linkermap.git 8e1f440fa15c567aceb5aa0d14f6d18c329cc67f all tools/uf2 https://github.com/microsoft/uf2.git c594542b2faa01cc33a2b97c9fbebc38549df80a all -======================================== ================================================================ ======================================== ============================================================================================================================================================================================================================================================================================================================================================== +======================================== ================================================================ ======================================== =================================================================================================================================================================================================================================================================================================================================================== diff --git a/examples/build_system/cmake/cpu/ft32.cmake b/examples/build_system/cmake/cpu/ft32.cmake new file mode 100644 index 000000000..13153e555 --- /dev/null +++ b/examples/build_system/cmake/cpu/ft32.cmake @@ -0,0 +1,13 @@ +if (TOOLCHAIN STREQUAL "gcc") + set(TOOLCHAIN_COMMON_FLAGS + -fvar-tracking + -fvar-tracking-assignments + ) + +elseif (TOOLCHAIN STREQUAL "clang") + message(FATAL_ERROR "Clang is not supported for this target") + +elseif (TOOLCHAIN STREQUAL "iar") + message(FATAL_ERROR "IAR is not supported for this target") + +endif () diff --git a/examples/build_system/cmake/cpu/rx610.cmake b/examples/build_system/cmake/cpu/rx610.cmake new file mode 100644 index 000000000..6f535275d --- /dev/null +++ b/examples/build_system/cmake/cpu/rx610.cmake @@ -0,0 +1,12 @@ +if (NOT DEFINED TOOLCHAIN OR TOOLCHAIN STREQUAL "gcc") + set(TOOLCHAIN_COMMON_FLAGS + -mcpu=rx610 + -misa=v1 + -mlittle-endian-data + -fshort-enums + ) + set(FREERTOS_PORT GCC_RX600 CACHE INTERNAL "") + +else () + message(FATAL_ERROR "Toolchain ${TOOLCHAIN} is not supported for RX") +endif () diff --git a/examples/build_system/cmake/cpu/rx64m.cmake b/examples/build_system/cmake/cpu/rx64m.cmake new file mode 100644 index 000000000..2b106ea00 --- /dev/null +++ b/examples/build_system/cmake/cpu/rx64m.cmake @@ -0,0 +1,12 @@ +if (NOT DEFINED TOOLCHAIN OR TOOLCHAIN STREQUAL "gcc") + set(TOOLCHAIN_COMMON_FLAGS + -mcpu=rx64m + -misa=v2 + -mlittle-endian-data + -fshort-enums + ) + set(FREERTOS_PORT GCC_RX600 CACHE INTERNAL "") + +else () + message(FATAL_ERROR "Toolchain ${TOOLCHAIN} is not supported for RX") +endif () diff --git a/examples/build_system/cmake/toolchain/ft32_gcc.cmake b/examples/build_system/cmake/toolchain/ft32_gcc.cmake new file mode 100644 index 000000000..edf8048ab --- /dev/null +++ b/examples/build_system/cmake/toolchain/ft32_gcc.cmake @@ -0,0 +1,22 @@ +if (NOT DEFINED CMAKE_C_COMPILER) + set(CMAKE_C_COMPILER "ft32-elf-gcc") +endif () + +if (NOT DEFINED CMAKE_CXX_COMPILER) + set(CMAKE_CXX_COMPILER "ft32-elf-g++") +endif () + +set(CMAKE_ASM_COMPILER ${CMAKE_C_COMPILER}) + +find_program(CMAKE_SIZE ft32-elf-size) +find_program(CMAKE_OBJCOPY ft32-elf-objcopy) +find_program(CMAKE_OBJDUMP ft32-elf-objdump) + +include(${CMAKE_CURRENT_LIST_DIR}/common.cmake) + +get_property(IS_IN_TRY_COMPILE GLOBAL PROPERTY IN_TRY_COMPILE) +if (IS_IN_TRY_COMPILE) + set(CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} -nostdlib") + set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -nostdlib") + cmake_print_variables(CMAKE_C_LINK_FLAGS) +endif () diff --git a/examples/build_system/cmake/toolchain/rx_gcc.cmake b/examples/build_system/cmake/toolchain/rx_gcc.cmake new file mode 100644 index 000000000..3f8e3662e --- /dev/null +++ b/examples/build_system/cmake/toolchain/rx_gcc.cmake @@ -0,0 +1,26 @@ +# Cross Compiler for RX +if (NOT DEFINED CROSS_COMPILE) + set(CROSS_COMPILE "rx-elf-") +endif () + +if (NOT DEFINED CMAKE_C_COMPILER) + set(CMAKE_C_COMPILER ${CROSS_COMPILE}gcc) +endif () + +if (NOT DEFINED CMAKE_CXX_COMPILER) + set(CMAKE_CXX_COMPILER ${CROSS_COMPILE}g++) +endif () + +set(CMAKE_ASM_COMPILER ${CMAKE_C_COMPILER}) +find_program(CMAKE_SIZE ${CROSS_COMPILE}size) +find_program(CMAKE_OBJCOPY ${CROSS_COMPILE}objcopy) +find_program(CMAKE_OBJDUMP ${CROSS_COMPILE}objdump) + +include(${CMAKE_CURRENT_LIST_DIR}/common.cmake) + +get_property(IS_IN_TRY_COMPILE GLOBAL PROPERTY IN_TRY_COMPILE) +if (IS_IN_TRY_COMPILE) + set(CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} -nostdlib") + set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -nostdlib") + cmake_print_variables(CMAKE_C_LINK_FLAGS) +endif () diff --git a/hw/bsp/hpmicro/boards/hpm6750evk2/board.h b/hw/bsp/hpmicro/boards/hpm6750evk2/board.h index 0636a4722..929e11c0d 100644 --- a/hw/bsp/hpmicro/boards/hpm6750evk2/board.h +++ b/hw/bsp/hpmicro/boards/hpm6750evk2/board.h @@ -5,6 +5,11 @@ * */ +/* metadata: + name: HPM6750EVK2 + url: https://hpm-sdk.readthedocs.io/en/v1.6.0/boards/hpm6750evk2/README_en.html +*/ + #ifndef _HPM_BOARD_H #define _HPM_BOARD_H -- cgit v1.3.1 From 4c7a9fed96e0a81cc640333c1c82fee54fa4be34 Mon Sep 17 00:00:00 2001 From: hathach Date: Thu, 19 Mar 2026 22:23:47 +0700 Subject: remove IAR toolchain support from make build system IAR is only supported with CMake. Remove all IAR-specific references from the Make build system including toolchain files, SRC_S_IAR, LD_FILE_IAR variables, and IAR toolchain detection. Also fix GET_SECTOR_COUNT truncation in msc_file_explorer and broken formatting in stm32f7 board_uart_write. Co-Authored-By: Claude Opus 4.6 (1M context) --- examples/build_system/make/cpu/arm1176jzf-s.mk | 4 -- examples/build_system/make/cpu/arm926ej-s.mk | 4 -- examples/build_system/make/cpu/cortex-a53.mk | 7 ---- examples/build_system/make/cpu/cortex-a72.mk | 7 ---- examples/build_system/make/cpu/cortex-m0.mk | 5 --- examples/build_system/make/cpu/cortex-m0plus.mk | 5 --- examples/build_system/make/cpu/cortex-m23.mk | 5 --- examples/build_system/make/cpu/cortex-m3.mk | 5 --- .../build_system/make/cpu/cortex-m33-nodsp-nofp.mk | 7 ---- examples/build_system/make/cpu/cortex-m33.mk | 9 ----- examples/build_system/make/cpu/cortex-m4-nofpu.mk | 4 -- examples/build_system/make/cpu/cortex-m4.mk | 4 -- examples/build_system/make/cpu/cortex-m55.mk | 9 ----- examples/build_system/make/cpu/cortex-m7-fpsp.mk | 9 ----- examples/build_system/make/cpu/cortex-m7.mk | 9 ----- examples/build_system/make/cpu/cortex-m85.mk | 9 ----- examples/build_system/make/cpu/msp430.mk | 2 - examples/build_system/make/cpu/rv32i-ilp32.mk | 2 - examples/build_system/make/cpu/rv32imac-ilp32.mk | 3 -- examples/build_system/make/toolchain/arm_iar.mk | 13 ------- examples/build_system/make/toolchain/gcc_rules.mk | 11 +----- examples/build_system/make/toolchain/iar_rules.mk | 44 ---------------------- examples/device/net_lwip_webserver/Makefile | 2 +- examples/dual/host_hid_to_device_cdc/Makefile | 2 +- examples/dual/host_info_to_device_cdc/Makefile | 2 +- examples/host/msc_file_explorer/Makefile | 2 +- examples/host/msc_file_explorer/src/msc_app.c | 2 +- hw/bsp/at32f402_405/family.mk | 10 ++--- hw/bsp/at32f403a_407/family.mk | 10 ++--- hw/bsp/at32f413/family.mk | 10 ++--- hw/bsp/at32f415/family.mk | 10 ++--- hw/bsp/at32f423/family.mk | 10 ++--- hw/bsp/at32f425/family.mk | 10 ++--- hw/bsp/at32f435_437/family.mk | 10 ++--- hw/bsp/at32f45x/family.mk | 10 ++--- hw/bsp/broadcom_32bit/family.mk | 2 +- hw/bsp/broadcom_64bit/family.mk | 2 +- hw/bsp/ch32v10x/family.mk | 2 +- hw/bsp/ch32v20x/family.mk | 2 +- hw/bsp/ch32v30x/family.mk | 2 +- hw/bsp/cxd56/family.mk | 2 +- hw/bsp/da1469x/family.mk | 2 +- hw/bsp/efm32/family.mk | 2 +- hw/bsp/family_support.mk | 12 +++--- hw/bsp/fomu/family.mk | 2 +- hw/bsp/hpmicro/family.mk | 2 +- hw/bsp/imxrt/family.mk | 2 +- hw/bsp/kinetis_k/family.mk | 2 +- hw/bsp/kinetis_k32l/boards/frdm_k32l2a4s/board.mk | 2 +- hw/bsp/kinetis_k32l/family.mk | 2 +- hw/bsp/kinetis_kl/family.mk | 2 +- hw/bsp/lpc11/family.mk | 2 +- hw/bsp/lpc13/family.mk | 2 +- hw/bsp/lpc15/family.mk | 4 +- hw/bsp/lpc17/family.mk | 4 +- hw/bsp/lpc18/family.mk | 4 +- hw/bsp/lpc40/family.mk | 4 +- hw/bsp/lpc43/family.mk | 4 +- hw/bsp/lpc51/family.mk | 2 +- hw/bsp/lpc54/family.mk | 2 +- hw/bsp/lpc55/family.mk | 2 +- hw/bsp/maxim/family.mk | 6 +-- hw/bsp/mcx/family.mk | 2 +- hw/bsp/mm32/family.mk | 2 +- hw/bsp/msp432e4/family.mk | 2 +- hw/bsp/nrf/family.mk | 4 +- hw/bsp/nuc100_120/family.mk | 2 +- hw/bsp/nuc121_125/family.mk | 2 +- hw/bsp/nuc126/family.mk | 2 +- hw/bsp/nuc505/family.mk | 2 +- hw/bsp/ra/family.mk | 4 +- hw/bsp/rw61x/family.mk | 2 +- hw/bsp/rx/family.mk | 2 +- hw/bsp/samd11/family.mk | 2 +- hw/bsp/samd2x_l2x/family.mk | 2 +- hw/bsp/samd5x_e5x/family.mk | 2 +- hw/bsp/same7x/family.mk | 2 +- hw/bsp/samg/family.mk | 2 +- hw/bsp/stm32c0/boards/stm32c071nucleo/board.mk | 7 +--- hw/bsp/stm32c0/family.mk | 6 +-- hw/bsp/stm32f0/boards/stm32f070rbnucleo/board.mk | 2 +- hw/bsp/stm32f0/boards/stm32f072disco/board.mk | 2 +- hw/bsp/stm32f0/boards/stm32f072eval/board.mk | 2 +- hw/bsp/stm32f0/family.mk | 10 ++--- hw/bsp/stm32f1/boards/stm32f103_bluepill/board.mk | 3 +- hw/bsp/stm32f1/boards/stm32f103_mini_2/board.mk | 3 +- hw/bsp/stm32f1/boards/stm32f103ze_iar/board.mk | 3 +- hw/bsp/stm32f1/family.mk | 9 ++--- hw/bsp/stm32f2/family.mk | 8 ++-- hw/bsp/stm32f3/family.mk | 8 ++-- hw/bsp/stm32f4/boards/feather_stm32f405/board.mk | 7 +--- hw/bsp/stm32f4/boards/pyboardv11/board.mk | 7 +--- hw/bsp/stm32f4/boards/stm32f401blackpill/board.mk | 7 +--- hw/bsp/stm32f4/boards/stm32f407blackvet/board.mk | 7 +--- hw/bsp/stm32f4/boards/stm32f407disco/board.mk | 7 +--- hw/bsp/stm32f4/boards/stm32f411blackpill/board.mk | 7 +--- hw/bsp/stm32f4/boards/stm32f411disco/board.mk | 7 +--- hw/bsp/stm32f4/boards/stm32f412disco/board.mk | 7 +--- hw/bsp/stm32f4/boards/stm32f412nucleo/board.mk | 7 +--- hw/bsp/stm32f4/boards/stm32f439nucleo/board.mk | 7 +--- hw/bsp/stm32f4/family.mk | 6 +-- hw/bsp/stm32f7/boards/stlinkv3mini/board.mk | 2 +- hw/bsp/stm32f7/boards/stm32f723disco/board.mk | 2 +- hw/bsp/stm32f7/boards/stm32f746disco/board.mk | 2 +- hw/bsp/stm32f7/boards/stm32f746nucleo/board.mk | 2 +- hw/bsp/stm32f7/boards/stm32f767nucleo/board.mk | 2 +- hw/bsp/stm32f7/boards/stm32f769disco/board.mk | 2 +- hw/bsp/stm32f7/family.mk | 10 ++--- hw/bsp/stm32g0/boards/stm32g0b1nucleo/board.mk | 7 +--- hw/bsp/stm32g0/family.mk | 6 +-- hw/bsp/stm32g4/boards/b_g474e_dpow1/board.mk | 2 +- hw/bsp/stm32g4/boards/stm32g474nucleo/board.mk | 2 +- hw/bsp/stm32g4/boards/stm32g491nucleo/board.mk | 2 +- hw/bsp/stm32g4/family.mk | 10 ++--- hw/bsp/stm32h5/family.mk | 12 +++--- hw/bsp/stm32h7/boards/daisyseed/board.mk | 2 +- hw/bsp/stm32h7/boards/stm32h723nucleo/board.mk | 2 +- hw/bsp/stm32h7/boards/stm32h743eval/board.mk | 2 +- hw/bsp/stm32h7/boards/stm32h743nucleo/board.mk | 2 +- hw/bsp/stm32h7/boards/stm32h745disco/board.mk | 3 +- hw/bsp/stm32h7/boards/stm32h747disco/board.mk | 3 +- hw/bsp/stm32h7/boards/stm32h750_weact/board.mk | 2 +- hw/bsp/stm32h7/boards/stm32h750bdk/board.mk | 2 +- hw/bsp/stm32h7/boards/waveshare_openh743i/board.mk | 2 +- hw/bsp/stm32h7/family.mk | 8 ++-- hw/bsp/stm32h7rs/family.mk | 12 +++--- hw/bsp/stm32l0/family.mk | 8 ++-- hw/bsp/stm32l4/boards/stm32l412nucleo/board.mk | 7 +--- hw/bsp/stm32l4/boards/stm32l476disco/board.mk | 7 +--- hw/bsp/stm32l4/boards/stm32l496nucleo/board.mk | 7 +--- hw/bsp/stm32l4/boards/stm32l4p5nucleo/board.mk | 7 +--- hw/bsp/stm32l4/boards/stm32l4r5nucleo/board.mk | 7 +--- hw/bsp/stm32l4/family.mk | 6 +-- hw/bsp/stm32n6/boards/stm32n6570dk/board.mk | 2 +- hw/bsp/stm32n6/boards/stm32n657nucleo/board.mk | 2 +- hw/bsp/stm32n6/family.mk | 12 +++--- hw/bsp/stm32u0/family.mk | 8 ++-- hw/bsp/stm32u5/family.mk | 10 ++--- hw/bsp/stm32wb/family.mk | 10 ++--- hw/bsp/stm32wba/family.mk | 10 ++--- hw/bsp/tm4c/boards/ek_tm4c1294xl/board.mk | 3 +- hw/bsp/tm4c/family.mk | 2 +- 142 files changed, 227 insertions(+), 504 deletions(-) delete mode 100644 examples/build_system/make/toolchain/arm_iar.mk delete mode 100644 examples/build_system/make/toolchain/iar_rules.mk (limited to 'examples/build_system') diff --git a/examples/build_system/make/cpu/arm1176jzf-s.mk b/examples/build_system/make/cpu/arm1176jzf-s.mk index 022ccf7ad..c0cef8784 100644 --- a/examples/build_system/make/cpu/arm1176jzf-s.mk +++ b/examples/build_system/make/cpu/arm1176jzf-s.mk @@ -2,8 +2,4 @@ ifeq ($(TOOLCHAIN),gcc) CFLAGS += \ -mcpu=arm1176jzf-s \ -else ifeq ($(TOOLCHAIN),iar) - #CFLAGS += --cpu cortex-a53 - #ASFLAGS += --cpu cortex-a53 - endif diff --git a/examples/build_system/make/cpu/arm926ej-s.mk b/examples/build_system/make/cpu/arm926ej-s.mk index 5b84f514f..e0558eca7 100644 --- a/examples/build_system/make/cpu/arm926ej-s.mk +++ b/examples/build_system/make/cpu/arm926ej-s.mk @@ -2,8 +2,4 @@ ifeq ($(TOOLCHAIN),gcc) CFLAGS += \ -mcpu=arm926ej-s \ -else ifeq ($(TOOLCHAIN),iar) - #CFLAGS += --cpu cortex-a53 - #ASFLAGS += --cpu cortex-a53 - endif diff --git a/examples/build_system/make/cpu/cortex-a53.mk b/examples/build_system/make/cpu/cortex-a53.mk index 42e522ecf..20ed8f0cc 100644 --- a/examples/build_system/make/cpu/cortex-a53.mk +++ b/examples/build_system/make/cpu/cortex-a53.mk @@ -2,11 +2,4 @@ ifeq ($(TOOLCHAIN),gcc) CFLAGS += \ -mcpu=cortex-a53 \ -else ifeq ($(TOOLCHAIN),iar) - CFLAGS += \ - --cpu cortex-a53 \ - - ASFLAGS += \ - --cpu cortex-a53 \ - endif diff --git a/examples/build_system/make/cpu/cortex-a72.mk b/examples/build_system/make/cpu/cortex-a72.mk index 1b3d8da4a..b2b3d9181 100644 --- a/examples/build_system/make/cpu/cortex-a72.mk +++ b/examples/build_system/make/cpu/cortex-a72.mk @@ -2,11 +2,4 @@ ifeq ($(TOOLCHAIN),gcc) CFLAGS += \ -mcpu=cortex-a72 \ -else ifeq ($(TOOLCHAIN),iar) - CFLAGS += \ - --cpu cortex-a72 \ - - ASFLAGS += \ - --cpu cortex-a72 \ - endif diff --git a/examples/build_system/make/cpu/cortex-m0.mk b/examples/build_system/make/cpu/cortex-m0.mk index c2c33a2ee..1d618982e 100644 --- a/examples/build_system/make/cpu/cortex-m0.mk +++ b/examples/build_system/make/cpu/cortex-m0.mk @@ -9,11 +9,6 @@ else ifeq ($(TOOLCHAIN),clang) --target=arm-none-eabi \ -mcpu=cortex-m0 \ -else ifeq ($(TOOLCHAIN),iar) - # IAR Flags - CFLAGS += --cpu cortex-m0 - ASFLAGS += --cpu cortex-m0 - else $(error "TOOLCHAIN is not supported") endif diff --git a/examples/build_system/make/cpu/cortex-m0plus.mk b/examples/build_system/make/cpu/cortex-m0plus.mk index fe8feb227..029ce09d1 100644 --- a/examples/build_system/make/cpu/cortex-m0plus.mk +++ b/examples/build_system/make/cpu/cortex-m0plus.mk @@ -9,11 +9,6 @@ else ifeq ($(TOOLCHAIN),clang) --target=arm-none-eabi \ -mcpu=cortex-m0plus \ -else ifeq ($(TOOLCHAIN),iar) - # IAR Flags - CFLAGS += --cpu cortex-m0+ - ASFLAGS += --cpu cortex-m0+ - else $(error "TOOLCHAIN is not supported") endif diff --git a/examples/build_system/make/cpu/cortex-m23.mk b/examples/build_system/make/cpu/cortex-m23.mk index 7ab758352..b92e24401 100644 --- a/examples/build_system/make/cpu/cortex-m23.mk +++ b/examples/build_system/make/cpu/cortex-m23.mk @@ -9,11 +9,6 @@ else ifeq ($(TOOLCHAIN),clang) --target=arm-none-eabi \ -mcpu=cortex-m23 \ -else ifeq ($(TOOLCHAIN),iar) - # IAR Flags - CFLAGS += --cpu cortex-m23 - ASFLAGS += --cpu cortex-m23 - else $(error "TOOLCHAIN is not supported") endif diff --git a/examples/build_system/make/cpu/cortex-m3.mk b/examples/build_system/make/cpu/cortex-m3.mk index b6325313f..b58f0203b 100644 --- a/examples/build_system/make/cpu/cortex-m3.mk +++ b/examples/build_system/make/cpu/cortex-m3.mk @@ -9,11 +9,6 @@ else ifeq ($(TOOLCHAIN),clang) --target=arm-none-eabi \ -mcpu=cortex-m3 \ -else ifeq ($(TOOLCHAIN),iar) - # IAR Flags - CFLAGS += --cpu cortex-m3 - ASFLAGS += --cpu cortex-m3 - else $(error "TOOLCHAIN is not supported") endif diff --git a/examples/build_system/make/cpu/cortex-m33-nodsp-nofp.mk b/examples/build_system/make/cpu/cortex-m33-nodsp-nofp.mk index 405053dd0..858a721fd 100644 --- a/examples/build_system/make/cpu/cortex-m33-nodsp-nofp.mk +++ b/examples/build_system/make/cpu/cortex-m33-nodsp-nofp.mk @@ -10,13 +10,6 @@ else ifeq ($(TOOLCHAIN),clang) -mcpu=cortex-m33 \ -mfpu=softvp \ -else ifeq ($(TOOLCHAIN),iar) - CFLAGS += \ - --cpu cortex-m33+nodsp \ - - ASFLAGS += \ - --cpu cortex-m33+nodsp \ - else $(error "TOOLCHAIN is not supported") endif diff --git a/examples/build_system/make/cpu/cortex-m33.mk b/examples/build_system/make/cpu/cortex-m33.mk index 47b0eaecd..5699fef7b 100644 --- a/examples/build_system/make/cpu/cortex-m33.mk +++ b/examples/build_system/make/cpu/cortex-m33.mk @@ -11,15 +11,6 @@ else ifeq ($(TOOLCHAIN),clang) -mcpu=cortex-m33 \ -mfpu=fpv5-sp-d16 \ -else ifeq ($(TOOLCHAIN),iar) - CFLAGS += \ - --cpu cortex-m33 \ - --fpu VFPv5-SP \ - - ASFLAGS += \ - --cpu cortex-m33 \ - --fpu VFPv5-SP \ - else $(error "TOOLCHAIN is not supported") endif diff --git a/examples/build_system/make/cpu/cortex-m4-nofpu.mk b/examples/build_system/make/cpu/cortex-m4-nofpu.mk index ac2916005..62ab21e31 100644 --- a/examples/build_system/make/cpu/cortex-m4-nofpu.mk +++ b/examples/build_system/make/cpu/cortex-m4-nofpu.mk @@ -9,10 +9,6 @@ else ifeq ($(TOOLCHAIN),clang) --target=arm-none-eabi \ -mcpu=cortex-m4 -else ifeq ($(TOOLCHAIN),iar) - CFLAGS += --cpu cortex-m4 --fpu none - ASFLAGS += --cpu cortex-m4 --fpu none - else $(error "TOOLCHAIN is not supported") endif diff --git a/examples/build_system/make/cpu/cortex-m4.mk b/examples/build_system/make/cpu/cortex-m4.mk index 57d6e126d..e50fe00ef 100644 --- a/examples/build_system/make/cpu/cortex-m4.mk +++ b/examples/build_system/make/cpu/cortex-m4.mk @@ -11,10 +11,6 @@ else ifeq ($(TOOLCHAIN),clang) -mcpu=cortex-m4 \ -mfpu=fpv4-sp-d16 \ -else ifeq ($(TOOLCHAIN),iar) - CFLAGS += --cpu cortex-m4 --fpu VFPv4-SP - ASFLAGS += --cpu cortex-m4 --fpu VFPv4-SP - else $(error "TOOLCHAIN is not supported") endif diff --git a/examples/build_system/make/cpu/cortex-m55.mk b/examples/build_system/make/cpu/cortex-m55.mk index de627caed..94cca1a5e 100644 --- a/examples/build_system/make/cpu/cortex-m55.mk +++ b/examples/build_system/make/cpu/cortex-m55.mk @@ -12,15 +12,6 @@ else ifeq ($(TOOLCHAIN),clang) -mcpu=cortex-m55 \ -mfpu=fpv5-d16 \ -else ifeq ($(TOOLCHAIN),iar) - CFLAGS += \ - --cpu cortex-m55 \ - --fpu VFPv5_D16 \ - - ASFLAGS += \ - --cpu cortex-m55 \ - --fpu VFPv5_D16 \ - else $(error "TOOLCHAIN is not supported") endif diff --git a/examples/build_system/make/cpu/cortex-m7-fpsp.mk b/examples/build_system/make/cpu/cortex-m7-fpsp.mk index cd42c6fb8..e79ff6d73 100644 --- a/examples/build_system/make/cpu/cortex-m7-fpsp.mk +++ b/examples/build_system/make/cpu/cortex-m7-fpsp.mk @@ -11,15 +11,6 @@ else ifeq ($(TOOLCHAIN),clang) -mcpu=cortex-m7 \ -mfpu=fpv5-sp-d16 \ -else ifeq ($(TOOLCHAIN),iar) - CFLAGS += \ - --cpu cortex-m7 \ - --fpu VFPv5_sp \ - - ASFLAGS += \ - --cpu cortex-m7 \ - --fpu VFPv5_sp \ - else $(error "TOOLCHAIN is not supported") endif diff --git a/examples/build_system/make/cpu/cortex-m7.mk b/examples/build_system/make/cpu/cortex-m7.mk index 3e6116179..3bd5c1155 100644 --- a/examples/build_system/make/cpu/cortex-m7.mk +++ b/examples/build_system/make/cpu/cortex-m7.mk @@ -11,15 +11,6 @@ else ifeq ($(TOOLCHAIN),clang) -mcpu=cortex-m7 \ -mfpu=fpv5-d16 \ -else ifeq ($(TOOLCHAIN),iar) - CFLAGS += \ - --cpu cortex-m7 \ - --fpu VFPv5_D16 \ - - ASFLAGS += \ - --cpu cortex-m7 \ - --fpu VFPv5_D16 \ - else $(error "TOOLCHAIN is not supported") endif diff --git a/examples/build_system/make/cpu/cortex-m85.mk b/examples/build_system/make/cpu/cortex-m85.mk index 75e8f3aaf..d66e26418 100644 --- a/examples/build_system/make/cpu/cortex-m85.mk +++ b/examples/build_system/make/cpu/cortex-m85.mk @@ -11,15 +11,6 @@ else ifeq ($(TOOLCHAIN),clang) -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 diff --git a/examples/build_system/make/cpu/msp430.mk b/examples/build_system/make/cpu/msp430.mk index 6daa2c38d..83a35140f 100644 --- a/examples/build_system/make/cpu/msp430.mk +++ b/examples/build_system/make/cpu/msp430.mk @@ -2,8 +2,6 @@ ifeq ($(TOOLCHAIN),gcc) # nothing to add else ifeq ($(TOOLCHAIN),clang) # nothing to add -else ifeq ($(TOOLCHAIN),iar) - # nothing to add else $(error "TOOLCHAIN is not supported") endif diff --git a/examples/build_system/make/cpu/rv32i-ilp32.mk b/examples/build_system/make/cpu/rv32i-ilp32.mk index af764afc5..6b2306008 100644 --- a/examples/build_system/make/cpu/rv32i-ilp32.mk +++ b/examples/build_system/make/cpu/rv32i-ilp32.mk @@ -8,8 +8,6 @@ else ifeq ($(TOOLCHAIN),clang) -march=rv32i_zicsr \ -mabi=ilp32 \ -else ifeq ($(TOOLCHAIN),iar) - $(error not support) endif # For freeRTOS port source diff --git a/examples/build_system/make/cpu/rv32imac-ilp32.mk b/examples/build_system/make/cpu/rv32imac-ilp32.mk index a7b2258d7..e4a3ad24f 100644 --- a/examples/build_system/make/cpu/rv32imac-ilp32.mk +++ b/examples/build_system/make/cpu/rv32imac-ilp32.mk @@ -8,9 +8,6 @@ else ifeq ($(TOOLCHAIN),clang) -march=rv32imac_zicsr_zifencei \ -mabi=ilp32 \ -else ifeq ($(TOOLCHAIN),iar) - $(error not support) - endif # For freeRTOS port source diff --git a/examples/build_system/make/toolchain/arm_iar.mk b/examples/build_system/make/toolchain/arm_iar.mk deleted file mode 100644 index 17967b41a..000000000 --- a/examples/build_system/make/toolchain/arm_iar.mk +++ /dev/null @@ -1,13 +0,0 @@ -# makefile for arm iar toolchain - -CC = iccarm -AS = iasmarm -LD = ilinkarm -OBJCOPY = ielftool --silent -SIZE = size - -# Enable extension mode (gcc compatible) -CFLAGS += -e --debug --silent - -# silent mode -ASFLAGS += -S $(addprefix -I,$(INC)) diff --git a/examples/build_system/make/toolchain/gcc_rules.mk b/examples/build_system/make/toolchain/gcc_rules.mk index fc5225503..3463cad48 100644 --- a/examples/build_system/make/toolchain/gcc_rules.mk +++ b/examples/build_system/make/toolchain/gcc_rules.mk @@ -1,5 +1,3 @@ -SRC_S += $(SRC_S_GCC) - # Assembly files can be name with upper case .S, convert it to .s SRC_S := $(SRC_S:.S=.s) @@ -9,7 +7,7 @@ SRC_S := $(SRC_S:.S=.s) OBJ += $(addprefix $(BUILD)/obj/, $(SRC_S:.s=_asm.o)) OBJ += $(addprefix $(BUILD)/obj/, $(SRC_C:.c=.o)) -CFLAGS += $(CFLAGS_GCC) -MD +CFLAGS += -MD # LTO makes it difficult to analyze map file for optimizing size purpose # We will run this option in ci @@ -25,18 +23,13 @@ ifeq ($(TOOLCHAIN),clang) CFLAGS += $(CFLAGS_CLANG) LDFLAGS += $(CFLAGS) $(LDFLAGS_CLANG) else -LDFLAGS += $(CFLAGS) $(LDFLAGS_GCC) +LDFLAGS += $(CFLAGS) endif -# TODO should be removed after all examples are updated ifdef LD_FILE LDFLAGS += -Wl,-T,$(TOP)/$(LD_FILE) endif -ifdef LD_FILE_GCC -LDFLAGS += -Wl,-T,$(TOP)/$(LD_FILE_GCC) -endif - ASFLAGS += $(CFLAGS) # libc diff --git a/examples/build_system/make/toolchain/iar_rules.mk b/examples/build_system/make/toolchain/iar_rules.mk deleted file mode 100644 index 2c066f6da..000000000 --- a/examples/build_system/make/toolchain/iar_rules.mk +++ /dev/null @@ -1,44 +0,0 @@ -SRC_S += $(SRC_S_IAR) - -# Assembly files can be name with upper case .S, convert it to .s -SRC_S := $(SRC_S:.S=.s) - -# Due to GCC LTO bug https://bugs.launchpad.net/gcc-arm-embedded/+bug/1747966 -# assembly file should be placed first in linking order -# '_asm' suffix is added to object of assembly file -OBJ += $(addprefix $(BUILD)/obj/, $(SRC_S:.s=_asm.o)) -OBJ += $(addprefix $(BUILD)/obj/, $(SRC_C:.c=.o)) - -# Linker script -LDFLAGS += --config $(TOP)/$(LD_FILE_IAR) - -# --------------------------------------- -# Rules -# --------------------------------------- - -# Compile .c file -$(BUILD)/obj/%.o: %.c - @echo CC $(notdir $@) - @$(CC) $(CFLAGS) -c -o $@ $< - -# ASM sources lower case .s -$(BUILD)/obj/%_asm.o: %.s - @echo AS $(notdir $@) - @$(AS) $(ASFLAGS) -c -o $@ $< - -# ASM sources upper case .S -$(BUILD)/obj/%_asm.o: %.S - @echo AS $(notdir $@) - @$(AS) $(ASFLAGS) -c -o $@ $< - -$(BUILD)/$(PROJECT).bin: $(BUILD)/$(PROJECT).elf - @echo CREATE $@ - @$(OBJCOPY) --bin $^ $@ - -$(BUILD)/$(PROJECT).hex: $(BUILD)/$(PROJECT).elf - @echo CREATE $@ - @$(OBJCOPY) --ihex $^ $@ - -$(BUILD)/$(PROJECT).elf: $(OBJ) - @echo LINK $@ - @$(LD) -o $@ $(LDFLAGS) $^ diff --git a/examples/device/net_lwip_webserver/Makefile b/examples/device/net_lwip_webserver/Makefile index 9d8e8ec77..6002039b3 100644 --- a/examples/device/net_lwip_webserver/Makefile +++ b/examples/device/net_lwip_webserver/Makefile @@ -1,7 +1,7 @@ include ../../../hw/bsp/family_support.mk # suppress warning caused by lwip -CFLAGS_GCC += \ +CFLAGS += \ -Wno-error=null-dereference \ -Wno-error=unused-parameter \ -Wno-error=unused-variable diff --git a/examples/dual/host_hid_to_device_cdc/Makefile b/examples/dual/host_hid_to_device_cdc/Makefile index a51251bf9..595cd7dec 100644 --- a/examples/dual/host_hid_to_device_cdc/Makefile +++ b/examples/dual/host_hid_to_device_cdc/Makefile @@ -8,7 +8,7 @@ INC += \ EXAMPLE_SOURCE += $(wildcard src/*.c) SRC_C += $(addprefix $(EXAMPLE_PATH)/, $(EXAMPLE_SOURCE)) -CFLAGS_GCC += -Wno-error=cast-align -Wno-error=null-dereference +CFLAGS += -Wno-error=cast-align -Wno-error=null-dereference SRC_C += \ src/class/hid/hid_host.c \ diff --git a/examples/dual/host_info_to_device_cdc/Makefile b/examples/dual/host_info_to_device_cdc/Makefile index 659cf6ff9..3a1d87f57 100644 --- a/examples/dual/host_info_to_device_cdc/Makefile +++ b/examples/dual/host_info_to_device_cdc/Makefile @@ -8,7 +8,7 @@ INC += \ EXAMPLE_SOURCE += $(wildcard src/*.c) SRC_C += $(addprefix $(EXAMPLE_PATH)/, $(EXAMPLE_SOURCE)) -CFLAGS_GCC += -Wno-error=cast-align -Wno-error=null-dereference +CFLAGS += -Wno-error=cast-align -Wno-error=null-dereference SRC_C += \ src/host/hub.c \ diff --git a/examples/host/msc_file_explorer/Makefile b/examples/host/msc_file_explorer/Makefile index 39d00d982..8c0b012ad 100644 --- a/examples/host/msc_file_explorer/Makefile +++ b/examples/host/msc_file_explorer/Makefile @@ -21,6 +21,6 @@ SRC_C += \ $(FATFS_PATH)/ffunicode.c \ # suppress warning caused by fatfs -CFLAGS_GCC += -Wno-error=cast-qual +CFLAGS += -Wno-error=cast-qual include ../../../hw/bsp/family_rules.mk diff --git a/examples/host/msc_file_explorer/src/msc_app.c b/examples/host/msc_file_explorer/src/msc_app.c index c7cc366b5..3f15bb84f 100644 --- a/examples/host/msc_file_explorer/src/msc_app.c +++ b/examples/host/msc_file_explorer/src/msc_app.c @@ -260,7 +260,7 @@ DRESULT disk_ioctl(BYTE pdrv, /* Physical drive nmuber (0..) */ return RES_OK; case GET_SECTOR_COUNT: - *((DWORD *)buff) = (WORD)tuh_msc_get_block_count(dev_addr, lun); + *((DWORD *)buff) = (DWORD)tuh_msc_get_block_count(dev_addr, lun); return RES_OK; case GET_SECTOR_SIZE: diff --git a/hw/bsp/at32f402_405/family.mk b/hw/bsp/at32f402_405/family.mk index 09b2f1139..5f9f3ccbb 100644 --- a/hw/bsp/at32f402_405/family.mk +++ b/hw/bsp/at32f402_405/family.mk @@ -5,7 +5,7 @@ include $(TOP)/$(BOARD_PATH)/board.mk CPU_CORE ?= cortex-m4 -CFLAGS_GCC += \ +CFLAGS += \ -flto RHPORT_SPEED ?= OPT_MODE_FULL_SPEED OPT_MODE_FULL_SPEED @@ -35,7 +35,7 @@ CFLAGS += \ -DBOARD_TUH_RHPORT=${RHPORT_HOST} \ -DBOARD_TUH_MAX_SPEED=${RHPORT_HOST_SPEED} \ -LDFLAGS_GCC += \ +LDFLAGS += \ -flto --specs=nosys.specs -nostdlib -nostartfiles SRC_C += \ @@ -55,11 +55,9 @@ INC += \ $(TOP)/$(AT32_SDK_LIB)/cmsis/cm4/core_support \ $(TOP)/$(AT32_SDK_LIB)/cmsis/cm4/device_support -SRC_S_GCC += ${AT32_SDK_LIB}/cmsis/cm4/device_support/startup/gcc/startup_${AT32_FAMILY}.s -SRC_S_IAR += ${AT32_SDK_LIB}/cmsis/cm4/device_support/startup/iar/startup_${AT32_FAMILY}.s +SRC_S += ${AT32_SDK_LIB}/cmsis/cm4/device_support/startup/gcc/startup_${AT32_FAMILY}.s -LD_FILE_GCC ?= ${AT32_SDK_LIB}/cmsis/cm4/device_support/startup/gcc/linker/${MCU_LINKER_NAME}_FLASH.ld -LD_FILE_IAR ?= ${AT32_SDK_LIB}/cmsis/cm4/device_support/startup/iar/linker/${MCU_LINKER_NAME}.icf +LD_FILE ?= ${AT32_SDK_LIB}/cmsis/cm4/device_support/startup/gcc/linker/${MCU_LINKER_NAME}_FLASH.ld # For freeRTOS port source FREERTOS_PORTABLE_SRC = $(FREERTOS_PORTABLE_PATH)/ARM_CM4F diff --git a/hw/bsp/at32f403a_407/family.mk b/hw/bsp/at32f403a_407/family.mk index f458881a3..f7dde7d90 100644 --- a/hw/bsp/at32f403a_407/family.mk +++ b/hw/bsp/at32f403a_407/family.mk @@ -5,13 +5,13 @@ include $(TOP)/$(BOARD_PATH)/board.mk CPU_CORE ?= cortex-m4 -CFLAGS_GCC += \ +CFLAGS += \ -flto CFLAGS += \ -DCFG_TUSB_MCU=OPT_MCU_AT32F403A_407 -LDFLAGS_GCC += \ +LDFLAGS += \ -flto --specs=nosys.specs -nostdlib -nostartfiles SRC_C += \ @@ -30,11 +30,9 @@ INC += \ $(TOP)/$(AT32_SDK_LIB)/cmsis/cm4/core_support \ $(TOP)/$(AT32_SDK_LIB)/cmsis/cm4/device_support -SRC_S_GCC += ${AT32_SDK_LIB}/cmsis/cm4/device_support/startup/gcc/startup_${AT32_FAMILY}.s -SRC_S_IAR += ${AT32_SDK_LIB}/cmsis/cm4/device_support/startup/iar/startup_${AT32_FAMILY}.s +SRC_S += ${AT32_SDK_LIB}/cmsis/cm4/device_support/startup/gcc/startup_${AT32_FAMILY}.s -LD_FILE_GCC ?= ${AT32_SDK_LIB}/cmsis/cm4/device_support/startup/gcc/linker/${MCU_LINKER_NAME}_FLASH.ld -LD_FILE_IAR ?= ${AT32_SDK_LIB}/cmsis/cm4/device_support/startup/iar/linker/${MCU_LINKER_NAME}.icf +LD_FILE ?= ${AT32_SDK_LIB}/cmsis/cm4/device_support/startup/gcc/linker/${MCU_LINKER_NAME}_FLASH.ld # For freeRTOS port source FREERTOS_PORTABLE_SRC = $(FREERTOS_PORTABLE_PATH)/ARM_CM4F diff --git a/hw/bsp/at32f413/family.mk b/hw/bsp/at32f413/family.mk index abcd15d11..86744e1dc 100644 --- a/hw/bsp/at32f413/family.mk +++ b/hw/bsp/at32f413/family.mk @@ -5,13 +5,13 @@ include $(TOP)/$(BOARD_PATH)/board.mk CPU_CORE ?= cortex-m4 -CFLAGS_GCC += \ +CFLAGS += \ -flto CFLAGS += \ -DCFG_TUSB_MCU=OPT_MCU_AT32F413 -LDFLAGS_GCC += \ +LDFLAGS += \ -flto --specs=nosys.specs -nostdlib -nostartfiles SRC_C += \ @@ -30,11 +30,9 @@ INC += \ $(TOP)/$(AT32_SDK_LIB)/cmsis/cm4/core_support \ $(TOP)/$(AT32_SDK_LIB)/cmsis/cm4/device_support -SRC_S_GCC += ${AT32_SDK_LIB}/cmsis/cm4/device_support/startup/gcc/startup_${AT32_FAMILY}.s -SRC_S_IAR += ${AT32_SDK_LIB}/cmsis/cm4/device_support/startup/iar/startup_${AT32_FAMILY}.s +SRC_S += ${AT32_SDK_LIB}/cmsis/cm4/device_support/startup/gcc/startup_${AT32_FAMILY}.s -LD_FILE_GCC ?= ${AT32_SDK_LIB}/cmsis/cm4/device_support/startup/gcc/linker/${MCU_LINKER_NAME}_FLASH.ld -LD_FILE_IAR ?= ${AT32_SDK_LIB}/cmsis/cm4/device_support/startup/iar/linker/${MCU_LINKER_NAME}.icf +LD_FILE ?= ${AT32_SDK_LIB}/cmsis/cm4/device_support/startup/gcc/linker/${MCU_LINKER_NAME}_FLASH.ld # For freeRTOS port source FREERTOS_PORTABLE_SRC = $(FREERTOS_PORTABLE_PATH)/ARM_CM4F diff --git a/hw/bsp/at32f415/family.mk b/hw/bsp/at32f415/family.mk index 73a89c543..72339b782 100644 --- a/hw/bsp/at32f415/family.mk +++ b/hw/bsp/at32f415/family.mk @@ -5,13 +5,13 @@ include $(TOP)/$(BOARD_PATH)/board.mk CPU_CORE ?= cortex-m4-nofpu -CFLAGS_GCC += \ +CFLAGS += \ -flto CFLAGS += \ -DCFG_TUSB_MCU=OPT_MCU_AT32F415 \ -LDFLAGS_GCC += \ +LDFLAGS += \ -flto --specs=nosys.specs -nostdlib -nostartfiles SRC_C += \ @@ -30,10 +30,8 @@ INC += \ $(TOP)/$(AT32_SDK_LIB)/cmsis/cm4/core_support \ $(TOP)/$(AT32_SDK_LIB)/cmsis/cm4/device_support -SRC_S_GCC += ${AT32_SDK_LIB}/cmsis/cm4/device_support/startup/gcc/startup_${AT32_FAMILY}.s -SRC_S_IAR += ${AT32_SDK_LIB}/cmsis/cm4/device_support/startup/iar/startup_${AT32_FAMILY}.s +SRC_S += ${AT32_SDK_LIB}/cmsis/cm4/device_support/startup/gcc/startup_${AT32_FAMILY}.s -LD_FILE_GCC ?= ${AT32_SDK_LIB}/cmsis/cm4/device_support/startup/gcc/linker/${MCU_LINKER_NAME}_FLASH.ld -LD_FILE_IAR ?= ${AT32_SDK_LIB}/cmsis/cm4/device_support/startup/iar/linker/${MCU_LINKER_NAME}.icf +LD_FILE ?= ${AT32_SDK_LIB}/cmsis/cm4/device_support/startup/gcc/linker/${MCU_LINKER_NAME}_FLASH.ld flash: flash-atlink diff --git a/hw/bsp/at32f423/family.mk b/hw/bsp/at32f423/family.mk index 960f4a9a1..df531460a 100644 --- a/hw/bsp/at32f423/family.mk +++ b/hw/bsp/at32f423/family.mk @@ -5,13 +5,13 @@ include $(TOP)/$(BOARD_PATH)/board.mk CPU_CORE ?= cortex-m4 -CFLAGS_GCC += \ +CFLAGS += \ -flto CFLAGS += \ -DCFG_TUSB_MCU=OPT_MCU_AT32F423 \ -LDFLAGS_GCC += \ +LDFLAGS += \ -flto --specs=nosys.specs -nostdlib -nostartfiles SRC_C += \ @@ -31,10 +31,8 @@ INC += \ $(TOP)/$(AT32_SDK_LIB)/cmsis/cm4/core_support \ $(TOP)/$(AT32_SDK_LIB)/cmsis/cm4/device_support -SRC_S_GCC += ${AT32_SDK_LIB}/cmsis/cm4/device_support/startup/gcc/startup_${AT32_FAMILY}.s -SRC_S_IAR += ${AT32_SDK_LIB}/cmsis/cm4/device_support/startup/iar/startup_${AT32_FAMILY}.s +SRC_S += ${AT32_SDK_LIB}/cmsis/cm4/device_support/startup/gcc/startup_${AT32_FAMILY}.s -LD_FILE_GCC ?= ${AT32_SDK_LIB}/cmsis/cm4/device_support/startup/gcc/linker/${MCU_LINKER_NAME}_FLASH.ld -LD_FILE_IAR ?= ${AT32_SDK_LIB}/cmsis/cm4/device_support/startup/iar/linker/${MCU_LINKER_NAME}.icf +LD_FILE ?= ${AT32_SDK_LIB}/cmsis/cm4/device_support/startup/gcc/linker/${MCU_LINKER_NAME}_FLASH.ld flash: flash-atlink diff --git a/hw/bsp/at32f425/family.mk b/hw/bsp/at32f425/family.mk index 0a0a74414..b659608a3 100644 --- a/hw/bsp/at32f425/family.mk +++ b/hw/bsp/at32f425/family.mk @@ -5,13 +5,13 @@ include $(TOP)/$(BOARD_PATH)/board.mk CPU_CORE ?= cortex-m4-nofpu -CFLAGS_GCC += \ +CFLAGS += \ -flto CFLAGS += \ -DCFG_TUSB_MCU=OPT_MCU_AT32F425 \ -LDFLAGS_GCC += \ +LDFLAGS += \ -flto --specs=nosys.specs -nostdlib -nostartfiles SRC_C += \ @@ -30,10 +30,8 @@ INC += \ $(TOP)/$(AT32_SDK_LIB)/cmsis/cm4/core_support \ $(TOP)/$(AT32_SDK_LIB)/cmsis/cm4/device_support -SRC_S_GCC += ${AT32_SDK_LIB}/cmsis/cm4/device_support/startup/gcc/startup_${AT32_FAMILY}.s -SRC_S_IAR += ${AT32_SDK_LIB}/cmsis/cm4/device_support/startup/iar/startup_${AT32_FAMILY}.s +SRC_S += ${AT32_SDK_LIB}/cmsis/cm4/device_support/startup/gcc/startup_${AT32_FAMILY}.s -LD_FILE_GCC ?= ${AT32_SDK_LIB}/cmsis/cm4/device_support/startup/gcc/linker/${MCU_LINKER_NAME}_FLASH.ld -LD_FILE_IAR ?= ${AT32_SDK_LIB}/cmsis/cm4/device_support/startup/iar/linker/${MCU_LINKER_NAME}.icf +LD_FILE ?= ${AT32_SDK_LIB}/cmsis/cm4/device_support/startup/gcc/linker/${MCU_LINKER_NAME}_FLASH.ld flash: flash-atlink diff --git a/hw/bsp/at32f435_437/family.mk b/hw/bsp/at32f435_437/family.mk index ba22f5420..73777400b 100644 --- a/hw/bsp/at32f435_437/family.mk +++ b/hw/bsp/at32f435_437/family.mk @@ -5,7 +5,7 @@ include $(TOP)/$(BOARD_PATH)/board.mk CPU_CORE ?= cortex-m4 -CFLAGS_GCC += \ +CFLAGS += \ -flto CFLAGS += \ @@ -15,7 +15,7 @@ CFLAGS += \ -DBOARD_TUD_MAX_SPEED=OPT_MODE_FULL_SPEED \ -DBOARD_TUH_MAX_SPEED=OPT_MODE_FULL_SPEED \ -LDFLAGS_GCC += \ +LDFLAGS += \ -flto --specs=nosys.specs -nostdlib -nostartfiles SRC_C += \ @@ -36,10 +36,8 @@ INC += \ $(TOP)/$(AT32_SDK_LIB)/cmsis/cm4/core_support \ $(TOP)/$(AT32_SDK_LIB)/cmsis/cm4/device_support -SRC_S_GCC += ${AT32_SDK_LIB}/cmsis/cm4/device_support/startup/gcc/startup_${AT32_FAMILY}.s -SRC_S_IAR += ${AT32_SDK_LIB}/cmsis/cm4/device_support/startup/iar/startup_${AT32_FAMILY}.s +SRC_S += ${AT32_SDK_LIB}/cmsis/cm4/device_support/startup/gcc/startup_${AT32_FAMILY}.s -LD_FILE_GCC ?= ${AT32_SDK_LIB}/cmsis/cm4/device_support/startup/gcc/linker/${MCU_LINKER_NAME}_FLASH.ld -LD_FILE_IAR ?= ${AT32_SDK_LIB}/cmsis/cm4/device_support/startup/iar/linker/${MCU_LINKER_NAME}.icf +LD_FILE ?= ${AT32_SDK_LIB}/cmsis/cm4/device_support/startup/gcc/linker/${MCU_LINKER_NAME}_FLASH.ld flash: flash-atlink diff --git a/hw/bsp/at32f45x/family.mk b/hw/bsp/at32f45x/family.mk index e42f27557..a9fb1a078 100644 --- a/hw/bsp/at32f45x/family.mk +++ b/hw/bsp/at32f45x/family.mk @@ -5,13 +5,13 @@ include $(TOP)/$(BOARD_PATH)/board.mk CPU_CORE ?= cortex-m4 -CFLAGS_GCC += \ +CFLAGS += \ -flto CFLAGS += \ -DCFG_TUSB_MCU=OPT_MCU_AT32F45X \ -LDFLAGS_GCC += \ +LDFLAGS += \ -flto --specs=nosys.specs -nostdlib -nostartfiles SRC_C += \ @@ -31,10 +31,8 @@ INC += \ $(TOP)/$(AT32_SDK_LIB)/cmsis/cm4/core_support \ $(TOP)/$(AT32_SDK_LIB)/cmsis/cm4/device_support -SRC_S_GCC += ${AT32_SDK_LIB}/cmsis/cm4/device_support/startup/gcc/startup_${AT32_FAMILY}.s -SRC_S_IAR += ${AT32_SDK_LIB}/cmsis/cm4/device_support/startup/iar/startup_${AT32_FAMILY}.s +SRC_S += ${AT32_SDK_LIB}/cmsis/cm4/device_support/startup/gcc/startup_${AT32_FAMILY}.s -LD_FILE_GCC ?= ${AT32_SDK_LIB}/cmsis/cm4/device_support/startup/gcc/linker/${MCU_LINKER_NAME}_FLASH.ld -LD_FILE_IAR ?= ${AT32_SDK_LIB}/cmsis/cm4/device_support/startup/iar/linker/${MCU_LINKER_NAME}.icf +LD_FILE ?= ${AT32_SDK_LIB}/cmsis/cm4/device_support/startup/gcc/linker/${MCU_LINKER_NAME}_FLASH.ld flash: flash-atlink diff --git a/hw/bsp/broadcom_32bit/family.mk b/hw/bsp/broadcom_32bit/family.mk index 9d4a3b76c..a282e9961 100644 --- a/hw/bsp/broadcom_32bit/family.mk +++ b/hw/bsp/broadcom_32bit/family.mk @@ -15,7 +15,7 @@ CFLAGS += \ CROSS_COMPILE = arm-none-eabi- # mcu driver cause following warnings -CFLAGS_GCC += -Wno-error=cast-qual -Wno-error=redundant-decls +CFLAGS += -Wno-error=cast-qual -Wno-error=redundant-decls SRC_C += \ src/portable/synopsys/dwc2/dcd_dwc2.c \ diff --git a/hw/bsp/broadcom_64bit/family.mk b/hw/bsp/broadcom_64bit/family.mk index 1ce80e22b..37d381f9f 100644 --- a/hw/bsp/broadcom_64bit/family.mk +++ b/hw/bsp/broadcom_64bit/family.mk @@ -14,7 +14,7 @@ CFLAGS += \ CROSS_COMPILE = aarch64-none-elf- # mcu driver cause following warnings -CFLAGS_GCC += -Wno-error=cast-qual -Wno-error=redundant-decls +CFLAGS += -Wno-error=cast-qual -Wno-error=redundant-decls SRC_C += \ src/portable/synopsys/dwc2/dcd_dwc2.c \ diff --git a/hw/bsp/ch32v10x/family.mk b/hw/bsp/ch32v10x/family.mk index d96d5012e..fb699b0bb 100644 --- a/hw/bsp/ch32v10x/family.mk +++ b/hw/bsp/ch32v10x/family.mk @@ -26,7 +26,7 @@ CFLAGS += \ # https://github.com/openwch/ch32v20x/pull/12 CFLAGS += -Wno-error=strict-prototypes -LDFLAGS_GCC += \ +LDFLAGS += \ -nostdlib -nostartfiles \ --specs=nosys.specs --specs=nano.specs \ diff --git a/hw/bsp/ch32v20x/family.mk b/hw/bsp/ch32v20x/family.mk index 7042ecbb7..1d059bcba 100644 --- a/hw/bsp/ch32v20x/family.mk +++ b/hw/bsp/ch32v20x/family.mk @@ -37,7 +37,7 @@ else CFLAGS += -DCFG_TUD_WCH_USBIP_USBFS=1 endif -LDFLAGS_GCC += \ +LDFLAGS += \ -nostdlib -nostartfiles \ --specs=nosys.specs --specs=nano.specs \ diff --git a/hw/bsp/ch32v30x/family.mk b/hw/bsp/ch32v30x/family.mk index be6813914..5ccdea8ae 100644 --- a/hw/bsp/ch32v30x/family.mk +++ b/hw/bsp/ch32v30x/family.mk @@ -36,7 +36,7 @@ else CFLAGS += -DCFG_TUD_WCH_USBIP_USBFS=1 endif -LDFLAGS_GCC += \ +LDFLAGS += \ -nostdlib -nostartfiles \ --specs=nosys.specs --specs=nano.specs \ diff --git a/hw/bsp/cxd56/family.mk b/hw/bsp/cxd56/family.mk index adfe9ee82..627dc6ec2 100644 --- a/hw/bsp/cxd56/family.mk +++ b/hw/bsp/cxd56/family.mk @@ -32,7 +32,7 @@ CPU_CORE ?= cortex-m4 # lwip/src/core/raw.c:334:43: error: declaration of 'recv' shadows a global declaration CFLAGS += -Wno-error=shadow -Wno-error=redundant-decls -LDFLAGS_GCC += -specs=nosys.specs -specs=nano.specs +LDFLAGS += -specs=nosys.specs -specs=nano.specs SPRESENSE_SDK = $(TOP)/hw/mcu/sony/cxd56/spresense-exported-sdk diff --git a/hw/bsp/da1469x/family.mk b/hw/bsp/da1469x/family.mk index f35fe2cb5..878442e8e 100644 --- a/hw/bsp/da1469x/family.mk +++ b/hw/bsp/da1469x/family.mk @@ -14,7 +14,7 @@ CFLAGS += \ -DCFG_TUSB_MCU=OPT_MCU_DA1469X \ -DCFG_TUD_ENDPOINT0_SIZE=8\ -LDFLAGS_GCC += \ +LDFLAGS += \ -nostdlib \ --specs=nosys.specs --specs=nano.specs diff --git a/hw/bsp/efm32/family.mk b/hw/bsp/efm32/family.mk index f115b6bd4..f8db0cc38 100644 --- a/hw/bsp/efm32/family.mk +++ b/hw/bsp/efm32/family.mk @@ -16,7 +16,7 @@ CPU_CORE ?= cortex-m4 # EFM32_FAMILY should be set by board.mk (e.g. efm32gg12b) SILABS_CMSIS = hw/mcu/silabs/cmsis-dfp-$(EFM32_FAMILY)/Device/SiliconLabs/$(shell echo $(EFM32_FAMILY) | tr a-z A-Z) -LDFLAGS_GCC += -specs=nosys.specs -specs=nano.specs +LDFLAGS += -specs=nosys.specs -specs=nano.specs # All source paths should be relative to the top level. LD_FILE = $(SILABS_CMSIS)/Source/GCC/$(EFM32_FAMILY).ld diff --git a/hw/bsp/family_support.mk b/hw/bsp/family_support.mk index 7122a7764..69aa08922 100644 --- a/hw/bsp/family_support.mk +++ b/hw/bsp/family_support.mk @@ -7,12 +7,10 @@ to_upper = $(subst a,A,$(subst b,B,$(subst c,C,$(subst d,D,$(subst e,E,$(subst f #------------------------------------------------------------- # Toolchain -# Can be changed via TOOLCHAIN=gcc|iar or CC=arm-none-eabi-gcc|iccarm|clang +# Can be changed via TOOLCHAIN=gcc|clang or CC=arm-none-eabi-gcc|clang #------------------------------------------------------------- ifneq (,$(findstring clang,$(CC))) TOOLCHAIN = clang -else ifneq (,$(findstring iccarm,$(CC))) - TOOLCHAIN = iar else ifneq (,$(findstring gcc,$(CC))) TOOLCHAIN = gcc endif @@ -149,7 +147,7 @@ endif #---------------------- FreeRTOS ----------------------- FREERTOS_SRC = lib/FreeRTOS-Kernel -FREERTOS_PORTABLE_PATH = $(FREERTOS_SRC)/portable/$(if $(findstring iar,$(TOOLCHAIN)),IAR,GCC) +FREERTOS_PORTABLE_PATH = $(FREERTOS_SRC)/portable/GCC ifeq ($(RTOS),freertos) SRC_C += \ @@ -168,13 +166,13 @@ ifeq ($(RTOS),freertos) CFLAGS += -DCFG_TUSB_OS=OPT_OS_FREERTOS # Suppress FreeRTOSConfig.h warnings - CFLAGS_GCC += -Wno-error=redundant-decls + CFLAGS += -Wno-error=redundant-decls # Suppress FreeRTOS source warnings - CFLAGS_GCC += -Wno-error=cast-qual + CFLAGS += -Wno-error=cast-qual # FreeRTOS (lto + Os) linker issue - LDFLAGS_GCC += -Wl,--undefined=vTaskSwitchContext + LDFLAGS += -Wl,--undefined=vTaskSwitchContext endif #---------------- Helper ---------------- diff --git a/hw/bsp/fomu/family.mk b/hw/bsp/fomu/family.mk index c29b1c70f..27404efb5 100644 --- a/hw/bsp/fomu/family.mk +++ b/hw/bsp/fomu/family.mk @@ -7,7 +7,7 @@ CFLAGS += \ -flto \ -DCFG_TUSB_MCU=OPT_MCU_VALENTYUSB_EPTRI -LDFLAGS_GCC += \ +LDFLAGS += \ -nostdlib \ --specs=nosys.specs --specs=nano.specs \ diff --git a/hw/bsp/hpmicro/family.mk b/hw/bsp/hpmicro/family.mk index f8cde55eb..ea4f0c003 100644 --- a/hw/bsp/hpmicro/family.mk +++ b/hw/bsp/hpmicro/family.mk @@ -27,7 +27,7 @@ endif CFLAGS += -Wno-error=cast-align -Wno-error=double-promotion -Wno-error=discarded-qualifiers \ -Wno-error=undef -Wno-error=unused-parameter -Wno-error=redundant-decls -LDFLAGS_GCC += \ +LDFLAGS += \ -nostartfiles \ --specs=nosys.specs --specs=nano.specs diff --git a/hw/bsp/imxrt/family.mk b/hw/bsp/imxrt/family.mk index 59735670a..59c3aa158 100644 --- a/hw/bsp/imxrt/family.mk +++ b/hw/bsp/imxrt/family.mk @@ -41,7 +41,7 @@ endif # mcu driver cause following warnings CFLAGS += -Wno-error=unused-parameter -Wno-error=implicit-fallthrough -Wno-error=redundant-decls -LDFLAGS_GCC += \ +LDFLAGS += \ -nostartfiles \ --specs=nosys.specs --specs=nano.specs diff --git a/hw/bsp/kinetis_k/family.mk b/hw/bsp/kinetis_k/family.mk index 7a51a77d8..b1e1fb3aa 100644 --- a/hw/bsp/kinetis_k/family.mk +++ b/hw/bsp/kinetis_k/family.mk @@ -12,7 +12,7 @@ LDFLAGS += \ -Wl,--defsym,__stack_size__=0x400 \ -Wl,--defsym,__heap_size__=0 -LDFLAGS_GCC += \ +LDFLAGS += \ -nostartfiles \ --specs=nosys.specs --specs=nano.specs \ diff --git a/hw/bsp/kinetis_k32l/boards/frdm_k32l2a4s/board.mk b/hw/bsp/kinetis_k32l/boards/frdm_k32l2a4s/board.mk index 513b78d66..bc6a4a1ba 100644 --- a/hw/bsp/kinetis_k32l/boards/frdm_k32l2a4s/board.mk +++ b/hw/bsp/kinetis_k32l/boards/frdm_k32l2a4s/board.mk @@ -3,7 +3,7 @@ MCU_VARIANT = K32L2A41A CFLAGS += -DCPU_K32L2A41VLH1A # mcu driver cause following warnings -CFLAGS_GCC += -Wno-error=unused-parameter -Wno-error=redundant-decls -Wno-error=cast-qual +CFLAGS += -Wno-error=unused-parameter -Wno-error=redundant-decls -Wno-error=cast-qual # All source paths should be relative to the top level. LD_FILE = $(MCUX_DEVICES)/K32L/$(MCU_VARIANT)/gcc/K32L2A41xxxxA_flash.ld diff --git a/hw/bsp/kinetis_k32l/family.mk b/hw/bsp/kinetis_k32l/family.mk index 2802337d3..a99fb5dbe 100644 --- a/hw/bsp/kinetis_k32l/family.mk +++ b/hw/bsp/kinetis_k32l/family.mk @@ -8,7 +8,7 @@ MCUX_DEVICES = hw/mcu/nxp/mcux-devices-kinetis CFLAGS += \ -DCFG_TUSB_MCU=OPT_MCU_KINETIS_K32L -LDFLAGS_GCC += \ +LDFLAGS += \ -nostartfiles \ -specs=nosys.specs -specs=nano.specs diff --git a/hw/bsp/kinetis_kl/family.mk b/hw/bsp/kinetis_kl/family.mk index aec53d486..201ab99dc 100644 --- a/hw/bsp/kinetis_kl/family.mk +++ b/hw/bsp/kinetis_kl/family.mk @@ -12,7 +12,7 @@ LDFLAGS += \ -Wl,--defsym,__stack_size__=0x400 \ -Wl,--defsym,__heap_size__=0 -LDFLAGS_GCC += \ +LDFLAGS += \ -nostartfiles \ -specs=nosys.specs -specs=nano.specs \ diff --git a/hw/bsp/lpc11/family.mk b/hw/bsp/lpc11/family.mk index a3ec33768..8ac3ecb6a 100644 --- a/hw/bsp/lpc11/family.mk +++ b/hw/bsp/lpc11/family.mk @@ -13,7 +13,7 @@ CFLAGS += \ CFLAGS += \ -Wno-error=incompatible-pointer-types \ -LDFLAGS_GCC += --specs=nosys.specs --specs=nano.specs +LDFLAGS += --specs=nosys.specs --specs=nano.specs SRC_C += \ src/portable/nxp/lpc_ip3511/dcd_lpc_ip3511.c \ diff --git a/hw/bsp/lpc13/family.mk b/hw/bsp/lpc13/family.mk index 7ff2c058a..0fed67ebc 100644 --- a/hw/bsp/lpc13/family.mk +++ b/hw/bsp/lpc13/family.mk @@ -12,7 +12,7 @@ CFLAGS += \ -DCFG_TUSB_MCU=OPT_MCU_LPC13XX \ -DCFG_TUSB_MEM_ALIGN='__attribute__((aligned(64)))' -LDFLAGS_GCC += -specs=nosys.specs -specs=nano.specs +LDFLAGS += -specs=nosys.specs -specs=nano.specs # startup.c and lpc_types.h cause following errors CFLAGS += -Wno-error=strict-prototypes -Wno-error=redundant-decls diff --git a/hw/bsp/lpc15/family.mk b/hw/bsp/lpc15/family.mk index 3267e973a..a42b2d9e4 100644 --- a/hw/bsp/lpc15/family.mk +++ b/hw/bsp/lpc15/family.mk @@ -10,10 +10,10 @@ CFLAGS += \ -DCFG_TUSB_MCU=OPT_MCU_LPC15XX \ -DCFG_TUSB_MEM_ALIGN='__attribute__((aligned(64)))' -LDFLAGS_GCC += -specs=nosys.specs -specs=nano.specs +LDFLAGS += -specs=nosys.specs -specs=nano.specs # mcu driver cause following warnings -CFLAGS_GCC += -Wno-error=strict-prototypes -Wno-error=unused-parameter -Wno-error=unused-variable -Wno-error=cast-qual +CFLAGS += -Wno-error=strict-prototypes -Wno-error=unused-parameter -Wno-error=unused-variable -Wno-error=cast-qual MCU_DIR = hw/mcu/nxp/lpcopen/lpc15xx/lpc_chip_15xx diff --git a/hw/bsp/lpc17/family.mk b/hw/bsp/lpc17/family.mk index f1ed1a7d0..5d4ff54a6 100644 --- a/hw/bsp/lpc17/family.mk +++ b/hw/bsp/lpc17/family.mk @@ -11,12 +11,12 @@ CFLAGS += \ -DRTC_EV_SUPPORT=0 # lpc_types.h cause following errors -CFLAGS_GCC += -Wno-error=strict-prototypes -Wno-error=cast-qual +CFLAGS += -Wno-error=strict-prototypes -Wno-error=cast-qual # caused by freeRTOS port !! CFLAGS += -Wno-error=maybe-uninitialized -LDFLAGS_GCC += --specs=nosys.specs --specs=nano.specs +LDFLAGS += --specs=nosys.specs --specs=nano.specs SRC_C += \ src/portable/nxp/lpc17_40/dcd_lpc17_40.c \ diff --git a/hw/bsp/lpc18/family.mk b/hw/bsp/lpc18/family.mk index 3bbafed11..5c46881e2 100644 --- a/hw/bsp/lpc18/family.mk +++ b/hw/bsp/lpc18/family.mk @@ -11,9 +11,9 @@ CFLAGS += \ -DCFG_TUSB_MCU=OPT_MCU_LPC18XX # mcu driver cause following warnings -CFLAGS_GCC += -Wno-error=unused-parameter -Wno-error=cast-qual +CFLAGS += -Wno-error=unused-parameter -Wno-error=cast-qual -LDFLAGS_GCC += --specs=nosys.specs --specs=nano.specs +LDFLAGS += --specs=nosys.specs --specs=nano.specs SRC_C += \ src/portable/chipidea/ci_hs/dcd_ci_hs.c \ diff --git a/hw/bsp/lpc40/family.mk b/hw/bsp/lpc40/family.mk index c21923000..af8864335 100644 --- a/hw/bsp/lpc40/family.mk +++ b/hw/bsp/lpc40/family.mk @@ -11,9 +11,9 @@ CFLAGS += \ -DCFG_TUSB_MCU=OPT_MCU_LPC40XX # mcu driver cause following warnings -CFLAGS_GCC += -Wno-error=strict-prototypes -Wno-error=unused-parameter -Wno-error=cast-qual +CFLAGS += -Wno-error=strict-prototypes -Wno-error=unused-parameter -Wno-error=cast-qual -LDFLAGS_GCC += --specs=nosys.specs --specs=nano.specs +LDFLAGS += --specs=nosys.specs --specs=nano.specs # All source paths should be relative to the top level. SRC_C += \ diff --git a/hw/bsp/lpc43/family.mk b/hw/bsp/lpc43/family.mk index 39be867d1..5813dfdcc 100644 --- a/hw/bsp/lpc43/family.mk +++ b/hw/bsp/lpc43/family.mk @@ -9,14 +9,14 @@ CFLAGS += \ -DCFG_TUSB_MCU=OPT_MCU_LPC43XX # mcu driver cause following warnings -CFLAGS_GCC += \ +CFLAGS += \ -flto \ -nostdlib \ -Wno-error=unused-parameter \ -Wno-error=cast-qual \ -Wno-error=incompatible-pointer-types \ -LDFLAGS_GCC += --specs=nosys.specs --specs=nano.specs +LDFLAGS += --specs=nosys.specs --specs=nano.specs SRC_C += \ src/portable/chipidea/ci_hs/dcd_ci_hs.c \ diff --git a/hw/bsp/lpc51/family.mk b/hw/bsp/lpc51/family.mk index 34987d183..e295d0587 100644 --- a/hw/bsp/lpc51/family.mk +++ b/hw/bsp/lpc51/family.mk @@ -12,7 +12,7 @@ CFLAGS += \ # mcu driver cause following warnings CFLAGS += -Wno-error=unused-parameter -LDFLAGS_GCC += \ +LDFLAGS += \ -nostartfiles \ --specs=nosys.specs --specs=nano.specs \ diff --git a/hw/bsp/lpc54/family.mk b/hw/bsp/lpc54/family.mk index 94168f6b2..324b3b6f1 100644 --- a/hw/bsp/lpc54/family.mk +++ b/hw/bsp/lpc54/family.mk @@ -23,7 +23,7 @@ endif # mcu driver cause following warnings CFLAGS += -Wno-error=unused-parameter -LDFLAGS_GCC += \ +LDFLAGS += \ -nostartfiles \ --specs=nosys.specs --specs=nano.specs diff --git a/hw/bsp/lpc55/family.mk b/hw/bsp/lpc55/family.mk index 2fc76ed50..a9b6f6af1 100644 --- a/hw/bsp/lpc55/family.mk +++ b/hw/bsp/lpc55/family.mk @@ -41,7 +41,7 @@ endif # mcu driver cause following warnings CFLAGS += -Wno-error=unused-parameter -Wno-error=float-equal -LDFLAGS_GCC += \ +LDFLAGS += \ -nostartfiles \ --specs=nosys.specs --specs=nano.specs \ -Wl,--defsym=__stack_size__=0x1000 \ diff --git a/hw/bsp/maxim/family.mk b/hw/bsp/maxim/family.mk index 3ddf8cf39..9d66553fc 100644 --- a/hw/bsp/maxim/family.mk +++ b/hw/bsp/maxim/family.mk @@ -60,8 +60,8 @@ CFLAGS += \ -Wno-error=sign-compare \ -Wno-error=enum-conversion \ -LDFLAGS_GCC += -nostartfiles --specs=nosys.specs --specs=nano.specs -LD_FILE_GCC ?= $(FAMILY_PATH)/linker/${MAX_DEVICE}.ld +LDFLAGS += -nostartfiles --specs=nosys.specs --specs=nano.specs +LD_FILE ?= $(FAMILY_PATH)/linker/${MAX_DEVICE}.ld # If the applications needs to be signed (for the MAX32651), sign it first and # then need to use MSDK's OpenOCD to flash it @@ -99,7 +99,7 @@ SRC_C += \ ${MSDK_LIB}/PeriphDrivers/Source/UART/uart_common.c \ ${MSDK_LIB}/PeriphDrivers/Source/UART/uart_${PERIPH_SUFFIX}${PERIPH_ID}.c \ -SRC_S_GCC += ${MSDK_LIB}/CMSIS/Device/Maxim/${MAX_DEVICE_UPPER}/Source/GCC/startup_${MAX_DEVICE}.S +SRC_S += ${MSDK_LIB}/CMSIS/Device/Maxim/${MAX_DEVICE_UPPER}/Source/GCC/startup_${MAX_DEVICE}.S INC += \ $(TOP)/$(BOARD_PATH) \ diff --git a/hw/bsp/mcx/family.mk b/hw/bsp/mcx/family.mk index 3d63eb238..c5dd945b9 100644 --- a/hw/bsp/mcx/family.mk +++ b/hw/bsp/mcx/family.mk @@ -15,7 +15,7 @@ CFLAGS += \ # mcu driver cause following warnings CFLAGS += -Wno-error=unused-parameter -Wno-error=old-style-declaration -Wno-error=redundant-decls -LDFLAGS_GCC += \ +LDFLAGS += \ --specs=nosys.specs --specs=nano.specs \ -Wl,--defsym=__stack_size__=0x1000 \ -Wl,--defsym=__heap_size__=0 \ diff --git a/hw/bsp/mm32/family.mk b/hw/bsp/mm32/family.mk index a790663ab..5e40fd09e 100644 --- a/hw/bsp/mm32/family.mk +++ b/hw/bsp/mm32/family.mk @@ -13,7 +13,7 @@ CFLAGS += \ # suppress warning caused by vendor mcu driver CFLAGS += -Wno-error=unused-parameter -Wno-error=maybe-uninitialized -Wno-error=cast-qual -LDFLAGS_GCC += \ +LDFLAGS += \ -nostdlib -nostartfiles \ -specs=nosys.specs -specs=nano.specs \ diff --git a/hw/bsp/msp432e4/family.mk b/hw/bsp/msp432e4/family.mk index d837f9351..7a7a17b61 100644 --- a/hw/bsp/msp432e4/family.mk +++ b/hw/bsp/msp432e4/family.mk @@ -11,7 +11,7 @@ CFLAGS += \ # mcu driver cause following warnings CFLAGS += -Wno-error=cast-qual -Wno-error=format= -LDFLAGS_GCC += --specs=nosys.specs --specs=nano.specs +LDFLAGS += --specs=nosys.specs --specs=nano.specs LD_FILE = hw/mcu/ti/msp432e4/Source/${MCU_VARIANT}.ld diff --git a/hw/bsp/nrf/family.mk b/hw/bsp/nrf/family.mk index 2cead99db..e7e9e7d0a 100644 --- a/hw/bsp/nrf/family.mk +++ b/hw/bsp/nrf/family.mk @@ -42,7 +42,7 @@ CFLAGS += \ #CFLAGS += -D__START=main # suppress warning caused by vendor mcu driver -CFLAGS_GCC += \ +CFLAGS += \ -flto \ -Wno-error=undef \ -Wno-error=unused-parameter \ @@ -51,7 +51,7 @@ CFLAGS_GCC += \ -Wno-error=cast-qual \ -Wno-error=redundant-decls \ -LDFLAGS_GCC += \ +LDFLAGS += \ -nostartfiles \ --specs=nosys.specs --specs=nano.specs \ -L$(TOP)/${NRFX_PATH}/mdk diff --git a/hw/bsp/nuc100_120/family.mk b/hw/bsp/nuc100_120/family.mk index f9afb4f72..e915e3e33 100644 --- a/hw/bsp/nuc100_120/family.mk +++ b/hw/bsp/nuc100_120/family.mk @@ -8,7 +8,7 @@ CFLAGS += \ CPU_CORE ?= cortex-m0 -LDFLAGS_GCC += -specs=nosys.specs -specs=nano.specs +LDFLAGS += -specs=nosys.specs -specs=nano.specs # LD_FILE is defined in board.mk diff --git a/hw/bsp/nuc121_125/family.mk b/hw/bsp/nuc121_125/family.mk index f46dac6e4..979e8ac9f 100644 --- a/hw/bsp/nuc121_125/family.mk +++ b/hw/bsp/nuc121_125/family.mk @@ -12,7 +12,7 @@ CPU_CORE ?= cortex-m0 # mcu driver cause following warnings CFLAGS += -Wno-error=redundant-decls -LDFLAGS_GCC += \ +LDFLAGS += \ --specs=nosys.specs --specs=nano.specs # All source paths should be relative to the top level. diff --git a/hw/bsp/nuc126/family.mk b/hw/bsp/nuc126/family.mk index 37df7aaab..f2f02b621 100644 --- a/hw/bsp/nuc126/family.mk +++ b/hw/bsp/nuc126/family.mk @@ -13,7 +13,7 @@ CPU_CORE ?= cortex-m0 # mcu driver cause following warnings CFLAGS += -Wno-error=redundant-decls -LDFLAGS_GCC += -specs=nosys.specs -specs=nano.specs +LDFLAGS += -specs=nosys.specs -specs=nano.specs # All source paths should be relative to the top level. # LD_FILE is defined in board.mk diff --git a/hw/bsp/nuc505/family.mk b/hw/bsp/nuc505/family.mk index e1f25e2db..d776defde 100644 --- a/hw/bsp/nuc505/family.mk +++ b/hw/bsp/nuc505/family.mk @@ -9,7 +9,7 @@ CPU_CORE ?= cortex-m4 # mcu driver cause following warnings CFLAGS += -Wno-error=redundant-decls -LDFLAGS_GCC += -specs=nosys.specs -specs=nano.specs +LDFLAGS += -specs=nosys.specs -specs=nano.specs # LD_FILE is defined in board.mk diff --git a/hw/bsp/ra/family.mk b/hw/bsp/ra/family.mk index 6ac7c262f..64a707ed6 100644 --- a/hw/bsp/ra/family.mk +++ b/hw/bsp/ra/family.mk @@ -39,7 +39,7 @@ CFLAGS += \ -DBOARD_TUH_RHPORT=${RHPORT_HOST} \ -DBOARD_TUH_MAX_SPEED=${RHPORT_HOST_SPEED} -CFLAGS_GCC += \ +CFLAGS += \ -flto \ -Wno-error=undef \ -Wno-error=strict-prototypes \ @@ -49,7 +49,7 @@ CFLAGS_GCC += \ -Wno-error=unused-variable \ -ffreestanding -LDFLAGS_GCC += \ +LDFLAGS += \ -nostartfiles -nostdlib \ -specs=nosys.specs -specs=nano.specs diff --git a/hw/bsp/rw61x/family.mk b/hw/bsp/rw61x/family.mk index 08eafddbc..4893f717f 100644 --- a/hw/bsp/rw61x/family.mk +++ b/hw/bsp/rw61x/family.mk @@ -17,7 +17,7 @@ CFLAGS += \ # mcu driver cause following warnings CFLAGS += -Wno-error=unused-parameter -Wno-error=old-style-declaration -Wno-error=redundant-decls -LDFLAGS_GCC += -specs=nosys.specs -specs=nano.specs +LDFLAGS += -specs=nosys.specs -specs=nano.specs # All source paths should be relative to the top level. LD_FILE ?= $(SDK_DIR)/devices/$(MCU_VARIANT)/gcc/$(MCU_CORE)_flash.ld diff --git a/hw/bsp/rx/family.mk b/hw/bsp/rx/family.mk index 8b23b6c46..a357460e8 100644 --- a/hw/bsp/rx/family.mk +++ b/hw/bsp/rx/family.mk @@ -14,7 +14,7 @@ CFLAGS += \ # suppress warning caused by vendor mcu driver CFLAGS += -Wno-error=redundant-decls -LDFLAGS_GCC += -specs=nosys.specs -specs=nano.specs +LDFLAGS += -specs=nosys.specs -specs=nano.specs SRC_C += \ src/portable/renesas/rusb2/dcd_rusb2.c \ diff --git a/hw/bsp/samd11/family.mk b/hw/bsp/samd11/family.mk index 6f89a2d66..327ec44c2 100644 --- a/hw/bsp/samd11/family.mk +++ b/hw/bsp/samd11/family.mk @@ -17,7 +17,7 @@ CFLAGS += -Wno-error=redundant-decls # SAM driver is flooded with -Wcast-qual which slow down complication significantly CFLAGS_SKIP += -Wcast-qual -LDFLAGS_GCC += -specs=nosys.specs -specs=nano.specs +LDFLAGS += -specs=nosys.specs -specs=nano.specs SRC_C += \ src/portable/microchip/samd/dcd_samd.c \ diff --git a/hw/bsp/samd2x_l2x/family.mk b/hw/bsp/samd2x_l2x/family.mk index dca440ddd..2ff01e8b7 100644 --- a/hw/bsp/samd2x_l2x/family.mk +++ b/hw/bsp/samd2x_l2x/family.mk @@ -39,7 +39,7 @@ CFLAGS += -Wno-error=redundant-decls # SAM driver is flooded with -Wcast-qual which slow down complication significantly CFLAGS_SKIP += -Wcast-qual -LDFLAGS_GCC += \ +LDFLAGS += \ -nostdlib -nostartfiles \ --specs=nosys.specs --specs=nano.specs \ diff --git a/hw/bsp/samd5x_e5x/family.mk b/hw/bsp/samd5x_e5x/family.mk index f0a4a3f00..c544508dc 100644 --- a/hw/bsp/samd5x_e5x/family.mk +++ b/hw/bsp/samd5x_e5x/family.mk @@ -12,7 +12,7 @@ CFLAGS += \ # SAM driver is flooded with -Wcast-qual which slow down complication significantly CFLAGS_SKIP += -Wcast-qual -LDFLAGS_GCC += \ +LDFLAGS += \ -nostdlib -nostartfiles \ --specs=nosys.specs --specs=nano.specs diff --git a/hw/bsp/same7x/family.mk b/hw/bsp/same7x/family.mk index 19e119625..02e940c5a 100644 --- a/hw/bsp/same7x/family.mk +++ b/hw/bsp/same7x/family.mk @@ -18,7 +18,7 @@ CFLAGS += -Wno-error=unused-parameter -Wno-error=cast-align -Wno-error=redundant # SAM driver is flooded with -Wcast-qual which slows down compilation significantly CFLAGS_SKIP += -Wcast-qual -LDFLAGS_GCC += -specs=nosys.specs -specs=nano.specs +LDFLAGS += -specs=nosys.specs -specs=nano.specs # All source paths should be relative to the top level. SRC_C += \ diff --git a/hw/bsp/samg/family.mk b/hw/bsp/samg/family.mk index d5d2e6122..037ac4709 100644 --- a/hw/bsp/samg/family.mk +++ b/hw/bsp/samg/family.mk @@ -13,7 +13,7 @@ CFLAGS += -Wno-error=undef -Wno-error=null-dereference -Wno-error=redundant-decl # SAM driver is flooded with -Wcast-qual which slow down complication significantly CFLAGS_SKIP += -Wcast-qual -LDFLAGS_GCC += \ +LDFLAGS += \ -nostdlib -nostartfiles \ --specs=nosys.specs --specs=nano.specs \ diff --git a/hw/bsp/stm32c0/boards/stm32c071nucleo/board.mk b/hw/bsp/stm32c0/boards/stm32c071nucleo/board.mk index fd22fc8d4..f2657e8c5 100644 --- a/hw/bsp/stm32c0/boards/stm32c071nucleo/board.mk +++ b/hw/bsp/stm32c0/boards/stm32c071nucleo/board.mk @@ -2,12 +2,9 @@ CFLAGS += \ -DSTM32C071xx # GCC -SRC_S_GCC += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32c071xx.s -LD_FILE_GCC = $(BOARD_PATH)/STM32C071RBTx_FLASH.ld +SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32c071xx.s +LD_FILE = $(BOARD_PATH)/STM32C071RBTx_FLASH.ld -# IAR -SRC_S_IAR += $(ST_CMSIS)/Source/Templates/iar/startup_stm32c071xx.s -LD_FILE_IAR = $(BOARD_PATH)/stm32c071xx_flash.icf # For flash-jlink target JLINK_DEVICE = stm32c071rb diff --git a/hw/bsp/stm32c0/family.mk b/hw/bsp/stm32c0/family.mk index 71209bf2e..44ec2531e 100644 --- a/hw/bsp/stm32c0/family.mk +++ b/hw/bsp/stm32c0/family.mk @@ -13,13 +13,13 @@ CFLAGS += \ -DCFG_EXAMPLE_VIDEO_READONLY \ # GCC Flags -CFLAGS_GCC += \ +CFLAGS += \ -flto \ # suppress warning caused by vendor mcu driver -CFLAGS_GCC += -Wno-error=cast-align -Wno-error=unused-parameter +CFLAGS += -Wno-error=cast-align -Wno-error=unused-parameter -LDFLAGS_GCC += \ +LDFLAGS += \ -nostdlib -nostartfiles \ --specs=nosys.specs --specs=nano.specs diff --git a/hw/bsp/stm32f0/boards/stm32f070rbnucleo/board.mk b/hw/bsp/stm32f0/boards/stm32f070rbnucleo/board.mk index 63f6a31c2..ea3cf34b4 100644 --- a/hw/bsp/stm32f0/boards/stm32f070rbnucleo/board.mk +++ b/hw/bsp/stm32f0/boards/stm32f070rbnucleo/board.mk @@ -3,7 +3,7 @@ MCU_VARIANT = stm32f070xb CFLAGS += -DSTM32F070xB -DCFG_EXAMPLE_VIDEO_READONLY # Linker -LD_FILE_GCC = $(BOARD_PATH)/stm32F070rbtx_flash.ld +LD_FILE = $(BOARD_PATH)/stm32F070rbtx_flash.ld # For flash-jlink target JLINK_DEVICE = stm32f070rb diff --git a/hw/bsp/stm32f0/boards/stm32f072disco/board.mk b/hw/bsp/stm32f0/boards/stm32f072disco/board.mk index 57c658629..e23af42e1 100644 --- a/hw/bsp/stm32f0/boards/stm32f072disco/board.mk +++ b/hw/bsp/stm32f0/boards/stm32f072disco/board.mk @@ -3,7 +3,7 @@ MCU_VARIANT = stm32f072xb CFLAGS += -DSTM32F072xB -DCFG_EXAMPLE_VIDEO_READONLY # Linker -LD_FILE_GCC = $(BOARD_PATH)/STM32F072RBTx_FLASH.ld +LD_FILE = $(BOARD_PATH)/STM32F072RBTx_FLASH.ld # For flash-jlink target JLINK_DEVICE = stm32f072rb diff --git a/hw/bsp/stm32f0/boards/stm32f072eval/board.mk b/hw/bsp/stm32f0/boards/stm32f072eval/board.mk index bab889524..fec26c7cc 100644 --- a/hw/bsp/stm32f0/boards/stm32f072eval/board.mk +++ b/hw/bsp/stm32f0/boards/stm32f072eval/board.mk @@ -3,7 +3,7 @@ MCU_VARIANT = stm32f072xb CFLAGS += -DSTM32F072xB -DLSI_VALUE=40000 -DCFG_EXAMPLE_VIDEO_READONLY # Linker -LD_FILE_GCC = $(BOARD_PATH)/STM32F072VBTx_FLASH.ld +LD_FILE = $(BOARD_PATH)/STM32F072VBTx_FLASH.ld # For flash-jlink target JLINK_DEVICE = stm32f072vb diff --git a/hw/bsp/stm32f0/family.mk b/hw/bsp/stm32f0/family.mk index b5efdcb8d..ac0c4fa14 100644 --- a/hw/bsp/stm32f0/family.mk +++ b/hw/bsp/stm32f0/family.mk @@ -14,13 +14,13 @@ CFLAGS += \ -DCFG_TUSB_MCU=OPT_MCU_STM32F0 # GCC Flags -CFLAGS_GCC += \ +CFLAGS += \ -flto \ # suppress warning caused by vendor mcu driver -CFLAGS_GCC += -Wno-error=unused-parameter -Wno-error=cast-align +CFLAGS += -Wno-error=unused-parameter -Wno-error=cast-align -LDFLAGS_GCC += \ +LDFLAGS += \ -nostdlib -nostartfiles \ --specs=nosys.specs --specs=nano.specs @@ -48,8 +48,6 @@ INC += \ $(TOP)/$(ST_HAL_DRIVER)/Inc # Startup -SRC_S_GCC += $(ST_CMSIS)/Source/Templates/gcc/startup_$(MCU_VARIANT).s -SRC_S_IAR += $(ST_CMSIS)/Source/Templates/iar/startup_$(MCU_VARIANT).s +SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_$(MCU_VARIANT).s # Linker -LD_FILE_IAR = $(ST_CMSIS)/Source/Templates/iar/linker/$(MCU_VARIANT)_flash.icf diff --git a/hw/bsp/stm32f1/boards/stm32f103_bluepill/board.mk b/hw/bsp/stm32f1/boards/stm32f103_bluepill/board.mk index 6c5f34501..745a2eb8f 100644 --- a/hw/bsp/stm32f1/boards/stm32f103_bluepill/board.mk +++ b/hw/bsp/stm32f1/boards/stm32f103_bluepill/board.mk @@ -3,8 +3,7 @@ MCU_VARIANT = stm32f103xb CFLAGS += -DSTM32F103xB -DHSE_VALUE=8000000U -DCFG_EXAMPLE_VIDEO_READONLY # Linker -LD_FILE_GCC = $(BOARD_PATH)/STM32F103X8_FLASH.ld -LD_FILE_IAR = $(BOARD_PATH)/stm32f103x8_flash.icf +LD_FILE = $(BOARD_PATH)/STM32F103X8_FLASH.ld # For flash-jlink target JLINK_DEVICE = stm32f103c8 diff --git a/hw/bsp/stm32f1/boards/stm32f103_mini_2/board.mk b/hw/bsp/stm32f1/boards/stm32f103_mini_2/board.mk index 7e95c1fe1..2d153dd81 100644 --- a/hw/bsp/stm32f1/boards/stm32f103_mini_2/board.mk +++ b/hw/bsp/stm32f1/boards/stm32f103_mini_2/board.mk @@ -3,8 +3,7 @@ MCU_VARIANT = stm32f103xb CFLAGS += -DSTM32F103xB -DHSE_VALUE=8000000U # Linker -LD_FILE_GCC = $(BOARD_PATH)/STM32F103XC_FLASH.ld -LD_FILE_IAR = $(BOARD_PATH)/stm32f103xc_flash.icf +LD_FILE = $(BOARD_PATH)/STM32F103XC_FLASH.ld # For flash-jlink target JLINK_DEVICE = stm32f103rc diff --git a/hw/bsp/stm32f1/boards/stm32f103ze_iar/board.mk b/hw/bsp/stm32f1/boards/stm32f103ze_iar/board.mk index 5b17d8036..ca4efd357 100644 --- a/hw/bsp/stm32f1/boards/stm32f103ze_iar/board.mk +++ b/hw/bsp/stm32f1/boards/stm32f103ze_iar/board.mk @@ -3,8 +3,7 @@ MCU_VARIANT = stm32f103xe CFLAGS += -DSTM32F103xE -DHSE_VALUE=8000000U # Linker -LD_FILE_GCC = ${ST_CMSIS}/Source/Templates/gcc/linker/STM32F103XE_FLASH.ld -LD_FILE_IAR = ${ST_CMSIS}/Source/Templates/iar/linker/${MCU_VARIANT}_flash.icf +LD_FILE = ${ST_CMSIS}/Source/Templates/gcc/linker/STM32F103XE_FLASH.ld # For flash-jlink target JLINK_DEVICE = stm32f103ze diff --git a/hw/bsp/stm32f1/family.mk b/hw/bsp/stm32f1/family.mk index ca022c7ec..a096fe17a 100644 --- a/hw/bsp/stm32f1/family.mk +++ b/hw/bsp/stm32f1/family.mk @@ -12,13 +12,13 @@ CFLAGS += \ -DCFG_TUSB_MCU=OPT_MCU_STM32F1 # GCC Flags -CFLAGS_GCC += \ +CFLAGS += \ -flto \ # mcu driver cause following warnings -CFLAGS_GCC += -Wno-error=cast-align +CFLAGS += -Wno-error=cast-align -LDFLAGS_GCC += \ +LDFLAGS += \ -nostdlib -nostartfiles \ -specs=nosys.specs -specs=nano.specs @@ -44,8 +44,7 @@ INC += \ ${TOP}/${ST_HAL_DRIVER}/Inc # Startup -SRC_S_GCC += ${ST_CMSIS}/Source/Templates/gcc/startup_${MCU_VARIANT}.s -SRC_S_IAR += ${ST_CMSIS}/Source/Templates/iar/startup_${MCU_VARIANT}.s +SRC_S += ${ST_CMSIS}/Source/Templates/gcc/startup_${MCU_VARIANT}.s # flash target ROM bootloader: flash-dfu-util DFU_UTIL_OPTION = -a 0 --dfuse-address 0x08000000 diff --git a/hw/bsp/stm32f2/family.mk b/hw/bsp/stm32f2/family.mk index ef14a9d67..e5a44ebba 100644 --- a/hw/bsp/stm32f2/family.mk +++ b/hw/bsp/stm32f2/family.mk @@ -9,11 +9,11 @@ CFLAGS += \ -DCFG_TUSB_MCU=OPT_MCU_STM32F2 # mcu driver cause following warnings -CFLAGS_GCC += \ +CFLAGS += \ -flto \ -Wno-error=sign-compare -LDFLAGS_GCC += \ +LDFLAGS += \ -nostdlib -nostartfiles \ --specs=nosys.specs --specs=nano.specs @@ -35,8 +35,6 @@ INC += \ $(TOP)/$(BOARD_PATH) # Startup -SRC_S_GCC += $(ST_CMSIS)/Source/Templates/gcc/startup_${MCU_VARIANT}.s -SRC_S_IAR += $(ST_CMSIS)/Source/Templates/iar/startup_${MCU_VARIANT}.s +SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_${MCU_VARIANT}.s # Linker -LD_FILE_IAR ?= $(ST_CMSIS)/Source/Templates/iar/linker/${MCU_VARIANT}_flash.icf diff --git a/hw/bsp/stm32f3/family.mk b/hw/bsp/stm32f3/family.mk index eb4a4e186..ff7558b73 100644 --- a/hw/bsp/stm32f3/family.mk +++ b/hw/bsp/stm32f3/family.mk @@ -9,11 +9,11 @@ CFLAGS += \ -DCFG_TUSB_MCU=OPT_MCU_STM32F3 # mcu driver cause following warnings -CFLAGS_GCC += \ +CFLAGS += \ -flto \ -Wno-error=unused-parameter -LDFLAGS_GCC += \ +LDFLAGS += \ -nostdlib -nostartfiles \ --specs=nosys.specs --specs=nano.specs @@ -34,8 +34,6 @@ INC += \ $(TOP)/$(BOARD_PATH) # Startup -SRC_S_GCC += $(ST_CMSIS)/Source/Templates/gcc/startup_${MCU_VARIANT}.s -SRC_S_IAR += $(ST_CMSIS)/Source/Templates/iar/startup_${MCU_VARIANT}.s +SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_${MCU_VARIANT}.s # Linker -LD_FILE_IAR ?= $(ST_CMSIS)/Source/Templates/iar/linker/${MCU_VARIANT}_flash.icf diff --git a/hw/bsp/stm32f4/boards/feather_stm32f405/board.mk b/hw/bsp/stm32f4/boards/feather_stm32f405/board.mk index cfd1d8b3b..1b24940fc 100644 --- a/hw/bsp/stm32f4/boards/feather_stm32f405/board.mk +++ b/hw/bsp/stm32f4/boards/feather_stm32f405/board.mk @@ -1,12 +1,9 @@ CFLAGS += -DSTM32F405xx # GCC -SRC_S_GCC += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f405xx.s -LD_FILE_GCC = $(BOARD_PATH)/STM32F405RGTx_FLASH.ld +SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f405xx.s +LD_FILE = $(BOARD_PATH)/STM32F405RGTx_FLASH.ld -# IAR -SRC_S_IAR += $(ST_CMSIS)/Source/Templates/iar/startup_stm32f405xx.s -LD_FILE_IAR = $(ST_CMSIS)/Source/Templates/iar/linker/stm32f405xx_flash.icf # For flash-jlink target JLINK_DEVICE = stm32f405rg diff --git a/hw/bsp/stm32f4/boards/pyboardv11/board.mk b/hw/bsp/stm32f4/boards/pyboardv11/board.mk index 4c52e004a..8aac5c4d7 100644 --- a/hw/bsp/stm32f4/boards/pyboardv11/board.mk +++ b/hw/bsp/stm32f4/boards/pyboardv11/board.mk @@ -1,12 +1,9 @@ CFLAGS += -DSTM32F405xx # GCC -SRC_S_GCC += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f405xx.s -LD_FILE_GCC = $(BOARD_PATH)/STM32F405RGTx_FLASH.ld +SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f405xx.s +LD_FILE = $(BOARD_PATH)/STM32F405RGTx_FLASH.ld -# IAR -SRC_S_IAR += $(ST_CMSIS)/Source/Templates/iar/startup_stm32f405xx.s -LD_FILE_IAR = $(ST_CMSIS)/Source/Templates/iar/linker/stm32f405xx_flash.icf # For flash-jlink target JLINK_DEVICE = stm32f405rg diff --git a/hw/bsp/stm32f4/boards/stm32f401blackpill/board.mk b/hw/bsp/stm32f4/boards/stm32f401blackpill/board.mk index 3285bd232..e094cf012 100644 --- a/hw/bsp/stm32f4/boards/stm32f401blackpill/board.mk +++ b/hw/bsp/stm32f4/boards/stm32f401blackpill/board.mk @@ -1,12 +1,9 @@ CFLAGS += -DSTM32F401xC # GCC -SRC_S_GCC += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f401xc.s -LD_FILE_GCC = $(BOARD_PATH)/STM32F401VCTx_FLASH.ld +SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f401xc.s +LD_FILE = $(BOARD_PATH)/STM32F401VCTx_FLASH.ld -# IAR -SRC_S_IAR += $(ST_CMSIS)/Source/Templates/iar/startup_stm32f401xc.s -LD_FILE_IAR = $(ST_CMSIS)/Source/Templates/iar/linker/stm32f401xc_flash.icf # For flash-jlink target JLINK_DEVICE = stm32f401cc diff --git a/hw/bsp/stm32f4/boards/stm32f407blackvet/board.mk b/hw/bsp/stm32f4/boards/stm32f407blackvet/board.mk index c46a78f81..db1719238 100644 --- a/hw/bsp/stm32f4/boards/stm32f407blackvet/board.mk +++ b/hw/bsp/stm32f4/boards/stm32f407blackvet/board.mk @@ -1,12 +1,9 @@ CFLAGS += -DSTM32F407xx # GCC -SRC_S_GCC += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f407xx.s -LD_FILE_GCC = $(BOARD_PATH)/STM32F407VETx_FLASH.ld +SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f407xx.s +LD_FILE = $(BOARD_PATH)/STM32F407VETx_FLASH.ld -# IAR -SRC_S_IAR += $(ST_CMSIS)/Source/Templates/iar/startup_stm32f407xx.s -LD_FILE_IAR = $(ST_CMSIS)/Source/Templates/iar/linker/stm32f407xx_flash.icf # For flash-jlink target diff --git a/hw/bsp/stm32f4/boards/stm32f407disco/board.mk b/hw/bsp/stm32f4/boards/stm32f407disco/board.mk index 4de656b0c..5faba55eb 100644 --- a/hw/bsp/stm32f4/boards/stm32f407disco/board.mk +++ b/hw/bsp/stm32f4/boards/stm32f407disco/board.mk @@ -1,12 +1,9 @@ CFLAGS += -DSTM32F407xx # GCC -SRC_S_GCC += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f407xx.s -LD_FILE_GCC = $(BOARD_PATH)/STM32F407VGTx_FLASH.ld +SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f407xx.s +LD_FILE = $(BOARD_PATH)/STM32F407VGTx_FLASH.ld -# IAR -SRC_S_IAR += $(ST_CMSIS)/Source/Templates/iar/startup_stm32f407xx.s -LD_FILE_IAR = $(ST_CMSIS)/Source/Templates/iar/linker/stm32f407xx_flash.icf # For flash-jlink target diff --git a/hw/bsp/stm32f4/boards/stm32f411blackpill/board.mk b/hw/bsp/stm32f4/boards/stm32f411blackpill/board.mk index c45aba79b..9ff7d0fe3 100644 --- a/hw/bsp/stm32f4/boards/stm32f411blackpill/board.mk +++ b/hw/bsp/stm32f4/boards/stm32f411blackpill/board.mk @@ -1,12 +1,9 @@ CFLAGS += -DSTM32F411xE -DHSE_VALUE=25000000 # GCC -SRC_S_GCC += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f411xe.s -LD_FILE_GCC = $(BOARD_PATH)/STM32F411CEUx_FLASH.ld +SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f411xe.s +LD_FILE = $(BOARD_PATH)/STM32F411CEUx_FLASH.ld -# IAR -SRC_S_IAR += $(ST_CMSIS)/Source/Templates/iar/startup_stm32f411xe.s -LD_FILE_IAR = $(ST_CMSIS)/Source/Templates/iar/linker/stm32f411xe_flash.icf # For flash-jlink target JLINK_DEVICE = stm32f411ce diff --git a/hw/bsp/stm32f4/boards/stm32f411disco/board.mk b/hw/bsp/stm32f4/boards/stm32f411disco/board.mk index 09fa50bd3..8e922e078 100644 --- a/hw/bsp/stm32f4/boards/stm32f411disco/board.mk +++ b/hw/bsp/stm32f4/boards/stm32f411disco/board.mk @@ -1,12 +1,9 @@ CFLAGS += -DSTM32F411xE # GCC -SRC_S_GCC += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f411xe.s -LD_FILE_GCC = $(BOARD_PATH)/STM32F411VETx_FLASH.ld +SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f411xe.s +LD_FILE = $(BOARD_PATH)/STM32F411VETx_FLASH.ld -# IAR -SRC_S_IAR += $(ST_CMSIS)/Source/Templates/iar/startup_stm32f411xe.s -LD_FILE_IAR = $(ST_CMSIS)/Source/Templates/iar/linker/stm32f411xe_flash.icf # For flash-jlink target JLINK_DEVICE = stm32f411ve diff --git a/hw/bsp/stm32f4/boards/stm32f412disco/board.mk b/hw/bsp/stm32f4/boards/stm32f412disco/board.mk index f767ac6c4..e89d673e2 100644 --- a/hw/bsp/stm32f4/boards/stm32f412disco/board.mk +++ b/hw/bsp/stm32f4/boards/stm32f412disco/board.mk @@ -1,12 +1,9 @@ CFLAGS += -DSTM32F412Zx # GCC -SRC_S_GCC += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f412zx.s -LD_FILE_GCC = $(BOARD_PATH)/STM32F412ZGTx_FLASH.ld +SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f412zx.s +LD_FILE = $(BOARD_PATH)/STM32F412ZGTx_FLASH.ld -# IAR -SRC_S_IAR += $(ST_CMSIS)/Source/Templates/iar/startup_stm32f412zx.s -LD_FILE_IAR = $(ST_CMSIS)/Source/Templates/iar/linker/stm32f412zx_flash.icf # For flash-jlink target JLINK_DEVICE = stm32f412zg diff --git a/hw/bsp/stm32f4/boards/stm32f412nucleo/board.mk b/hw/bsp/stm32f4/boards/stm32f412nucleo/board.mk index f767ac6c4..e89d673e2 100644 --- a/hw/bsp/stm32f4/boards/stm32f412nucleo/board.mk +++ b/hw/bsp/stm32f4/boards/stm32f412nucleo/board.mk @@ -1,12 +1,9 @@ CFLAGS += -DSTM32F412Zx # GCC -SRC_S_GCC += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f412zx.s -LD_FILE_GCC = $(BOARD_PATH)/STM32F412ZGTx_FLASH.ld +SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f412zx.s +LD_FILE = $(BOARD_PATH)/STM32F412ZGTx_FLASH.ld -# IAR -SRC_S_IAR += $(ST_CMSIS)/Source/Templates/iar/startup_stm32f412zx.s -LD_FILE_IAR = $(ST_CMSIS)/Source/Templates/iar/linker/stm32f412zx_flash.icf # For flash-jlink target JLINK_DEVICE = stm32f412zg diff --git a/hw/bsp/stm32f4/boards/stm32f439nucleo/board.mk b/hw/bsp/stm32f4/boards/stm32f439nucleo/board.mk index 2ab32b7f3..97f4aac36 100644 --- a/hw/bsp/stm32f4/boards/stm32f439nucleo/board.mk +++ b/hw/bsp/stm32f4/boards/stm32f439nucleo/board.mk @@ -1,12 +1,9 @@ CFLAGS += -DSTM32F439xx # GCC -SRC_S_GCC += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f439xx.s -LD_FILE_GCC = $(BOARD_PATH)/STM32F439ZITX_FLASH.ld +SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f439xx.s +LD_FILE = $(BOARD_PATH)/STM32F439ZITX_FLASH.ld -# IAR -SRC_S_IAR += $(ST_CMSIS)/Source/Templates/iar/startup_stm32f439xx.s -LD_FILE_IAR = $(ST_CMSIS)/Source/Templates/iar/linker/stm32f439xx_flash.icf # For flash-jlink target JLINK_DEVICE = stm32f439zi diff --git a/hw/bsp/stm32f4/family.mk b/hw/bsp/stm32f4/family.mk index f3e74ecea..f0f0731d9 100644 --- a/hw/bsp/stm32f4/family.mk +++ b/hw/bsp/stm32f4/family.mk @@ -43,13 +43,13 @@ CFLAGS += \ -DBOARD_TUH_MAX_SPEED=${RHPORT_HOST_SPEED} \ # GCC Flags -CFLAGS_GCC += \ +CFLAGS += \ -flto \ # suppress warning caused by vendor mcu driver -CFLAGS_GCC += -Wno-error=cast-align +CFLAGS += -Wno-error=cast-align -LDFLAGS_GCC += \ +LDFLAGS += \ -nostdlib -nostartfiles \ --specs=nosys.specs --specs=nano.specs diff --git a/hw/bsp/stm32f7/boards/stlinkv3mini/board.mk b/hw/bsp/stm32f7/boards/stlinkv3mini/board.mk index a19e455c7..8082a29d6 100644 --- a/hw/bsp/stm32f7/boards/stlinkv3mini/board.mk +++ b/hw/bsp/stm32f7/boards/stlinkv3mini/board.mk @@ -13,7 +13,7 @@ CFLAGS += \ -DHSE_VALUE=25000000 \ # Linker -LD_FILE_GCC = $(BOARD_PATH)/STM32F723xE_FLASH.ld +LD_FILE = $(BOARD_PATH)/STM32F723xE_FLASH.ld # flash target using on-board stlink flash: flash-stlink diff --git a/hw/bsp/stm32f7/boards/stm32f723disco/board.mk b/hw/bsp/stm32f7/boards/stm32f723disco/board.mk index 9b8e7a969..b75192962 100644 --- a/hw/bsp/stm32f7/boards/stm32f723disco/board.mk +++ b/hw/bsp/stm32f7/boards/stm32f723disco/board.mk @@ -10,7 +10,7 @@ CFLAGS += \ -DHSE_VALUE=25000000 \ # Linker -LD_FILE_GCC = $(BOARD_PATH)/STM32F723xE_FLASH.ld +LD_FILE = $(BOARD_PATH)/STM32F723xE_FLASH.ld # flash target using on-board stlink flash: flash-stlink diff --git a/hw/bsp/stm32f7/boards/stm32f746disco/board.mk b/hw/bsp/stm32f7/boards/stm32f746disco/board.mk index c2b54406e..b652ffca4 100644 --- a/hw/bsp/stm32f7/boards/stm32f746disco/board.mk +++ b/hw/bsp/stm32f7/boards/stm32f746disco/board.mk @@ -12,7 +12,7 @@ CFLAGS += \ -DHSE_VALUE=25000000 # Linker -LD_FILE_GCC = $(BOARD_PATH)/STM32F746ZGTx_FLASH.ld +LD_FILE = $(BOARD_PATH)/STM32F746ZGTx_FLASH.ld # flash target using on-board stlink flash: flash-stlink diff --git a/hw/bsp/stm32f7/boards/stm32f746nucleo/board.mk b/hw/bsp/stm32f7/boards/stm32f746nucleo/board.mk index fe7104eca..21697a300 100644 --- a/hw/bsp/stm32f7/boards/stm32f746nucleo/board.mk +++ b/hw/bsp/stm32f7/boards/stm32f746nucleo/board.mk @@ -11,7 +11,7 @@ CFLAGS += \ -DHSE_VALUE=8000000 # Linker -LD_FILE_GCC = $(BOARD_PATH)/STM32F746ZGTx_FLASH.ld +LD_FILE = $(BOARD_PATH)/STM32F746ZGTx_FLASH.ld # flash target using on-board stlink flash: flash-stlink diff --git a/hw/bsp/stm32f7/boards/stm32f767nucleo/board.mk b/hw/bsp/stm32f7/boards/stm32f767nucleo/board.mk index d61e0a00d..9705297cf 100644 --- a/hw/bsp/stm32f7/boards/stm32f767nucleo/board.mk +++ b/hw/bsp/stm32f7/boards/stm32f767nucleo/board.mk @@ -11,7 +11,7 @@ CFLAGS += \ -DHSE_VALUE=8000000 \ # Linker -LD_FILE_GCC = $(BOARD_PATH)/STM32F767ZITx_FLASH.ld +LD_FILE = $(BOARD_PATH)/STM32F767ZITx_FLASH.ld # For flash-jlink target JLINK_DEVICE = stm32f767zi diff --git a/hw/bsp/stm32f7/boards/stm32f769disco/board.mk b/hw/bsp/stm32f7/boards/stm32f769disco/board.mk index e756c9727..e2566e989 100644 --- a/hw/bsp/stm32f7/boards/stm32f769disco/board.mk +++ b/hw/bsp/stm32f7/boards/stm32f769disco/board.mk @@ -13,7 +13,7 @@ CFLAGS += \ -DHSE_VALUE=25000000 \ # Linker -LD_FILE_GCC = $(BOARD_PATH)/STM32F769ZITx_FLASH.ld +LD_FILE = $(BOARD_PATH)/STM32F769ZITx_FLASH.ld JLINK_DEVICE = stm32f769ni diff --git a/hw/bsp/stm32f7/family.mk b/hw/bsp/stm32f7/family.mk index d3422e03c..ecda4caf4 100644 --- a/hw/bsp/stm32f7/family.mk +++ b/hw/bsp/stm32f7/family.mk @@ -56,13 +56,13 @@ CFLAGS += \ #endif # GCC Flags -CFLAGS_GCC += \ +CFLAGS += \ -flto \ # mcu driver cause following warnings -CFLAGS_GCC += -Wno-error=cast-align +CFLAGS += -Wno-error=cast-align -LDFLAGS_GCC += \ +LDFLAGS += \ -nostdlib -nostartfiles \ --specs=nosys.specs --specs=nano.specs @@ -91,8 +91,6 @@ INC += \ $(TOP)/$(ST_HAL_DRIVER)/Inc # Startup -SRC_S_GCC += $(ST_CMSIS)/Source/Templates/gcc/startup_$(MCU_VARIANT).s -SRC_S_IAR += $(ST_CMSIS)/Source/Templates/iar/startup_$(MCU_VARIANT).s +SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_$(MCU_VARIANT).s # Linker -LD_FILE_IAR = $(ST_CMSIS)/Source/Templates/iar/linker/$(MCU_VARIANT)_flash.icf diff --git a/hw/bsp/stm32g0/boards/stm32g0b1nucleo/board.mk b/hw/bsp/stm32g0/boards/stm32g0b1nucleo/board.mk index 6a6078d5f..9b9128e44 100644 --- a/hw/bsp/stm32g0/boards/stm32g0b1nucleo/board.mk +++ b/hw/bsp/stm32g0/boards/stm32g0b1nucleo/board.mk @@ -2,12 +2,9 @@ CFLAGS += \ -DSTM32G0B1xx # GCC -SRC_S_GCC += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32g0b1xx.s -LD_FILE_GCC = $(BOARD_PATH)/STM32G0B1RETx_FLASH.ld +SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32g0b1xx.s +LD_FILE = $(BOARD_PATH)/STM32G0B1RETx_FLASH.ld -# IAR -SRC_S_IAR += $(ST_CMSIS)/Source/Templates/iar/startup_stm32g0b1xx.s -LD_FILE_IAR = $(ST_CMSIS)/Source/Templates/iar/linker/stm32g0b1xx_flash.icf # For flash-jlink target JLINK_DEVICE = stm32g0b1re diff --git a/hw/bsp/stm32g0/family.mk b/hw/bsp/stm32g0/family.mk index e376f7f06..85ae38e37 100644 --- a/hw/bsp/stm32g0/family.mk +++ b/hw/bsp/stm32g0/family.mk @@ -13,13 +13,13 @@ CFLAGS += \ -DCFG_TUSB_MCU=OPT_MCU_STM32G0 # GCC Flags -CFLAGS_GCC += \ +CFLAGS += \ -flto \ # suppress warning caused by vendor mcu driver -CFLAGS_GCC += -Wno-error=cast-align +CFLAGS += -Wno-error=cast-align -LDFLAGS_GCC += \ +LDFLAGS += \ -nostdlib -nostartfiles \ --specs=nosys.specs --specs=nano.specs diff --git a/hw/bsp/stm32g4/boards/b_g474e_dpow1/board.mk b/hw/bsp/stm32g4/boards/b_g474e_dpow1/board.mk index 6266b3ccc..a2b4dddf9 100644 --- a/hw/bsp/stm32g4/boards/b_g474e_dpow1/board.mk +++ b/hw/bsp/stm32g4/boards/b_g474e_dpow1/board.mk @@ -4,7 +4,7 @@ CFLAGS += \ -DSTM32G474xx \ # Linker -LD_FILE_GCC = $(BOARD_PATH)/STM32G474RETx_FLASH.ld +LD_FILE = $(BOARD_PATH)/STM32G474RETx_FLASH.ld # For flash-jlink target JLINK_DEVICE = stm32g474re diff --git a/hw/bsp/stm32g4/boards/stm32g474nucleo/board.mk b/hw/bsp/stm32g4/boards/stm32g474nucleo/board.mk index dc46af1d1..77178d2bc 100644 --- a/hw/bsp/stm32g4/boards/stm32g474nucleo/board.mk +++ b/hw/bsp/stm32g4/boards/stm32g474nucleo/board.mk @@ -5,7 +5,7 @@ CFLAGS += \ -DHSE_VALUE=24000000 # Linker -LD_FILE_GCC = $(BOARD_PATH)/STM32G474RETx_FLASH.ld +LD_FILE = $(BOARD_PATH)/STM32G474RETx_FLASH.ld # For flash-jlink target JLINK_DEVICE = stm32g474re diff --git a/hw/bsp/stm32g4/boards/stm32g491nucleo/board.mk b/hw/bsp/stm32g4/boards/stm32g491nucleo/board.mk index c0f876331..0ef3642dd 100644 --- a/hw/bsp/stm32g4/boards/stm32g491nucleo/board.mk +++ b/hw/bsp/stm32g4/boards/stm32g491nucleo/board.mk @@ -5,7 +5,7 @@ CFLAGS += \ -DHSE_VALUE=24000000 # Linker -LD_FILE_GCC = $(BOARD_PATH)/STM32G491RETX_FLASH.ld +LD_FILE = $(BOARD_PATH)/STM32G491RETX_FLASH.ld # For flash-jlink target JLINK_DEVICE = stm32g491re diff --git a/hw/bsp/stm32g4/family.mk b/hw/bsp/stm32g4/family.mk index a153194ce..1882af43b 100644 --- a/hw/bsp/stm32g4/family.mk +++ b/hw/bsp/stm32g4/family.mk @@ -13,13 +13,13 @@ CFLAGS += \ -DCFG_TUSB_MCU=OPT_MCU_STM32G4 # GCC Flags -CFLAGS_GCC += \ +CFLAGS += \ -flto \ # suppress warning caused by vendor mcu driver -CFLAGS_GCC += -Wno-error=cast-align +CFLAGS += -Wno-error=cast-align -LDFLAGS_GCC += \ +LDFLAGS += \ -nostdlib -nostartfiles \ --specs=nosys.specs --specs=nano.specs @@ -48,11 +48,9 @@ INC += \ $(TOP)/$(ST_HAL_DRIVER)/Inc # Startup -SRC_S_GCC += $(ST_CMSIS)/Source/Templates/gcc/startup_$(MCU_VARIANT).s -SRC_S_IAR += $(ST_CMSIS)/Source/Templates/iar/startup_$(MCU_VARIANT).s +SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_$(MCU_VARIANT).s # Linker -LD_FILE_IAR = $(ST_CMSIS)/Source/Templates/iar/linker/$(MCU_VARIANT)_flash.icf # flash target using on-board stlink flash: flash-stlink diff --git a/hw/bsp/stm32h5/family.mk b/hw/bsp/stm32h5/family.mk index e34bb513e..6f76872bc 100644 --- a/hw/bsp/stm32h5/family.mk +++ b/hw/bsp/stm32h5/family.mk @@ -15,11 +15,11 @@ CFLAGS += \ -DCFG_TUSB_MCU=OPT_MCU_STM32H5 # GCC Flags -CFLAGS_GCC += \ +CFLAGS += \ -flto \ # suppress warning caused by vendor mcu driver -CFLAGS_GCC += \ +CFLAGS += \ -Wno-error=cast-align \ -Wno-error=undef \ -Wno-error=unused-parameter \ @@ -27,7 +27,7 @@ CFLAGS_GCC += \ CFLAGS_CLANG += \ -Wno-error=parentheses-equality -LDFLAGS_GCC += \ +LDFLAGS += \ -nostdlib -nostartfiles \ --specs=nosys.specs --specs=nano.specs @@ -59,12 +59,10 @@ INC += \ $(TOP)/$(ST_HAL_DRIVER)/Inc # Startup -SRC_S_GCC += $(ST_CMSIS)/Source/Templates/gcc/startup_$(MCU_VARIANT).s -SRC_S_IAR += $(ST_CMSIS)/Source/Templates/iar/startup_$(MCU_VARIANT).s +SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_$(MCU_VARIANT).s # Linker -LD_FILE_IAR = $(ST_CMSIS)/Source/Templates/iar/linker/$(MCU_VARIANT)_flash.icf -LD_FILE_GCC = $(FAMILY_PATH)/linker/$(MCU_VARIANT_UPPER)_FLASH.ld +LD_FILE = $(FAMILY_PATH)/linker/$(MCU_VARIANT_UPPER)_FLASH.ld # flash target using on-board stlink flash: flash-stlink diff --git a/hw/bsp/stm32h7/boards/daisyseed/board.mk b/hw/bsp/stm32h7/boards/daisyseed/board.mk index bb254cfc2..5898b4b12 100644 --- a/hw/bsp/stm32h7/boards/daisyseed/board.mk +++ b/hw/bsp/stm32h7/boards/daisyseed/board.mk @@ -1,7 +1,7 @@ MCU_VARIANT = stm32h750xx CFLAGS += -DSTM32H750xx -DCORE_CM7 -DHSE_VALUE=16000000 -LD_FILE_GCC = $(BOARD_PATH)/stm32h750ibkx_flash.ld +LD_FILE = $(BOARD_PATH)/stm32h750ibkx_flash.ld # For flash-jlink target JLINK_DEVICE = stm32h750ibk6_m7 diff --git a/hw/bsp/stm32h7/boards/stm32h723nucleo/board.mk b/hw/bsp/stm32h7/boards/stm32h723nucleo/board.mk index c1a98a025..79b521e2a 100644 --- a/hw/bsp/stm32h7/boards/stm32h723nucleo/board.mk +++ b/hw/bsp/stm32h7/boards/stm32h723nucleo/board.mk @@ -1,7 +1,7 @@ MCU_VARIANT = stm32h723xx CFLAGS += -DSTM32H723xx -DHSE_VALUE=8000000 -LD_FILE_GCC = $(FAMILY_PATH)/linker/${MCU_VARIANT}_flash.ld +LD_FILE = $(FAMILY_PATH)/linker/${MCU_VARIANT}_flash.ld # For flash-jlink target JLINK_DEVICE = stm32h723zg diff --git a/hw/bsp/stm32h7/boards/stm32h743eval/board.mk b/hw/bsp/stm32h7/boards/stm32h743eval/board.mk index 67b403932..8f27f6460 100644 --- a/hw/bsp/stm32h7/boards/stm32h743eval/board.mk +++ b/hw/bsp/stm32h7/boards/stm32h743eval/board.mk @@ -5,7 +5,7 @@ RHPORT_SPEED = OPT_MODE_FULL_SPEED OPT_MODE_HIGH_SPEED RHPORT_DEVICE ?= 1 RHPORT_HOST ?= 0 -LD_FILE_GCC = $(FAMILY_PATH)/linker/${MCU_VARIANT}_flash.ld +LD_FILE = $(FAMILY_PATH)/linker/${MCU_VARIANT}_flash.ld SRC_C += \ ${ST_MFXSTM32L152}/mfxstm32l152.c \ diff --git a/hw/bsp/stm32h7/boards/stm32h743nucleo/board.mk b/hw/bsp/stm32h7/boards/stm32h743nucleo/board.mk index d904de6d2..269137e61 100644 --- a/hw/bsp/stm32h7/boards/stm32h743nucleo/board.mk +++ b/hw/bsp/stm32h7/boards/stm32h743nucleo/board.mk @@ -1,7 +1,7 @@ MCU_VARIANT = stm32h743xx CFLAGS += -DSTM32H743xx -DHSE_VALUE=8000000 -LD_FILE_GCC = $(FAMILY_PATH)/linker/${MCU_VARIANT}_flash.ld +LD_FILE = $(FAMILY_PATH)/linker/${MCU_VARIANT}_flash.ld # For flash-jlink target JLINK_DEVICE = stm32h743zi diff --git a/hw/bsp/stm32h7/boards/stm32h745disco/board.mk b/hw/bsp/stm32h7/boards/stm32h745disco/board.mk index 64003f5a9..79387f26a 100644 --- a/hw/bsp/stm32h7/boards/stm32h745disco/board.mk +++ b/hw/bsp/stm32h7/boards/stm32h745disco/board.mk @@ -6,8 +6,7 @@ CFLAGS += -DSTM32H745xx -DCORE_CM7 -DHSE_VALUE=25000000 # Default is FulSpeed port PORT ?= 0 -LD_FILE_GCC = $(FAMILY_PATH)/linker/${MCU_VARIANT}_flash_CM7.ld -LD_FILE_IAR = $(ST_CMSIS)/Source/Templates/iar/linker/stm32h745xx_flash_CM7.icf +LD_FILE = $(FAMILY_PATH)/linker/${MCU_VARIANT}_flash_CM7.ld # For flash-jlink target JLINK_DEVICE = stm32h745xi_m7 diff --git a/hw/bsp/stm32h7/boards/stm32h747disco/board.mk b/hw/bsp/stm32h7/boards/stm32h747disco/board.mk index 4b17246e2..4fb7cfd48 100644 --- a/hw/bsp/stm32h7/boards/stm32h747disco/board.mk +++ b/hw/bsp/stm32h7/boards/stm32h747disco/board.mk @@ -6,8 +6,7 @@ CFLAGS += -DSTM32H747xx -DCORE_CM7 -DHSE_VALUE=25000000 # Default is FulSpeed port PORT ?= 0 -LD_FILE_GCC = $(FAMILY_PATH)/linker/${MCU_VARIANT}_flash_CM7.ld -LD_FILE_IAR = $(ST_CMSIS)/Source/Templates/iar/linker/stm32h747xx_flash_CM7.icf +LD_FILE = $(FAMILY_PATH)/linker/${MCU_VARIANT}_flash_CM7.ld # For flash-jlink target JLINK_DEVICE = stm32h747xi_m7 diff --git a/hw/bsp/stm32h7/boards/stm32h750_weact/board.mk b/hw/bsp/stm32h7/boards/stm32h750_weact/board.mk index 988fed804..87c81cb63 100644 --- a/hw/bsp/stm32h7/boards/stm32h750_weact/board.mk +++ b/hw/bsp/stm32h7/boards/stm32h750_weact/board.mk @@ -3,7 +3,7 @@ MCU_VARIANT = stm32h750xx CFLAGS += -DSTM32H750xx -DCORE_CM7 -DHSE_VALUE=25000000 -LD_FILE_GCC = $(BOARD_PATH)/stm32h750xx_flash_CM7.ld +LD_FILE = $(BOARD_PATH)/stm32h750xx_flash_CM7.ld # For flash-jlink target JLINK_DEVICE = stm32h750vb diff --git a/hw/bsp/stm32h7/boards/stm32h750bdk/board.mk b/hw/bsp/stm32h7/boards/stm32h750bdk/board.mk index 6eb3eb498..dec138f92 100644 --- a/hw/bsp/stm32h7/boards/stm32h750bdk/board.mk +++ b/hw/bsp/stm32h7/boards/stm32h750bdk/board.mk @@ -3,7 +3,7 @@ MCU_VARIANT = stm32h750xx CFLAGS += -DSTM32H750xx -DCORE_CM7 -DHSE_VALUE=25000000 -LD_FILE_GCC = $(BOARD_PATH)/stm32h750xx_flash_CM7.ld +LD_FILE = $(BOARD_PATH)/stm32h750xx_flash_CM7.ld # For flash-jlink target JLINK_DEVICE = stm32h750xb diff --git a/hw/bsp/stm32h7/boards/waveshare_openh743i/board.mk b/hw/bsp/stm32h7/boards/waveshare_openh743i/board.mk index 5ff2f4165..65c1fff09 100644 --- a/hw/bsp/stm32h7/boards/waveshare_openh743i/board.mk +++ b/hw/bsp/stm32h7/boards/waveshare_openh743i/board.mk @@ -5,7 +5,7 @@ RHPORT_SPEED = OPT_MODE_FULL_SPEED OPT_MODE_HIGH_SPEED RHPORT_DEVICE ?= 1 RHPORT_HOST ?= 0 -LD_FILE_GCC = $(FAMILY_PATH)/linker/stm32h743xx_flash.ld +LD_FILE = $(FAMILY_PATH)/linker/stm32h743xx_flash.ld # Use Timer module for ULPI PHY reset CFLAGS += -DHAL_TIM_MODULE_ENABLED diff --git a/hw/bsp/stm32h7/family.mk b/hw/bsp/stm32h7/family.mk index 19a085424..3978b2eb0 100644 --- a/hw/bsp/stm32h7/family.mk +++ b/hw/bsp/stm32h7/family.mk @@ -46,12 +46,12 @@ CFLAGS += \ # GCC Flags # suppress warning caused by vendor mcu driver -CFLAGS_GCC += \ +CFLAGS += \ -flto \ -Wno-error=cast-align \ -Wno-error=unused-parameter \ -LDFLAGS_GCC += \ +LDFLAGS += \ -nostdlib -nostartfiles \ --specs=nosys.specs --specs=nano.specs @@ -84,8 +84,6 @@ INC += \ $(TOP)/$(ST_HAL_DRIVER)/Inc # Startup -SRC_S_GCC += $(ST_CMSIS)/Source/Templates/gcc/startup_$(MCU_VARIANT).s -SRC_S_IAR += $(ST_CMSIS)/Source/Templates/iar/startup_$(MCU_VARIANT).s +SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_$(MCU_VARIANT).s # Linker -LD_FILE_IAR ?= $(ST_CMSIS)/Source/Templates/iar/linker/$(MCU_VARIANT)_flash.icf diff --git a/hw/bsp/stm32h7rs/family.mk b/hw/bsp/stm32h7rs/family.mk index 7082cc900..d1336a773 100644 --- a/hw/bsp/stm32h7rs/family.mk +++ b/hw/bsp/stm32h7rs/family.mk @@ -47,15 +47,15 @@ CFLAGS += \ -DBUFFER_SIZE_UP=0x300 \ # GCC Flags -CFLAGS_GCC += \ +CFLAGS += \ -flto \ # suppress warning caused by vendor mcu driver -CFLAGS_GCC += \ +CFLAGS += \ -Wno-error=cast-align \ -Wno-error=unused-parameter \ -LDFLAGS_GCC += \ +LDFLAGS += \ -nostdlib -nostartfiles \ --specs=nosys.specs --specs=nano.specs @@ -87,9 +87,7 @@ INC += \ $(TOP)/$(ST_HAL_DRIVER)/Inc # Startup -SRC_S_GCC += $(ST_CMSIS)/Source/Templates/gcc/startup_$(MCU_VARIANT).s -SRC_S_IAR += $(ST_CMSIS)/Source/Templates/iar/startup_$(MCU_VARIANT).s +SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_$(MCU_VARIANT).s # Linker -LD_FILE_GCC ?= $(FAMILY_PATH)/linker/$(MCU_VARIANT)_flash.ld -LD_FILE_IAR ?= $(ST_CMSIS)/Source/Templates/iar/linker/$(MCU_VARIANT)_flash.icf +LD_FILE ?= $(FAMILY_PATH)/linker/$(MCU_VARIANT)_flash.ld diff --git a/hw/bsp/stm32l0/family.mk b/hw/bsp/stm32l0/family.mk index 0ae881fdf..b72e077f3 100644 --- a/hw/bsp/stm32l0/family.mk +++ b/hw/bsp/stm32l0/family.mk @@ -11,7 +11,7 @@ CFLAGS += \ -DCFG_TUSB_MCU=OPT_MCU_STM32L0 # mcu driver cause following warnings -CFLAGS_GCC += \ +CFLAGS += \ -flto \ -Wno-error=unused-parameter \ -Wno-error=redundant-decls \ @@ -21,7 +21,7 @@ CFLAGS_GCC += \ CFLAGS_CLANG += \ -Wno-error=parentheses-equality -LDFLAGS_GCC += \ +LDFLAGS += \ -nostdlib -nostartfiles \ --specs=nosys.specs --specs=nano.specs @@ -43,8 +43,6 @@ INC += \ $(TOP)/$(ST_HAL_DRIVER)/Inc # Startup -SRC_S_GCC += $(ST_CMSIS)/Source/Templates/gcc/startup_${MCU_VARIANT}.s -SRC_S_IAR += $(ST_CMSIS)/Source/Templates/iar/startup_${MCU_VARIANT}.s +SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_${MCU_VARIANT}.s # Linker -LD_FILE_IAR ?= $(ST_CMSIS)/Source/Templates/iar/linker/$(MCU_VARIANT)_flash.icf diff --git a/hw/bsp/stm32l4/boards/stm32l412nucleo/board.mk b/hw/bsp/stm32l4/boards/stm32l412nucleo/board.mk index 87b333500..c9b2ab9fa 100644 --- a/hw/bsp/stm32l4/boards/stm32l412nucleo/board.mk +++ b/hw/bsp/stm32l4/boards/stm32l412nucleo/board.mk @@ -2,12 +2,9 @@ CFLAGS += \ -DSTM32L412xx \ # GCC -SRC_S_GCC += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32l412xx.s -LD_FILE_GCC = $(BOARD_PATH)/STM32L412KBUx_FLASH.ld +SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32l412xx.s +LD_FILE = $(BOARD_PATH)/STM32L412KBUx_FLASH.ld -# IAR -SRC_S_IAR += $(ST_CMSIS)/Source/Templates/iar/startup_stm32l412xx.s -LD_FILE_IAR = $(ST_CMSIS)/Source/Templates/iar/linker/stm32l412xx_flash.icf # For flash-jlink target JLINK_DEVICE = stm32l412kb diff --git a/hw/bsp/stm32l4/boards/stm32l476disco/board.mk b/hw/bsp/stm32l4/boards/stm32l476disco/board.mk index 3ba9ab444..23f0966ee 100644 --- a/hw/bsp/stm32l4/boards/stm32l476disco/board.mk +++ b/hw/bsp/stm32l4/boards/stm32l476disco/board.mk @@ -2,12 +2,9 @@ CFLAGS += \ -DSTM32L476xx \ # GCC -SRC_S_GCC += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32l476xx.s -LD_FILE_GCC = $(BOARD_PATH)/STM32L476VGTx_FLASH.ld +SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32l476xx.s +LD_FILE = $(BOARD_PATH)/STM32L476VGTx_FLASH.ld -# IAR -SRC_S_IAR += $(ST_CMSIS)/Source/Templates/iar/startup_stm32l476xx.s -LD_FILE_IAR = $(ST_CMSIS)/Source/Templates/iar/linker/stm32l476xx_flash.icf # For flash-jlink target JLINK_DEVICE = stm32l476vg diff --git a/hw/bsp/stm32l4/boards/stm32l496nucleo/board.mk b/hw/bsp/stm32l4/boards/stm32l496nucleo/board.mk index bc0a63c1c..21666b026 100644 --- a/hw/bsp/stm32l4/boards/stm32l496nucleo/board.mk +++ b/hw/bsp/stm32l4/boards/stm32l496nucleo/board.mk @@ -2,12 +2,9 @@ CFLAGS += \ -DSTM32L496xx \ # GCC -SRC_S_GCC += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32l496xx.s -LD_FILE_GCC = $(BOARD_PATH)/STM32L496ZGTX_FLASH.ld +SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32l496xx.s +LD_FILE = $(BOARD_PATH)/STM32L496ZGTX_FLASH.ld -# IAR -SRC_S_IAR += $(ST_CMSIS)/Source/Templates/iar/startup_stm32l496xx.s -LD_FILE_IAR = $(ST_CMSIS)/Source/Templates/iar/linker/stm32l496xx_flash.icf # For flash-jlink target JLINK_DEVICE = stm32l496zg diff --git a/hw/bsp/stm32l4/boards/stm32l4p5nucleo/board.mk b/hw/bsp/stm32l4/boards/stm32l4p5nucleo/board.mk index 84f831878..09357ff4f 100644 --- a/hw/bsp/stm32l4/boards/stm32l4p5nucleo/board.mk +++ b/hw/bsp/stm32l4/boards/stm32l4p5nucleo/board.mk @@ -2,12 +2,9 @@ CFLAGS += \ -DSTM32L4P5xx \ # GCC -SRC_S_GCC += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32l4p5xx.s -LD_FILE_GCC = $(BOARD_PATH)/STM32L4P5ZGTX_FLASH.ld +SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32l4p5xx.s +LD_FILE = $(BOARD_PATH)/STM32L4P5ZGTX_FLASH.ld -# IAR -SRC_S_IAR += $(ST_CMSIS)/Source/Templates/iar/startup_stm32l4p5xx.s -LD_FILE_IAR = $(ST_CMSIS)/Source/Templates/iar/linker/stm32l4p5xx_flash.icf # For flash-jlink target JLINK_DEVICE = stm32l4p5zg diff --git a/hw/bsp/stm32l4/boards/stm32l4r5nucleo/board.mk b/hw/bsp/stm32l4/boards/stm32l4r5nucleo/board.mk index ad5bfba38..e811a6e53 100644 --- a/hw/bsp/stm32l4/boards/stm32l4r5nucleo/board.mk +++ b/hw/bsp/stm32l4/boards/stm32l4r5nucleo/board.mk @@ -3,12 +3,9 @@ CFLAGS += \ -DSTM32L4R5xx \ # GCC -SRC_S_GCC += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32l4r5xx.s -LD_FILE_GCC = $(BOARD_PATH)/STM32L4RXxI_FLASH.ld +SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32l4r5xx.s +LD_FILE = $(BOARD_PATH)/STM32L4RXxI_FLASH.ld -# IAR -SRC_S_IAR += $(ST_CMSIS)/Source/Templates/iar/startup_stm32l4r5xx.s -LD_FILE_IAR = $(ST_CMSIS)/Source/Templates/iar/linker/stm32l4r5xx_flash.icf # For flash-jlink target JLINK_DEVICE = stm32l4r5zi diff --git a/hw/bsp/stm32l4/family.mk b/hw/bsp/stm32l4/family.mk index fd11fd226..b45884989 100644 --- a/hw/bsp/stm32l4/family.mk +++ b/hw/bsp/stm32l4/family.mk @@ -13,15 +13,15 @@ CFLAGS += \ -DCFG_TUSB_MCU=OPT_MCU_STM32L4 # GCC Flags -CFLAGS_GCC += \ +CFLAGS += \ -flto \ -Wno-error=cast-align \ ifeq ($(TOOLCHAIN),gcc) -CFLAGS_GCC += -Wno-error=maybe-uninitialized +CFLAGS += -Wno-error=maybe-uninitialized endif -LDFLAGS_GCC += \ +LDFLAGS += \ -nostdlib -nostartfiles \ --specs=nosys.specs --specs=nano.specs diff --git a/hw/bsp/stm32n6/boards/stm32n6570dk/board.mk b/hw/bsp/stm32n6/boards/stm32n6570dk/board.mk index 05717699c..524ba0ca0 100644 --- a/hw/bsp/stm32n6/boards/stm32n6570dk/board.mk +++ b/hw/bsp/stm32n6/boards/stm32n6570dk/board.mk @@ -2,7 +2,7 @@ MCU_VARIANT = stm32n657xx CFLAGS += -DSTM32N657xx JLINK_DEVICE = stm32n6xx -LD_FILE_GCC = $(BOARD_PATH)/STM32N657XX_AXISRAM2_fsbl.ld +LD_FILE = $(BOARD_PATH)/STM32N657XX_AXISRAM2_fsbl.ld # flash target using on-board stlink flash: flash-stlink diff --git a/hw/bsp/stm32n6/boards/stm32n657nucleo/board.mk b/hw/bsp/stm32n6/boards/stm32n657nucleo/board.mk index efbb82611..d488f555e 100644 --- a/hw/bsp/stm32n6/boards/stm32n657nucleo/board.mk +++ b/hw/bsp/stm32n6/boards/stm32n657nucleo/board.mk @@ -2,7 +2,7 @@ MCU_VARIANT = stm32n657xx CFLAGS += -DSTM32N657xx JLINK_DEVICE = stm32n657x0 -LD_FILE_GCC = $(BOARD_PATH)/STM32N657XX_AXISRAM2_fsbl.ld +LD_FILE = $(BOARD_PATH)/STM32N657XX_AXISRAM2_fsbl.ld RHPORT_DEVICE ?= 0 RHPORT_HOST ?= 0 diff --git a/hw/bsp/stm32n6/family.mk b/hw/bsp/stm32n6/family.mk index 9fef533b1..408867153 100644 --- a/hw/bsp/stm32n6/family.mk +++ b/hw/bsp/stm32n6/family.mk @@ -36,15 +36,15 @@ CFLAGS += \ -DBUFFER_SIZE_UP=0x4000 \ # GCC Flags -CFLAGS_GCC += \ +CFLAGS += \ -flto \ # suppress warning caused by vendor mcu driver -CFLAGS_GCC += \ +CFLAGS += \ -Wno-error=cast-align \ -Wno-error=unused-parameter \ -LDFLAGS_GCC += \ +LDFLAGS += \ -nostdlib -nostartfiles \ --specs=nosys.specs --specs=nano.specs @@ -81,9 +81,7 @@ INC += \ $(TOP)/$(ST_HAL_DRIVER)/Inc # Startup -SRC_S_GCC += $(ST_CMSIS)/Source/Templates/gcc/startup_$(MCU_VARIANT)_fsbl.s -SRC_S_IAR += $(ST_CMSIS)/Source/Templates/iar/startup_$(MCU_VARIANT).s +SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_$(MCU_VARIANT)_fsbl.s # Linker -LD_FILE_GCC ?= $(ST_CMSIS)/Source/Templates/gcc/linker/$(MCU_VARIANT)_flash.ld -LD_FILE_IAR ?= $(ST_CMSIS)/Source/Templates/iar/linker/$(MCU_VARIANT)_flash.icf +LD_FILE ?= $(ST_CMSIS)/Source/Templates/gcc/linker/$(MCU_VARIANT)_flash.ld diff --git a/hw/bsp/stm32u0/family.mk b/hw/bsp/stm32u0/family.mk index 9119f3652..4ced248bc 100644 --- a/hw/bsp/stm32u0/family.mk +++ b/hw/bsp/stm32u0/family.mk @@ -11,7 +11,7 @@ CFLAGS += \ -DCFG_TUSB_MCU=OPT_MCU_STM32U0 # mcu driver cause following warnings -CFLAGS_GCC += \ +CFLAGS += \ -flto \ -Wno-error=unused-parameter \ -Wno-error=redundant-decls \ @@ -21,7 +21,7 @@ CFLAGS_GCC += \ CFLAGS_CLANG += \ -Wno-error=parentheses-equality -LDFLAGS_GCC += \ +LDFLAGS += \ -nostdlib -nostartfiles \ --specs=nosys.specs --specs=nano.specs @@ -45,10 +45,8 @@ INC += \ $(TOP)/$(ST_HAL_DRIVER)/Inc # Startup -SRC_S_GCC += $(ST_CMSIS)/Source/Templates/gcc/startup_${MCU_VARIANT}.s -SRC_S_IAR += $(ST_CMSIS)/Source/Templates/iar/startup_${MCU_VARIANT}.s +SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_${MCU_VARIANT}.s # Linker MCU_VARIANT_UPPER = $(subst stm32u,STM32U,$(MCU_VARIANT)) LD_FILE ?= $(FAMILY_PATH)/linker/$(MCU_VARIANT_UPPER)_FLASH.ld -LD_FILE_IAR ?= $(ST_CMSIS)/Source/Templates/iar/linker/$(MCU_VARIANT)_flash.icf diff --git a/hw/bsp/stm32u5/family.mk b/hw/bsp/stm32u5/family.mk index 90796836b..e7bc4f299 100644 --- a/hw/bsp/stm32u5/family.mk +++ b/hw/bsp/stm32u5/family.mk @@ -10,7 +10,7 @@ CFLAGS += \ -DCFG_TUSB_MCU=OPT_MCU_STM32U5 # suppress warning caused by vendor mcu driver -CFLAGS_GCC += \ +CFLAGS += \ -flto \ -Wno-error=cast-align \ -Wno-error=undef \ @@ -19,10 +19,10 @@ CFLAGS_GCC += \ -Wno-self-assign \ ifeq ($(TOOLCHAIN),gcc) -CFLAGS_GCC += -Wno-error=maybe-uninitialized +CFLAGS += -Wno-error=maybe-uninitialized endif -LDFLAGS_GCC += \ +LDFLAGS += \ -nostdlib -nostartfiles \ --specs=nosys.specs --specs=nano.specs @@ -61,11 +61,9 @@ INC += \ $(TOP)/$(BOARD_PATH) # Startup -SRC_S_GCC += $(ST_CMSIS)/Source/Templates/gcc/startup_$(MCU_VARIANT).s -SRC_S_IAR += $(ST_CMSIS)/Source/Templates/iar/startup_$(MCU_VARIANT).s +SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_$(MCU_VARIANT).s # Linker -LD_FILE_IAR ?= $(ST_CMSIS)/Source/Templates/iar/linker/$(MCU_VARIANT)_flash.icf # flash target using on-board stlink flash: flash-stlink diff --git a/hw/bsp/stm32wb/family.mk b/hw/bsp/stm32wb/family.mk index 9397be62d..6123a65de 100644 --- a/hw/bsp/stm32wb/family.mk +++ b/hw/bsp/stm32wb/family.mk @@ -11,12 +11,12 @@ CPU_CORE ?= cortex-m4 CFLAGS += \ -DCFG_TUSB_MCU=OPT_MCU_STM32WB -CFLAGS_GCC += \ +CFLAGS += \ -flto \ -nostdlib -nostartfiles \ -Wno-error=cast-align -Wno-unused-parameter -LDFLAGS_GCC += -specs=nosys.specs -specs=nano.specs +LDFLAGS += -specs=nosys.specs -specs=nano.specs SRC_C += \ src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c \ @@ -39,12 +39,10 @@ INC += \ $(TOP)/$(ST_HAL_DRIVER)/Inc # Startup -SRC_S_GCC += $(ST_CMSIS)/Source/Templates/gcc/startup_$(MCU_VARIANT)_cm4.s -SRC_S_IAR += $(ST_CMSIS)/Source/Templates/iar/startup_$(MCU_VARIANT)_cm4.s +SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_$(MCU_VARIANT)_cm4.s # Linker -LD_FILE_GCC ?= ${ST_CMSIS}/Source/Templates/gcc/linker/${MCU_VARIANT}_flash_cm4.ld -LD_FILE_IAR ?= $(ST_CMSIS)/Source/Templates/iar/linker/$(MCU_VARIANT)_flash_cm4.icf +LD_FILE ?= ${ST_CMSIS}/Source/Templates/gcc/linker/${MCU_VARIANT}_flash_cm4.ld # flash target using on-board stlink flash: flash-stlink diff --git a/hw/bsp/stm32wba/family.mk b/hw/bsp/stm32wba/family.mk index 0a325323b..30848ac89 100644 --- a/hw/bsp/stm32wba/family.mk +++ b/hw/bsp/stm32wba/family.mk @@ -11,11 +11,11 @@ CPU_CORE ?= cortex-m33 CFLAGS += \ -DCFG_TUSB_MCU=OPT_MCU_STM32WBA -CFLAGS_GCC += \ +CFLAGS += \ -flto \ -Wno-error=cast-align -Wno-unused-parameter -LDFLAGS_GCC += \ +LDFLAGS += \ -nostdlib -nostartfiles \ -specs=nosys.specs -specs=nano.specs -Wl,--gc-sections @@ -49,12 +49,10 @@ INC += \ UPPERCASE_MCU_VARIANT = $(subst XX,xx,$(call to_upper,$(MCU_VARIANT))) # Startup - Manually specify lowercase version for startup file -SRC_S_GCC += $(ST_CMSIS)/Source/Templates/gcc/startup_$(MCU_VARIANT).s -SRC_S_IAR += $(ST_CMSIS)/Source/Templates/iar/startup_$(MCU_VARIANT).s +SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_$(MCU_VARIANT).s # Linker -LD_FILE_GCC ?= ${FAMILY_PATH}/linker/${UPPERCASE_MCU_VARIANT}_FLASH_ns.ld -LD_FILE_IAR ?= $(ST_CMSIS)/Source/Templates/iar/linker/$(MCU_VARIANT)_flash_ns.icf +LD_FILE ?= ${FAMILY_PATH}/linker/${UPPERCASE_MCU_VARIANT}_FLASH_ns.ld # flash target using on-board stlink flash: flash-stlink diff --git a/hw/bsp/tm4c/boards/ek_tm4c1294xl/board.mk b/hw/bsp/tm4c/boards/ek_tm4c1294xl/board.mk index b01977674..26aa55c05 100644 --- a/hw/bsp/tm4c/boards/ek_tm4c1294xl/board.mk +++ b/hw/bsp/tm4c/boards/ek_tm4c1294xl/board.mk @@ -2,8 +2,7 @@ MCU_SUB_VARIANT = 129 CFLAGS += -DTM4C1294NCPDT -LD_FILE_GCC = $(BOARD_PATH)/tm4c1294nc.ld -LD_FILE_IAR = $(BOARD_PATH)/TM4C1294NC.icf +LD_FILE = $(BOARD_PATH)/tm4c1294nc.ld # For flash-jlink target JLINK_DEVICE = TM4C1294NCPDT diff --git a/hw/bsp/tm4c/family.mk b/hw/bsp/tm4c/family.mk index bc966d98e..fc192c3af 100644 --- a/hw/bsp/tm4c/family.mk +++ b/hw/bsp/tm4c/family.mk @@ -14,7 +14,7 @@ CFLAGS += \ # mcu driver cause following warnings CFLAGS += -Wno-error=strict-prototypes -Wno-error=cast-qual -LDFLAGS_GCC += --specs=nosys.specs --specs=nano.specs +LDFLAGS += --specs=nosys.specs --specs=nano.specs INC += \ $(TOP)/lib/CMSIS_5/CMSIS/Core/Include \ -- cgit v1.3.1