mirror of
https://github.com/hathach/tinyusb.git
synced 2025-01-17 05:32:55 +08:00
rp2040 audio_test compile
This commit is contained in:
parent
ffad6eaf80
commit
959a94b98d
35
examples/device/audio_test/CMakeLists.txt
Normal file
35
examples/device/audio_test/CMakeLists.txt
Normal file
@ -0,0 +1,35 @@
|
||||
# use directory name for project id
|
||||
get_filename_component(PROJECT ${CMAKE_CURRENT_SOURCE_DIR} NAME)
|
||||
|
||||
# TOP is absolute path to root directory of TinyUSB git repo
|
||||
set(TOP "../../..")
|
||||
get_filename_component(TOP "${TOP}" REALPATH)
|
||||
|
||||
# Check for -DFAMILY=
|
||||
if(FAMILY STREQUAL "rp2040")
|
||||
cmake_minimum_required(VERSION 3.12)
|
||||
set(PICO_SDK_PATH ${TOP}/hw/mcu/raspberrypi/pico-sdk)
|
||||
include(${PICO_SDK_PATH}/pico_sdk_init.cmake)
|
||||
project(${PROJECT})
|
||||
pico_sdk_init()
|
||||
add_executable(${PROJECT})
|
||||
|
||||
include(${TOP}/hw/bsp/${FAMILY}/family.cmake)
|
||||
|
||||
# Example source
|
||||
target_sources(${PROJECT} PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/main.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/usb_descriptors.c
|
||||
)
|
||||
|
||||
# Example include
|
||||
target_include_directories(${PROJECT} PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
)
|
||||
|
||||
target_link_libraries(${PROJECT} pico_stdlib)
|
||||
pico_add_extra_outputs(${PROJECT})
|
||||
|
||||
else()
|
||||
message(FATAL_ERROR "Invalid FAMILY specified")
|
||||
endif()
|
@ -45,7 +45,9 @@ extern "C" {
|
||||
#define CFG_TUSB_RHPORT0_MODE OPT_MODE_DEVICE
|
||||
#endif
|
||||
|
||||
#ifndef CFG_TUSB_OS
|
||||
#define CFG_TUSB_OS OPT_OS_NONE
|
||||
#endif
|
||||
|
||||
#ifndef CFG_TUSB_DEBUG
|
||||
#define CFG_TUSB_DEBUG 0
|
||||
|
@ -1,5 +1,3 @@
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
# use directory name for project id
|
||||
get_filename_component(PROJECT ${CMAKE_CURRENT_SOURCE_DIR} NAME)
|
||||
|
||||
@ -9,22 +7,33 @@ get_filename_component(TOP "${TOP}" REALPATH)
|
||||
|
||||
# Check for -DFAMILY=
|
||||
if(FAMILY STREQUAL "esp32s2")
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
include(${TOP}/hw/bsp/${FAMILY}/family.cmake)
|
||||
project(${PROJECT})
|
||||
|
||||
elseif(FAMILY STREQUAL "rp2040")
|
||||
cmake_minimum_required(VERSION 3.12)
|
||||
set(PICO_SDK_PATH ${TOP}/hw/mcu/raspberrypi/pico-sdk)
|
||||
include(${PICO_SDK_PATH}/pico_sdk_init.cmake)
|
||||
project(${PROJECT})
|
||||
pico_sdk_init()
|
||||
add_executable(${PROJECT})
|
||||
|
||||
include(${TOP}/hw/bsp/${FAMILY}/family.cmake)
|
||||
|
||||
# Example source
|
||||
target_sources(${PROJECT} PUBLIC
|
||||
src/main.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/main.c
|
||||
)
|
||||
|
||||
# Example include
|
||||
target_include_directories(${PROJECT} PUBLIC
|
||||
src
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
)
|
||||
|
||||
target_link_libraries(${PROJECT} pico_stdlib)
|
||||
pico_add_extra_outputs(${PROJECT})
|
||||
|
||||
else()
|
||||
message(FATAL_ERROR "Invalid FAMILY specified")
|
||||
endif()
|
||||
|
@ -1,5 +1,3 @@
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
# use directory name for project id
|
||||
get_filename_component(PROJECT ${CMAKE_CURRENT_SOURCE_DIR} NAME)
|
||||
|
||||
@ -9,24 +7,35 @@ get_filename_component(TOP "${TOP}" REALPATH)
|
||||
|
||||
# Check for -DFAMILY=
|
||||
if(FAMILY STREQUAL "esp32s2")
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
include(${TOP}/hw/bsp/${FAMILY}/family.cmake)
|
||||
project(${PROJECT})
|
||||
|
||||
elseif(FAMILY STREQUAL "rp2040")
|
||||
cmake_minimum_required(VERSION 3.12)
|
||||
set(PICO_SDK_PATH ${TOP}/hw/mcu/raspberrypi/pico-sdk)
|
||||
include(${PICO_SDK_PATH}/pico_sdk_init.cmake)
|
||||
project(${PROJECT})
|
||||
pico_sdk_init()
|
||||
add_executable(${PROJECT})
|
||||
|
||||
include(${TOP}/hw/bsp/${FAMILY}/family.cmake)
|
||||
|
||||
# Example source
|
||||
target_sources(${PROJECT} PUBLIC
|
||||
src/main.c
|
||||
src/msc_disk.c
|
||||
src/usb_descriptors.c
|
||||
${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
|
||||
src
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
)
|
||||
|
||||
target_link_libraries(${PROJECT} pico_stdlib)
|
||||
pico_add_extra_outputs(${PROJECT})
|
||||
|
||||
else()
|
||||
message(FATAL_ERROR "Invalid FAMILY specified")
|
||||
endif()
|
||||
|
@ -1,14 +1,3 @@
|
||||
cmake_minimum_required(VERSION 3.12)
|
||||
|
||||
set(PICO_SDK_PATH ${TOP}/hw/mcu/raspberrypi/pico-sdk)
|
||||
include(${PICO_SDK_PATH}/pico_sdk_init.cmake)
|
||||
|
||||
project(${PROJECT})
|
||||
|
||||
pico_sdk_init()
|
||||
|
||||
add_executable(${PROJECT})
|
||||
|
||||
# TinyUSB Stack source
|
||||
set(SRC_TINYUSB
|
||||
${TOP}/src/tusb.c
|
||||
@ -43,7 +32,3 @@ target_compile_definitions(${PROJECT} PUBLIC
|
||||
CFG_TUSB_MCU=OPT_MCU_RP2040
|
||||
CFG_TUSB_OS=OPT_OS_PICO
|
||||
)
|
||||
|
||||
target_link_libraries(${PROJECT} pico_stdlib)
|
||||
|
||||
pico_add_extra_outputs(${PROJECT})
|
||||
|
@ -95,7 +95,13 @@ def build_size(example, board):
|
||||
|
||||
def skip_example(example, board):
|
||||
ex_dir = 'examples/' + example
|
||||
|
||||
# family.mk
|
||||
board_mk = 'hw/bsp/{}/family.mk'.format(family)
|
||||
|
||||
# family.cmake
|
||||
if not os.path.exists(board_mk):
|
||||
board_mk = 'hw/bsp/{}/family.cmake'.format(family)
|
||||
|
||||
with open(board_mk) as mk:
|
||||
mk_contents = mk.read()
|
||||
|
Loading…
x
Reference in New Issue
Block a user