mirror of
https://github.com/raspberrypi/pico-sdk.git
synced 2025-12-10 07:14:36 +01:00
add missing libraries to test/kitchen_sink and auto-gen includes (#2567)
* add missing libraries to test/kitchen_sink and auto-gen includes * bazel fix
This commit is contained in:
parent
d32d315624
commit
af518de1c3
2 changed files with 77 additions and 138 deletions
|
|
@ -2,23 +2,32 @@ add_library(kitchen_sink_libs INTERFACE)
|
||||||
|
|
||||||
set(KITCHEN_SINK_LIBS
|
set(KITCHEN_SINK_LIBS
|
||||||
hardware_adc
|
hardware_adc
|
||||||
|
hardware_boot_lock
|
||||||
|
hardware_claim
|
||||||
hardware_clocks
|
hardware_clocks
|
||||||
|
hardware_dcp
|
||||||
hardware_divider
|
hardware_divider
|
||||||
hardware_dma
|
hardware_dma
|
||||||
hardware_exception
|
hardware_exception
|
||||||
hardware_flash
|
hardware_flash
|
||||||
hardware_gpio
|
hardware_gpio
|
||||||
|
hardware_hazard3
|
||||||
hardware_i2c
|
hardware_i2c
|
||||||
hardware_interp
|
hardware_interp
|
||||||
hardware_irq
|
hardware_irq
|
||||||
hardware_pio
|
hardware_pio
|
||||||
hardware_powman
|
|
||||||
hardware_pll
|
hardware_pll
|
||||||
|
hardware_powman
|
||||||
hardware_pwm
|
hardware_pwm
|
||||||
|
hardware_rcp
|
||||||
hardware_resets
|
hardware_resets
|
||||||
|
hardware_riscv
|
||||||
|
hardware_riscv_platform_timer
|
||||||
hardware_rtc
|
hardware_rtc
|
||||||
|
hardware_sha256
|
||||||
hardware_spi
|
hardware_spi
|
||||||
hardware_sync
|
hardware_sync
|
||||||
|
hardware_sync_spin_lock
|
||||||
hardware_ticks
|
hardware_ticks
|
||||||
hardware_timer
|
hardware_timer
|
||||||
hardware_uart
|
hardware_uart
|
||||||
|
|
@ -41,8 +50,12 @@ set(KITCHEN_SINK_LIBS
|
||||||
pico_mem_ops
|
pico_mem_ops
|
||||||
pico_multicore
|
pico_multicore
|
||||||
pico_platform
|
pico_platform
|
||||||
|
pico_printf
|
||||||
pico_rand
|
pico_rand
|
||||||
|
pico_runtime
|
||||||
|
pico_runtime_init
|
||||||
pico_sha256
|
pico_sha256
|
||||||
|
pico_stdio
|
||||||
pico_stdlib
|
pico_stdlib
|
||||||
pico_sync
|
pico_sync
|
||||||
pico_time
|
pico_time
|
||||||
|
|
@ -50,16 +63,47 @@ set(KITCHEN_SINK_LIBS
|
||||||
pico_util
|
pico_util
|
||||||
)
|
)
|
||||||
|
|
||||||
|
set(KITCHEN_SINK_NO_HEADER_LIBS
|
||||||
|
hardware_dcp
|
||||||
|
pico_bootsel_via_double_reset
|
||||||
|
pico_int64_ops # currently empty, and only included by _pico variant
|
||||||
|
pico_mem_ops # currently empty, and only included by _pico variant
|
||||||
|
)
|
||||||
|
|
||||||
|
set(KITCHEN_SINK_INCLUDES "#pragma once\n")
|
||||||
foreach(LIB IN LISTS KITCHEN_SINK_LIBS)
|
foreach(LIB IN LISTS KITCHEN_SINK_LIBS)
|
||||||
if (TARGET ${LIB})
|
if (TARGET ${LIB})
|
||||||
target_link_libraries(kitchen_sink_libs INTERFACE ${LIB})
|
target_link_libraries(kitchen_sink_libs INTERFACE ${LIB})
|
||||||
|
string(REGEX MATCH "([a-z]+)_(.+)" HAS_MATCH ${LIB})
|
||||||
|
if (HAS_MATCH AND NOT LIB IN_LIST KITCHEN_SINK_NO_HEADER_LIBS)
|
||||||
|
# these are few, so just hack fixing for now
|
||||||
|
if (LIB STREQUAL "pico_util")
|
||||||
|
string(APPEND KITCHEN_SINK_INCLUDES "#include \"pico/util/datetime.h\"\n")
|
||||||
|
string(APPEND KITCHEN_SINK_INCLUDES "#include \"pico/util/pheap.h\"\n")
|
||||||
|
string(APPEND KITCHEN_SINK_INCLUDES "#include \"pico/util/queue.h\"\n")
|
||||||
|
else()
|
||||||
|
if ("${CMAKE_MATCH_2}" STREQUAL "fix_rp2040_usb_device_enumeration")
|
||||||
|
set(CMAKE_MATCH_2 "fix/rp2040_usb_device_enumeration")
|
||||||
|
elseif ("${CMAKE_MATCH_2}" STREQUAL "sync_spin_lock")
|
||||||
|
set(CMAKE_MATCH_2 "sync/spin_lock")
|
||||||
|
endif()
|
||||||
|
string(APPEND KITCHEN_SINK_INCLUDES "#include \"${CMAKE_MATCH_1}/${CMAKE_MATCH_2}.h\"\n")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endforeach ()
|
endforeach ()
|
||||||
|
set(KITCHEN_SINK_INCLUDE_HEADER "${CMAKE_CURRENT_BINARY_DIR}/kitchen_sink_includes.h")
|
||||||
|
file(GENERATE OUTPUT ${KITCHEN_SINK_INCLUDE_HEADER} CONTENT ${KITCHEN_SINK_INCLUDES})
|
||||||
|
|
||||||
add_library(kitchen_sink_options INTERFACE)
|
add_library(kitchen_sink_options INTERFACE)
|
||||||
|
|
||||||
target_compile_options(kitchen_sink_options INTERFACE
|
if (NOT KITCHEN_SINK_NO_WERROR)
|
||||||
|
target_compile_options(kitchen_sink_options INTERFACE
|
||||||
-Werror
|
-Werror
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
target_compile_options(kitchen_sink_options INTERFACE
|
||||||
-Wall
|
-Wall
|
||||||
-Wextra
|
-Wextra
|
||||||
# -pedantic
|
# -pedantic
|
||||||
|
|
@ -97,6 +141,7 @@ target_compile_definitions(kitchen_sink_libs INTERFACE
|
||||||
PICO_FORBID_ARM_HEADERS_ON_RISCV=1
|
PICO_FORBID_ARM_HEADERS_ON_RISCV=1
|
||||||
PARAM_ASSERTIONS_ENABLE_ALL=1 # want to check all the assertions for compilation warnings
|
PARAM_ASSERTIONS_ENABLE_ALL=1 # want to check all the assertions for compilation warnings
|
||||||
PICO_AUDIO_DMA_IRQ=1
|
PICO_AUDIO_DMA_IRQ=1
|
||||||
|
KITCHEN_SINK_INCLUDE_HEADER="${KITCHEN_SINK_INCLUDE_HEADER}"
|
||||||
)
|
)
|
||||||
|
|
||||||
add_executable(kitchen_sink ${CMAKE_CURRENT_LIST_DIR}/kitchen_sink.c)
|
add_executable(kitchen_sink ${CMAKE_CURRENT_LIST_DIR}/kitchen_sink.c)
|
||||||
|
|
@ -147,25 +192,27 @@ target_link_libraries(kitchen_sink_printf_none kitchen_sink_libs kitchen_sink_op
|
||||||
pico_add_extra_outputs(kitchen_sink_printf_none)
|
pico_add_extra_outputs(kitchen_sink_printf_none)
|
||||||
pico_set_printf_implementation(kitchen_sink_printf_none none)
|
pico_set_printf_implementation(kitchen_sink_printf_none none)
|
||||||
|
|
||||||
add_executable(kitchen_sink_copy_to_ram ${CMAKE_CURRENT_LIST_DIR}/kitchen_sink.c)
|
if (NOT KITCHEN_SINK_NO_BINARY_TYPE_VARIANTS)
|
||||||
pico_set_binary_type(kitchen_sink_copy_to_ram copy_to_ram)
|
add_executable(kitchen_sink_copy_to_ram ${CMAKE_CURRENT_LIST_DIR}/kitchen_sink.c)
|
||||||
target_link_libraries(kitchen_sink_copy_to_ram kitchen_sink_libs kitchen_sink_options)
|
pico_set_binary_type(kitchen_sink_copy_to_ram copy_to_ram)
|
||||||
pico_add_extra_outputs(kitchen_sink_copy_to_ram)
|
target_link_libraries(kitchen_sink_copy_to_ram kitchen_sink_libs kitchen_sink_options)
|
||||||
target_compile_definitions(kitchen_sink_copy_to_ram PRIVATE KITCHEN_SINK_ID="copy-to-ram binary")
|
pico_add_extra_outputs(kitchen_sink_copy_to_ram)
|
||||||
|
target_compile_definitions(kitchen_sink_copy_to_ram PRIVATE KITCHEN_SINK_ID="copy-to-ram binary")
|
||||||
|
|
||||||
add_executable(kitchen_sink_no_flash ${CMAKE_CURRENT_LIST_DIR}/kitchen_sink.c)
|
add_executable(kitchen_sink_no_flash ${CMAKE_CURRENT_LIST_DIR}/kitchen_sink.c)
|
||||||
pico_set_binary_type(kitchen_sink_no_flash no_flash)
|
pico_set_binary_type(kitchen_sink_no_flash no_flash)
|
||||||
target_link_libraries(kitchen_sink_no_flash kitchen_sink_libs kitchen_sink_options)
|
target_link_libraries(kitchen_sink_no_flash kitchen_sink_libs kitchen_sink_options)
|
||||||
pico_add_extra_outputs(kitchen_sink_no_flash)
|
pico_add_extra_outputs(kitchen_sink_no_flash)
|
||||||
target_compile_definitions(kitchen_sink_no_flash PRIVATE KITCHEN_SINK_ID="no-flash binary")
|
target_compile_definitions(kitchen_sink_no_flash PRIVATE KITCHEN_SINK_ID="no-flash binary")
|
||||||
|
|
||||||
if (NOT PICO_RP2350)
|
if (PICO_RP2040)
|
||||||
# RP2350 does not have blocked ram
|
# RP2040 has blocked ram
|
||||||
add_executable(kitchen_sink_blocked_ram ${CMAKE_CURRENT_LIST_DIR}/kitchen_sink.c)
|
add_executable(kitchen_sink_blocked_ram ${CMAKE_CURRENT_LIST_DIR}/kitchen_sink.c)
|
||||||
pico_set_binary_type(kitchen_sink_blocked_ram blocked_ram)
|
pico_set_binary_type(kitchen_sink_blocked_ram blocked_ram)
|
||||||
target_link_libraries(kitchen_sink_blocked_ram kitchen_sink_libs kitchen_sink_options)
|
target_link_libraries(kitchen_sink_blocked_ram kitchen_sink_libs kitchen_sink_options)
|
||||||
pico_add_extra_outputs(kitchen_sink_blocked_ram)
|
pico_add_extra_outputs(kitchen_sink_blocked_ram)
|
||||||
target_compile_definitions(kitchen_sink_blocked_ram PRIVATE KITCHEN_SINK_ID="blocked-ram binary")
|
target_compile_definitions(kitchen_sink_blocked_ram PRIVATE KITCHEN_SINK_ID="blocked-ram binary")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_executable(kitchen_sink_cpp ${CMAKE_CURRENT_LIST_DIR}/kitchen_sink_cpp.cpp)
|
add_executable(kitchen_sink_cpp ${CMAKE_CURRENT_LIST_DIR}/kitchen_sink_cpp.cpp)
|
||||||
|
|
|
||||||
|
|
@ -5,127 +5,18 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
// Include all headers to check for compiler warnings
|
|
||||||
#include "hardware/adc.h"
|
|
||||||
#include "hardware/claim.h"
|
|
||||||
#include "hardware/clocks.h"
|
|
||||||
#include "hardware/divider.h"
|
|
||||||
#include "hardware/dma.h"
|
|
||||||
#include "hardware/exception.h"
|
|
||||||
#include "hardware/flash.h"
|
|
||||||
#include "hardware/gpio.h"
|
|
||||||
#include "hardware/i2c.h"
|
|
||||||
#include "hardware/interp.h"
|
|
||||||
#include "hardware/irq.h"
|
|
||||||
#include "hardware/pio.h"
|
|
||||||
#include "hardware/pio_instructions.h"
|
|
||||||
#include "hardware/pll.h"
|
|
||||||
#include "hardware/pwm.h"
|
|
||||||
#include "hardware/resets.h"
|
|
||||||
#if PICO_RP2040
|
|
||||||
#include "hardware/rtc.h"
|
|
||||||
#endif
|
|
||||||
#if !PICO_RP2040
|
|
||||||
#include "hardware/sha256.h"
|
|
||||||
#endif
|
|
||||||
#include "hardware/spi.h"
|
|
||||||
#include "hardware/sync.h"
|
|
||||||
#include "hardware/timer.h"
|
|
||||||
#include "hardware/ticks.h"
|
|
||||||
#include "hardware/uart.h"
|
|
||||||
#include "hardware/vreg.h"
|
|
||||||
#include "hardware/watchdog.h"
|
|
||||||
#include "hardware/xosc.h"
|
|
||||||
#include "pico/aon_timer.h"
|
|
||||||
#include "pico/binary_info.h"
|
|
||||||
#include "pico/bit_ops.h"
|
|
||||||
#include "pico/bootrom.h"
|
|
||||||
#if LIB_PICO_CYW43_ARCH
|
|
||||||
#include "pico/cyw43_arch.h"
|
|
||||||
#endif
|
|
||||||
#include "pico/divider.h"
|
|
||||||
// todo we should have this but right now double.h is only present with double_implementation == pico
|
|
||||||
#if PICO_RP2040
|
|
||||||
#include "pico/double.h"
|
|
||||||
#endif
|
|
||||||
#include "pico/fix/rp2040_usb_device_enumeration.h"
|
|
||||||
#include "pico/flash.h"
|
|
||||||
// todo we should have this but right now float.h is only present with float_implementation == pico
|
|
||||||
#if PICO_RP2040
|
|
||||||
#include "pico/float.h"
|
|
||||||
#endif
|
|
||||||
#include "pico/i2c_slave.h"
|
|
||||||
#if LIB_PICO_INT64_OPS_PICO
|
|
||||||
#include "pico/int64_ops.h"
|
|
||||||
#endif
|
|
||||||
#include "pico/malloc.h"
|
|
||||||
#include "pico/multicore.h"
|
|
||||||
#include "pico/platform.h"
|
|
||||||
#include "pico/printf.h"
|
|
||||||
#include "pico/rand.h"
|
|
||||||
#include "pico/runtime.h"
|
|
||||||
#if LIB_PICO_SHA256
|
|
||||||
#include "pico/sha256.h"
|
|
||||||
#endif
|
|
||||||
#include "pico/stdio.h"
|
|
||||||
#include "pico/stdlib.h"
|
|
||||||
#include "pico/sync.h"
|
|
||||||
#include "pico/time.h"
|
|
||||||
#include "pico/unique_id.h"
|
|
||||||
#include "pico/util/datetime.h"
|
|
||||||
#include "pico/util/pheap.h"
|
|
||||||
#include "pico/util/queue.h"
|
|
||||||
|
|
||||||
#include "hardware/structs/adc.h"
|
#ifndef KITCHEN_SINK_INCLUDE_HEADER
|
||||||
#include "hardware/structs/busctrl.h"
|
// provided for backwards compatibility for non CMake build systems - just includes enough to compile
|
||||||
#include "hardware/structs/clocks.h"
|
#include "hardware/dma.h"
|
||||||
#include "hardware/structs/dma.h"
|
#include "pico/sync.h"
|
||||||
#include "hardware/structs/i2c.h"
|
#include "pico/stdlib.h"
|
||||||
#include "hardware/structs/interp.h"
|
#if LIB_PICO_BINARY_INFO
|
||||||
#include "hardware/structs/io_bank0.h"
|
#include "pico/binary_info.h"
|
||||||
#include "hardware/structs/io_qspi.h"
|
|
||||||
#ifndef __riscv
|
|
||||||
#include "hardware/structs/mpu.h"
|
|
||||||
#include "hardware/structs/nvic.h"
|
|
||||||
#endif
|
#endif
|
||||||
#include "hardware/structs/pads_bank0.h"
|
#else
|
||||||
#include "hardware/structs/pads_qspi.h"
|
#include KITCHEN_SINK_INCLUDE_HEADER
|
||||||
#include "hardware/structs/pio.h"
|
|
||||||
#include "hardware/structs/pll.h"
|
|
||||||
#if PICO_RP2350
|
|
||||||
#include "hardware/structs/powman.h"
|
|
||||||
#endif
|
#endif
|
||||||
#include "hardware/structs/psm.h"
|
|
||||||
#include "hardware/structs/pwm.h"
|
|
||||||
#include "hardware/structs/resets.h"
|
|
||||||
#include "hardware/structs/rosc.h"
|
|
||||||
#if PICO_RP2040
|
|
||||||
#include "hardware/structs/rtc.h"
|
|
||||||
#endif
|
|
||||||
#ifndef __riscv
|
|
||||||
#include "hardware/structs/scb.h"
|
|
||||||
#endif
|
|
||||||
#include "hardware/structs/sio.h"
|
|
||||||
#if !PICO_RP2040
|
|
||||||
#include "hardware/structs/sha256.h"
|
|
||||||
#endif
|
|
||||||
#include "hardware/structs/spi.h"
|
|
||||||
#if PICO_RP2040
|
|
||||||
#include "hardware/structs/ssi.h"
|
|
||||||
#endif
|
|
||||||
#include "hardware/structs/syscfg.h"
|
|
||||||
#ifndef __riscv
|
|
||||||
#include "hardware/structs/systick.h"
|
|
||||||
#endif
|
|
||||||
#include "hardware/structs/timer.h"
|
|
||||||
#include "hardware/structs/uart.h"
|
|
||||||
#include "hardware/structs/usb.h"
|
|
||||||
#if PICO_RP2040
|
|
||||||
#include "hardware/structs/vreg_and_chip_reset.h"
|
|
||||||
#endif
|
|
||||||
#include "hardware/structs/watchdog.h"
|
|
||||||
#include "hardware/structs/xip_ctrl.h"
|
|
||||||
#include "hardware/structs/xosc.h"
|
|
||||||
|
|
||||||
#if LIB_PICO_MBEDTLS
|
#if LIB_PICO_MBEDTLS
|
||||||
#include "mbedtls/ssl.h"
|
#include "mbedtls/ssl.h"
|
||||||
|
|
@ -133,6 +24,7 @@
|
||||||
#include "lwip/altcp_tls.h"
|
#include "lwip/altcp_tls.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if LIB_PICO_BINARY_INFO
|
||||||
bi_decl(bi_block_device(
|
bi_decl(bi_block_device(
|
||||||
BINARY_INFO_MAKE_TAG('K', 'S'),
|
BINARY_INFO_MAKE_TAG('K', 'S'),
|
||||||
"foo",
|
"foo",
|
||||||
|
|
@ -141,6 +33,7 @@ bi_decl(bi_block_device(
|
||||||
NULL,
|
NULL,
|
||||||
BINARY_INFO_BLOCK_DEV_FLAG_READ | BINARY_INFO_BLOCK_DEV_FLAG_WRITE |
|
BINARY_INFO_BLOCK_DEV_FLAG_READ | BINARY_INFO_BLOCK_DEV_FLAG_WRITE |
|
||||||
BINARY_INFO_BLOCK_DEV_FLAG_PT_UNKNOWN));
|
BINARY_INFO_BLOCK_DEV_FLAG_PT_UNKNOWN));
|
||||||
|
#endif
|
||||||
|
|
||||||
uint32_t *foo = (uint32_t *) 200;
|
uint32_t *foo = (uint32_t *) 200;
|
||||||
|
|
||||||
|
|
@ -167,7 +60,6 @@ float __attribute__((noinline)) foox(float x, float b) {
|
||||||
return x * b;
|
return x * b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int main(void) {
|
int main(void) {
|
||||||
spiggle();
|
spiggle();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue