-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Refactor buildsystem and bsp #3306
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…ML21 & OPT_MCU_SAML22
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Refactors build system integration to standardize example Makefiles on new family_support/family_rules includes, consolidates compiler warning flag handling, introduces SAML2X MCU aliasing, adds new board families (SAME7X, EFM32), and adjusts various BSP and class headers for consistency and warning suppression. Key changes:
- Replaced legacy example Makefile includes with hw/bsp/family_support.mk and family_rules.mk; switched path variable CURRENT_PATH to EXAMPLE_PATH.
- Unified GCC/Clang flag configuration and centralized warning lists (family_support.cmake, common.cmake); added widespread -Wno-missing-prototypes overrides per family.
- Introduced SAML2X consolidation for SAML21/22 MCUs and added SAME7X + EFM32 BSP support with new board files and FreeRTOS config updates.
Reviewed Changes
Copilot reviewed 210 out of 253 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
tools/get_deps.py | Updated CMSIS_6 commit and family list (adds stm32n6 handling). |
test/fuzz/make.mk | Renamed CURRENT_PATH to EXAMPLE_PATH; comment updated. |
test/fuzz/device/net/Makefile | Switched to EXAMPLE_PATH; removed hw include. |
test/fuzz/device/msc/Makefile | Switched to EXAMPLE_PATH; removed hw include. |
test/fuzz/device/cdc/Makefile | Switched to EXAMPLE_PATH; removed hw include. |
src/tusb_option.h | Added OPT_MCU_SAML2X with backward-compatible aliases. |
src/portable/wch/hcd_ch32_usbfs.c | Added GCC pragma push/pop around vendor includes. |
src/portable/synopsys/dwc2/dcd_dwc2.c | Suppressed unused parameter warning for GD32VF103. |
src/portable/sunxi/dcd_sunxi_musb.c | Made helper static; replaced delay_ms with tusb_time_delay_ms_api. |
src/portable/microchip/samd/hcd_samd.c | Simplified MCU checks via TU_CHECK_MCU macro. |
src/portable/microchip/samd/dcd_samd.c | Simplified MCU checks; style adjustments. |
src/portable/mentor/musb/musb_max32.h | Added pragma to suppress redundant-decls. |
src/common/tusb_mcu.h | Reordered Microchip MCU conditionals for SAML2X consolidation. |
src/class/net/net_device.h | Exposed rndis_class_set_handler prototype under CFG_TUD_ECM_RNDIS. |
src/class/net/ecm_rndis_device.c | Removed now-headered extern declaration. |
src/class/audio/audio_device.h | Added new tud_audio_int_xfer_cb callback prototype. |
lib/networking/rndis_reports.c | Added CFG_TUD_ECM_RNDIS guard; switched include; wrapped code in #if. |
lib/networking/dhserver.c | Made internal helper functions static. |
hw/bsp/xmc4000/family.cmake | Added missing-prototypes suppression for family.c. |
hw/bsp/tm4c/family.cmake | Added missing-prototypes suppression. |
hw/bsp/stm32*/family.cmake (multiple) | Added missing-prototypes suppression across STM32 families. |
hw/bsp/stm32n6/family.mk | Switched CMSIS include path to CMSIS_6. |
hw/bsp/stm32n6/family.cmake | Updated CMSIS path; added missing-prototypes suppression. |
hw/bsp/stm32n6/boards/* | Made clock/config helper functions static. |
hw/bsp/saml2x/family.mk / family.c (removed) | Removed deprecated SAML2x-specific BSP (replaced by samd2x_l2x). |
hw/bsp/samg/family.c | Added forward declaration for _init. |
hw/bsp/same7x/* | Added new SAME7X BSP (Make, CMake, source, boards). |
hw/bsp/samd2x_l2x/* | Unified SAMD21/SAML21/SAML22 BSP under configurable SAM_FAMILY. |
hw/bsp/samd21/* (removed select board files) | Migrated SAMD21 boards into samd2x_l2x structure. |
hw/bsp/samd11/family.c | Added forward declaration for _init. |
hw/bsp/ra/family.cmake | Suppressed specific warnings; added missing-prototypes suppression. |
hw/bsp/nrf/family.cmake | Made startup sources PRIVATE; added missing-prototypes suppression. |
hw/bsp/msp432e4/family.cmake | Added missing-prototypes suppression. |
hw/bsp/msp430/family.c | Refactored ISR prototypes to separate declaration/definition. |
hw/bsp/mm32/family.cmake | Added missing-prototypes suppression. |
hw/bsp/mcx/family.cmake | Added missing-prototypes suppression. |
hw/bsp/maxim/family.cmake / family.c | Suppressed additional warnings; redundant-decls pragma; silenced parameter warning. |
hw/bsp/lpc**/family.cmake (multiple) | Added missing-prototypes suppression. |
hw/bsp/kinetis*/family.cmake (multiple) | Added missing-prototypes suppression. |
hw/bsp/imxrt/family.cmake | Added missing-prototypes suppression. |
hw/bsp/gd32vf103/family.cmake | Missing-prototypes suppression for multiple stub sources. |
hw/bsp/fomu/family.cmake / family.c | Added missing-prototypes suppression; removed blank line. |
hw/bsp/family_support.mk | Introduced EXAMPLE_PATH; added hw include; removed artifact copy logic. |
hw/bsp/family_support.cmake | Centralized warning flags; adjusted error message; zephyr-specific flag removal; structured WARN_FLAGS. |
hw/bsp/family_rules.mk | Removed artifact copy targets. |
hw/bsp/efm32/* | Added new EFM32 GG BSP (Make/CMake, board, FreeRTOSConfig). |
hw/bsp/da1469x/family.cmake | Added missing-prototypes suppression. |
hw/bsp/ch32v*/ & ch32f*/ files | Added interrupt header prototypes; made SysTick_Config static; added include of *_it.h headers. |
hw/bsp/at32f*/ families | Added interrupt header prototypes and _init forward declarations. |
examples/typec/power_delivery/Makefile | Migrated to family_support; explicit source list. |
examples/host/*/Makefile (multiple) | Migrated to family_support; EXAMPLE_PATH updates. |
examples/host/hid_controller/* | Added app.h header; removed redundant externs; minor style refactor. |
examples/host/device_info/src/main.c | Consolidated serial printf into single formatted call. |
examples/device/*/Makefile (multiple) | Migrated to family_support; EXAMPLE_PATH updates. |
examples/device/webusb_serial/src/main.c | Made echo helper static. |
examples/device/video_capture_2ch/src/main.c | Made framebuf/video send functions static. |
examples/device/net_lwip_webserver/* | Added lwip/sys.h include; function made static; SAML2X MCU condition update; Makefile migration. |
examples/device/uac2_speaker_fb/src/main.c | Updated logging format macros to use PRIu32. |
examples/build_system/cmake/toolchain/common.cmake | Merged GCC/Clang common flags; commented unsupported flag for Clang. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Lines 43 to 51 in 6a1117a
'hw/mcu/microchip': ['https://github.com/hathach/microchip_driver.git', | |
'9e8b37e307d8404033bb881623a113931e1edf27', | |
'sam3x samd11 samd21 samd51 samd5x_e5x same5x same7x saml2x 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'], |
The boards formerly under saml2x
were moved into the new samd2x_l2x
family, but tools/get_deps.py
still only looks for saml2x
when deciding whether to clone the Microchip SDK and CMSIS dependencies. Calling tools/get_deps.py samd2x_l2x
(or passing a board that resolves to this new family) will therefore skip both hw/mcu/microchip
and lib/CMSIS_5
, leaving required headers and startup files missing and causing subsequent builds to fail. Add samd2x_l2x
to the affected family strings so the script fetches the Microchip dependencies for the renamed family.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting
Since you are working on it, could you add this to family_support.cmake, IAR by default only define # Also check for CC env variable if set
if(DEFINED ENV{CC})
string(FIND $ENV{CC} "iccarm" IS_IAR)
string(FIND $ENV{CC} "clang" IS_CLANG)
string(FIND $ENV{CC} "gcc" IS_GCC)
if (NOT IS_GCC EQUAL -1)
set(TOOLCHAIN gcc)
elseif (NOT IS_CLANG EQUAL -1)
set(TOOLCHAIN clang)
elseif (NOT IS_IAR EQUAL -1)
set(TOOLCHAIN iar)
endif ()
endif () |
87f9e79
to
a3ec088
Compare
a3ec088
to
55227a6
Compare
@HiFiPhile normally how you compile tinyusb example with cmake and iar. I normally usually specify it with -DCMAKE_C_COMPILER=iccarm |
|
@HiFiPhile ah thanks, I will udpate the change in a seperated PR, which I plan to enable IAR c-stat (both with local and ci build). CMake 4.1 make run c-stat much easier https://github.com/iarsystems/cmake-tutorial/wiki/IAR-C%E2%80%90STAT-Static-Analysis |
@codex review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 251 out of 323 changed files in this pull request and generated 4 comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
tinyusb/hw/bsp/family_support.mk
Lines 129 to 141 in d96d468
# 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) |
The new family_support.mk
includes ${TOP}/examples/build_system/make/cpu/$(CPU_CORE).mk
at the top, but FREERTOS_SRC
and FREERTOS_PORTABLE_PATH
are only defined afterwards. The CPU‑specific makefiles compute FREERTOS_PORTABLE_SRC ?= $(FREERTOS_PORTABLE_PATH)/…
; because FREERTOS_PORTABLE_PATH
is still empty at include time, the variable expands to an absolute path like /ARM_CM4F
. Consequently any FreeRTOS build now tries to pull portable sources from the root directory and fails with “No such file or directory”. The portable path needs to be initialized before the CPU include or those makefiles will generate broken paths.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This pull request refactors the build system integration for multiple example device projects, standardizing Makefile includes and improving toolchain support. The main focus is on replacing legacy build system includes with board family-specific ones, and unifying compiler flag handling for GCC and Clang.
Build system refactoring:
All example device
Makefile
s now includefamily_support.mk
andfamily_rules.mk
from the board support package (hw/bsp
) instead of the previous generic build system makefiles, ensuring better compatibility and maintainability across board families. (examples/device/audio_4_channel_mic/Makefile
,examples/device/audio_4_channel_mic_freertos/Makefile
,examples/device/audio_test/Makefile
,examples/device/audio_test_freertos/Makefile
,examples/device/audio_test_multi_rate/Makefile
,examples/device/board_test/Makefile
,examples/device/cdc_dual_ports/Makefile
,examples/device/cdc_msc/Makefile
,examples/device/cdc_msc_freertos/Makefile
,examples/device/cdc_uac2/Makefile
,examples/device/dfu/Makefile
,examples/device/dfu_runtime/Makefile
,examples/device/dynamic_configuration/Makefile
,examples/device/hid_boot_interface/Makefile
,examples/device/hid_composite/Makefile
,examples/device/hid_composite_freertos/Makefile
,examples/device/hid_generic_inout/Makefile
) [1] [2] [3] [4] [5] [6] [7] [8] [9]The source file list variable construction in Makefiles has been updated to use
EXAMPLE_PATH
instead ofCURRENT_PATH
, aligning with the new structure and reducing confusion. [1] [2] [3] [4] [5] [6] [7] [8]Toolchain and compiler flag improvements:
Code cleanup:
#include $(TOP)/hw
lines have been removed from all device example Makefiles, as board-specific includes are now handled by the new structure. [1] [2] [3] [4] [5] [6] [7] [8]Device example source updates:
cdc_uac2
, function prototypes forled_blinking_task
andaudio_task
have been moved frommain.c
tocommon.h
to improve code organization. [1] [2]