Merge pull request #3306 from hathach/refactor-buildsystem

Refactor buildsystem and bsp
This commit is contained in:
Ha Thach
2025-10-15 20:59:58 +07:00
committed by GitHub
323 changed files with 3464 additions and 1496 deletions

View File

@ -31,11 +31,11 @@ family_list = {
"msp430": ["msp430-gcc"],
"msp432e4 tm4c": ["arm-gcc"],
"nrf": ["arm-gcc", "arm-clang"],
"nuc100_120 nuc121_125 nuc126 nuc505": ["arm-gcc"],
"ra": ["arm-gcc"],
"rp2040": ["arm-gcc"],
"rx": ["rx-gcc"],
"samd11 saml2x": ["arm-gcc", "arm-clang"],
"samd21": ["arm-gcc", "arm-clang"],
"samd11 samd2x_l2x": ["arm-gcc", "arm-clang"],
"samd5x_e5x samg": ["arm-gcc", "arm-clang"],
"stm32c0 stm32f0 stm32f1 stm32f2 stm32f3": ["arm-gcc", "arm-clang", "arm-iar"],
"stm32f4": ["arm-gcc", "arm-clang", "arm-iar"],

1
.gitignore vendored
View File

@ -20,6 +20,7 @@ latex
*.ewt
*.ewd
*.hex
.venv/
cmake_install.cmake
CMakeCache.txt
settings/

View File

@ -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

View File

@ -1,14 +1,14 @@
include ../../build_system/make/make.mk
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

View File

@ -1,15 +1,15 @@
RTOS = freertos
include ../../build_system/make/make.mk
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

View File

@ -17,3 +17,4 @@ board:lpcxpresso11u37
board:lpcxpresso1347
family:broadcom_32bit
family:broadcom_64bit
family:nuc121_125

View File

@ -1,11 +1,11 @@
include ../../build_system/make/make.mk
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

View File

@ -1,15 +1,15 @@
RTOS = freertos
include ../../build_system/make/make.mk
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

View File

@ -15,3 +15,4 @@ mcu:RAXXX
family:broadcom_32bit
family:broadcom_64bit
board:stm32l0538disco
family:nuc121_125

View File

@ -1,11 +1,11 @@
include ../../build_system/make/make.mk
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

View File

@ -1,11 +1,11 @@
include ../../build_system/make/make.mk
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

View File

@ -1,11 +1,11 @@
include ../../build_system/make/make.mk
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

View File

@ -1,8 +1,8 @@
include ../../build_system/make/make.mk
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

View File

@ -1,9 +1,9 @@
RTOS = freertos
include ../../build_system/make/make.mk
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

View File

@ -15,3 +15,4 @@ mcu:RAXXX
mcu:STM32L0
family:broadcom_32bit
family:broadcom_64bit
family:nuc121_125

View File

@ -299,13 +299,11 @@ int32_t tud_msc_write10_cb(uint8_t lun, uint32_t lba, uint32_t offset, uint8_t*
return TUD_MSC_RET_ERROR;
}
#ifdef CFG_EXAMPLE_MSC_READONLY
#ifdef CFG_EXAMPLE_MSC_READONLY
(void) lun;
(void) buffer;
return bufsize;
#endif
#if CFG_EXAMPLE_MSC_ASYNC_IO
#elif CFG_EXAMPLE_MSC_ASYNC_IO
io_ops_t io_ops = {.is_read = false, .lun = lun, .lba = lba, .offset = offset, .buffer = buffer, .bufsize = bufsize};
// Send IO operation to IO task
@ -318,7 +316,7 @@ int32_t tud_msc_write10_cb(uint8_t lun, uint32_t lba, uint32_t offset, uint8_t*
tusb_time_delay_ms_api(CFG_EXAMPLE_MSC_IO_DELAY_MS);
return bufsize;
#endif
#endif
}
// Callback invoked when received an SCSI command not in built-in list below

View File

@ -1,8 +1,8 @@
include ../../build_system/make/make.mk
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

View File

@ -31,4 +31,7 @@ enum
VOLUME_CTRL_SILENCE = 0x8000,
};
void led_blinking_task(void);
void audio_task(void);
#endif

View File

@ -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)
{

View File

@ -1,14 +1,14 @@
include ../../build_system/make/make.mk
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

View File

@ -1,11 +1,11 @@
include ../../build_system/make/make.mk
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

View File

@ -1,11 +1,11 @@
include ../../build_system/make/make.mk
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

View File

@ -1,14 +1,14 @@
include ../../build_system/make/make.mk
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

View File

@ -1,11 +1,11 @@
include ../../build_system/make/make.mk
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

View File

@ -1,15 +1,15 @@
RTOS = freertos
include ../../build_system/make/make.mk
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

View File

@ -1,11 +1,11 @@
include ../../build_system/make/make.mk
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

View File

@ -1,11 +1,11 @@
include ../../build_system/make/make.mk
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

View File

@ -1,11 +1,11 @@
include ../../build_system/make/make.mk
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

View File

@ -1,15 +1,15 @@
RTOS = freertos
include ../../build_system/make/make.mk
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

View File

@ -1,11 +1,11 @@
include ../../build_system/make/make.mk
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

View File

@ -1,11 +1,11 @@
include ../../build_system/make/make.mk
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

View File

@ -1,4 +1,4 @@
include ../../build_system/make/make.mk
include ../../../hw/bsp/family_support.mk
# suppress warning caused by lwip
CFLAGS_GCC += \
@ -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

View File

@ -20,3 +20,5 @@ board:curiosity_nano
board:frdm_kl25z
# lpc55 has weird error 'ncm_interface' causes a section type conflict with 'ntb_parameters'
family:lpc55
family:nuc126
family:nuc100_120

View File

@ -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;

View File

@ -88,7 +88,7 @@ extern "C" {
#ifndef USE_ECM
#if TU_CHECK_MCU(OPT_MCU_LPC15XX, OPT_MCU_LPC40XX, OPT_MCU_LPC51UXX, OPT_MCU_LPC54)
#define USE_ECM 1
#elif TU_CHECK_MCU(OPT_MCU_SAMD21, OPT_MCU_SAML21, OPT_MCU_SAML22)
#elif TU_CHECK_MCU(OPT_MCU_SAMD21, OPT_MCU_SAML2X)
#define USE_ECM 1
#elif TU_CHECK_MCU(OPT_MCU_STM32F0, OPT_MCU_STM32F1)
#define USE_ECM 1

View File

@ -1,11 +1,11 @@
include ../../build_system/make/make.mk
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

View File

@ -87,9 +87,9 @@ uint8_t const * tud_descriptor_device_cb(void)
#elif CFG_TUSB_MCU == OPT_MCU_CXD56
// CXD56 USB driver has fixed endpoint type (bulk/interrupt/iso) and direction (IN/OUT) by its number
// 0 control (IN/OUT), 1 Bulk (IN), 2 Bulk (OUT), 3 In (IN), 4 Bulk (IN), 5 Bulk (OUT), 6 In (IN)
// #define EPNUM_AUDIO_IN 0x01
// #define EPNUM_AUDIO_OUT 0x02
// #define EPNUM_AUDIO_INT 0x03
#define EPNUM_AUDIO_IN 0x01
#define EPNUM_AUDIO_OUT 0x02
#define EPNUM_AUDIO_INT 0x03
#elif CFG_TUSB_MCU == OPT_MCU_NRF5X
// ISO endpoints for NRF5x are fixed to 0x08 (0x88)

View File

@ -1,11 +1,11 @@
include ../../build_system/make/make.mk
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

View File

@ -159,7 +159,7 @@ static bool tud_audio_clock_get_request(uint8_t rhport, audio_control_request_t
if (request->bControlSelector == AUDIO_CS_CTRL_SAM_FREQ) {
if (request->bRequest == AUDIO_CS_REQ_CUR) {
TU_LOG1("Clock get current freq %lu\r\n", current_sample_rate);
TU_LOG1("Clock get current freq %" PRIu32 "\r\n", current_sample_rate);
audio_control_cur_4_t curf = {(int32_t) tu_htole32(current_sample_rate)};
return tud_audio_buffer_and_schedule_control_xfer(rhport, (tusb_control_request_t const *) request, &curf, sizeof(curf));
@ -200,7 +200,7 @@ static bool tud_audio_clock_set_request(uint8_t rhport, audio_control_request_t
current_sample_rate = (uint32_t) ((audio_control_cur_4_t const *) buf)->bCur;
TU_LOG1("Clock set current freq: %ld\r\n", current_sample_rate);
TU_LOG1("Clock set current freq: %" PRIu32 "\r\n", current_sample_rate);
return true;
} else {

View File

@ -1,11 +1,11 @@
include ../../build_system/make/make.mk
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

View File

@ -29,6 +29,7 @@
#include "bsp/board_api.h"
#include "tusb.h"
#include "main.h"
#include "usbtmc_app.h"
//--------------------------------------------------------------------+
// MACRO CONSTANT TYPEDEF PROTYPES

View File

@ -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

View File

@ -1,4 +1,4 @@
include ../../build_system/make/make.mk
include ../../../hw/bsp/family_support.mk
ifeq ($(DISABLE_MJPEG),1)
CFLAGS += -DCFG_EXAMPLE_VIDEO_DISABLE_MJPEG
@ -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

View File

@ -1,4 +1,4 @@
include ../../build_system/make/make.mk
include ../../../hw/bsp/family_support.mk
ifeq ($(DISABLE_MJPEG),1)
CFLAGS += -DCFG_EXAMPLE_VIDEO_DISABLE_MJPEG
@ -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

View File

@ -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;

View File

@ -1,11 +1,11 @@
include ../../build_system/make/make.mk
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

View File

@ -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);

View File

@ -1,12 +1,12 @@
include ../../build_system/make/make.mk
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

View File

@ -1,12 +1,12 @@
include ../../build_system/make/make.mk
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

View File

@ -218,9 +218,7 @@ static void print_device_info(uint8_t daddr, const tusb_desc_device_t* desc_devi
cdc_printf("\r\n");
cdc_printf(" iSerialNumber %u " , desc_device->iSerialNumber);
cdc_printf((char*)serial); // serial is already to UTF-8
cdc_printf("\r\n");
cdc_printf("%s \r\n", (char*)serial); // serial is already to UTF-8
cdc_printf(" bNumConfigurations %u\r\n" , desc_device->bNumConfigurations);
}
@ -310,5 +308,5 @@ static void print_utf16(uint16_t *temp_buf, size_t buf_len) {
_convert_utf16le_to_utf8(temp_buf + 1, utf16_len, (uint8_t *) temp_buf, sizeof(uint16_t) * buf_len);
((uint8_t*) temp_buf)[utf8_len] = '\0';
cdc_printf((char*) temp_buf);
cdc_printf("%s", (char*) temp_buf);
}

View File

@ -1,13 +1,13 @@
include ../../build_system/make/make.mk
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

View File

@ -1,8 +1,8 @@
include ../../build_system/make/make.mk
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

View File

@ -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

View File

@ -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;

View File

@ -25,6 +25,7 @@
#include "bsp/board_api.h"
#include "tusb.h"
#include "app.h"
//--------------------------------------------------------------------+
// MACRO TYPEDEF CONSTANT ENUM DECLARATION

View File

@ -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) {

View File

@ -1,9 +1,9 @@
RTOS = freertos
include ../../build_system/make/make.mk
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

View File

@ -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

View File

@ -26,6 +26,7 @@
#include "tusb.h"
#include "bsp/board_api.h"
#include "app.h"
#ifdef ESP_PLATFORM
#define CDC_STACK_SZIE 2048

View File

@ -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) {
@ -210,6 +211,7 @@ static void process_mouse_report(hid_mouse_report_t const *report) {
//--------------------------------------------------------------------+
static void process_generic_report(uint8_t dev_addr, uint8_t instance, uint8_t const *report, uint16_t len) {
(void) dev_addr;
(void) len;
uint8_t const rpt_count = hid_info[instance].report_count;
tuh_hid_report_info_t *rpt_info_arr = hid_info[instance].report_info;

View File

@ -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) {

View File

@ -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 {

View File

@ -1,13 +1,13 @@
include ../../build_system/make/make.mk
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

View File

@ -171,9 +171,7 @@ void tuh_mount_cb(uint8_t daddr) {
printf("\r\n");
printf(" iSerialNumber %u ", desc.device.iSerialNumber);
printf((char*)desc.serial); // serial is already to UTF-8
printf("\r\n");
printf("%s\r\n", (char*)desc.serial); // serial is already to UTF-8
printf(" bNumConfigurations %u\r\n", desc.device.bNumConfigurations);
}

View File

@ -1,14 +1,14 @@
include ../../build_system/make/make.mk
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

View File

@ -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

View File

@ -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
____________________________ __

View File

@ -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;

View File

@ -1,13 +1,13 @@
include ../../build_system/make/make.mk
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

View File

@ -27,10 +27,8 @@ target_sources(${PROJECT} PUBLIC
)
# Suppress warnings on fatfs
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
set_source_files_properties(
${TOP}/lib/fatfs/source/ff.c
PROPERTIES
if (CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
set_source_files_properties(${TOP}/lib/fatfs/source/ff.c PROPERTIES
COMPILE_FLAGS "-Wno-conversion -Wno-cast-qual"
)
endif ()

View File

@ -1,10 +1,9 @@
include ../../build_system/make/make.mk
include ../../../hw/bsp/family_support.mk
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

View File

@ -1,11 +1,13 @@
include ../../build_system/make/make.mk
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
include ../../build_system/make/rules.mk
SRC_C += $(addprefix $(EXAMPLE_PATH)/, $(EXAMPLE_SOURCE))
include ../../../hw/bsp/family_rules.mk

View File

@ -48,6 +48,12 @@ void DebugMon_Handler(void);
void PendSV_Handler(void);
void SysTick_Handler(void);
void OTGFS1_IRQHandler(void);
void OTGHS_IRQHandler(void);
void OTGFS1_WKUP_IRQHandler(void);
void OTGHS_WKUP_IRQHandler(void);
#ifdef __cplusplus
}
#endif

View File

@ -29,6 +29,7 @@
*/
#include "at32f402_405_clock.h"
#include "at32f402_405_int.h"
#include "bsp/board_api.h"
#include "board.h"
@ -40,20 +41,16 @@ void usb_gpio_config(void);
//--------------------------------------------------------------------+
// Forward USB interrupt events to TinyUSB IRQ Handler
//--------------------------------------------------------------------+
void OTGFS1_IRQHandler(void)
{
void OTGFS1_IRQHandler(void) {
tusb_int_handler(0, true);
}
void OTGHS_IRQHandler(void)
{
void OTGHS_IRQHandler(void) {
tusb_int_handler(1, true);
}
void OTGFS1_WKUP_IRQHandler(void)
{
void OTGFS1_WKUP_IRQHandler(void) {
tusb_int_handler(0, true);
}
void OTGHS_WKUP_IRQHandler(void)
{
void OTGHS_WKUP_IRQHandler(void) {
tusb_int_handler(1, true);
}
@ -278,6 +275,7 @@ void HardFault_Handler(void) {
// Required by __libc_init_array in startup code if we are compiling using
// -nostdlib/-nostartfiles.
void _init(void);
void _init(void) {
}

View File

@ -48,6 +48,12 @@ void DebugMon_Handler(void);
void PendSV_Handler(void);
void SysTick_Handler(void);
void USBFS_H_CAN1_TX_IRQHandler(void);
void USBFS_L_CAN1_RX0_IRQHandler(void);
void USBFS_MAPH_IRQHandler(void);
void USBFS_MAPL_IRQHandler(void);
void USBFSWakeUp_IRQHandler(void);
#ifdef __cplusplus
}
#endif

View File

@ -29,6 +29,7 @@
*/
#include "at32f403a_407_clock.h"
#include "at32f403a_407_int.h"
#include "bsp/board_api.h"
#include "board.h"
@ -266,6 +267,7 @@ void HardFault_Handler(void) {
// Required by __libc_init_array in startup code if we are compiling using
// -nostdlib/-nostartfiles.
void _init(void);
void _init(void) {
}

View File

@ -48,6 +48,12 @@ void DebugMon_Handler(void);
void PendSV_Handler(void);
void SysTick_Handler(void);
void USBFS_H_CAN1_TX_IRQHandler(void);
void USBFS_L_CAN1_RX0_IRQHandler(void);
void USBFS_MAPH_IRQHandler(void);
void USBFS_MAPL_IRQHandler(void);
void USBFSWakeUp_IRQHandler(void);
#ifdef __cplusplus
}
#endif

View File

@ -29,6 +29,7 @@
*/
#include "at32f413_clock.h"
#include "at32f413_int.h"
#include "board.h"
#include "bsp/board_api.h"
@ -266,6 +267,7 @@ void HardFault_Handler(void) {
// Required by __libc_init_array in startup code if we are compiling using
// -nostdlib/-nostartfiles.
void _init(void);
void _init(void) {
}

View File

@ -48,6 +48,9 @@ void DebugMon_Handler(void);
void PendSV_Handler(void);
void SysTick_Handler(void);
void OTGFS1_IRQHandler(void);
void OTGFS1_WKUP_IRQHandler(void);
#ifdef __cplusplus
}
#endif

View File

@ -29,6 +29,7 @@
*/
#include "at32f415_clock.h"
#include "at32f415_int.h"
#include "board.h"
#include "bsp/board_api.h"
@ -262,6 +263,7 @@ void HardFault_Handler(void) {
// Required by __libc_init_array in startup code if we are compiling using
// -nostdlib/-nostartfiles.
void _init(void);
void _init(void) {
}

View File

@ -39,7 +39,7 @@ extern "C" {
/* exported functions ------------------------------------------------------- */
void NMI_Handler(void);
//void HardFault_Handler(void);
void HardFault_Handler(void);
void MemManage_Handler(void);
void BusFault_Handler(void);
void UsageFault_Handler(void);
@ -48,6 +48,9 @@ void DebugMon_Handler(void);
void PendSV_Handler(void);
void SysTick_Handler(void);
void OTGFS1_IRQHandler(void);
void OTGFS1_WKUP_IRQHandler(void);
#ifdef __cplusplus
}
#endif

View File

@ -29,6 +29,7 @@
*/
#include "at32f423_clock.h"
#include "at32f423_int.h"
#include "board.h"
#include "bsp/board_api.h"
@ -266,6 +267,7 @@ void HardFault_Handler(void) {
// Required by __libc_init_array in startup code if we are compiling using
// -nostdlib/-nostartfiles.
void _init(void);
void _init(void) {
}

View File

@ -48,6 +48,9 @@ void DebugMon_Handler(void);
void PendSV_Handler(void);
void SysTick_Handler(void);
void OTGFS1_IRQHandler(void);
void OTGFS1_WKUP_IRQHandler(void);
#ifdef __cplusplus
}
#endif

View File

@ -29,6 +29,7 @@
*/
#include "at32f425_clock.h"
#include "at32f425_int.h"
#include "board.h"
#include "bsp/board_api.h"
@ -270,6 +271,7 @@ void HardFault_Handler(void) {
// Required by __libc_init_array in startup code if we are compiling using
// -nostdlib/-nostartfiles.
void _init(void);
void _init(void) {
}

View File

@ -48,6 +48,11 @@ void DebugMon_Handler(void);
void PendSV_Handler(void);
void SysTick_Handler(void);
void OTGFS1_IRQHandler(void);
void OTGFS2_IRQHandler(void);
void OTGFS1_WKUP_IRQHandler(void);
void OTGFS2_WKUP_IRQHandler(void);
#ifdef __cplusplus
}
#endif

View File

@ -29,6 +29,7 @@
*/
#include "at32f435_437_clock.h"
#include "at32f435_437_int.h"
#include "board.h"
#include "bsp/board_api.h"
@ -332,6 +333,7 @@ void HardFault_Handler(void) {
// Required by __libc_init_array in startup code if we are compiling using
// -nostdlib/-nostartfiles.
void _init(void);
void _init(void) {
}

View File

@ -31,7 +31,7 @@
#ifdef __ICCARM__
#define sys_write __write
#define sys_read __read
#elif defined(__MSP430__) || defined(__RX__)
#elif defined(__MSP430__) || defined(__RX__) || TU_CHECK_MCU(OPT_MCU_NUC120, OPT_MCU_NUC121, OPT_MCU_NUC126, OPT_MCU_NUC505)
#define sys_write write
#define sys_read read
#else
@ -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 */

View File

@ -86,6 +86,10 @@ function(family_configure_example TARGET RTOS)
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/family.c
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/../board.c
)
if (CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
set_source_files_properties(${CMAKE_CURRENT_FUNCTION_LIST_DIR}/family.c PROPERTIES COMPILE_FLAGS "-Wno-missing-prototypes")
endif ()
target_include_directories(${TARGET} PUBLIC
# family, hw, board
${CMAKE_CURRENT_FUNCTION_LIST_DIR}

View File

@ -93,6 +93,10 @@ function(family_configure_example TARGET RTOS)
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/family.c
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/../board.c
)
if (CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
set_source_files_properties(${CMAKE_CURRENT_FUNCTION_LIST_DIR}/family.c PROPERTIES COMPILE_FLAGS "-Wno-missing-prototypes")
endif ()
target_include_directories(${TARGET} PUBLIC
# family, hw, board
${CMAKE_CURRENT_FUNCTION_LIST_DIR}

View File

@ -1,9 +1,9 @@
/********************************** (C) COPYRIGHT *******************************
* File Name : ch32f20x_it.h
* Author : WCH
* Version : V1.0.0
* Date : 2021/08/08
* Description : This file contains the headers of the interrupt handlers.
* File Name : ch32f20x_it.h
* Author : WCH
* Version : V1.0.0
* Date : 2021/08/08
* Description : This file contains the headers of the interrupt handlers.
*********************************************************************************
* Copyright (c) 2021 Nanjing Qinheng Microelectronics Co., Ltd.
* Attention: This software (modified or not) and binary are used for
@ -21,5 +21,7 @@ void BusFault_Handler(void);
void UsageFault_Handler(void);
void DebugMon_Handler(void);
void USBHS_IRQHandler(void);
void SysTick_Handler(void);
#endif /* __CH32F20xIT_H */

View File

@ -32,6 +32,7 @@
#include "debug_uart.h"
#include "ch32f20x.h"
#include "ch32f20x_it.h"
#include "bsp/board_api.h"
#include "board.h"

View File

@ -12,4 +12,18 @@
#ifndef __CH32V10x_IT_H
#define __CH32V10x_IT_H
#ifdef __cplusplus
extern "C" {
#endif
#include "ch32v10x.h"
void USBHD_IRQHandler(void);
void USBWakeUp_IRQHandler(void);
void SysTick_Handler(void);
#ifdef __cplusplus
}
#endif
#endif /* __CH32V10x_IT_H */

View File

@ -12,6 +12,7 @@
#endif
#include "ch32v10x.h"
#include "ch32v10x_it.h"
#ifdef __GNUC__
#pragma GCC diagnostic pop
@ -44,7 +45,7 @@ void SysTick_Handler(void) {
system_ticks++;
}
uint32_t SysTick_Config(uint32_t ticks) {
static uint32_t SysTick_Config(uint32_t ticks) {
NVIC_EnableIRQ(SysTicK_IRQn);
SysTick->CTLR = 0;
SysTick->CNTL0 = SysTick->CNTL1 = SysTick->CNTL2 = SysTick->CNTL3 = 0;

View File

@ -12,4 +12,21 @@
#ifndef __CH32V20x_IT_H
#define __CH32V20x_IT_H
#ifdef __cplusplus
extern "C" {
#endif
#include "ch32v20x.h"
void USB_LP_CAN1_RX0_IRQHandler(void);
void USB_HP_CAN1_TX_IRQHandler(void);
void USBWakeUp_IRQHandler(void);
void USBHD_IRQHandler(void);
void USBHDWakeUp_IRQHandler(void);
void SysTick_Handler(void);
#ifdef __cplusplus
}
#endif
#endif /* __CH32V20x_IT_H */

View File

@ -12,6 +12,7 @@ manufacturer: WCH
#endif
#include "ch32v20x.h"
#include "ch32v20x_it.h"
#ifdef __GNUC__
#pragma GCC diagnostic pop
@ -74,7 +75,7 @@ __attribute__((interrupt)) void SysTick_Handler(void) {
system_ticks++;
}
uint32_t SysTick_Config(uint32_t ticks) {
static uint32_t SysTick_Config(uint32_t ticks) {
NVIC_EnableIRQ(SysTicK_IRQn);
SysTick->CTLR = 0;
SysTick->SR = 0;

View File

@ -10,7 +10,19 @@
#ifndef __CH32V30x_IT_H
#define __CH32V30x_IT_H
// #include "debug.h"
#ifdef __cplusplus
extern "C" {
#endif
#include "ch32v30x.h"
void USBHS_IRQHandler(void);
void OTG_FS_IRQHandler(void);
void SysTick_Handler(void);
#ifdef __cplusplus
}
#endif
#endif /* __CH32V30x_IT_H */

View File

@ -49,7 +49,8 @@ void USART1_IRQHandler(void) {
__asm volatile ("call USART1_IRQHandler_impl; mret");
}
__attribute__((used)) void USART1_IRQHandler_impl(void)
void USART1_IRQHandler_impl(void) __attribute__((used)) ;
void USART1_IRQHandler_impl(void)
{
if(USART_GetITStatus(USART1, USART_IT_TC) != RESET)
{

View File

@ -40,6 +40,7 @@
#include "debug_uart.h"
#include "ch32v30x.h"
#include "ch32v30x_it.h"
#ifdef __GNUC__
#pragma GCC diagnostic pop
@ -70,7 +71,7 @@ __attribute__((interrupt)) void OTG_FS_IRQHandler(void) {
// MACRO TYPEDEF CONSTANT ENUM
//--------------------------------------------------------------------+
uint32_t SysTick_Config(uint32_t ticks) {
static uint32_t SysTick_Config(uint32_t ticks) {
NVIC_EnableIRQ(SysTicK_IRQn);
SysTick->CTLR = 0;
SysTick->SR = 0;

View File

@ -0,0 +1,150 @@
/*
* FreeRTOS Kernel V10.0.0
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* 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. If you wish to use our Amazon
* FreeRTOS name, please do so in a fair use way that does not cause confusion.
*
* 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.
*
* http://www.FreeRTOS.org
* http://aws.amazon.com/freertos
*
* 1 tab == 4 spaces!
*/
#ifndef FREERTOS_CONFIG_H
#define FREERTOS_CONFIG_H
/*-----------------------------------------------------------
* Application specific definitions.
*
* These definitions should be adjusted for your particular hardware and
* application requirements.
*
* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
*
* See http://www.freertos.org/a00110.html.
*----------------------------------------------------------*/
// skip if included from IAR assembler
#ifndef __IASMARM__
#include "nuttx/config.h"
#endif
/* Cortex-M4F port configuration. */
#define configENABLE_MPU 0
#define configENABLE_FPU 1
#define configENABLE_TRUSTZONE 0
#define configMINIMAL_SECURE_STACK_SIZE (1024)
#define configUSE_PREEMPTION 1
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
#define configCPU_CLOCK_HZ SystemCoreClock
#define configTICK_RATE_HZ ( 1000 )
#define configMAX_PRIORITIES ( 5 )
#define configMINIMAL_STACK_SIZE ( 128 )
#define configTOTAL_HEAP_SIZE ( configSUPPORT_DYNAMIC_ALLOCATION*8*1024 )
#define configMAX_TASK_NAME_LEN 16
#define configUSE_16_BIT_TICKS 0
#define configIDLE_SHOULD_YIELD 1
#define configUSE_MUTEXES 1
#define configUSE_RECURSIVE_MUTEXES 1
#define configUSE_COUNTING_SEMAPHORES 1
#define configQUEUE_REGISTRY_SIZE 4
#define configUSE_QUEUE_SETS 0
#define configUSE_TIME_SLICING 0
#define configUSE_NEWLIB_REENTRANT 0
#define configENABLE_BACKWARD_COMPATIBILITY 1
#define configSTACK_ALLOCATION_FROM_SEPARATE_HEAP 0
#define configSUPPORT_STATIC_ALLOCATION 1
#define configSUPPORT_DYNAMIC_ALLOCATION 0
/* Hook function related definitions. */
#define configUSE_IDLE_HOOK 0
#define configUSE_TICK_HOOK 0
#define configUSE_MALLOC_FAILED_HOOK 0 // cause nested extern warning
#define configCHECK_FOR_STACK_OVERFLOW 2
#define configCHECK_HANDLER_INSTALLATION 0
/* Run time and task stats gathering related definitions. */
#define configGENERATE_RUN_TIME_STATS 0
#define configRECORD_STACK_HIGH_ADDRESS 1
#define configUSE_TRACE_FACILITY 1 // legacy trace
#define configUSE_STATS_FORMATTING_FUNCTIONS 0
/* Co-routine definitions. */
#define configUSE_CO_ROUTINES 0
#define configMAX_CO_ROUTINE_PRIORITIES 2
/* Software timer related definitions. */
#define configUSE_TIMERS 1
#define configTIMER_TASK_PRIORITY (configMAX_PRIORITIES-2)
#define configTIMER_QUEUE_LENGTH 32
#define configTIMER_TASK_STACK_DEPTH configMINIMAL_STACK_SIZE
/* Optional functions - most linkers will remove unused functions anyway. */
#define INCLUDE_vTaskPrioritySet 0
#define INCLUDE_uxTaskPriorityGet 0
#define INCLUDE_vTaskDelete 0
#define INCLUDE_vTaskSuspend 1 // required for queue, semaphore, mutex to be blocked indefinitely with portMAX_DELAY
#define INCLUDE_xResumeFromISR 0
#define INCLUDE_vTaskDelayUntil 1
#define INCLUDE_vTaskDelay 1
#define INCLUDE_xTaskGetSchedulerState 0
#define INCLUDE_xTaskGetCurrentTaskHandle 1
#define INCLUDE_uxTaskGetStackHighWaterMark 0
#define INCLUDE_xTaskGetIdleTaskHandle 0
#define INCLUDE_xTimerGetTimerDaemonTaskHandle 0
#define INCLUDE_pcTaskGetTaskName 0
#define INCLUDE_eTaskGetState 0
#define INCLUDE_xEventGroupSetBitFromISR 0
#define INCLUDE_xTimerPendFunctionCall 0
/* FreeRTOS hooks to NVIC vectors */
#define xPortPendSVHandler PendSV_Handler
#define xPortSysTickHandler SysTick_Handler
#define vPortSVCHandler SVC_Handler
//--------------------------------------------------------------------+
// Interrupt nesting behavior configuration.
//--------------------------------------------------------------------+
// For Cortex-M specific: __NVIC_PRIO_BITS is defined in mcu header
// CXD56 (Cortex-M4F) has 3 priority bits
#define configPRIO_BITS 3
/* The lowest interrupt priority that can be used in a call to a "set priority" function. */
#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY ((1<<configPRIO_BITS) - 1)
/* The highest interrupt priority that can be used by any interrupt service
routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT CALL
INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER
PRIORITY THAN THIS! (higher priorities are lower numeric values. */
#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 2
/* Interrupt priorities used by the kernel port layer itself. These are generic
to all Cortex-M ports, and do not rely on any particular library functions. */
#define configKERNEL_INTERRUPT_PRIORITY ( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
/* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!!
See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
#define configMAX_SYSCALL_INTERRUPT_PRIORITY ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
#endif

View File

@ -0,0 +1,6 @@
set(SERIAL /dev/ttyUSB0 CACHE STRING "Serial port for flashing")
function(update_board TARGET)
target_compile_definitions(${TARGET} PUBLIC
)
endfunction()

Some files were not shown because too many files have changed in this diff Show More