diff --git a/examples/device/board_test/src/main.c b/examples/device/board_test/src/main.c index 321f6638a..2269d45f1 100644 --- a/examples/device/board_test/src/main.c +++ b/examples/device/board_test/src/main.c @@ -23,7 +23,6 @@ * */ -#if 1 #include #include #include @@ -52,7 +51,7 @@ int main(void) { // Blink and print every interval ms if (!(board_millis() - start_ms < interval_ms)) { - // board_uart_write(HELLO_STR, strlen(HELLO_STR)); + board_uart_write(HELLO_STR, strlen(HELLO_STR)); start_ms = board_millis(); @@ -61,57 +60,12 @@ int main(void) { } // echo - // uint8_t ch; - // if (board_uart_read(&ch, 1) > 0) { - // board_uart_write(&ch, 1); - // } - } -} - -#else -#include -#include -#include - -/* 1000 msec = 1 sec */ -#define SLEEP_TIME_MS 200 - -/* The devicetree node identifier for the "led0" alias. */ -#define LED0_NODE DT_ALIAS(led0) - -/* - * A build error on this line means your board is unsupported. - * See the sample documentation for information on how to fix this. - */ -static const struct gpio_dt_spec led = GPIO_DT_SPEC_GET(LED0_NODE, gpios); - -int main(void) -{ - int ret; - bool led_state = true; - - if (!gpio_is_ready_dt(&led)) { - return 0; - } - - ret = gpio_pin_configure_dt(&led, GPIO_OUTPUT_ACTIVE); - if (ret < 0) { - return 0; - } - - while (1) { - ret = gpio_pin_toggle_dt(&led); - if (ret < 0) { - return 0; + uint8_t ch; + if (board_uart_read(&ch, 1) > 0) { + board_uart_write(&ch, 1); } - - led_state = !led_state; - printf("LED state: %s\n", led_state ? "ON" : "OFF"); - k_msleep(SLEEP_TIME_MS); } - return 0; } -#endif #if TUSB_MCU_VENDOR_ESPRESSIF void app_main(void) { diff --git a/hw/bsp/family_support.cmake b/hw/bsp/family_support.cmake index f9ce47173..04d537376 100644 --- a/hw/bsp/family_support.cmake +++ b/hw/bsp/family_support.cmake @@ -346,29 +346,29 @@ endfunction() # RPI specific: refactor later #---------------------------------- function(family_add_default_example_warnings TARGET) -# target_compile_options(${TARGET} PUBLIC -# -Wall -# -Wextra -# -Werror -# -Wfatal-errors -# -Wdouble-promotion -# -Wfloat-equal -# # FIXME commented out because of https://github.com/raspberrypi/pico-sdk/issues/1468 -# #-Wshadow -# -Wwrite-strings -# -Wsign-compare -# -Wmissing-format-attribute -# -Wunreachable-code -# -Wcast-align -# -Wcast-qual -# -Wnull-dereference -# -Wuninitialized -# -Wunused -# -Wredundant-decls -# #-Wstrict-prototypes -# #-Werror-implicit-function-declaration -# #-Wundef -# ) + target_compile_options(${TARGET} PUBLIC + -Wall + -Wextra + -Werror + -Wfatal-errors + -Wdouble-promotion + -Wfloat-equal + # FIXME commented out because of https://github.com/raspberrypi/pico-sdk/issues/1468 + #-Wshadow + -Wwrite-strings + -Wsign-compare + -Wmissing-format-attribute + -Wunreachable-code + -Wcast-align + -Wcast-qual + -Wnull-dereference + -Wuninitialized + -Wunused + -Wredundant-decls + #-Wstrict-prototypes + #-Werror-implicit-function-declaration + #-Wundef + ) if (CMAKE_C_COMPILER_ID STREQUAL "GNU") if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 12.0 AND NO_WARN_RWX_SEGMENTS_SUPPORTED) diff --git a/hw/bsp/lpc11/family.c b/hw/bsp/lpc11/family.c index 566449ca0..b5371632c 100644 --- a/hw/bsp/lpc11/family.c +++ b/hw/bsp/lpc11/family.c @@ -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 //--------------------------------------------------------------------+ diff --git a/hw/bsp/lpc11/family.cmake b/hw/bsp/lpc11/family.cmake index a9febfc7f..6781b20c6 100644 --- a/hw/bsp/lpc11/family.cmake +++ b/hw/bsp/lpc11/family.cmake @@ -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 diff --git a/hw/bsp/lpc18/family.c b/hw/bsp/lpc18/family.c index 8f6dbcd4a..0db5c83b6 100644 --- a/hw/bsp/lpc18/family.c +++ b/hw/bsp/lpc18/family.c @@ -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 //--------------------------------------------------------------------+ diff --git a/hw/bsp/lpc18/family.mk b/hw/bsp/lpc18/family.mk index f625e926a..f120f63b2 100644 --- a/hw/bsp/lpc18/family.mk +++ b/hw/bsp/lpc18/family.mk @@ -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 diff --git a/hw/bsp/lpc43/family.c b/hw/bsp/lpc43/family.c index fe6c7b0c8..591090c36 100644 --- a/hw/bsp/lpc43/family.c +++ b/hw/bsp/lpc43/family.c @@ -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 *------------------------------------------------------------------*/ diff --git a/hw/bsp/lpc43/family.cmake b/hw/bsp/lpc43/family.cmake index 9d993a698..23c4aecea 100644 --- a/hw/bsp/lpc43/family.cmake +++ b/hw/bsp/lpc43/family.cmake @@ -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 diff --git a/hw/bsp/lpc43/family.mk b/hw/bsp/lpc43/family.mk index 84e7c30b3..e1406aae7 100644 --- a/hw/bsp/lpc43/family.mk +++ b/hw/bsp/lpc43/family.mk @@ -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 \ diff --git a/hw/bsp/nrf/family.mk b/hw/bsp/nrf/family.mk index f5a3f5c45..a8acb1624 100644 --- a/hw/bsp/nrf/family.mk +++ b/hw/bsp/nrf/family.mk @@ -45,6 +45,7 @@ SRC_C += \ INC += \ $(TOP)/$(BOARD_PATH) \ + $(TOP)/$(FAMILY_PATH)/nrfx_config \ $(TOP)/lib/CMSIS_5/CMSIS/Core/Include \ $(TOP)/${NRFX_PATH} \ $(TOP)/${NRFX_PATH}/mdk \ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index bf926fd09..7b3ab4d42 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -40,35 +40,3 @@ function(tinyusb_target_add TARGET) ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/../lib/networking ) endfunction() - -#------------------------------------ -# TinyUSB as library target -#------------------------------------ -#if (NOT DEFINED TINYUSB_TARGET) -# set(TINYUSB_TARGET "tinyusb") -#endif () -# -#set(TINYUSB_CONFIG_TARGET "${TINYUSB_TARGET}_config") -# -#if (DEFINED TINYUSB_TARGET_PREFIX) -# set(TINYUSB_TARGET "${TINYUSB_TARGET_PREFIX}${TINYUSB_TARGET}") -# set(TINYUSB_CONFIG_TARGET "${TINYUSB_TARGET_PREFIX}${TINYUSB_CONFIG_TARGET}") -#endif () -# -#if (DEFINED TINYUSB_TARGET_SUFFIX) -# set(TINYUSB_TARGET "${TINYUSB_TARGET}${TINYUSB_TARGET_SUFFIX}") -# set(TINYUSB_CONFIG_TARGET "${TINYUSB_CONFIG_TARGET}${TINYUSB_TARGET_SUFFIX}") -#endif () -# -#add_library(${TINYUSB_TARGET} STATIC) -#tinyusb_target_add(${TINYUSB_TARGET}) -# -## Check if tinyusb_config target is defined -#if (NOT TARGET ${TINYUSB_CONFIG_TARGET}) -# message(FATAL_ERROR "${TINYUSB_CONFIG_TARGET} target is not defined") -#endif() -# -## Link with tinyusb_config target -#target_link_libraries(${TINYUSB_TARGET} PUBLIC -# ${TINYUSB_CONFIG_TARGET} -# )