mirror of
https://github.com/hathach/tinyusb.git
synced 2025-01-28 00:35:25 +00:00
Merge pull request #2962 from hathach/zephyr-support
Initial Zephyr support
This commit is contained in:
commit
0d4f945bdc
21
.github/workflows/build.yml
vendored
21
.github/workflows/build.yml
vendored
@ -137,3 +137,24 @@ jobs:
|
||||
|
||||
- name: Build
|
||||
run: python3 tools/build.py --one-per-family --toolchain iar $BUILD_ARGS
|
||||
|
||||
# ---------------------------------------
|
||||
# Zephyr
|
||||
# ---------------------------------------
|
||||
zephyr:
|
||||
if: github.event_name == 'push'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout TinyUSB
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Zephyr project
|
||||
uses: zephyrproject-rtos/action-zephyr-setup@v1
|
||||
with:
|
||||
app-path: examples
|
||||
toolchains: arm-zephyr-eabi
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
west build -b pca10056 -d examples/device/cdc_msc/build examples/device/cdc_msc -- -DRTOS=zephyr
|
||||
west build -b pca10056 -d examples/device/msc_dual_lun/build examples/device/msc_dual_lun -- -DRTOS=zephyr
|
||||
|
6
.idea/cmake.xml
generated
6
.idea/cmake.xml
generated
@ -80,12 +80,14 @@
|
||||
<configuration PROFILE_NAME="samd11_xplained" ENABLED="false" CONFIG_NAME="MinSizeRel" GENERATION_OPTIONS="-DBOARD=samd11_xplained" />
|
||||
<configuration PROFILE_NAME="atsaml21_xpro" ENABLED="false" GENERATION_OPTIONS="-DBOARD=atsaml21_xpro" />
|
||||
<configuration PROFILE_NAME="feather_m4_express" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=feather_m4_express -DLOG=1 -DLOGGER=RTT -DMAX3421_HOST=1" />
|
||||
<configuration PROFILE_NAME="metro_m4_express" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=metro_m4_express -DLOG=1 -DLOGGER=RTT -DMAX3421_HOST=1" />
|
||||
<configuration PROFILE_NAME="metro_m4_express" ENABLED="true" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=metro_m4_express -DLOG=1 -DLOGGER=RTT -DMAX3421_HOST=1" />
|
||||
<configuration PROFILE_NAME="feather_m4_express-zephyr" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=feather_m4_express -DLOG=1 -DMAX3421_HOST=1 -DRTOS=zephyr" />
|
||||
<configuration PROFILE_NAME="itsybitsy_m4" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=itsybitsy_m4" />
|
||||
<configuration PROFILE_NAME="same54_xplained" ENABLED="false" GENERATION_OPTIONS="-DBOARD=same54_xplained -DLOG=1 -DLOGGER=RTT" />
|
||||
<configuration PROFILE_NAME="samg55_xplained" ENABLED="false" GENERATION_OPTIONS="-DBOARD=samg55_xplained" />
|
||||
<configuration PROFILE_NAME="feather_nrf52840_express" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=feather_nrf52840_express -DLOG=1 -DLOGGER=RTT -DMAX3421_HOST=1" />
|
||||
<configuration PROFILE_NAME="pca10056" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=pca10056 -DLOG=1 -DLOGGER=RTT -DTRACE_ETM=1" />
|
||||
<configuration PROFILE_NAME="pca10056" ENABLED="true" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=pca10056 -DLOG=1 -DLOGGER=RTT -DTRACE_ETM=1" />
|
||||
<configuration PROFILE_NAME="pca10056-zephyr" ENABLED="true" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=pca10056 -DLOG=1 -DTRACE_ETM=1 -DRTOS=zephyr" BUILD_OPTIONS="-v" />
|
||||
<configuration PROFILE_NAME="pca10095" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=pca10095 -DLOG=1 -DLOGGER=RTT -DTRACE_ETM=1" />
|
||||
<configuration PROFILE_NAME="metro m7 1011 sd" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=metro_m7_1011_sd -DLOG=1 -DLOGGER=RTT -DTRACE_ETM=1" />
|
||||
<configuration PROFILE_NAME="metro_m7_1011" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=metro_m7_1011 -DLOG=1 -DLOGGER=RTT" />
|
||||
|
@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.17)
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
|
||||
#set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/../hw/bsp/family_support.cmake)
|
||||
|
@ -1,3 +1,7 @@
|
||||
if (RTOS STREQUAL zephyr)
|
||||
return()
|
||||
endif ()
|
||||
|
||||
if (NOT DEFINED CMAKE_C_COMPILER)
|
||||
set(CMAKE_C_COMPILER "arm-none-eabi-gcc")
|
||||
endif ()
|
||||
|
@ -4,6 +4,7 @@ include(CMakePrintHelpers)
|
||||
# Common
|
||||
# ----------------------------------------------------------------------------
|
||||
set(CMAKE_SYSTEM_NAME Generic)
|
||||
set(CMAKE_SYSTEM_PROCESSOR ${CMAKE_SYSTEM_CPU})
|
||||
set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE)
|
||||
|
||||
# Look for includes and libraries only in the target system prefix.
|
||||
@ -13,8 +14,8 @@ set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
|
||||
# pass TOOLCHAIN_CPU to
|
||||
set(CMAKE_TRY_COMPILE_PLATFORM_VARIABLES CMAKE_SYSTEM_PROCESSOR)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/../cpu/${CMAKE_SYSTEM_PROCESSOR}.cmake)
|
||||
set(CMAKE_TRY_COMPILE_PLATFORM_VARIABLES CMAKE_SYSTEM_PROCESSOR CMAKE_SYSTEM_CPU)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/../cpu/${CMAKE_SYSTEM_CPU}.cmake)
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Compile flags
|
||||
|
@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.17)
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/../../hw/bsp/family_support.cmake)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.17)
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.17)
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.17)
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.17)
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.17)
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.17)
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)
|
||||
|
||||
@ -15,18 +15,23 @@ if(FAMILY STREQUAL "espressif")
|
||||
return()
|
||||
endif()
|
||||
|
||||
add_executable(${PROJECT})
|
||||
if (RTOS STREQUAL zephyr)
|
||||
set(EXE_NAME app)
|
||||
else()
|
||||
set(EXE_NAME ${PROJECT})
|
||||
add_executable(${EXE_NAME})
|
||||
endif()
|
||||
|
||||
# Example source
|
||||
target_sources(${PROJECT} PUBLIC
|
||||
target_sources(${EXE_NAME} PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/main.c
|
||||
)
|
||||
|
||||
# Example include
|
||||
target_include_directories(${PROJECT} PUBLIC
|
||||
target_include_directories(${EXE_NAME} PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
)
|
||||
|
||||
# Configure compilation flags and libraries for the example without RTOS.
|
||||
# See the corresponding function in hw/bsp/FAMILY/family.cmake for details.
|
||||
family_configure_device_example(${PROJECT} noos)
|
||||
family_configure_device_example(${EXE_NAME} ${RTOS})
|
||||
|
@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.17)
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.17)
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
#set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)
|
||||
@ -16,20 +16,25 @@ if(FAMILY STREQUAL "espressif")
|
||||
return()
|
||||
endif()
|
||||
|
||||
add_executable(${PROJECT})
|
||||
if (RTOS STREQUAL zephyr)
|
||||
set(EXE_NAME app)
|
||||
else()
|
||||
set(EXE_NAME ${PROJECT})
|
||||
add_executable(${EXE_NAME})
|
||||
endif()
|
||||
|
||||
# Example source
|
||||
target_sources(${PROJECT} PUBLIC
|
||||
target_sources(${EXE_NAME} PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/main.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/msc_disk.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/usb_descriptors.c
|
||||
)
|
||||
|
||||
# Example include
|
||||
target_include_directories(${PROJECT} PUBLIC
|
||||
target_include_directories(${EXE_NAME} PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
)
|
||||
|
||||
# Configure compilation flags and libraries for the example... see the corresponding function
|
||||
# in hw/bsp/FAMILY/family.cmake for details.
|
||||
family_configure_device_example(${PROJECT} noos)
|
||||
# Configure compilation flags and libraries for the example without RTOS.
|
||||
# See the corresponding function in hw/bsp/FAMILY/family.cmake for details.
|
||||
family_configure_device_example(${EXE_NAME} ${RTOS})
|
||||
|
6
examples/device/cdc_msc/prj.conf
Normal file
6
examples/device/cdc_msc/prj.conf
Normal file
@ -0,0 +1,6 @@
|
||||
CONFIG_GPIO=y
|
||||
CONFIG_FPU=y
|
||||
CONFIG_NO_OPTIMIZATIONS=y
|
||||
CONFIG_UART_INTERRUPT_DRIVEN=y
|
||||
CONFIG_NRFX_POWER=y
|
||||
CONFIG_NRFX_UARTE0=y
|
@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.17)
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.17)
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.17)
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.17)
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.17)
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.17)
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.17)
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.17)
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.17)
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.17)
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.17)
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.17)
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.17)
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)
|
||||
|
||||
@ -15,20 +15,25 @@ if(FAMILY STREQUAL "espressif")
|
||||
return()
|
||||
endif()
|
||||
|
||||
add_executable(${PROJECT})
|
||||
if (RTOS STREQUAL zephyr)
|
||||
set(EXE_NAME app)
|
||||
else()
|
||||
set(EXE_NAME ${PROJECT})
|
||||
add_executable(${EXE_NAME})
|
||||
endif()
|
||||
|
||||
# Example source
|
||||
target_sources(${PROJECT} PUBLIC
|
||||
target_sources(${EXE_NAME} PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/main.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/msc_disk_dual.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/usb_descriptors.c
|
||||
)
|
||||
|
||||
# Example include
|
||||
target_include_directories(${PROJECT} PUBLIC
|
||||
target_include_directories(${EXE_NAME} PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
)
|
||||
|
||||
# Configure compilation flags and libraries for the example without RTOS.
|
||||
# See the corresponding function in hw/bsp/FAMILY/family.cmake for details.
|
||||
family_configure_device_example(${PROJECT} noos)
|
||||
family_configure_device_example(${EXE_NAME} ${RTOS})
|
||||
|
6
examples/device/msc_dual_lun/prj.conf
Normal file
6
examples/device/msc_dual_lun/prj.conf
Normal file
@ -0,0 +1,6 @@
|
||||
CONFIG_GPIO=y
|
||||
CONFIG_FPU=y
|
||||
CONFIG_NO_OPTIMIZATIONS=y
|
||||
CONFIG_UART_INTERRUPT_DRIVEN=y
|
||||
CONFIG_NRFX_POWER=y
|
||||
CONFIG_NRFX_UARTE0=y
|
@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.17)
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/../../../hw/bsp/family_support.cmake)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.17)
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.17)
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.17)
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.17)
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)
|
||||
|
||||
|
@ -185,7 +185,7 @@ static void fill_color_bar(uint8_t* buffer, unsigned start_position) {
|
||||
|
||||
#endif
|
||||
|
||||
void video_send_frame(void) {
|
||||
static void video_send_frame(void) {
|
||||
static unsigned start_ms = 0;
|
||||
static unsigned already_sent = 0;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.17)
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.17)
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.17)
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/../../hw/bsp/family_support.cmake)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.17)
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.17)
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.17)
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/../../hw/bsp/family_support.cmake)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.17)
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.17)
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.17)
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.17)
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.17)
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.17)
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)
|
||||
|
||||
|
@ -62,15 +62,13 @@
|
||||
#include "bsp/board_api.h"
|
||||
#include "tusb.h"
|
||||
|
||||
#include "msc_app.h"
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// MACRO CONSTANT TYPEDEF PROTYPES
|
||||
//--------------------------------------------------------------------+
|
||||
void led_blinking_task(void);
|
||||
|
||||
// from msc_app.c
|
||||
extern bool msc_app_init(void);
|
||||
extern void msc_app_task(void);
|
||||
|
||||
/*------------- MAIN -------------*/
|
||||
int main(void) {
|
||||
board_init();
|
||||
|
@ -67,7 +67,9 @@ bool cli_init(void);
|
||||
|
||||
bool msc_app_init(void)
|
||||
{
|
||||
for(size_t i=0; i<CFG_TUH_DEVICE_MAX; i++) _disk_busy[i] = false;
|
||||
for(size_t i=0; i<CFG_TUH_DEVICE_MAX; i++) {
|
||||
_disk_busy[i] = false;
|
||||
}
|
||||
|
||||
// disable stdout buffered for echoing typing command
|
||||
#ifndef __ICCARM__ // TODO IAR doesn't support stream control ?
|
||||
@ -81,7 +83,9 @@ bool msc_app_init(void)
|
||||
|
||||
void msc_app_task(void)
|
||||
{
|
||||
if (!_cli) return;
|
||||
if (!_cli) {
|
||||
return;
|
||||
}
|
||||
|
||||
int ch = board_getchar();
|
||||
if ( ch > 0 )
|
||||
@ -99,8 +103,7 @@ void msc_app_task(void)
|
||||
//
|
||||
//--------------------------------------------------------------------+
|
||||
|
||||
bool inquiry_complete_cb(uint8_t dev_addr, tuh_msc_complete_data_t const * cb_data)
|
||||
{
|
||||
static bool inquiry_complete_cb(uint8_t dev_addr, tuh_msc_complete_data_t const * cb_data) {
|
||||
msc_cbw_t const* cbw = cb_data->cbw;
|
||||
msc_csw_t const* csw = cb_data->csw;
|
||||
|
||||
@ -294,18 +297,11 @@ void cli_cmd_mkdir(EmbeddedCli *cli, char *args, void *context);
|
||||
void cli_cmd_mv(EmbeddedCli *cli, char *args, void *context);
|
||||
void cli_cmd_rm(EmbeddedCli *cli, char *args, void *context);
|
||||
|
||||
void cli_write_char(EmbeddedCli *cli, char c)
|
||||
{
|
||||
static void cli_write_char(EmbeddedCli *cli, char c) {
|
||||
(void) cli;
|
||||
putchar((int) c);
|
||||
}
|
||||
|
||||
void cli_cmd_unknown(EmbeddedCli *cli, CliCommand *command)
|
||||
{
|
||||
(void) cli;
|
||||
printf("%s: command not found\r\n", command->name);
|
||||
}
|
||||
|
||||
bool cli_init(void)
|
||||
{
|
||||
EmbeddedCliConfig *config = embeddedCliDefaultConfig();
|
||||
|
35
examples/host/msc_file_explorer/src/msc_app.h
Normal file
35
examples/host/msc_file_explorer/src/msc_app.h
Normal file
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* 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 MSC_APP_H
|
||||
#define MSC_APP_H
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
bool msc_app_init(void);
|
||||
void msc_app_task(void);
|
||||
|
||||
|
||||
#endif
|
@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.17)
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/../../hw/bsp/family_support.cmake)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.17)
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)
|
||||
|
||||
|
12
examples/west.yml
Normal file
12
examples/west.yml
Normal file
@ -0,0 +1,12 @@
|
||||
manifest:
|
||||
remotes:
|
||||
- name: zephyrproject-rtos
|
||||
url-base: https://github.com/zephyrproject-rtos
|
||||
projects:
|
||||
- name: zephyr
|
||||
remote: zephyrproject-rtos
|
||||
revision: main
|
||||
path: zephyr
|
||||
import: true
|
||||
self:
|
||||
path: .
|
@ -38,22 +38,24 @@ extern "C" {
|
||||
|
||||
#include "tusb.h"
|
||||
|
||||
#if CFG_TUSB_OS == OPT_OS_FREERTOS
|
||||
#if TUSB_MCU_VENDOR_ESPRESSIF
|
||||
// ESP-IDF need "freertos/" prefix in include path.
|
||||
// CFG_TUSB_OS_INC_PATH should be defined accordingly.
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/semphr.h"
|
||||
#include "freertos/queue.h"
|
||||
#include "freertos/task.h"
|
||||
#include "freertos/timers.h"
|
||||
#else
|
||||
#include "FreeRTOS.h"
|
||||
#include "semphr.h"
|
||||
#include "queue.h"
|
||||
#include "task.h"
|
||||
#include "timers.h"
|
||||
#endif
|
||||
#if CFG_TUSB_OS == OPT_OS_ZEPHYR
|
||||
#include <zephyr/kernel.h>
|
||||
#elif CFG_TUSB_OS == OPT_OS_FREERTOS
|
||||
#if TUSB_MCU_VENDOR_ESPRESSIF
|
||||
// ESP-IDF need "freertos/" prefix in include path.
|
||||
// CFG_TUSB_OS_INC_PATH should be defined accordingly.
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/semphr.h"
|
||||
#include "freertos/queue.h"
|
||||
#include "freertos/task.h"
|
||||
#include "freertos/timers.h"
|
||||
#else
|
||||
#include "FreeRTOS.h"
|
||||
#include "semphr.h"
|
||||
#include "queue.h"
|
||||
#include "task.h"
|
||||
#include "timers.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Define the default baudrate
|
||||
@ -124,6 +126,10 @@ static inline uint32_t board_millis(void) {
|
||||
// Implement your own board_millis() in any of .c file
|
||||
uint32_t board_millis(void);
|
||||
|
||||
#elif CFG_TUSB_OS == OPT_OS_ZEPHYR
|
||||
static inline uint32_t board_millis(void) {
|
||||
return k_uptime_get_32();
|
||||
}
|
||||
#else
|
||||
#error "board_millis() is not implemented for this OS"
|
||||
#endif
|
||||
|
@ -1,4 +1,4 @@
|
||||
set(CMAKE_SYSTEM_PROCESSOR arm1176jzf-s CACHE INTERNAL "System Processor")
|
||||
set(CMAKE_SYSTEM_CPU arm1176jzf-s CACHE INTERNAL "System Processor")
|
||||
#set(SUFFIX "")
|
||||
|
||||
function(update_board TARGET)
|
||||
|
@ -94,16 +94,15 @@ function(family_configure_example TARGET RTOS)
|
||||
)
|
||||
|
||||
# Add TinyUSB target and port source
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_BCM2835 ${RTOS})
|
||||
target_sources(${TARGET}-tinyusb PUBLIC
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_BCM2835)
|
||||
target_sources(${TARGET} PUBLIC
|
||||
${TOP}/src/portable/synopsys/dwc2/dcd_dwc2.c
|
||||
${TOP}/src/portable/synopsys/dwc2/hcd_dwc2.c
|
||||
${TOP}/src/portable/synopsys/dwc2/dwc2_common.c
|
||||
)
|
||||
target_link_libraries(${TARGET}-tinyusb PUBLIC board_${BOARD})
|
||||
target_link_libraries(${TARGET} PUBLIC board_${BOARD})
|
||||
|
||||
|
||||
# Link dependencies
|
||||
target_link_libraries(${TARGET} PUBLIC board_${BOARD} ${TARGET}-tinyusb)
|
||||
|
||||
# Flashing
|
||||
family_add_bin_hex(${TARGET})
|
||||
|
@ -1,4 +1,4 @@
|
||||
set(CMAKE_SYSTEM_PROCESSOR cortex-a72 CACHE INTERNAL "System Processor")
|
||||
set(CMAKE_SYSTEM_CPU cortex-a72 CACHE INTERNAL "System Processor")
|
||||
set(BCM_VERSION 2711)
|
||||
|
||||
function(update_board TARGET)
|
||||
|
@ -1,4 +1,4 @@
|
||||
set(CMAKE_SYSTEM_PROCESSOR cortex-a53 CACHE INTERNAL "System Processor")
|
||||
set(CMAKE_SYSTEM_CPU cortex-a53 CACHE INTERNAL "System Processor")
|
||||
set(BCM_VERSION 2837)
|
||||
|
||||
function(update_board TARGET)
|
||||
|
@ -101,16 +101,15 @@ function(family_configure_example TARGET RTOS)
|
||||
)
|
||||
|
||||
# Add TinyUSB target and port source
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_BCM${BCM_VERSION} ${RTOS})
|
||||
target_sources(${TARGET}-tinyusb PUBLIC
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_BCM${BCM_VERSION})
|
||||
target_sources(${TARGET} PUBLIC
|
||||
${TOP}/src/portable/synopsys/dwc2/dcd_dwc2.c
|
||||
${TOP}/src/portable/synopsys/dwc2/hcd_dwc2.c
|
||||
${TOP}/src/portable/synopsys/dwc2/dwc2_common.c
|
||||
)
|
||||
target_link_libraries(${TARGET}-tinyusb PUBLIC board_${BOARD})
|
||||
target_link_libraries(${TARGET} PUBLIC board_${BOARD})
|
||||
|
||||
|
||||
# Link dependencies
|
||||
target_link_libraries(${TARGET} PUBLIC board_${BOARD} ${TARGET}-tinyusb)
|
||||
|
||||
# Flashing
|
||||
family_add_bin_hex(${TARGET})
|
||||
|
@ -9,7 +9,7 @@ set(SDK_SRC_DIR ${SDK_DIR}/EVT/EXAM/SRC)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/boards/${BOARD}/board.cmake)
|
||||
|
||||
# toolchain set up
|
||||
set(CMAKE_SYSTEM_PROCESSOR rv32imac-ilp32 CACHE INTERNAL "System Processor")
|
||||
set(CMAKE_SYSTEM_CPU rv32imac-ilp32 CACHE INTERNAL "System Processor")
|
||||
set(CMAKE_TOOLCHAIN_FILE ${TOP}/examples/build_system/cmake/toolchain/riscv_${TOOLCHAIN}.cmake)
|
||||
|
||||
set(FAMILY_MCUS CH32V103 CACHE INTERNAL "")
|
||||
@ -98,15 +98,14 @@ function(family_configure_example TARGET RTOS)
|
||||
)
|
||||
|
||||
# Add TinyUSB target and port source
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_CH32V103 ${RTOS})
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_CH32V103)
|
||||
|
||||
target_sources(${TARGET}-tinyusb PUBLIC
|
||||
target_sources(${TARGET} PUBLIC
|
||||
${TOP}/src/portable/wch/dcd_ch32_usbfs.c
|
||||
)
|
||||
target_link_libraries(${TARGET}-tinyusb PUBLIC board_${BOARD})
|
||||
target_link_libraries(${TARGET} PUBLIC board_${BOARD})
|
||||
|
||||
|
||||
# Link dependencies
|
||||
target_link_libraries(${TARGET} PUBLIC board_${BOARD} ${TARGET}-tinyusb)
|
||||
|
||||
# Flashing
|
||||
family_add_bin_hex(${TARGET})
|
||||
|
@ -9,7 +9,7 @@ set(SDK_SRC_DIR ${SDK_DIR}/EVT/EXAM/SRC)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/boards/${BOARD}/board.cmake)
|
||||
|
||||
# toolchain set up
|
||||
set(CMAKE_SYSTEM_PROCESSOR rv32imac-ilp32 CACHE INTERNAL "System Processor")
|
||||
set(CMAKE_SYSTEM_CPU rv32imac-ilp32 CACHE INTERNAL "System Processor")
|
||||
set(CMAKE_TOOLCHAIN_FILE ${TOP}/examples/build_system/cmake/toolchain/riscv_${TOOLCHAIN}.cmake)
|
||||
|
||||
set(FAMILY_MCUS CH32V20X CACHE INTERNAL "")
|
||||
@ -123,16 +123,15 @@ function(family_configure_example TARGET RTOS)
|
||||
)
|
||||
|
||||
# Add TinyUSB target and port source
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_CH32V20X ${RTOS})
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_CH32V20X)
|
||||
|
||||
target_sources(${TARGET}-tinyusb PUBLIC
|
||||
target_sources(${TARGET} PUBLIC
|
||||
${TOP}/src/portable/wch/dcd_ch32_usbfs.c
|
||||
${TOP}/src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c
|
||||
)
|
||||
target_link_libraries(${TARGET}-tinyusb PUBLIC board_${BOARD})
|
||||
target_link_libraries(${TARGET} PUBLIC board_${BOARD})
|
||||
|
||||
|
||||
# Link dependencies
|
||||
target_link_libraries(${TARGET} PUBLIC board_${BOARD} ${TARGET}-tinyusb)
|
||||
|
||||
# Flashing
|
||||
family_add_bin_hex(${TARGET})
|
||||
|
@ -8,7 +8,7 @@ set(SDK_SRC_DIR ${SDK_DIR}/EVT/EXAM/SRC)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/boards/${BOARD}/board.cmake)
|
||||
|
||||
# toolchain set up
|
||||
set(CMAKE_SYSTEM_PROCESSOR rv32imac-ilp32 CACHE INTERNAL "System Processor")
|
||||
set(CMAKE_SYSTEM_CPU rv32imac-ilp32 CACHE INTERNAL "System Processor")
|
||||
set(CMAKE_TOOLCHAIN_FILE ${TOP}/examples/build_system/cmake/toolchain/riscv_${TOOLCHAIN}.cmake)
|
||||
|
||||
set(FAMILY_MCUS CH32V307 CACHE INTERNAL "")
|
||||
@ -113,15 +113,14 @@ function(family_configure_example TARGET RTOS)
|
||||
)
|
||||
|
||||
# Add TinyUSB target and port source
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_CH32V307 ${RTOS})
|
||||
target_sources(${TARGET}-tinyusb PUBLIC
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_CH32V307)
|
||||
target_sources(${TARGET} PUBLIC
|
||||
${TOP}/src/portable/wch/dcd_ch32_usbhs.c
|
||||
${TOP}/src/portable/wch/dcd_ch32_usbfs.c
|
||||
)
|
||||
target_link_libraries(${TARGET}-tinyusb PUBLIC board_${BOARD})
|
||||
target_link_libraries(${TARGET} PUBLIC board_${BOARD})
|
||||
|
||||
|
||||
# Link dependencies
|
||||
target_link_libraries(${TARGET} PUBLIC board_${BOARD} ${TARGET}-tinyusb)
|
||||
|
||||
# Flashing
|
||||
family_add_bin_hex(${TARGET})
|
||||
|
@ -5,7 +5,7 @@ set(MCU_DIR ${TOP}/hw/mcu/dialog/da1469x)
|
||||
# include board specific
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/boards/${BOARD}/board.cmake)
|
||||
|
||||
set(CMAKE_SYSTEM_PROCESSOR cortex-m33-nodsp CACHE INTERNAL "System Processor")
|
||||
set(CMAKE_SYSTEM_CPU cortex-m33-nodsp CACHE INTERNAL "System Processor")
|
||||
set(CMAKE_TOOLCHAIN_FILE ${TOP}/examples/build_system/cmake/toolchain/arm_${TOOLCHAIN}.cmake)
|
||||
set(FAMILY_MCUS DA1469X CACHE INTERNAL "")
|
||||
|
||||
@ -126,14 +126,13 @@ function(family_configure_example TARGET RTOS)
|
||||
)
|
||||
|
||||
# Add TinyUSB target and port source
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_DA1469X ${RTOS})
|
||||
target_sources(${TARGET}-tinyusb PUBLIC
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_DA1469X)
|
||||
target_sources(${TARGET} PUBLIC
|
||||
${TOP}/src/portable/dialog/da146xx/dcd_da146xx.c
|
||||
)
|
||||
target_link_libraries(${TARGET}-tinyusb PUBLIC board_${BOARD})
|
||||
target_link_libraries(${TARGET} PUBLIC board_${BOARD})
|
||||
|
||||
|
||||
# Link dependencies
|
||||
target_link_libraries(${TARGET} PUBLIC board_${BOARD} ${TARGET}-tinyusb)
|
||||
|
||||
# Flashing
|
||||
family_add_bin_hex(${TARGET})
|
||||
|
@ -5,7 +5,7 @@ set(SDK_DIR ${TOP}/hw/mcu/allwinner/f1c100s)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/boards/${BOARD}/board.cmake)
|
||||
|
||||
# toolchain set up
|
||||
set(CMAKE_SYSTEM_PROCESSOR arm926ej-s CACHE INTERNAL "System Processor")
|
||||
set(CMAKE_SYSTEM_CPU arm926ej-s CACHE INTERNAL "System Processor")
|
||||
set(CMAKE_TOOLCHAIN_FILE ${TOP}/examples/build_system/cmake/toolchain/arm_${TOOLCHAIN}.cmake)
|
||||
|
||||
set(FAMILY_MCUS F1C100S CACHE INTERNAL "")
|
||||
@ -100,14 +100,13 @@ function(family_configure_example TARGET RTOS)
|
||||
)
|
||||
|
||||
# Add TinyUSB target and port source
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_F1C100S ${RTOS})
|
||||
target_sources(${TARGET}-tinyusb PRIVATE
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_F1C100S)
|
||||
target_sources(${TARGET} PRIVATE
|
||||
${TOP}/src/portable/sunxi/dcd_sunxi_musb.c
|
||||
)
|
||||
target_link_libraries(${TARGET}-tinyusb PUBLIC board_${BOARD})
|
||||
target_link_libraries(${TARGET} PUBLIC board_${BOARD})
|
||||
|
||||
|
||||
# Link dependencies
|
||||
target_link_libraries(${TARGET} PUBLIC board_${BOARD} ${TARGET}-tinyusb)
|
||||
|
||||
# Flashing
|
||||
family_add_bin_hex(${TARGET})
|
||||
|
@ -8,6 +8,13 @@ get_filename_component(TOP ${TOP} ABSOLUTE)
|
||||
|
||||
set(UF2CONV_PY ${TOP}/tools/uf2/utils/uf2conv.py)
|
||||
|
||||
#-------------------------------------------------------------
|
||||
# RTOS
|
||||
#-------------------------------------------------------------
|
||||
if (NOT DEFINED RTOS)
|
||||
set(RTOS noos)
|
||||
endif ()
|
||||
|
||||
#-------------------------------------------------------------
|
||||
# Toolchain
|
||||
# Can be changed via -DTOOLCHAIN=gcc|iar or -DCMAKE_C_COMPILER=
|
||||
@ -27,7 +34,6 @@ if (DEFINED CMAKE_C_COMPILER)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
# default to gcc
|
||||
if (NOT DEFINED TOOLCHAIN)
|
||||
set(TOOLCHAIN gcc)
|
||||
endif ()
|
||||
@ -53,6 +59,7 @@ if (NOT DEFINED FAMILY)
|
||||
# replace / with ; so that we can get the first element as FAMILY
|
||||
string(REPLACE "/" ";" BOARD_PATH ${BOARD_PATH})
|
||||
list(GET BOARD_PATH 0 FAMILY)
|
||||
set(FAMILY ${FAMILY} CACHE STRING "Board family")
|
||||
endif ()
|
||||
|
||||
if (NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/${FAMILY}/family.cmake)
|
||||
@ -73,33 +80,14 @@ if (NOT NO_WARN_RWX_SEGMENTS_SUPPORTED)
|
||||
set(NO_WARN_RWX_SEGMENTS_SUPPORTED 1)
|
||||
endif()
|
||||
|
||||
set(WARNING_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
|
||||
-Wreturn-type
|
||||
-Wredundant-decls
|
||||
)
|
||||
|
||||
set(WARNING_FLAGS_IAR "")
|
||||
#----------------------------------
|
||||
# Zephyr
|
||||
#----------------------------------
|
||||
if (RTOS STREQUAL zephyr)
|
||||
set(BOARD_ROOT ${TOP}/hw/bsp/${FAMILY})
|
||||
set(ZEPHYR_BOARD_ALIASES ${CMAKE_CURRENT_LIST_DIR}/zephyr_board_aliases.cmake)
|
||||
find_package(Zephyr REQUIRED HINTS ${TOP}/zephyr)
|
||||
endif ()
|
||||
|
||||
#-------------------------------------------------------------
|
||||
# Functions
|
||||
@ -177,7 +165,6 @@ endfunction()
|
||||
# Add RTOS to example
|
||||
function(family_add_rtos TARGET RTOS)
|
||||
if (RTOS STREQUAL "freertos")
|
||||
# freertos config
|
||||
if (NOT TARGET freertos_config)
|
||||
add_library(freertos_config INTERFACE)
|
||||
target_include_directories(freertos_config INTERFACE ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/${FAMILY}/FreeRTOSConfig)
|
||||
@ -185,12 +172,15 @@ function(family_add_rtos TARGET RTOS)
|
||||
target_link_libraries(freertos_config INTERFACE board_${BOARD})
|
||||
endif()
|
||||
|
||||
# freertos kernel
|
||||
if (NOT TARGET freertos_kernel)
|
||||
add_subdirectory(${TOP}/lib/FreeRTOS-Kernel ${CMAKE_BINARY_DIR}/lib/freertos_kernel)
|
||||
endif ()
|
||||
|
||||
target_link_libraries(${TARGET} PUBLIC freertos_kernel)
|
||||
target_compile_definitions(${TARGET} PUBLIC CFG_TUSB_OS=OPT_OS_FREERTOS)
|
||||
elseif (RTOS STREQUAL "zephyr")
|
||||
target_compile_definitions(${TARGET} PUBLIC CFG_TUSB_OS=OPT_OS_ZEPHYR)
|
||||
target_include_directories(${TARGET} PUBLIC ${ZEPHYR_BASE}/include)
|
||||
endif ()
|
||||
endfunction()
|
||||
|
||||
@ -198,6 +188,7 @@ endfunction()
|
||||
function(family_configure_common TARGET RTOS)
|
||||
family_add_rtos(${TARGET} ${RTOS})
|
||||
|
||||
# Add BOARD_${BOARD} define
|
||||
string(TOUPPER ${BOARD} BOARD_UPPER)
|
||||
string(REPLACE "-" "_" BOARD_UPPER ${BOARD_UPPER})
|
||||
target_compile_definitions(${TARGET} PUBLIC
|
||||
@ -210,20 +201,6 @@ function(family_configure_common TARGET RTOS)
|
||||
target_compile_options(${TARGET} PUBLIC ${CFLAGS_CLI})
|
||||
endif()
|
||||
|
||||
target_compile_options(${TARGET} PUBLIC ${WARNING_FLAGS_${CMAKE_C_COMPILER_ID}})
|
||||
|
||||
# Generate linker map file
|
||||
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
||||
target_link_options(${TARGET} PUBLIC "LINKER:-Map=$<TARGET_FILE:${TARGET}>.map")
|
||||
if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 12.0 AND NO_WARN_RWX_SEGMENTS_SUPPORTED)
|
||||
target_link_options(${TARGET} PUBLIC "LINKER:--no-warn-rwx-segments")
|
||||
endif ()
|
||||
elseif (CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
target_link_options(${TARGET} PUBLIC "LINKER:-Map=$<TARGET_FILE:${TARGET}>.map")
|
||||
elseif (CMAKE_C_COMPILER_ID STREQUAL "IAR")
|
||||
target_link_options(${TARGET} PUBLIC "LINKER:--map=$<TARGET_FILE:${TARGET}>.map")
|
||||
endif()
|
||||
|
||||
# ETM Trace option
|
||||
if (TRACE_ETM STREQUAL "1")
|
||||
target_compile_definitions(${TARGET} PUBLIC TRACE_ETM)
|
||||
@ -234,68 +211,84 @@ function(family_configure_common TARGET RTOS)
|
||||
target_compile_definitions(${TARGET} PUBLIC LOGGER_${LOGGER})
|
||||
# Add segger rtt to example
|
||||
if(LOGGER STREQUAL "RTT" OR LOGGER STREQUAL "rtt")
|
||||
if (NOT TARGET segger_rtt)
|
||||
add_library(segger_rtt STATIC ${TOP}/lib/SEGGER_RTT/RTT/SEGGER_RTT.c)
|
||||
target_include_directories(segger_rtt PUBLIC ${TOP}/lib/SEGGER_RTT/RTT)
|
||||
# target_compile_definitions(segger_rtt PUBLIC SEGGER_RTT_MODE_DEFAULT=SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL)
|
||||
endif()
|
||||
target_link_libraries(${TARGET} PUBLIC segger_rtt)
|
||||
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)
|
||||
endif ()
|
||||
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_link_options(${TARGET} PUBLIC "LINKER:-Map=$<TARGET_FILE:${TARGET}>.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))
|
||||
target_link_options(${TARGET} PUBLIC "LINKER:--no-warn-rwx-segments")
|
||||
endif ()
|
||||
elseif (CMAKE_C_COMPILER_ID STREQUAL "IAR")
|
||||
target_link_options(${TARGET} PUBLIC "LINKER:--map=$<TARGET_FILE:${TARGET}>.map")
|
||||
endif ()
|
||||
|
||||
# run size after build
|
||||
find_program(SIZE_EXE ${CMAKE_SIZE})
|
||||
if(NOT ${SIZE_EXE} STREQUAL SIZE_EXE-NOTFOUND)
|
||||
add_custom_command(TARGET ${TARGET} POST_BUILD
|
||||
COMMAND ${SIZE_EXE} $<TARGET_FILE:${TARGET}>
|
||||
)
|
||||
endif ()
|
||||
# find_program(SIZE_EXE ${CMAKE_SIZE})
|
||||
# if(NOT ${SIZE_EXE} STREQUAL SIZE_EXE-NOTFOUND)
|
||||
# add_custom_command(TARGET ${TARGET} POST_BUILD
|
||||
# COMMAND ${SIZE_EXE} $<TARGET_FILE:${TARGET}>
|
||||
# )
|
||||
# endif ()
|
||||
endfunction()
|
||||
|
||||
# Add tinyusb to example
|
||||
function(family_add_tinyusb TARGET OPT_MCU RTOS)
|
||||
# tinyusb target is built for each example since it depends on example's tusb_config.h
|
||||
set(TINYUSB_TARGET_PREFIX ${TARGET}-)
|
||||
add_library(${TARGET}-tinyusb_config INTERFACE)
|
||||
|
||||
# path to tusb_config.h
|
||||
target_include_directories(${TARGET}-tinyusb_config INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
||||
target_compile_definitions(${TARGET}-tinyusb_config INTERFACE CFG_TUSB_MCU=${OPT_MCU})
|
||||
|
||||
if (DEFINED LOG)
|
||||
target_compile_definitions(${TARGET}-tinyusb_config INTERFACE CFG_TUSB_DEBUG=${LOG})
|
||||
if (LOG STREQUAL "4")
|
||||
# no inline for debug level 4
|
||||
target_compile_definitions(${TARGET}-tinyusb_config INTERFACE TU_ATTR_ALWAYS_INLINE=)
|
||||
endif ()
|
||||
endif()
|
||||
|
||||
if (RTOS STREQUAL "freertos")
|
||||
target_compile_definitions(${TARGET}-tinyusb_config INTERFACE CFG_TUSB_OS=OPT_OS_FREERTOS)
|
||||
endif ()
|
||||
|
||||
# Add tinyusb to target
|
||||
function(family_add_tinyusb TARGET OPT_MCU)
|
||||
# tinyusb's CMakeList.txt
|
||||
add_subdirectory(${TOP}/src ${CMAKE_CURRENT_BINARY_DIR}/tinyusb)
|
||||
|
||||
if (RTOS STREQUAL "freertos")
|
||||
# link tinyusb with freeRTOS kernel
|
||||
target_link_libraries(${TARGET}-tinyusb PUBLIC freertos_kernel)
|
||||
endif ()
|
||||
# Add TinyUSB sources, include and common define
|
||||
tinyusb_target_add(${TARGET})
|
||||
|
||||
# path to tusb_config.h
|
||||
target_include_directories(${TARGET} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
||||
|
||||
target_compile_definitions(${TARGET} PUBLIC CFG_TUSB_MCU=${OPT_MCU})
|
||||
if (DEFINED LOG)
|
||||
target_compile_definitions(${TARGET} PUBLIC CFG_TUSB_DEBUG=${LOG})
|
||||
if (LOG STREQUAL "4") # no inline for debug level 4
|
||||
target_compile_definitions(${TARGET} PUBLIC TU_ATTR_ALWAYS_INLINE=)
|
||||
endif ()
|
||||
endif()
|
||||
|
||||
# use max3421 as host controller
|
||||
if (MAX3421_HOST STREQUAL "1")
|
||||
target_compile_definitions(${TARGET}-tinyusb_config INTERFACE CFG_TUH_MAX3421=1)
|
||||
target_sources(${TARGET}-tinyusb PUBLIC
|
||||
target_compile_definitions(${TARGET} PUBLIC CFG_TUH_MAX3421=1)
|
||||
target_sources(${TARGET} PUBLIC
|
||||
${TOP}/src/portable/analog/max3421/hcd_max3421.c
|
||||
)
|
||||
endif ()
|
||||
|
||||
# compile define from command line
|
||||
if(DEFINED CFLAGS_CLI)
|
||||
separate_arguments(CFLAGS_CLI)
|
||||
target_compile_options(${TARGET}-tinyusb PUBLIC ${CFLAGS_CLI})
|
||||
endif()
|
||||
|
||||
endfunction()
|
||||
|
||||
# Add bin/hex output
|
||||
@ -321,10 +314,10 @@ function(family_add_uf2 TARGET FAMILY_ID)
|
||||
VERBATIM)
|
||||
endfunction()
|
||||
|
||||
#----------------------------------
|
||||
#-------------------------------------------------------
|
||||
# Example Target Configure (Default rule)
|
||||
# These function can be redefined in FAMILY/family.cmake
|
||||
#----------------------------------
|
||||
#--------------------------------------------------------
|
||||
|
||||
function(family_configure_example TARGET RTOS)
|
||||
# empty function, should be redefined in FAMILY/family.cmake
|
||||
@ -418,26 +411,28 @@ function(family_flash_jlink TARGET)
|
||||
endif ()
|
||||
separate_arguments(OPTION_LIST UNIX_COMMAND ${JLINK_OPTION})
|
||||
|
||||
if (RTOS STREQUAL zephyr)
|
||||
set(BINARY_TARGET zephyr_final)
|
||||
set(NAME_TARGET ${CMAKE_PROJECT_NAME})
|
||||
else ()
|
||||
set(BINARY_TARGET ${TARGET})
|
||||
set(NAME_TARGET ${TARGET})
|
||||
endif ()
|
||||
|
||||
file(GENERATE
|
||||
OUTPUT $<TARGET_FILE_DIR:${TARGET}>/${TARGET}.jlink
|
||||
OUTPUT $<TARGET_FILE_DIR:${BINARY_TARGET}>/${BINARY_TARGET}.jlink
|
||||
CONTENT "halt
|
||||
loadfile $<TARGET_FILE:${TARGET}>
|
||||
loadfile $<TARGET_FILE:${BINARY_TARGET}>
|
||||
r
|
||||
go
|
||||
exit"
|
||||
)
|
||||
|
||||
add_custom_target(${TARGET}-jlink
|
||||
DEPENDS ${TARGET}
|
||||
COMMAND ${JLINKEXE} -device ${JLINK_DEVICE} ${OPTION_LIST} -if ${JLINK_IF} -JTAGConf -1,-1 -speed auto -CommandFile $<TARGET_FILE_DIR:${TARGET}>/${TARGET}.jlink
|
||||
add_custom_target(${NAME_TARGET}-jlink
|
||||
DEPENDS ${BINARY_TARGET}
|
||||
COMMAND ${JLINKEXE} -device ${JLINK_DEVICE} ${OPTION_LIST} -if ${JLINK_IF} -JTAGConf -1,-1 -speed auto -CommandFile $<TARGET_FILE_DIR:${BINARY_TARGET}>/${BINARY_TARGET}.jlink
|
||||
VERBATIM
|
||||
)
|
||||
|
||||
# optional flash post build
|
||||
# add_custom_command(TARGET ${TARGET} POST_BUILD
|
||||
# COMMAND ${JLINKEXE} -device ${JLINK_DEVICE} ${OPTION_LIST} -if ${JLINK_IF} -JTAGConf -1,-1 -speed auto -CommandFile $<TARGET_FILE_DIR:${TARGET}>/${TARGET}.jlink
|
||||
# VERBATIM
|
||||
# )
|
||||
endfunction()
|
||||
|
||||
|
||||
@ -613,7 +608,6 @@ function(family_flash_msp430flasher TARGET)
|
||||
)
|
||||
endfunction()
|
||||
|
||||
|
||||
function(family_flash_uniflash TARGET)
|
||||
if (NOT DEFINED DSLITE)
|
||||
set(DSLITE dslite.sh)
|
||||
|
@ -4,7 +4,7 @@ include_guard()
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/boards/${BOARD}/board.cmake)
|
||||
|
||||
# toolchain set up
|
||||
set(CMAKE_SYSTEM_PROCESSOR rv32i-ilp32 CACHE INTERNAL "System Processor")
|
||||
set(CMAKE_SYSTEM_CPU rv32i-ilp32 CACHE INTERNAL "System Processor")
|
||||
set(CMAKE_TOOLCHAIN_FILE ${TOP}/examples/build_system/cmake/toolchain/riscv_${TOOLCHAIN}.cmake)
|
||||
|
||||
set(FAMILY_MCUS VALENTYUSB_EPTRI CACHE INTERNAL "")
|
||||
@ -77,14 +77,13 @@ function(family_configure_example TARGET RTOS)
|
||||
)
|
||||
|
||||
# Add TinyUSB target and port source
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_VALENTYUSB_EPTRI ${RTOS})
|
||||
target_sources(${TARGET}-tinyusb PUBLIC
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_VALENTYUSB_EPTRI)
|
||||
target_sources(${TARGET} PUBLIC
|
||||
${TOP}/src/portable/valentyusb/eptri/dcd_eptri.c
|
||||
)
|
||||
target_link_libraries(${TARGET}-tinyusb PUBLIC board_${BOARD})
|
||||
target_link_libraries(${TARGET} PUBLIC board_${BOARD})
|
||||
|
||||
|
||||
# Link dependencies
|
||||
target_link_libraries(${TARGET} PUBLIC board_${BOARD} ${TARGET}-tinyusb)
|
||||
|
||||
# Flashing
|
||||
family_add_bin_hex(${TARGET})
|
||||
|
@ -7,7 +7,7 @@ set(SOC_DIR ${SDK_DIR}/SoC/gd32vf103)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/boards/${BOARD}/board.cmake)
|
||||
|
||||
# toolchain set up
|
||||
set(CMAKE_SYSTEM_PROCESSOR rv32imac-ilp32 CACHE INTERNAL "System Processor")
|
||||
set(CMAKE_SYSTEM_CPU rv32imac-ilp32 CACHE INTERNAL "System Processor")
|
||||
set(CMAKE_TOOLCHAIN_FILE ${TOP}/examples/build_system/cmake/toolchain/riscv_${TOOLCHAIN}.cmake)
|
||||
|
||||
set(FAMILY_MCUS GD32VF103 CACHE INTERNAL "")
|
||||
@ -105,16 +105,15 @@ function(family_configure_example TARGET RTOS)
|
||||
)
|
||||
|
||||
# Add TinyUSB target and port source
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_GD32VF103 ${RTOS})
|
||||
target_sources(${TARGET}-tinyusb PUBLIC
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_GD32VF103)
|
||||
target_sources(${TARGET} PUBLIC
|
||||
${TOP}/src/portable/synopsys/dwc2/dcd_dwc2.c
|
||||
${TOP}/src/portable/synopsys/dwc2/hcd_dwc2.c
|
||||
${TOP}/src/portable/synopsys/dwc2/dwc2_common.c
|
||||
)
|
||||
target_link_libraries(${TARGET}-tinyusb PUBLIC board_${BOARD})
|
||||
target_link_libraries(${TARGET} PUBLIC board_${BOARD})
|
||||
|
||||
|
||||
# Link dependencies
|
||||
target_link_libraries(${TARGET} PUBLIC board_${BOARD} ${TARGET}-tinyusb)
|
||||
|
||||
# Flashing
|
||||
family_add_bin_hex(${TARGET})
|
||||
|
@ -4,7 +4,7 @@ if (M4 STREQUAL "1")
|
||||
set(MCU_CORE _cm4)
|
||||
set(JLINK_CORE _M4)
|
||||
set(LD_FILE_GNU ${SDK_DIR}/devices/${MCU_VARIANT}/gcc/${MCU_VARIANT}xxxxx${MCU_CORE}_ram.ld)
|
||||
set(CMAKE_SYSTEM_PROCESSOR cortex-m4 CACHE INTERNAL "System Processor")
|
||||
set(CMAKE_SYSTEM_CPU cortex-m4 CACHE INTERNAL "System Processor")
|
||||
else ()
|
||||
set(MCU_CORE _cm7)
|
||||
set(JLINK_CORE _M7)
|
||||
|
@ -8,8 +8,8 @@ include(${CMAKE_CURRENT_LIST_DIR}/boards/${BOARD}/board.cmake)
|
||||
set(MCU_VARIANT_WITH_CORE ${MCU_VARIANT}${MCU_CORE})
|
||||
|
||||
# toolchain set up
|
||||
if (NOT DEFINED CMAKE_SYSTEM_PROCESSOR)
|
||||
set(CMAKE_SYSTEM_PROCESSOR cortex-m7 CACHE INTERNAL "System Processor")
|
||||
if (NOT DEFINED CMAKE_SYSTEM_CPU)
|
||||
set(CMAKE_SYSTEM_CPU cortex-m7 CACHE INTERNAL "System Processor")
|
||||
endif ()
|
||||
set(CMAKE_TOOLCHAIN_FILE ${TOP}/examples/build_system/cmake/toolchain/arm_${TOOLCHAIN}.cmake)
|
||||
|
||||
@ -138,16 +138,15 @@ function(family_configure_example TARGET RTOS)
|
||||
)
|
||||
|
||||
# Add TinyUSB target and port source
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_MIMXRT1XXX ${RTOS})
|
||||
target_sources(${TARGET}-tinyusb PRIVATE
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_MIMXRT1XXX)
|
||||
target_sources(${TARGET} PRIVATE
|
||||
${TOP}/src/portable/chipidea/ci_hs/dcd_ci_hs.c
|
||||
${TOP}/src/portable/chipidea/ci_hs/hcd_ci_hs.c
|
||||
${TOP}/src/portable/ehci/ehci.c
|
||||
)
|
||||
target_link_libraries(${TARGET}-tinyusb PUBLIC board_${BOARD})
|
||||
target_link_libraries(${TARGET} PUBLIC board_${BOARD})
|
||||
|
||||
|
||||
# Link dependencies
|
||||
target_link_libraries(${TARGET} PUBLIC board_${BOARD} ${TARGET}-tinyusb)
|
||||
|
||||
# Flashing
|
||||
family_add_bin_hex(${TARGET})
|
||||
|
@ -11,7 +11,7 @@ set(CMSIS_DIR ${TOP}/lib/CMSIS_5)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/boards/${BOARD}/board.cmake)
|
||||
|
||||
# toolchain set up
|
||||
set(CMAKE_SYSTEM_PROCESSOR cortex-m4 CACHE INTERNAL "System Processor")
|
||||
set(CMAKE_SYSTEM_CPU cortex-m4 CACHE INTERNAL "System Processor")
|
||||
set(CMAKE_TOOLCHAIN_FILE ${TOP}/examples/build_system/cmake/toolchain/arm_${TOOLCHAIN}.cmake)
|
||||
|
||||
set(FAMILY_MCUS KINETIS_K CACHE INTERNAL "")
|
||||
@ -97,15 +97,14 @@ function(family_configure_example TARGET RTOS)
|
||||
)
|
||||
|
||||
# Add TinyUSB target and port source
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_KINETIS_K ${RTOS})
|
||||
target_sources(${TARGET}-tinyusb PUBLIC
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_KINETIS_K)
|
||||
target_sources(${TARGET} PUBLIC
|
||||
${TOP}/src/portable/chipidea/ci_fs/dcd_ci_fs.c
|
||||
${TOP}/src/portable/nxp/khci/hcd_khci.c
|
||||
)
|
||||
target_link_libraries(${TARGET}-tinyusb PUBLIC board_${BOARD})
|
||||
target_link_libraries(${TARGET} PUBLIC board_${BOARD})
|
||||
|
||||
|
||||
# Link dependencies
|
||||
target_link_libraries(${TARGET} PUBLIC board_${BOARD} ${TARGET}-tinyusb)
|
||||
|
||||
# Flashing
|
||||
family_add_bin_hex(${TARGET})
|
||||
|
@ -7,7 +7,7 @@ set(CMSIS_DIR ${TOP}/lib/CMSIS_5)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/boards/${BOARD}/board.cmake)
|
||||
|
||||
# toolchain set up
|
||||
set(CMAKE_SYSTEM_PROCESSOR cortex-m0plus CACHE INTERNAL "System Processor")
|
||||
set(CMAKE_SYSTEM_CPU cortex-m0plus CACHE INTERNAL "System Processor")
|
||||
set(CMAKE_TOOLCHAIN_FILE ${TOP}/examples/build_system/cmake/toolchain/arm_${TOOLCHAIN}.cmake)
|
||||
|
||||
set(FAMILY_MCUS KINETIS_K32L CACHE INTERNAL "")
|
||||
@ -92,15 +92,14 @@ function(family_configure_example TARGET RTOS)
|
||||
)
|
||||
|
||||
# Add TinyUSB target and port source
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_KINETIS_K32L ${RTOS})
|
||||
target_sources(${TARGET}-tinyusb PUBLIC
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_KINETIS_K32L)
|
||||
target_sources(${TARGET} PUBLIC
|
||||
${TOP}/src/portable/nxp/khci/dcd_khci.c
|
||||
${TOP}/src/portable/nxp/khci/hcd_khci.c
|
||||
)
|
||||
target_link_libraries(${TARGET}-tinyusb PUBLIC board_${BOARD})
|
||||
target_link_libraries(${TARGET} PUBLIC board_${BOARD})
|
||||
|
||||
|
||||
# Link dependencies
|
||||
target_link_libraries(${TARGET} PUBLIC board_${BOARD} ${TARGET}-tinyusb)
|
||||
|
||||
# Flashing
|
||||
family_flash_jlink(${TARGET})
|
||||
|
@ -11,7 +11,7 @@ set(CMSIS_DIR ${TOP}/lib/CMSIS_5)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/boards/${BOARD}/board.cmake)
|
||||
|
||||
# toolchain set up
|
||||
set(CMAKE_SYSTEM_PROCESSOR cortex-m0plus CACHE INTERNAL "System Processor")
|
||||
set(CMAKE_SYSTEM_CPU cortex-m0plus CACHE INTERNAL "System Processor")
|
||||
set(CMAKE_TOOLCHAIN_FILE ${TOP}/examples/build_system/cmake/toolchain/arm_${TOOLCHAIN}.cmake)
|
||||
|
||||
set(FAMILY_MCUS KINETIS_KL CACHE INTERNAL "")
|
||||
@ -96,15 +96,14 @@ function(family_configure_example TARGET RTOS)
|
||||
)
|
||||
|
||||
# Add TinyUSB target and port source
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_KINETIS_KL ${RTOS})
|
||||
target_sources(${TARGET}-tinyusb PUBLIC
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_KINETIS_KL)
|
||||
target_sources(${TARGET} PUBLIC
|
||||
${TOP}/src/portable/chipidea/ci_fs/dcd_ci_fs.c
|
||||
${TOP}/src/portable/nxp/khci/hcd_khci.c
|
||||
)
|
||||
target_link_libraries(${TARGET}-tinyusb PUBLIC board_${BOARD})
|
||||
target_link_libraries(${TARGET} PUBLIC board_${BOARD})
|
||||
|
||||
|
||||
# Link dependencies
|
||||
target_link_libraries(${TARGET} PUBLIC board_${BOARD} ${TARGET}-tinyusb)
|
||||
|
||||
# Flashing
|
||||
family_add_bin_hex(${TARGET})
|
||||
|
@ -42,6 +42,10 @@
|
||||
#include "bsp/board_api.h"
|
||||
#include "board.h"
|
||||
|
||||
extern void USB_IRQHandler(void);
|
||||
extern void SysTick_Handler(void);
|
||||
void SystemInit(void);
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// Forward USB interrupt events to TinyUSB IRQ Handler
|
||||
//--------------------------------------------------------------------+
|
||||
|
@ -11,7 +11,7 @@ else()
|
||||
endif()
|
||||
|
||||
# toolchain set up
|
||||
set(CMAKE_SYSTEM_PROCESSOR cortex-m0plus CACHE INTERNAL "System Processor")
|
||||
set(CMAKE_SYSTEM_CPU cortex-m0plus CACHE INTERNAL "System Processor")
|
||||
set(CMAKE_TOOLCHAIN_FILE ${TOP}/examples/build_system/cmake/toolchain/arm_${TOOLCHAIN}.cmake)
|
||||
|
||||
set(FAMILY_MCUS LPC11UXX CACHE INTERNAL "")
|
||||
@ -49,7 +49,10 @@ function(add_board_target BOARD_TARGET)
|
||||
update_board(${BOARD_TARGET})
|
||||
|
||||
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
||||
target_compile_options(${BOARD_TARGET} PUBLIC -nostdlib)
|
||||
target_compile_options(${BOARD_TARGET} PUBLIC
|
||||
-nostdlib
|
||||
-Wno-error=incompatible-pointer-types
|
||||
)
|
||||
target_link_options(${BOARD_TARGET} PUBLIC
|
||||
"LINKER:--script=${LD_FILE_GNU}"
|
||||
--specs=nosys.specs --specs=nano.specs
|
||||
@ -90,14 +93,13 @@ function(family_configure_example TARGET RTOS)
|
||||
)
|
||||
|
||||
# Add TinyUSB target and port source
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_LPC11UXX ${RTOS})
|
||||
target_sources(${TARGET}-tinyusb PUBLIC
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_LPC11UXX)
|
||||
target_sources(${TARGET} PUBLIC
|
||||
${TOP}/src/portable/nxp/lpc_ip3511/dcd_lpc_ip3511.c
|
||||
)
|
||||
target_link_libraries(${TARGET}-tinyusb PUBLIC board_${BOARD})
|
||||
target_link_libraries(${TARGET} PUBLIC board_${BOARD})
|
||||
|
||||
|
||||
# Link dependencies
|
||||
target_link_libraries(${TARGET} PUBLIC board_${BOARD} ${TARGET}-tinyusb)
|
||||
|
||||
# Flashing
|
||||
family_add_bin_hex(${TARGET})
|
||||
|
@ -8,7 +8,7 @@ set(CMSIS_DIR ${TOP}/lib/CMSIS_5)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/boards/${BOARD}/board.cmake)
|
||||
|
||||
# toolchain set up
|
||||
set(CMAKE_SYSTEM_PROCESSOR cortex-m3 CACHE INTERNAL "System Processor")
|
||||
set(CMAKE_SYSTEM_CPU cortex-m3 CACHE INTERNAL "System Processor")
|
||||
set(CMAKE_TOOLCHAIN_FILE ${TOP}/examples/build_system/cmake/toolchain/arm_${TOOLCHAIN}.cmake)
|
||||
|
||||
set(FAMILY_MCUS LPC13XX CACHE INTERNAL "")
|
||||
@ -87,14 +87,13 @@ function(family_configure_example TARGET RTOS)
|
||||
)
|
||||
|
||||
# Add TinyUSB target and port source
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_LPC13XX ${RTOS})
|
||||
target_sources(${TARGET}-tinyusb PUBLIC
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_LPC13XX)
|
||||
target_sources(${TARGET} PUBLIC
|
||||
${TOP}/src/portable/nxp/lpc_ip3511/dcd_lpc_ip3511.c
|
||||
)
|
||||
target_link_libraries(${TARGET}-tinyusb PUBLIC board_${BOARD})
|
||||
target_link_libraries(${TARGET} PUBLIC board_${BOARD})
|
||||
|
||||
|
||||
# Link dependencies
|
||||
target_link_libraries(${TARGET} PUBLIC board_${BOARD} ${TARGET}-tinyusb)
|
||||
|
||||
# Flashing
|
||||
family_add_bin_hex(${TARGET})
|
||||
|
@ -8,7 +8,7 @@ set(CMSIS_DIR ${TOP}/lib/CMSIS_5)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/boards/${BOARD}/board.cmake)
|
||||
|
||||
# toolchain set up
|
||||
set(CMAKE_SYSTEM_PROCESSOR cortex-m3 CACHE INTERNAL "System Processor")
|
||||
set(CMAKE_SYSTEM_CPU cortex-m3 CACHE INTERNAL "System Processor")
|
||||
set(CMAKE_TOOLCHAIN_FILE ${TOP}/examples/build_system/cmake/toolchain/arm_${TOOLCHAIN}.cmake)
|
||||
|
||||
set(FAMILY_MCUS LPC15XX CACHE INTERNAL "")
|
||||
@ -89,14 +89,13 @@ function(family_configure_example TARGET RTOS)
|
||||
)
|
||||
|
||||
# Add TinyUSB target and port source
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_LPC15XX ${RTOS})
|
||||
target_sources(${TARGET}-tinyusb PUBLIC
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_LPC15XX)
|
||||
target_sources(${TARGET} PUBLIC
|
||||
${TOP}/src/portable/nxp/lpc_ip3511/dcd_lpc_ip3511.c
|
||||
)
|
||||
target_link_libraries(${TARGET}-tinyusb PUBLIC board_${BOARD})
|
||||
target_link_libraries(${TARGET} PUBLIC board_${BOARD})
|
||||
|
||||
|
||||
# Link dependencies
|
||||
target_link_libraries(${TARGET} PUBLIC board_${BOARD} ${TARGET}-tinyusb)
|
||||
|
||||
# Flashing
|
||||
family_add_bin_hex(${TARGET})
|
||||
|
@ -7,7 +7,7 @@ set(CMSIS_DIR ${TOP}/lib/CMSIS_5)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/boards/${BOARD}/board.cmake)
|
||||
|
||||
# toolchain set up
|
||||
set(CMAKE_SYSTEM_PROCESSOR cortex-m3 CACHE INTERNAL "System Processor")
|
||||
set(CMAKE_SYSTEM_CPU cortex-m3 CACHE INTERNAL "System Processor")
|
||||
set(CMAKE_TOOLCHAIN_FILE ${TOP}/examples/build_system/cmake/toolchain/arm_${TOOLCHAIN}.cmake)
|
||||
|
||||
set(FAMILY_MCUS LPC175X_6X CACHE INTERNAL "")
|
||||
@ -86,16 +86,15 @@ function(family_configure_example TARGET RTOS)
|
||||
)
|
||||
|
||||
# Add TinyUSB target and port source
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_LPC175X_6X ${RTOS})
|
||||
target_sources(${TARGET}-tinyusb PUBLIC
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_LPC175X_6X)
|
||||
target_sources(${TARGET} PUBLIC
|
||||
${TOP}/src/portable/nxp/lpc17_40/dcd_lpc17_40.c
|
||||
${TOP}/src/portable/nxp/lpc17_40/hcd_lpc17_40.c
|
||||
${TOP}/src/portable/ohci/ohci.c
|
||||
)
|
||||
target_link_libraries(${TARGET}-tinyusb PUBLIC board_${BOARD})
|
||||
target_link_libraries(${TARGET} PUBLIC board_${BOARD})
|
||||
|
||||
|
||||
# Link dependencies
|
||||
target_link_libraries(${TARGET} PUBLIC board_${BOARD} ${TARGET}-tinyusb)
|
||||
|
||||
# Flashing
|
||||
family_add_bin_hex(${TARGET})
|
||||
|
@ -32,6 +32,11 @@
|
||||
#include "bsp/board_api.h"
|
||||
#include "board.h"
|
||||
|
||||
extern void USB0_IRQHandler(void);
|
||||
extern void USB1_IRQHandler(void);
|
||||
extern void SysTick_Handler(void);
|
||||
void SystemInit(void);
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// USB Interrupt Handler
|
||||
//--------------------------------------------------------------------+
|
||||
|
@ -7,7 +7,7 @@ set(CMSIS_5 ${TOP}/lib/CMSIS_5)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/boards/${BOARD}/board.cmake)
|
||||
|
||||
# toolchain set up
|
||||
set(CMAKE_SYSTEM_PROCESSOR cortex-m3 CACHE INTERNAL "System Processor")
|
||||
set(CMAKE_SYSTEM_CPU cortex-m3 CACHE INTERNAL "System Processor")
|
||||
set(CMAKE_TOOLCHAIN_FILE ${TOP}/examples/build_system/cmake/toolchain/arm_${TOOLCHAIN}.cmake)
|
||||
|
||||
set(FAMILY_MCUS LPC18XX CACHE INTERNAL "")
|
||||
@ -84,16 +84,15 @@ function(family_configure_example TARGET RTOS)
|
||||
)
|
||||
|
||||
# Add TinyUSB target and port source
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_LPC18XX ${RTOS})
|
||||
target_sources(${TARGET}-tinyusb PUBLIC
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_LPC18XX)
|
||||
target_sources(${TARGET} PUBLIC
|
||||
${TOP}/src/portable/chipidea/ci_hs/dcd_ci_hs.c
|
||||
${TOP}/src/portable/chipidea/ci_hs/hcd_ci_hs.c
|
||||
${TOP}/src/portable/ehci/ehci.c
|
||||
)
|
||||
target_link_libraries(${TARGET}-tinyusb PUBLIC board_${BOARD})
|
||||
target_link_libraries(${TARGET} PUBLIC board_${BOARD})
|
||||
|
||||
|
||||
# Link dependencies
|
||||
target_link_libraries(${TARGET} PUBLIC board_${BOARD} ${TARGET}-tinyusb)
|
||||
|
||||
# Flashing
|
||||
family_add_bin_hex(${TARGET})
|
||||
|
@ -12,7 +12,7 @@ CFLAGS += \
|
||||
-DCFG_TUSB_MCU=OPT_MCU_LPC18XX
|
||||
|
||||
# mcu driver cause following warnings
|
||||
CFLAGS += -Wno-error=unused-parameter -Wno-error=strict-prototypes -Wno-error=cast-qual
|
||||
CFLAGS += -Wno-error=unused-parameter -Wno-error=cast-qual
|
||||
|
||||
LDFLAGS_GCC += --specs=nosys.specs --specs=nano.specs
|
||||
|
||||
|
@ -7,7 +7,7 @@ set(CMSIS_DIR ${TOP}/lib/CMSIS_5)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/boards/${BOARD}/board.cmake)
|
||||
|
||||
# toolchain set up
|
||||
set(CMAKE_SYSTEM_PROCESSOR cortex-m4 CACHE INTERNAL "System Processor")
|
||||
set(CMAKE_SYSTEM_CPU cortex-m4 CACHE INTERNAL "System Processor")
|
||||
set(CMAKE_TOOLCHAIN_FILE ${TOP}/examples/build_system/cmake/toolchain/arm_${TOOLCHAIN}.cmake)
|
||||
|
||||
set(FAMILY_MCUS LPC40XX CACHE INTERNAL "")
|
||||
@ -87,16 +87,15 @@ function(family_configure_example TARGET RTOS)
|
||||
)
|
||||
|
||||
# Add TinyUSB target and port source
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_LPC40XX ${RTOS})
|
||||
target_sources(${TARGET}-tinyusb PUBLIC
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_LPC40XX)
|
||||
target_sources(${TARGET} PUBLIC
|
||||
${TOP}/src/portable/nxp/lpc17_40/dcd_lpc17_40.c
|
||||
${TOP}/src/portable/nxp/lpc17_40/hcd_lpc17_40.c
|
||||
${TOP}/src/portable/ohci/ohci.c
|
||||
)
|
||||
target_link_libraries(${TARGET}-tinyusb PUBLIC board_${BOARD})
|
||||
target_link_libraries(${TARGET} PUBLIC board_${BOARD})
|
||||
|
||||
|
||||
# Link dependencies
|
||||
target_link_libraries(${TARGET} PUBLIC board_${BOARD} ${TARGET}-tinyusb)
|
||||
|
||||
# Flashing
|
||||
family_add_bin_hex(${TARGET})
|
||||
|
@ -47,6 +47,11 @@
|
||||
const uint32_t OscRateIn = 12000000;
|
||||
const uint32_t ExtRateIn = 0;
|
||||
|
||||
extern void USB0_IRQHandler(void);
|
||||
extern void USB1_IRQHandler(void);
|
||||
extern void SysTick_Handler(void);
|
||||
void SystemInit(void);
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
/* BOARD API
|
||||
*------------------------------------------------------------------*/
|
||||
|
@ -7,7 +7,7 @@ set(CMSIS_5 ${TOP}/lib/CMSIS_5)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/boards/${BOARD}/board.cmake)
|
||||
|
||||
# toolchain set up
|
||||
set(CMAKE_SYSTEM_PROCESSOR cortex-m4 CACHE INTERNAL "System Processor")
|
||||
set(CMAKE_SYSTEM_CPU cortex-m4 CACHE INTERNAL "System Processor")
|
||||
set(CMAKE_TOOLCHAIN_FILE ${TOP}/examples/build_system/cmake/toolchain/arm_${TOOLCHAIN}.cmake)
|
||||
|
||||
set(FAMILY_MCUS LPC43XX CACHE INTERNAL "")
|
||||
@ -51,7 +51,10 @@ function(add_board_target BOARD_TARGET)
|
||||
update_board(${BOARD_TARGET})
|
||||
|
||||
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
||||
target_compile_options(${BOARD_TARGET} PUBLIC -nostdlib)
|
||||
target_compile_options(${BOARD_TARGET} PUBLIC
|
||||
-nostdlib
|
||||
-Wno-error=incompatible-pointer-types
|
||||
)
|
||||
target_link_options(${BOARD_TARGET} PUBLIC
|
||||
"LINKER:--script=${LD_FILE_GNU}"
|
||||
--specs=nosys.specs --specs=nano.specs
|
||||
@ -92,16 +95,15 @@ function(family_configure_example TARGET RTOS)
|
||||
)
|
||||
|
||||
# Add TinyUSB target and port source
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_LPC43XX ${RTOS})
|
||||
target_sources(${TARGET}-tinyusb PUBLIC
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_LPC43XX)
|
||||
target_sources(${TARGET} PUBLIC
|
||||
${TOP}/src/portable/chipidea/ci_hs/dcd_ci_hs.c
|
||||
${TOP}/src/portable/chipidea/ci_hs/hcd_ci_hs.c
|
||||
${TOP}/src/portable/ehci/ehci.c
|
||||
)
|
||||
target_link_libraries(${TARGET}-tinyusb PUBLIC board_${BOARD})
|
||||
target_link_libraries(${TARGET} PUBLIC board_${BOARD})
|
||||
|
||||
|
||||
# Link dependencies
|
||||
target_link_libraries(${TARGET} PUBLIC board_${BOARD} ${TARGET}-tinyusb)
|
||||
|
||||
# Flashing
|
||||
family_add_bin_hex(${TARGET})
|
||||
|
@ -14,7 +14,6 @@ CFLAGS += \
|
||||
# mcu driver cause following warnings
|
||||
CFLAGS += \
|
||||
-Wno-error=unused-parameter \
|
||||
-Wno-error=strict-prototypes \
|
||||
-Wno-error=cast-qual \
|
||||
-Wno-error=incompatible-pointer-types \
|
||||
|
||||
|
@ -7,7 +7,7 @@ set(CMSIS_DIR ${TOP}/lib/CMSIS_5)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/boards/${BOARD}/board.cmake)
|
||||
|
||||
# toolchain set up
|
||||
set(CMAKE_SYSTEM_PROCESSOR cortex-m0plus CACHE INTERNAL "System Processor")
|
||||
set(CMAKE_SYSTEM_CPU cortex-m0plus CACHE INTERNAL "System Processor")
|
||||
set(CMAKE_TOOLCHAIN_FILE ${TOP}/examples/build_system/cmake/toolchain/arm_${TOOLCHAIN}.cmake)
|
||||
|
||||
set(FAMILY_MCUS LPC51 CACHE INTERNAL "")
|
||||
@ -106,14 +106,13 @@ function(family_configure_example TARGET RTOS)
|
||||
)
|
||||
|
||||
# Add TinyUSB target and port source
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_LPC51 ${RTOS})
|
||||
target_sources(${TARGET}-tinyusb PUBLIC
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_LPC51)
|
||||
target_sources(${TARGET} PUBLIC
|
||||
${TOP}/src/portable/nxp/lpc_ip3511/dcd_lpc_ip3511.c
|
||||
)
|
||||
target_link_libraries(${TARGET}-tinyusb PUBLIC board_${BOARD})
|
||||
target_link_libraries(${TARGET} PUBLIC board_${BOARD})
|
||||
|
||||
|
||||
# Link dependencies
|
||||
target_link_libraries(${TARGET} PUBLIC board_${BOARD} ${TARGET}-tinyusb)
|
||||
|
||||
# Flashing
|
||||
family_add_bin_hex(${TARGET})
|
||||
|
@ -7,7 +7,7 @@ set(CMSIS_DIR ${TOP}/lib/CMSIS_5)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/boards/${BOARD}/board.cmake)
|
||||
|
||||
# toolchain set up
|
||||
set(CMAKE_SYSTEM_PROCESSOR cortex-m4 CACHE INTERNAL "System Processor")
|
||||
set(CMAKE_SYSTEM_CPU cortex-m4 CACHE INTERNAL "System Processor")
|
||||
set(CMAKE_TOOLCHAIN_FILE ${TOP}/examples/build_system/cmake/toolchain/arm_${TOOLCHAIN}.cmake)
|
||||
|
||||
set(FAMILY_MCUS LPC54 CACHE INTERNAL "")
|
||||
@ -139,14 +139,13 @@ function(family_configure_example TARGET RTOS)
|
||||
)
|
||||
|
||||
# Add TinyUSB target and port source
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_LPC54 ${RTOS})
|
||||
target_sources(${TARGET}-tinyusb PUBLIC
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_LPC54)
|
||||
target_sources(${TARGET} PUBLIC
|
||||
${TOP}/src/portable/nxp/lpc_ip3511/dcd_lpc_ip3511.c
|
||||
)
|
||||
target_link_libraries(${TARGET}-tinyusb PUBLIC board_${BOARD})
|
||||
target_link_libraries(${TARGET} PUBLIC board_${BOARD})
|
||||
|
||||
|
||||
# Link dependencies
|
||||
target_link_libraries(${TARGET} PUBLIC board_${BOARD} ${TARGET}-tinyusb)
|
||||
|
||||
# Flashing
|
||||
family_add_bin_hex(${TARGET})
|
||||
|
@ -7,7 +7,7 @@ set(CMSIS_DIR ${TOP}/lib/CMSIS_5)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/boards/${BOARD}/board.cmake)
|
||||
|
||||
# toolchain set up
|
||||
set(CMAKE_SYSTEM_PROCESSOR cortex-m33 CACHE INTERNAL "System Processor")
|
||||
set(CMAKE_SYSTEM_CPU cortex-m33 CACHE INTERNAL "System Processor")
|
||||
set(CMAKE_TOOLCHAIN_FILE ${TOP}/examples/build_system/cmake/toolchain/arm_${TOOLCHAIN}.cmake)
|
||||
|
||||
set(FAMILY_MCUS LPC55 CACHE INTERNAL "")
|
||||
@ -140,14 +140,13 @@ function(family_configure_example TARGET RTOS)
|
||||
)
|
||||
|
||||
# Add TinyUSB target and port source
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_LPC55 ${RTOS})
|
||||
target_sources(${TARGET}-tinyusb PUBLIC
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_LPC55)
|
||||
target_sources(${TARGET} PUBLIC
|
||||
${TOP}/src/portable/nxp/lpc_ip3511/dcd_lpc_ip3511.c
|
||||
)
|
||||
target_link_libraries(${TARGET}-tinyusb PUBLIC board_${BOARD})
|
||||
target_link_libraries(${TARGET} PUBLIC board_${BOARD})
|
||||
|
||||
|
||||
# Link dependencies
|
||||
target_link_libraries(${TARGET} PUBLIC board_${BOARD} ${TARGET}-tinyusb)
|
||||
|
||||
# Flashing
|
||||
family_add_bin_hex(${TARGET})
|
||||
|
@ -11,7 +11,7 @@ include(${CMAKE_CURRENT_LIST_DIR}/boards/${BOARD}/board.cmake)
|
||||
set(LD_FILE_Clang ${LD_FILE_GNU})
|
||||
|
||||
# toolchain set up
|
||||
set(CMAKE_SYSTEM_PROCESSOR cortex-m4 CACHE INTERNAL "System Processor")
|
||||
set(CMAKE_SYSTEM_CPU cortex-m4 CACHE INTERNAL "System Processor")
|
||||
set(CMAKE_TOOLCHAIN_FILE ${TOP}/examples/build_system/cmake/toolchain/arm_${TOOLCHAIN}.cmake)
|
||||
set(JLINK_DEVICE max32650)
|
||||
set(OPENOCD_OPTION "-f interface/cmsis-dap.cfg -f target/max32650.cfg")
|
||||
@ -130,21 +130,20 @@ function(family_configure_example TARGET RTOS)
|
||||
)
|
||||
|
||||
# Add TinyUSB target and port source
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_MAX32650 ${RTOS})
|
||||
target_sources(${TARGET}-tinyusb PUBLIC
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_MAX32650)
|
||||
target_sources(${TARGET} PUBLIC
|
||||
${TOP}/src/portable/mentor/musb/dcd_musb.c
|
||||
)
|
||||
target_compile_options(${TARGET} PRIVATE
|
||||
-Wno-error=strict-prototypes
|
||||
)
|
||||
|
||||
target_link_libraries(${TARGET}-tinyusb PUBLIC board_${BOARD})
|
||||
target_compile_options(${TARGET}-tinyusb PRIVATE
|
||||
target_link_libraries(${TARGET} PUBLIC board_${BOARD})
|
||||
target_compile_options(${TARGET} PRIVATE
|
||||
-Wno-error=strict-prototypes
|
||||
)
|
||||
|
||||
# Link dependencies
|
||||
target_link_libraries(${TARGET} PUBLIC board_${BOARD} ${TARGET}-tinyusb)
|
||||
|
||||
|
||||
# Flashing
|
||||
family_add_bin_hex(${TARGET})
|
||||
|
@ -12,7 +12,7 @@ set(LD_FILE_GNU ${CMAKE_CURRENT_LIST_DIR}/max32666.ld)
|
||||
set(LD_FILE_Clang ${LD_FILE_GNU})
|
||||
|
||||
# toolchain set up
|
||||
set(CMAKE_SYSTEM_PROCESSOR cortex-m4 CACHE INTERNAL "System Processor")
|
||||
set(CMAKE_SYSTEM_CPU cortex-m4 CACHE INTERNAL "System Processor")
|
||||
set(CMAKE_TOOLCHAIN_FILE ${TOP}/examples/build_system/cmake/toolchain/arm_${TOOLCHAIN}.cmake)
|
||||
set(JLINK_DEVICE max32666)
|
||||
set(OPENOCD_OPTION "-f interface/cmsis-dap.cfg -f target/max32665.cfg")
|
||||
@ -125,21 +125,20 @@ function(family_configure_example TARGET RTOS)
|
||||
)
|
||||
|
||||
# Add TinyUSB target and port source
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_MAX32666 ${RTOS})
|
||||
target_sources(${TARGET}-tinyusb PUBLIC
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_MAX32666)
|
||||
target_sources(${TARGET} PUBLIC
|
||||
${TOP}/src/portable/mentor/musb/dcd_musb.c
|
||||
)
|
||||
target_compile_options(${TARGET} PRIVATE
|
||||
-Wno-error=strict-prototypes
|
||||
)
|
||||
|
||||
target_link_libraries(${TARGET}-tinyusb PUBLIC board_${BOARD})
|
||||
target_compile_options(${TARGET}-tinyusb PRIVATE
|
||||
target_link_libraries(${TARGET} PUBLIC board_${BOARD})
|
||||
target_compile_options(${TARGET} PRIVATE
|
||||
-Wno-error=strict-prototypes
|
||||
)
|
||||
|
||||
# Link dependencies
|
||||
target_link_libraries(${TARGET} PUBLIC board_${BOARD} ${TARGET}-tinyusb)
|
||||
|
||||
|
||||
# Flashing
|
||||
family_add_bin_hex(${TARGET})
|
||||
|
@ -12,7 +12,7 @@ set(LD_FILE_GNU ${CMAKE_CURRENT_LIST_DIR}/max32690.ld)
|
||||
set(LD_FILE_Clang ${LD_FILE_GNU})
|
||||
|
||||
# toolchain set up
|
||||
set(CMAKE_SYSTEM_PROCESSOR cortex-m4 CACHE INTERNAL "System Processor")
|
||||
set(CMAKE_SYSTEM_CPU cortex-m4 CACHE INTERNAL "System Processor")
|
||||
set(CMAKE_TOOLCHAIN_FILE ${TOP}/examples/build_system/cmake/toolchain/arm_${TOOLCHAIN}.cmake)
|
||||
set(JLINK_DEVICE max32690)
|
||||
set(OPENOCD_OPTION "-f interface/cmsis-dap.cfg -f target/max32690.cfg")
|
||||
@ -130,21 +130,20 @@ function(family_configure_example TARGET RTOS)
|
||||
)
|
||||
|
||||
# Add TinyUSB target and port source
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_MAX32690 ${RTOS})
|
||||
target_sources(${TARGET}-tinyusb PUBLIC
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_MAX32690)
|
||||
target_sources(${TARGET} PUBLIC
|
||||
${TOP}/src/portable/mentor/musb/dcd_musb.c
|
||||
)
|
||||
target_compile_options(${TARGET} PRIVATE
|
||||
-Wno-error=strict-prototypes
|
||||
)
|
||||
|
||||
target_link_libraries(${TARGET}-tinyusb PUBLIC board_${BOARD})
|
||||
target_compile_options(${TARGET}-tinyusb PRIVATE
|
||||
target_link_libraries(${TARGET} PUBLIC board_${BOARD})
|
||||
target_compile_options(${TARGET} PRIVATE
|
||||
-Wno-error=strict-prototypes
|
||||
)
|
||||
|
||||
# Link dependencies
|
||||
target_link_libraries(${TARGET} PUBLIC board_${BOARD} ${TARGET}-tinyusb)
|
||||
|
||||
|
||||
# Flashing
|
||||
family_add_bin_hex(${TARGET})
|
||||
|
@ -12,7 +12,7 @@ set(LD_FILE_GNU ${CMAKE_CURRENT_LIST_DIR}/max78002.ld)
|
||||
set(LD_FILE_Clang ${LD_FILE_GNU})
|
||||
|
||||
# toolchain set up
|
||||
set(CMAKE_SYSTEM_PROCESSOR cortex-m4 CACHE INTERNAL "System Processor")
|
||||
set(CMAKE_SYSTEM_CPU cortex-m4 CACHE INTERNAL "System Processor")
|
||||
set(CMAKE_TOOLCHAIN_FILE ${TOP}/examples/build_system/cmake/toolchain/arm_${TOOLCHAIN}.cmake)
|
||||
set(JLINK_DEVICE max78000)
|
||||
|
||||
@ -134,18 +134,17 @@ function(family_configure_example TARGET RTOS)
|
||||
|
||||
|
||||
# Add TinyUSB target and port source
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_MAX78002 ${RTOS})
|
||||
target_sources(${TARGET}-tinyusb PUBLIC
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_MAX78002)
|
||||
target_sources(${TARGET} PUBLIC
|
||||
${TOP}/src/portable/mentor/musb/dcd_musb.c
|
||||
)
|
||||
target_link_libraries(${TARGET}-tinyusb PUBLIC board_${BOARD})
|
||||
target_compile_options(${TARGET}-tinyusb PRIVATE
|
||||
target_link_libraries(${TARGET} PUBLIC board_${BOARD})
|
||||
target_compile_options(${TARGET} PRIVATE
|
||||
-Wno-error=strict-prototypes
|
||||
-Wno-error=redundant-decls
|
||||
)
|
||||
|
||||
# Link dependencies
|
||||
target_link_libraries(${TARGET} PUBLIC board_${BOARD} ${TARGET}-tinyusb)
|
||||
|
||||
|
||||
# Flashing
|
||||
family_add_bin_hex(${TARGET})
|
||||
|
@ -8,10 +8,10 @@ include(${CMAKE_CURRENT_LIST_DIR}/boards/${BOARD}/board.cmake)
|
||||
|
||||
# toolchain set up
|
||||
if (MCU_VARIANT STREQUAL "MCXA153")
|
||||
set(CMAKE_SYSTEM_PROCESSOR cortex-m33-nodsp-nofp CACHE INTERNAL "System Processor")
|
||||
set(CMAKE_SYSTEM_CPU cortex-m33-nodsp-nofp CACHE INTERNAL "System Processor")
|
||||
set(FAMILY_MCUS MCXA15 CACHE INTERNAL "")
|
||||
elseif (MCU_VARIANT STREQUAL "MCXN947")
|
||||
set(CMAKE_SYSTEM_PROCESSOR cortex-m33 CACHE INTERNAL "System Processor")
|
||||
set(CMAKE_SYSTEM_CPU cortex-m33 CACHE INTERNAL "System Processor")
|
||||
set(FAMILY_MCUS MCXN9 CACHE INTERNAL "")
|
||||
else()
|
||||
message(FATAL_ERROR "MCU_VARIANT not supported")
|
||||
@ -110,19 +110,18 @@ function(family_configure_example TARGET RTOS)
|
||||
|
||||
# Add TinyUSB target and port source
|
||||
if (${FAMILY_MCUS} STREQUAL "MCXN9")
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_MCXN9 ${RTOS})
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_MCXN9)
|
||||
elseif(${FAMILY_MCUS} STREQUAL "MCXA15")
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_MCXA15 ${RTOS})
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_MCXA15)
|
||||
endif()
|
||||
|
||||
target_sources(${TARGET}-tinyusb PUBLIC
|
||||
target_sources(${TARGET} PUBLIC
|
||||
# TinyUSB: Port0 is chipidea FS, Port1 is chipidea HS
|
||||
${TOP}/src/portable/chipidea/$<IF:${PORT},ci_hs/dcd_ci_hs.c,ci_fs/dcd_ci_fs.c>
|
||||
)
|
||||
target_link_libraries(${TARGET}-tinyusb PUBLIC board_${BOARD})
|
||||
target_link_libraries(${TARGET} PUBLIC board_${BOARD})
|
||||
|
||||
|
||||
# Link dependencies
|
||||
target_link_libraries(${TARGET} PUBLIC board_${BOARD} ${TARGET}-tinyusb)
|
||||
|
||||
# Flashing
|
||||
family_add_bin_hex(${TARGET})
|
||||
|
@ -7,7 +7,7 @@ set(SDK_DIR ${TOP}/hw/mcu/mindmotion/mm32sdk/${MCU_VARIANT_UPPER})
|
||||
set(CMSIS_5 ${TOP}/lib/CMSIS_5)
|
||||
|
||||
# toolchain set up
|
||||
set(CMAKE_SYSTEM_PROCESSOR cortex-m3 CACHE INTERNAL "System Processor")
|
||||
set(CMAKE_SYSTEM_CPU cortex-m3 CACHE INTERNAL "System Processor")
|
||||
set(CMAKE_TOOLCHAIN_FILE ${TOP}/examples/build_system/cmake/toolchain/arm_${TOOLCHAIN}.cmake)
|
||||
|
||||
set(FAMILY_MCUS MM32F327X CACHE INTERNAL "")
|
||||
@ -87,14 +87,13 @@ function(family_configure_example TARGET RTOS)
|
||||
)
|
||||
|
||||
# Add TinyUSB target and port source
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_MM32F327X ${RTOS})
|
||||
target_sources(${TARGET}-tinyusb PUBLIC
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_MM32F327X)
|
||||
target_sources(${TARGET} PUBLIC
|
||||
${TOP}/src/portable/mindmotion/mm32/dcd_mm32f327x_otg.c
|
||||
)
|
||||
target_link_libraries(${TARGET}-tinyusb PUBLIC board_${BOARD})
|
||||
target_link_libraries(${TARGET} PUBLIC board_${BOARD})
|
||||
|
||||
|
||||
# Link dependencies
|
||||
target_link_libraries(${TARGET} PUBLIC board_${BOARD} ${TARGET}-tinyusb)
|
||||
|
||||
# Flashing
|
||||
family_add_bin_hex(${TARGET})
|
||||
|
@ -6,7 +6,7 @@ set(SDK_DIR ${TOP}/hw/mcu/ti/msp430/msp430-gcc-support-files/include)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/boards/${BOARD}/board.cmake)
|
||||
|
||||
# toolchain set up
|
||||
set(CMAKE_SYSTEM_PROCESSOR msp430 CACHE INTERNAL "System Processor")
|
||||
set(CMAKE_SYSTEM_CPU msp430 CACHE INTERNAL "System Processor")
|
||||
set(CMAKE_TOOLCHAIN_FILE ${TOP}/examples/build_system/cmake/toolchain/msp430_${TOOLCHAIN}.cmake)
|
||||
|
||||
set(FAMILY_MCUS MSP430x5xx CACHE INTERNAL "")
|
||||
@ -69,14 +69,12 @@ function(family_configure_example TARGET RTOS)
|
||||
)
|
||||
|
||||
# Add TinyUSB target and port source
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_MSP430x5xx ${RTOS})
|
||||
target_sources(${TARGET}-tinyusb PUBLIC
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_MSP430x5xx)
|
||||
target_sources(${TARGET} PUBLIC
|
||||
${TOP}/src/portable/ti/msp430x5xx/dcd_msp430x5xx.c
|
||||
)
|
||||
target_link_libraries(${TARGET}-tinyusb PUBLIC board_${BOARD})
|
||||
target_link_libraries(${TARGET} PUBLIC board_${BOARD})
|
||||
|
||||
# Link dependencies
|
||||
target_link_libraries(${TARGET} PUBLIC board_${BOARD} ${TARGET}-tinyusb)
|
||||
|
||||
# Flashing
|
||||
family_add_bin_hex(${TARGET})
|
||||
|
@ -7,7 +7,7 @@ set(CMSIS_DIR ${TOP}/lib/CMSIS_5)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/boards/${BOARD}/board.cmake)
|
||||
|
||||
# toolchain set up
|
||||
set(CMAKE_SYSTEM_PROCESSOR cortex-m4 CACHE INTERNAL "System Processor")
|
||||
set(CMAKE_SYSTEM_CPU cortex-m4 CACHE INTERNAL "System Processor")
|
||||
set(CMAKE_TOOLCHAIN_FILE ${TOP}/examples/build_system/cmake/toolchain/arm_${TOOLCHAIN}.cmake)
|
||||
|
||||
set(FAMILY_MCUS MSP432E4 CACHE INTERNAL "")
|
||||
@ -85,15 +85,14 @@ function(family_configure_example TARGET RTOS)
|
||||
)
|
||||
|
||||
# Add TinyUSB target and port source
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_MSP432E4 ${RTOS})
|
||||
target_sources(${TARGET}-tinyusb PUBLIC
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_MSP432E4)
|
||||
target_sources(${TARGET} PUBLIC
|
||||
${TOP}/src/portable/mentor/musb/dcd_musb.c
|
||||
${TOP}/src/portable/mentor/musb/hcd_musb.c
|
||||
)
|
||||
target_link_libraries(${TARGET}-tinyusb PUBLIC board_${BOARD})
|
||||
target_link_libraries(${TARGET} PUBLIC board_${BOARD})
|
||||
|
||||
|
||||
# Link dependencies
|
||||
target_link_libraries(${TARGET} PUBLIC board_${BOARD} ${TARGET}-tinyusb)
|
||||
|
||||
# Flashing
|
||||
family_add_bin_hex(${TARGET})
|
||||
|
@ -2,3 +2,9 @@ set(MCU_VARIANT nrf52840)
|
||||
|
||||
function(update_board TARGET)
|
||||
endfunction()
|
||||
|
||||
#board_runner_args(jlink "--device=nRF52840_xxAA" "--speed=4000")
|
||||
#include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake)
|
||||
#include(${ZEPHYR_BASE}/boards/common/nrfutil.board.cmake)
|
||||
#include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)
|
||||
#include(${ZEPHYR_BASE}/boards/common/openocd-nrf5.board.cmake)
|
||||
|
@ -2,6 +2,6 @@ set(MCU_VARIANT nrf5340_application)
|
||||
|
||||
function(update_board TARGET)
|
||||
target_sources(${TARGET} PRIVATE
|
||||
${NRFX_DIR}/drivers/src/nrfx_usbreg.c
|
||||
${NRFX_PATH}/drivers/src/nrfx_usbreg.c
|
||||
)
|
||||
endfunction()
|
||||
|
@ -44,10 +44,10 @@
|
||||
|
||||
#include "nrfx.h"
|
||||
#include "hal/nrf_gpio.h"
|
||||
#include "drivers/include/nrfx_gpiote.h"
|
||||
#include "drivers/include/nrfx_power.h"
|
||||
#include "drivers/include/nrfx_uarte.h"
|
||||
#include "drivers/include/nrfx_spim.h"
|
||||
#include "nrfx_gpiote.h"
|
||||
#include "nrfx_power.h"
|
||||
#include "nrfx_uarte.h"
|
||||
#include "nrfx_spim.h"
|
||||
|
||||
#ifdef SOFTDEVICE_PRESENT
|
||||
#include "nrf_sdm.h"
|
||||
@ -137,8 +137,20 @@ void board_init(void) {
|
||||
// Button
|
||||
nrf_gpio_cfg_input(BUTTON_PIN, NRF_GPIO_PIN_PULLUP);
|
||||
|
||||
#if CFG_TUSB_OS == OPT_OS_NONE
|
||||
// 1ms tick timer
|
||||
SysTick_Config(SystemCoreClock / 1000);
|
||||
#elif CFG_TUSB_OS == OPT_OS_ZEPHYR
|
||||
#ifdef CONFIG_HAS_HW_NRF_USBREG
|
||||
// IRQ_CONNECT(USBREGULATOR_IRQn, DT_IRQ(DT_INST(0, nordic_nrf_clock), priority), nrfx_isr, nrfx_usbreg_irq_handler, 0);
|
||||
// irq_enable(USBREGULATOR_IRQn);
|
||||
#endif
|
||||
|
||||
/* USB device controller access from devicetree */
|
||||
#define DT_DRV_COMPAT nordic_nrf_usbd
|
||||
IRQ_CONNECT(DT_INST_IRQN(0), DT_INST_IRQ(0, priority), nrfx_isr, USBD_IRQHandler, 0);
|
||||
irq_enable(DT_INST_IRQN(0));
|
||||
#endif
|
||||
|
||||
// UART
|
||||
#if NRFX_VER <= 2
|
||||
@ -171,7 +183,7 @@ void board_init(void) {
|
||||
};
|
||||
#endif
|
||||
|
||||
nrfx_uarte_init(&_uart_id, &uart_cfg, NULL); //uart_handler);
|
||||
nrfx_uarte_init(&_uart_id, &uart_cfg, NULL);
|
||||
|
||||
//------------- USB -------------//
|
||||
#if CFG_TUD_ENABLED
|
||||
@ -215,8 +227,12 @@ void board_init(void) {
|
||||
#endif
|
||||
}
|
||||
|
||||
if ( usb_reg & VBUSDETECT_Msk ) tusb_hal_nrf_power_event(USB_EVT_DETECTED);
|
||||
if ( usb_reg & OUTPUTRDY_Msk ) tusb_hal_nrf_power_event(USB_EVT_READY);
|
||||
if ( usb_reg & VBUSDETECT_Msk ) {
|
||||
tusb_hal_nrf_power_event(USB_EVT_DETECTED);
|
||||
}
|
||||
if ( usb_reg & OUTPUTRDY_Msk ) {
|
||||
tusb_hal_nrf_power_event(USB_EVT_READY);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if CFG_TUH_ENABLED && defined(CFG_TUH_MAX3421) && CFG_TUH_MAX3421
|
||||
@ -228,7 +244,6 @@ void board_init(void) {
|
||||
//--------------------------------------------------------------------+
|
||||
// Board porting API
|
||||
//--------------------------------------------------------------------+
|
||||
|
||||
void board_led_write(bool state) {
|
||||
nrf_gpio_pin_write(LED_PIN, state ? LED_STATE_ON : (1 - LED_STATE_ON));
|
||||
}
|
||||
|
@ -1,17 +1,20 @@
|
||||
include_guard()
|
||||
|
||||
set(NRFX_DIR ${TOP}/hw/mcu/nordic/nrfx)
|
||||
set(NRFX_PATH ${TOP}/hw/mcu/nordic/nrfx)
|
||||
set(CMSIS_DIR ${TOP}/lib/CMSIS_5)
|
||||
|
||||
# include board specific
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/boards/${BOARD}/board.cmake)
|
||||
# include board specific, for zephyr BOARD_ALIAS may be used instead
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/boards/${BOARD}/board.cmake OPTIONAL RESULT_VARIABLE board_cmake_included)
|
||||
if (NOT board_cmake_included)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/boards/${BOARD_ALIAS}/board.cmake)
|
||||
endif ()
|
||||
|
||||
# toolchain set up
|
||||
if (MCU_VARIANT STREQUAL "nrf5340_application")
|
||||
set(CMAKE_SYSTEM_PROCESSOR cortex-m33 CACHE INTERNAL "System Processor")
|
||||
set(CMAKE_SYSTEM_CPU cortex-m33 CACHE INTERNAL "System Processor")
|
||||
set(JLINK_DEVICE nrf5340_xxaa_app)
|
||||
else ()
|
||||
set(CMAKE_SYSTEM_PROCESSOR cortex-m4 CACHE INTERNAL "System Processor")
|
||||
set(CMAKE_SYSTEM_CPU cortex-m4 CACHE INTERNAL "System Processor")
|
||||
set(JLINK_DEVICE ${MCU_VARIANT}_xxaa)
|
||||
endif ()
|
||||
|
||||
@ -19,7 +22,6 @@ set(CMAKE_TOOLCHAIN_FILE ${TOP}/examples/build_system/cmake/toolchain/arm_${TOOL
|
||||
|
||||
set(FAMILY_MCUS NRF5X CACHE INTERNAL "")
|
||||
|
||||
|
||||
#------------------------------------
|
||||
# BOARD_TARGET
|
||||
#------------------------------------
|
||||
@ -40,18 +42,18 @@ function(add_board_target BOARD_TARGET)
|
||||
endif ()
|
||||
|
||||
if (NOT DEFINED STARTUP_FILE_${CMAKE_C_COMPILER_ID})
|
||||
set(STARTUP_FILE_GNU ${NRFX_DIR}/mdk/gcc_startup_${MCU_VARIANT}.S)
|
||||
set(STARTUP_FILE_GNU ${NRFX_PATH}/mdk/gcc_startup_${MCU_VARIANT}.S)
|
||||
set(STARTUP_FILE_Clang ${STARTUP_FILE_GNU})
|
||||
endif ()
|
||||
|
||||
add_library(${BOARD_TARGET} STATIC
|
||||
${NRFX_DIR}/helpers/nrfx_flag32_allocator.c
|
||||
${NRFX_DIR}/drivers/src/nrfx_gpiote.c
|
||||
${NRFX_DIR}/drivers/src/nrfx_power.c
|
||||
${NRFX_DIR}/drivers/src/nrfx_spim.c
|
||||
${NRFX_DIR}/drivers/src/nrfx_uarte.c
|
||||
${NRFX_DIR}/mdk/system_${MCU_VARIANT}.c
|
||||
${NRFX_DIR}/soc/nrfx_atomic.c
|
||||
${NRFX_PATH}/helpers/nrfx_flag32_allocator.c
|
||||
${NRFX_PATH}/drivers/src/nrfx_gpiote.c
|
||||
${NRFX_PATH}/drivers/src/nrfx_power.c
|
||||
${NRFX_PATH}/drivers/src/nrfx_spim.c
|
||||
${NRFX_PATH}/drivers/src/nrfx_uarte.c
|
||||
${NRFX_PATH}/mdk/system_${MCU_VARIANT}.c
|
||||
${NRFX_PATH}/soc/nrfx_atomic.c
|
||||
${STARTUP_FILE_${CMAKE_C_COMPILER_ID}}
|
||||
)
|
||||
string(TOUPPER "${MCU_VARIANT_XXAA}" MCU_VARIANT_XXAA_UPPER)
|
||||
@ -67,12 +69,10 @@ function(add_board_target BOARD_TARGET)
|
||||
endif ()
|
||||
|
||||
target_include_directories(${BOARD_TARGET} PUBLIC
|
||||
${CMAKE_CURRENT_FUNCTION_LIST_DIR}
|
||||
${NRFX_DIR}
|
||||
${NRFX_DIR}/mdk
|
||||
${NRFX_DIR}/hal
|
||||
${NRFX_DIR}/drivers/include
|
||||
${NRFX_DIR}/drivers/src
|
||||
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/nrfx_config
|
||||
${NRFX_PATH}
|
||||
${NRFX_PATH}/mdk
|
||||
${NRFX_PATH}/drivers/include
|
||||
${CMSIS_DIR}/CMSIS/Core/Include
|
||||
)
|
||||
|
||||
@ -81,14 +81,14 @@ function(add_board_target BOARD_TARGET)
|
||||
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
||||
target_link_options(${BOARD_TARGET} PUBLIC
|
||||
"LINKER:--script=${LD_FILE_GNU}"
|
||||
-L${NRFX_DIR}/mdk
|
||||
-L${NRFX_PATH}/mdk
|
||||
--specs=nosys.specs --specs=nano.specs
|
||||
-nostartfiles
|
||||
)
|
||||
elseif (CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
target_link_options(${BOARD_TARGET} PUBLIC
|
||||
"LINKER:--script=${LD_FILE_GNU}"
|
||||
-L${NRFX_DIR}/mdk
|
||||
-L${NRFX_PATH}/mdk
|
||||
)
|
||||
elseif (CMAKE_C_COMPILER_ID STREQUAL "IAR")
|
||||
target_link_options(${BOARD_TARGET} PUBLIC
|
||||
@ -111,14 +111,17 @@ endfunction()
|
||||
|
||||
|
||||
function(family_configure_example TARGET RTOS)
|
||||
family_configure_common(${TARGET} ${RTOS})
|
||||
|
||||
# Board target
|
||||
add_board_target(board_${BOARD})
|
||||
if (NOT RTOS STREQUAL zephyr)
|
||||
add_board_target(board_${BOARD})
|
||||
target_link_libraries(${TARGET} PUBLIC board_${BOARD})
|
||||
endif ()
|
||||
|
||||
family_configure_common(${TARGET} ${RTOS})
|
||||
|
||||
#---------- Port Specific ----------
|
||||
# These files are built for each example since it depends on example's tusb_config.h
|
||||
target_sources(${TARGET} PUBLIC
|
||||
target_sources(${TARGET} PRIVATE
|
||||
# BSP
|
||||
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/family.c
|
||||
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/../board.c
|
||||
@ -129,19 +132,18 @@ function(family_configure_example TARGET RTOS)
|
||||
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/../../
|
||||
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/boards/${BOARD}
|
||||
)
|
||||
if (RTOS STREQUAL zephyr AND DEFINED BOARD_ALIAS AND NOT BOARD STREQUAL BOARD_ALIAS)
|
||||
target_include_directories(${TARGET} PUBLIC ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/boards/${BOARD_ALIAS})
|
||||
endif ()
|
||||
|
||||
# Add TinyUSB target and port source
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_NRF5X ${RTOS})
|
||||
target_sources(${TARGET}-tinyusb PUBLIC
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_NRF5X)
|
||||
target_sources(${TARGET} PRIVATE
|
||||
${TOP}/src/portable/nordic/nrf5x/dcd_nrf5x.c
|
||||
)
|
||||
target_link_libraries(${TARGET}-tinyusb PUBLIC board_${BOARD})
|
||||
|
||||
# Link dependencies
|
||||
target_link_libraries(${TARGET} PUBLIC board_${BOARD} ${TARGET}-tinyusb)
|
||||
|
||||
# Flashing
|
||||
family_add_bin_hex(${TARGET})
|
||||
# family_add_bin_hex(${TARGET})
|
||||
family_flash_jlink(${TARGET})
|
||||
# family_flash_adafruit_nrfutil(${TARGET})
|
||||
endfunction()
|
||||
|
@ -1,6 +1,6 @@
|
||||
UF2_FAMILY_ID = 0xADA52840
|
||||
|
||||
NRFX_DIR = hw/mcu/nordic/nrfx
|
||||
NRFX_PATH = hw/mcu/nordic/nrfx
|
||||
|
||||
include $(TOP)/$(BOARD_PATH)/board.mk
|
||||
|
||||
@ -28,31 +28,32 @@ CFLAGS_GCC += \
|
||||
LDFLAGS_GCC += \
|
||||
-nostartfiles \
|
||||
--specs=nosys.specs --specs=nano.specs \
|
||||
-L$(TOP)/${NRFX_DIR}/mdk
|
||||
-L$(TOP)/${NRFX_PATH}/mdk
|
||||
|
||||
LDFLAGS_CLANG += \
|
||||
-L$(TOP)/${NRFX_DIR}/mdk \
|
||||
-L$(TOP)/${NRFX_PATH}/mdk \
|
||||
|
||||
SRC_C += \
|
||||
src/portable/nordic/nrf5x/dcd_nrf5x.c \
|
||||
${NRFX_DIR}/helpers/nrfx_flag32_allocator.c \
|
||||
${NRFX_DIR}/drivers/src/nrfx_gpiote.c \
|
||||
${NRFX_DIR}/drivers/src/nrfx_power.c \
|
||||
${NRFX_DIR}/drivers/src/nrfx_spim.c \
|
||||
${NRFX_DIR}/drivers/src/nrfx_uarte.c \
|
||||
${NRFX_DIR}/mdk/system_$(MCU_VARIANT).c \
|
||||
${NRFX_DIR}/soc/nrfx_atomic.c
|
||||
${NRFX_PATH}/helpers/nrfx_flag32_allocator.c \
|
||||
${NRFX_PATH}/drivers/src/nrfx_gpiote.c \
|
||||
${NRFX_PATH}/drivers/src/nrfx_power.c \
|
||||
${NRFX_PATH}/drivers/src/nrfx_spim.c \
|
||||
${NRFX_PATH}/drivers/src/nrfx_uarte.c \
|
||||
${NRFX_PATH}/mdk/system_$(MCU_VARIANT).c \
|
||||
${NRFX_PATH}/soc/nrfx_atomic.c
|
||||
|
||||
INC += \
|
||||
$(TOP)/$(BOARD_PATH) \
|
||||
$(TOP)/$(FAMILY_PATH)/nrfx_config \
|
||||
$(TOP)/lib/CMSIS_5/CMSIS/Core/Include \
|
||||
$(TOP)/${NRFX_DIR} \
|
||||
$(TOP)/${NRFX_DIR}/mdk \
|
||||
$(TOP)/${NRFX_DIR}/hal \
|
||||
$(TOP)/${NRFX_DIR}/drivers/include \
|
||||
$(TOP)/${NRFX_DIR}/drivers/src \
|
||||
$(TOP)/${NRFX_PATH} \
|
||||
$(TOP)/${NRFX_PATH}/mdk \
|
||||
$(TOP)/${NRFX_PATH}/hal \
|
||||
$(TOP)/${NRFX_PATH}/drivers/include \
|
||||
$(TOP)/${NRFX_PATH}/drivers/src \
|
||||
|
||||
SRC_S += ${NRFX_DIR}/mdk/gcc_startup_$(MCU_VARIANT).S
|
||||
SRC_S += ${NRFX_PATH}/mdk/gcc_startup_$(MCU_VARIANT).S
|
||||
|
||||
ASFLAGS += -D__HEAP_SIZE=0
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user