make all non hardware_ libraries foo add C preprocessor definition LIB_FOO=1, and remove bespoke definitions which were all undocumented anyway (#374)
This commit is contained in:
@ -1,6 +1,2 @@
|
||||
add_library(hardware_claim INTERFACE)
|
||||
target_include_directories(hardware_claim INTERFACE include)
|
||||
target_sources(hardware_claim INTERFACE
|
||||
${CMAKE_CURRENT_LIST_DIR}/claim.c)
|
||||
|
||||
pico_simple_hardware_target(claim)
|
||||
target_link_libraries(hardware_claim INTERFACE hardware_sync)
|
@ -1,4 +1,3 @@
|
||||
add_library(hardware_divider INTERFACE)
|
||||
pico_simple_hardware_headers_only_target(divider)
|
||||
target_sources(hardware_divider INTERFACE ${CMAKE_CURRENT_LIST_DIR}/divider.S)
|
||||
target_include_directories(hardware_divider INTERFACE ${CMAKE_CURRENT_LIST_DIR}/include)
|
||||
target_link_libraries(hardware_divider INTERFACE hardware_structs)
|
@ -1,8 +1,2 @@
|
||||
add_library(hardware_flash INTERFACE)
|
||||
|
||||
target_sources(hardware_flash INTERFACE
|
||||
${CMAKE_CURRENT_LIST_DIR}/flash.c
|
||||
)
|
||||
|
||||
target_include_directories(hardware_flash INTERFACE ${CMAKE_CURRENT_LIST_DIR}/include)
|
||||
target_link_libraries(hardware_flash INTERFACE pico_base_headers pico_bootrom)
|
||||
pico_simple_hardware_target(flash)
|
||||
target_link_libraries(hardware_flash INTERFACE pico_bootrom)
|
||||
|
@ -1,2 +1 @@
|
||||
add_library(hardware_resets INTERFACE)
|
||||
target_include_directories(hardware_resets INTERFACE include)
|
||||
pico_simple_hardware_headers_only_target(resets)
|
||||
|
@ -1,13 +1,9 @@
|
||||
if (NOT TARGET pico_bit_ops)
|
||||
#shims for ROM functions for -lgcc functions (listed below)
|
||||
add_library(pico_bit_ops INTERFACE)
|
||||
pico_add_impl_library(pico_bit_ops)
|
||||
|
||||
# no custom implementation; falls thru to compiler
|
||||
add_library(pico_bit_ops_compiler INTERFACE)
|
||||
# PICO_BUILD_DEFINE: PICO_BIT_OPS_COMPILER, whether compiler provided bit_ops bit functions support is being used, type=bool, default=0, but dependent on CMake options, group=pico_bit_ops
|
||||
target_compile_definitions(pico_bit_ops_compiler INTERFACE
|
||||
PICO_BIT_OPS_COMPILER=1
|
||||
)
|
||||
pico_add_impl_library(pico_bit_ops_compiler)
|
||||
|
||||
# add alias "default" which is just pico.
|
||||
add_library(pico_bit_ops_default INTERFACE)
|
||||
@ -15,15 +11,10 @@ if (NOT TARGET pico_bit_ops)
|
||||
|
||||
set(PICO_DEFAULT_BIT_OPS_IMPL pico_bit_ops_default)
|
||||
|
||||
add_library(pico_bit_ops_pico INTERFACE)
|
||||
pico_add_impl_library(pico_bit_ops_pico)
|
||||
target_link_libraries(pico_bit_ops INTERFACE
|
||||
$<IF:$<BOOL:$<TARGET_PROPERTY:PICO_TARGET_BIT_OPS_IMPL>>,$<TARGET_PROPERTY:PICO_TARGET_BIT_OPS_IMPL>,${PICO_DEFAULT_BIT_OPS_IMPL}>)
|
||||
|
||||
# PICO_BUILD_DEFINE: PICO_BIT_OPS_PICO, whether optimized pico/bootrom provided bit_ops bit functions support is being used, type=bool, default=1, but dependent on CMake options, group=pico_bit_ops
|
||||
target_compile_definitions(pico_bit_ops_pico INTERFACE
|
||||
PICO_BIT_OPS_PICO=1
|
||||
)
|
||||
|
||||
target_sources(pico_bit_ops_pico INTERFACE
|
||||
${CMAKE_CURRENT_LIST_DIR}/bit_ops_aeabi.S
|
||||
)
|
||||
|
@ -1,4 +1,4 @@
|
||||
add_library(pico_bootsel_via_double_reset INTERFACE)
|
||||
pico_add_impl_library(pico_bootsel_via_double_reset)
|
||||
|
||||
target_sources(pico_bootsel_via_double_reset INTERFACE
|
||||
${CMAKE_CURRENT_LIST_DIR}/pico_bootsel_via_double_reset.c
|
||||
|
@ -1,12 +1,9 @@
|
||||
if (NOT TARGET pico_divider)
|
||||
# library to be depended on - we make this depend on particular implementations using per target generator expressions
|
||||
add_library(pico_divider INTERFACE)
|
||||
pico_add_impl_library(pico_divider)
|
||||
|
||||
# no custom implementation; falls thru to compiler
|
||||
add_library(pico_divider_compiler INTERFACE)
|
||||
target_compile_definitions(pico_divider_compiler INTERFACE
|
||||
PICO_DIVIDER_COMPILER=1
|
||||
)
|
||||
pico_add_impl_library(pico_divider_compiler)
|
||||
|
||||
# add alias "default" which is just hardware.
|
||||
add_library(pico_divider_default INTERFACE)
|
||||
@ -27,10 +24,7 @@ if (NOT TARGET pico_divider)
|
||||
hardware_regs
|
||||
)
|
||||
|
||||
add_library(pico_divider_hardware INTERFACE)
|
||||
target_compile_definitions(pico_divider_hardware INTERFACE
|
||||
PICO_DIVIDER_HARDWARE=1
|
||||
)
|
||||
pico_add_impl_library(pico_divider_hardware)
|
||||
|
||||
target_link_libraries(pico_divider_hardware INTERFACE pico_divider_hardware_explicit)
|
||||
|
||||
|
@ -1,13 +1,9 @@
|
||||
if (NOT TARGET pico_double)
|
||||
# library to be depended on - we make this depend on particular implementations using per target generator expressions
|
||||
add_library(pico_double INTERFACE)
|
||||
pico_add_impl_library(pico_double)
|
||||
|
||||
# no custom implementation; falls thru to compiler
|
||||
add_library(pico_double_compiler INTERFACE)
|
||||
# PICO_BUILD_DEFINE: PICO_DOUBLE_COMPILER, whether compiler provided double support is being used, type=bool, default=0, but dependent on CMake options, group=pico_double
|
||||
target_compile_definitions(pico_double_compiler INTERFACE
|
||||
PICO_DOUBLE_COMPILER=1
|
||||
)
|
||||
pico_add_impl_library(pico_double_compiler)
|
||||
|
||||
add_library(pico_double_headers INTERFACE)
|
||||
target_include_directories(pico_double_headers INTERFACE ${CMAKE_CURRENT_LIST_DIR}/include)
|
||||
@ -21,30 +17,24 @@ if (NOT TARGET pico_double)
|
||||
target_link_libraries(pico_double INTERFACE
|
||||
$<IF:$<BOOL:$<TARGET_PROPERTY:PICO_TARGET_DOUBLE_IMPL>>,$<TARGET_PROPERTY:PICO_TARGET_DOUBLE_IMPL>,${PICO_DEFAULT_DOUBLE_IMPL}>)
|
||||
|
||||
add_library(pico_double_pico INTERFACE)
|
||||
pico_add_impl_library(pico_double_pico)
|
||||
target_sources(pico_double_pico INTERFACE
|
||||
${CMAKE_CURRENT_LIST_DIR}/double_aeabi.S
|
||||
${CMAKE_CURRENT_LIST_DIR}/double_init_rom.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/double_math.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/double_v1_rom_shim.S
|
||||
)
|
||||
# PICO_BUILD_DEFINE: PICO_DOUBLE_PICO, whether optimized pico/bootrom provided double support is being used, type=bool, default=1, but dependent on CMake options, group=pico_double
|
||||
target_compile_definitions(pico_double_pico INTERFACE
|
||||
PICO_DOUBLE_PICO=1
|
||||
)
|
||||
|
||||
target_link_libraries(pico_double_pico INTERFACE pico_bootrom pico_double_headers)
|
||||
|
||||
add_library(pico_double_none INTERFACE)
|
||||
pico_add_impl_library(pico_double_none)
|
||||
target_sources(pico_double_none INTERFACE
|
||||
${CMAKE_CURRENT_LIST_DIR}/double_none.S
|
||||
)
|
||||
|
||||
target_link_libraries(pico_double_none INTERFACE pico_double_headers)
|
||||
|
||||
# PICO_BUILD_DEFINE: PICO_DOUBLE_NONE, whether double support is disabled and functions will panic, type=bool, default=0, but dependent on CMake options, group=pico_double
|
||||
target_compile_definitions(pico_double_none INTERFACE
|
||||
PICO_DOUBLE_NONE=1
|
||||
PICO_PRINTF_SUPPORT_FLOAT=0 # printing floats/doubles won't work, so we can save space by removing it
|
||||
)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
add_library(pico_fix_rp2040_usb_device_enumeration INTERFACE)
|
||||
pico_add_impl_library(pico_fix_rp2040_usb_device_enumeration)
|
||||
|
||||
target_sources(pico_fix_rp2040_usb_device_enumeration INTERFACE
|
||||
${CMAKE_CURRENT_LIST_DIR}/rp2040_usb_device_enumeration.c
|
||||
|
@ -1,13 +1,9 @@
|
||||
if (NOT TARGET pico_float)
|
||||
# library to be depended on - we make this depend on particular implementations using per target generator expressions
|
||||
add_library(pico_float INTERFACE)
|
||||
pico_add_impl_library(pico_float)
|
||||
|
||||
# no custom implementation; falls thru to compiler
|
||||
add_library(pico_float_compiler INTERFACE)
|
||||
# PICO_BUILD_DEFINE: PICO_FLOAT_COMPILER, whether compiler provided float support is being used, type=bool, default=0, but dependent on CMake options, group=pico_float
|
||||
target_compile_definitions(pico_float_compiler INTERFACE
|
||||
PICO_FLOAT_COMPILER=1
|
||||
)
|
||||
pico_add_impl_library(pico_float_compiler)
|
||||
|
||||
add_library(pico_float_headers INTERFACE)
|
||||
target_include_directories(pico_float_headers INTERFACE ${CMAKE_CURRENT_LIST_DIR}/include)
|
||||
@ -21,32 +17,23 @@ if (NOT TARGET pico_float)
|
||||
target_link_libraries(pico_float INTERFACE
|
||||
$<IF:$<BOOL:$<TARGET_PROPERTY:PICO_TARGET_FLOAT_IMPL>>,$<TARGET_PROPERTY:PICO_TARGET_FLOAT_IMPL>,${PICO_DEFAULT_FLOAT_IMPL}>)
|
||||
|
||||
add_library(pico_float_pico INTERFACE)
|
||||
pico_add_impl_library(pico_float_pico)
|
||||
target_sources(pico_float_pico INTERFACE
|
||||
${CMAKE_CURRENT_LIST_DIR}/float_aeabi.S
|
||||
${CMAKE_CURRENT_LIST_DIR}/float_init_rom.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/float_math.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/float_v1_rom_shim.S
|
||||
)
|
||||
# PICO_BUILD_DEFINE: PICO_FLOAT_PICO, whether optimized pico/bootrom provided float support is being used, type=bool, default=1, but dependent on CMake options, group=pico_float
|
||||
target_compile_definitions(pico_float_pico INTERFACE
|
||||
PICO_FLOAT_PICO=1
|
||||
)
|
||||
|
||||
target_link_libraries(pico_float_pico INTERFACE pico_bootrom pico_float_headers)
|
||||
|
||||
add_library(pico_float_none INTERFACE)
|
||||
pico_add_impl_library(pico_float_none)
|
||||
target_sources(pico_float_none INTERFACE
|
||||
${CMAKE_CURRENT_LIST_DIR}/float_none.S
|
||||
)
|
||||
|
||||
target_link_libraries(pico_float_none INTERFACE pico_float_headers)
|
||||
|
||||
# PICO_BUILD_DEFINE: PICO_FLOAT_NONE, whether float support is disabled and functions will panic, type=bool, default=0, but dependent on CMake options, group=pico_float
|
||||
target_compile_definitions(pico_float_none INTERFACE
|
||||
PICO_FLOAT_NONE=1
|
||||
)
|
||||
|
||||
function(wrap_float_functions TARGET)
|
||||
pico_wrap_function(${TARGET} __aeabi_fadd)
|
||||
pico_wrap_function(${TARGET} __aeabi_fdiv)
|
||||
|
@ -1,14 +1,10 @@
|
||||
if (NOT TARGET pico_int64_ops)
|
||||
|
||||
#shims for ROM functions for -lgcc functions (listed below)
|
||||
add_library(pico_int64_ops INTERFACE)
|
||||
pico_add_impl_library(pico_int64_ops)
|
||||
|
||||
# no custom implementation; falls thru to compiler
|
||||
add_library(pico_int64_ops_compiler INTERFACE)
|
||||
# PICO_BUILD_DEFINE: PICO_INT64_OPS_COMPILER, whether compiler provided int64_ops multiplication support is being used, type=bool, default=0, but dependent on CMake options, group=pico_int64_ops
|
||||
target_compile_definitions(pico_int64_ops_compiler INTERFACE
|
||||
PICO_INT64_OPS_COMPILER=1
|
||||
)
|
||||
pico_add_impl_library(pico_int64_ops_compiler)
|
||||
|
||||
# add alias "default" which is just pico.
|
||||
add_library(pico_int64_ops_default INTERFACE)
|
||||
@ -19,18 +15,13 @@ if (NOT TARGET pico_int64_ops)
|
||||
target_link_libraries(pico_int64_ops INTERFACE
|
||||
$<IF:$<BOOL:$<TARGET_PROPERTY:PICO_TARGET_INT64_OPS_IMPL>>,$<TARGET_PROPERTY:PICO_TARGET_INT64_OPS_IMPL>,${PICO_DEFAULT_INT64_OPS_IMPL}>)
|
||||
|
||||
add_library(pico_int64_ops_pico INTERFACE)
|
||||
pico_add_impl_library(pico_int64_ops_pico)
|
||||
target_include_directories(pico_int64_ops_pico INTERFACE ${CMAKE_CURRENT_LIST_DIR}/include)
|
||||
|
||||
target_sources(pico_int64_ops_pico INTERFACE
|
||||
${CMAKE_CURRENT_LIST_DIR}/pico_int64_ops_aeabi.S
|
||||
)
|
||||
|
||||
# PICO_BUILD_DEFINE: PICO_INT64_OPS_PICO, whether optimized pico/bootrom provided int64_ops multiplication support is being used, type=bool, default=1, but dependent on CMake options, group=pico_int64_ops
|
||||
target_compile_definitions(pico_int64_ops_pico INTERFACE
|
||||
PICO_INT64_OPS_PICO=1
|
||||
)
|
||||
|
||||
pico_wrap_function(pico_int64_ops_pico __aeabi_lmul)
|
||||
|
||||
macro(pico_set_int64_ops_implementation TARGET IMPL)
|
||||
|
@ -1,6 +1,6 @@
|
||||
if (NOT TARGET pico_malloc)
|
||||
#shims for ROM functions for -lgcc functions (listed below)
|
||||
add_library(pico_malloc INTERFACE)
|
||||
pico_add_impl_library(pico_malloc)
|
||||
|
||||
target_sources(pico_malloc INTERFACE
|
||||
${CMAKE_CURRENT_LIST_DIR}/pico_malloc.c
|
||||
|
@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
// PICO_CONFIG: PICO_USE_MALLOC_MUTEX, Whether to protect malloc etc with a mutex, type=bool, default=1 with pico_multicore, 0 otherwise, group=pico_malloc
|
||||
#if PICO_MULTICORE && !defined(PICO_USE_MALLOC_MUTEX)
|
||||
#if LIB_PICO_MULTICORE && !defined(PICO_USE_MALLOC_MUTEX)
|
||||
#define PICO_USE_MALLOC_MUTEX 1
|
||||
#endif
|
||||
|
||||
|
@ -1,13 +1,9 @@
|
||||
if (NOT TARGET pico_mem_ops)
|
||||
#shims for ROM functions for -lgcc functions (listed below)
|
||||
add_library(pico_mem_ops INTERFACE)
|
||||
pico_add_impl_library(pico_mem_ops)
|
||||
|
||||
# no custom implementation; falls thru to compiler
|
||||
add_library(pico_mem_ops_compiler INTERFACE)
|
||||
# PICO_BUILD_DEFINE: PICO_MEM_OPS_COMPILER, whether compiler provided mem_ops memcpy etc. support is being used, type=bool, default=0, but dependent on CMake options, group=pico_mem_ops
|
||||
target_compile_definitions(pico_mem_ops_compiler INTERFACE
|
||||
PICO_MEM_OPS_COMPILER=1
|
||||
)
|
||||
pico_add_impl_library(pico_mem_ops_compiler)
|
||||
|
||||
# add alias "default" which is just pico.
|
||||
add_library(pico_mem_ops_default INTERFACE)
|
||||
@ -15,16 +11,10 @@ if (NOT TARGET pico_mem_ops)
|
||||
|
||||
set(PICO_DEFAULT_MEM_OPS_IMPL pico_mem_ops_default)
|
||||
|
||||
add_library(pico_mem_ops_pico INTERFACE)
|
||||
pico_add_impl_library(pico_mem_ops_pico)
|
||||
target_link_libraries(pico_mem_ops INTERFACE
|
||||
$<IF:$<BOOL:$<TARGET_PROPERTY:PICO_TARGET_MEM_OPS_IMPL>>,$<TARGET_PROPERTY:PICO_TARGET_MEM_OPS_IMPL>,${PICO_DEFAULT_MEM_OPS_IMPL}>)
|
||||
|
||||
# PICO_BUILD_DEFINE: PICO_MEM_OPS_PICO, whether optimized pico/bootrom provided mem_ops memcpy etc. support is being used, type=bool, default=1, but dependent on CMake options, group=pico_mem_ops
|
||||
target_compile_definitions(pico_mem_ops_pico INTERFACE
|
||||
PICO_MEM_OPS_PICO=1
|
||||
)
|
||||
|
||||
|
||||
target_sources(pico_mem_ops_pico INTERFACE
|
||||
${CMAKE_CURRENT_LIST_DIR}/mem_ops_aeabi.S
|
||||
)
|
||||
|
@ -1,15 +1,11 @@
|
||||
if (NOT TARGET pico_multicore)
|
||||
add_library(pico_multicore INTERFACE)
|
||||
pico_add_impl_library(pico_multicore)
|
||||
|
||||
target_sources(pico_multicore INTERFACE
|
||||
${CMAKE_CURRENT_LIST_DIR}/multicore.c)
|
||||
|
||||
target_include_directories(pico_multicore INTERFACE ${CMAKE_CURRENT_LIST_DIR}/include)
|
||||
|
||||
target_compile_definitions(pico_multicore INTERFACE
|
||||
PICO_MULTICORE=1
|
||||
)
|
||||
|
||||
target_link_libraries(pico_multicore INTERFACE pico_sync)
|
||||
endif()
|
||||
|
||||
|
@ -13,7 +13,7 @@ if (NOT TARGET pico_platform_headers)
|
||||
endif()
|
||||
|
||||
if (NOT TARGET pico_platform)
|
||||
add_library(pico_platform INTERFACE)
|
||||
pico_add_impl_library(pico_platform)
|
||||
target_sources(pico_platform INTERFACE
|
||||
${CMAKE_CURRENT_LIST_DIR}/platform.c)
|
||||
|
||||
|
@ -1,12 +1,9 @@
|
||||
if (NOT TARGET pico_printf)
|
||||
# library to be depended on - we make this depend on particular implementations using per target generator expressions
|
||||
add_library(pico_printf INTERFACE)
|
||||
pico_add_impl_library(pico_printf)
|
||||
|
||||
# no custom implementation; falls thru to compiler
|
||||
add_library(pico_printf_compiler INTERFACE)
|
||||
target_compile_definitions(pico_printf_compiler INTERFACE
|
||||
PICO_PRINTF_COMPILER=1
|
||||
)
|
||||
pico_add_impl_library(pico_printf_compiler)
|
||||
|
||||
add_library(pico_printf_headers INTERFACE)
|
||||
target_include_directories(pico_printf_headers INTERFACE ${CMAKE_CURRENT_LIST_DIR}/include)
|
||||
@ -20,28 +17,20 @@ if (NOT TARGET pico_printf)
|
||||
target_link_libraries(pico_printf INTERFACE
|
||||
$<IF:$<BOOL:$<TARGET_PROPERTY:PICO_TARGET_PRINTF_IMPL>>,$<TARGET_PROPERTY:PICO_TARGET_PRINTF_IMPL>,${PICO_DEFAULT_PRINTF_IMPL}>)
|
||||
|
||||
add_library(pico_printf_pico INTERFACE)
|
||||
pico_add_impl_library(pico_printf_pico)
|
||||
target_sources(pico_printf_pico INTERFACE
|
||||
${CMAKE_CURRENT_LIST_DIR}/printf.c
|
||||
)
|
||||
|
||||
target_compile_definitions(pico_printf_pico INTERFACE
|
||||
PICO_PRINTF_PICO=1
|
||||
)
|
||||
|
||||
target_link_libraries(pico_printf_pico INTERFACE pico_printf_headers)
|
||||
|
||||
add_library(pico_printf_none INTERFACE)
|
||||
pico_add_impl_library(pico_printf_none)
|
||||
target_sources(pico_printf_none INTERFACE
|
||||
${CMAKE_CURRENT_LIST_DIR}/printf_none.S
|
||||
)
|
||||
|
||||
target_link_libraries(pico_printf_none INTERFACE pico_printf_headers)
|
||||
|
||||
target_compile_definitions(pico_printf_none INTERFACE
|
||||
PICO_PRINTF_NONE=1
|
||||
)
|
||||
|
||||
function(wrap_printf_functions TARGET)
|
||||
# note that printf and vprintf are in pico_stdio so we can provide thread safety
|
||||
pico_wrap_function(${TARGET} sprintf)
|
||||
|
@ -55,7 +55,7 @@ extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if PICO_PRINTF_PICO
|
||||
#if LIB_PICO_PRINTF_PICO
|
||||
// weak raw printf may be a puts if printf has not been called,
|
||||
// so that we can support gc of printf when it isn't called
|
||||
//
|
||||
|
@ -918,7 +918,7 @@ int vfctprintf(void (*out)(char character, void *arg), void *arg, const char *fo
|
||||
return _vsnprintf(_out_fct, (char *) (uintptr_t) &out_fct_wrap, (size_t) -1, format, va);
|
||||
}
|
||||
|
||||
#if PICO_PRINTF_PICO
|
||||
#if LIB_PICO_PRINTF_PICO
|
||||
#if !PICO_PRINTF_ALWAYS_INCLUDED
|
||||
bool weak_raw_printf(const char *fmt, ...) {
|
||||
va_list va;
|
||||
|
@ -1,4 +1,4 @@
|
||||
add_library(pico_runtime INTERFACE)
|
||||
pico_add_impl_library(pico_runtime)
|
||||
|
||||
target_sources(pico_runtime INTERFACE
|
||||
${CMAKE_CURRENT_LIST_DIR}/runtime.c
|
||||
|
@ -225,7 +225,7 @@ void __attribute__((noreturn)) panic_unsupported() {
|
||||
void __attribute__((noreturn)) __printflike(1, 0) panic(const char *fmt, ...) {
|
||||
puts("\n*** PANIC ***\n");
|
||||
if (fmt) {
|
||||
#if PICO_PRINTF_NONE
|
||||
#if LIB_PICO_PRINTF_NONE
|
||||
puts(fmt);
|
||||
#else
|
||||
va_list args;
|
||||
|
@ -1,5 +1,5 @@
|
||||
if (NOT TARGET pico_standard_link)
|
||||
add_library(pico_standard_link INTERFACE)
|
||||
pico_add_impl_library(pico_standard_link)
|
||||
|
||||
target_sources(pico_standard_link INTERFACE
|
||||
${CMAKE_CURRENT_LIST_DIR}/crt0.S
|
||||
|
@ -1,5 +1,5 @@
|
||||
if (NOT TARGET pico_stdio)
|
||||
add_library(pico_stdio INTERFACE)
|
||||
pico_add_impl_library(pico_stdio)
|
||||
|
||||
target_include_directories(pico_stdio INTERFACE ${CMAKE_CURRENT_LIST_DIR}/include)
|
||||
|
||||
|
@ -15,15 +15,15 @@
|
||||
#include "pico/stdio/driver.h"
|
||||
#include "pico/time.h"
|
||||
|
||||
#if PICO_STDIO_UART
|
||||
#if LIB_PICO_STDIO_UART
|
||||
#include "pico/stdio_uart.h"
|
||||
#endif
|
||||
|
||||
#if PICO_STDIO_USB
|
||||
#if LIB_PICO_STDIO_USB
|
||||
#include "pico/stdio_usb.h"
|
||||
#endif
|
||||
|
||||
#if PICO_STDIO_SEMIHOSTING
|
||||
#if LIB_PICO_STDIO_SEMIHOSTING
|
||||
#include "pico/stdio_semihosting.h"
|
||||
#endif
|
||||
|
||||
@ -212,12 +212,12 @@ int WRAPPER_FUNC(vprintf)(const char *format, va_list va) {
|
||||
#endif
|
||||
}
|
||||
int ret;
|
||||
#if PICO_PRINTF_PICO
|
||||
#if LIB_PICO_PRINTF_PICO
|
||||
struct stdio_stack_buffer buffer = {.used = 0};
|
||||
ret = vfctprintf(stdio_buffered_printer, &buffer, format, va);
|
||||
stdio_stack_buffer_flush(&buffer);
|
||||
stdio_flush();
|
||||
#elif PICO_PRINTF_NONE
|
||||
#elif LIB_PICO_PRINTF_NONE
|
||||
extern void printf_none_assert();
|
||||
printf_none_assert();
|
||||
#else
|
||||
@ -242,15 +242,15 @@ int __printflike(1, 0) WRAPPER_FUNC(printf)(const char* format, ...)
|
||||
void stdio_init_all() {
|
||||
// todo add explicit custom, or registered although you can call stdio_enable_driver explicitly anyway
|
||||
// These are well known ones
|
||||
#if PICO_STDIO_UART
|
||||
#if LIB_PICO_STDIO_UART
|
||||
stdio_uart_init();
|
||||
#endif
|
||||
|
||||
#if PICO_STDIO_SEMIHOSTING
|
||||
#if LIB_PICO_STDIO_SEMIHOSTING
|
||||
stdio_semihosting_init();
|
||||
#endif
|
||||
|
||||
#if PICO_STDIO_USB
|
||||
#if LIB_PICO_STDIO_USB
|
||||
stdio_usb_init();
|
||||
#endif
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
add_library(pico_stdio_semihosting INTERFACE)
|
||||
pico_add_impl_library(pico_stdio_semihosting)
|
||||
|
||||
target_sources(pico_stdio_semihosting INTERFACE
|
||||
${CMAKE_CURRENT_LIST_DIR}/stdio_semihosting.c
|
||||
@ -6,8 +6,4 @@ target_sources(pico_stdio_semihosting INTERFACE
|
||||
|
||||
target_include_directories(pico_stdio_semihosting INTERFACE ${CMAKE_CURRENT_LIST_DIR}/include)
|
||||
|
||||
target_compile_definitions(pico_stdio_semihosting INTERFACE
|
||||
PICO_STDIO_SEMIHOSTING=1
|
||||
)
|
||||
|
||||
target_link_libraries(pico_stdio_semihosting INTERFACE pico_stdio)
|
@ -1,4 +1,4 @@
|
||||
add_library(pico_stdio_uart INTERFACE)
|
||||
pico_add_impl_library(pico_stdio_uart)
|
||||
|
||||
target_sources(pico_stdio_uart INTERFACE
|
||||
${CMAKE_CURRENT_LIST_DIR}/stdio_uart.c
|
||||
@ -6,8 +6,4 @@ target_sources(pico_stdio_uart INTERFACE
|
||||
|
||||
target_include_directories(pico_stdio_uart INTERFACE ${CMAKE_CURRENT_LIST_DIR}/include)
|
||||
|
||||
target_compile_definitions(pico_stdio_uart INTERFACE
|
||||
PICO_STDIO_UART=1
|
||||
)
|
||||
|
||||
target_link_libraries(pico_stdio_uart INTERFACE pico_stdio)
|
@ -1,5 +1,5 @@
|
||||
if (TARGET tinyusb_device_unmarked)
|
||||
add_library(pico_stdio_usb INTERFACE)
|
||||
pico_add_impl_library(pico_stdio_usb)
|
||||
|
||||
target_include_directories(pico_stdio_usb INTERFACE ${CMAKE_CURRENT_LIST_DIR}/include)
|
||||
|
||||
@ -15,8 +15,4 @@ if (TARGET tinyusb_device_unmarked)
|
||||
pico_time
|
||||
pico_unique_id
|
||||
)
|
||||
|
||||
target_compile_definitions(pico_stdio_usb INTERFACE
|
||||
PICO_STDIO_USB=1
|
||||
)
|
||||
endif()
|
||||
|
@ -4,7 +4,7 @@
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#if !defined(TINYUSB_HOST_LINKED) && !defined(TINYUSB_DEVICE_LINKED)
|
||||
#if !defined(LIB_TINYUSB_HOST) && !defined(LIB_TINYUSB_DEVICE)
|
||||
#include "tusb.h"
|
||||
|
||||
#include "pico/time.h"
|
||||
|
@ -26,7 +26,7 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#if !defined(TINYUSB_HOST_LINKED) && !defined(TINYUSB_DEVICE_LINKED)
|
||||
#if !defined(LIB_TINYUSB_HOST) && !defined(LIB_TINYUSB_DEVICE)
|
||||
|
||||
#include "tusb.h"
|
||||
#include "pico/stdio_usb/reset_interface.h"
|
||||
|
@ -6,7 +6,7 @@ option(PICO_STDIO_USB "Globablly enable stdio USB" 0)
|
||||
option(PICO_STDIO_USB "Globablly enable stdio semihosting " 0)
|
||||
|
||||
if (NOT TARGET pico_stdlib)
|
||||
add_library(pico_stdlib INTERFACE)
|
||||
pico_add_impl_library(pico_stdlib)
|
||||
target_sources(pico_stdlib INTERFACE
|
||||
${CMAKE_CURRENT_LIST_DIR}/stdlib.c
|
||||
)
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include "pico/stdlib.h"
|
||||
#include "hardware/pll.h"
|
||||
#include "hardware/clocks.h"
|
||||
#if PICO_STDIO_UART
|
||||
#if LIB_PICO_STDIO_UART
|
||||
#include "pico/stdio_uart.h"
|
||||
#else
|
||||
#include "pico/binary_info.h"
|
||||
@ -90,7 +90,7 @@ bool check_sys_clock_khz(uint32_t freq_khz, uint *vco_out, uint *postdiv1_out, u
|
||||
}
|
||||
|
||||
void setup_default_uart() {
|
||||
#if PICO_STDIO_UART
|
||||
#if LIB_PICO_STDIO_UART
|
||||
stdio_uart_init();
|
||||
#elif defined(PICO_DEFAULT_UART_BAUD_RATE) && defined(PICO_DEFAULT_UART_TX_PIN) && defined(PICO_DEFAULT_UART_RX_PIN)
|
||||
// this is mostly for backwards compatibility - stdio_uart_init is a bit more nuanced, and usually likely to be present
|
||||
|
@ -1,4 +1,4 @@
|
||||
add_library(pico_unique_id INTERFACE)
|
||||
pico_add_impl_library(pico_unique_id)
|
||||
|
||||
target_sources(pico_unique_id INTERFACE
|
||||
${CMAKE_CURRENT_LIST_DIR}/unique_id.c
|
||||
|
@ -73,14 +73,13 @@ if (EXISTS ${PICO_TINYUSB_PATH}/${TINYUSB_TEST_PATH})
|
||||
# unmarked version used by stdio USB
|
||||
target_link_libraries(tinyusb_device_unmarked INTERFACE tinyusb_common pico_fix_rp2040_usb_device_enumeration)
|
||||
|
||||
add_library(tinyusb_device INTERFACE)
|
||||
pico_add_impl_library(tinyusb_device)
|
||||
target_link_libraries(tinyusb_device INTERFACE tinyusb_device_unmarked)
|
||||
target_compile_definitions(tinyusb_device INTERFACE
|
||||
RP2040_USB_DEVICE_MODE=1
|
||||
TINYUSB_DEVICE_LINKED=1
|
||||
RP2040_USB_DEVICE_MODE=1 #define is used by tinyusb still
|
||||
)
|
||||
|
||||
add_library(tinyusb_host INTERFACE)
|
||||
pico_add_impl_library(tinyusb_host)
|
||||
target_sources(tinyusb_host INTERFACE
|
||||
${PICO_TINYUSB_PATH}/src/portable/raspberrypi/rp2040/hcd_rp2040.c
|
||||
${PICO_TINYUSB_PATH}/src/portable/raspberrypi/rp2040/rp2040_usb.c
|
||||
@ -96,13 +95,12 @@ if (EXISTS ${PICO_TINYUSB_PATH}/${TINYUSB_TEST_PATH})
|
||||
# Sometimes have to do host specific actions in mostly
|
||||
# common functions
|
||||
target_compile_definitions(tinyusb_host INTERFACE
|
||||
RP2040_USB_HOST_MODE=1
|
||||
TINYUSB_HOST_LINKED=1
|
||||
RP2040_USB_HOST_MODE=1 #define is used by tinyusb still
|
||||
)
|
||||
|
||||
target_link_libraries(tinyusb_host INTERFACE tinyusb_common)
|
||||
|
||||
add_library(tinyusb_board INTERFACE)
|
||||
pico_add_impl_library(tinyusb_board)
|
||||
target_sources(tinyusb_board INTERFACE
|
||||
${PICO_TINYUSB_PATH}/hw/bsp/raspberry_pi_pico/board_raspberry_pi_pico.c
|
||||
)
|
||||
|
Reference in New Issue
Block a user