mirror of
https://github.com/hathach/tinyusb.git
synced 2025-01-31 05:52:55 +08:00
fix ci
This commit is contained in:
parent
6b3a5957c2
commit
8c7998b0e9
@ -23,7 +23,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#if 1
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@ -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 <stdio.h>
|
||||
#include <zephyr/kernel.h>
|
||||
#include <zephyr/drivers/gpio.h>
|
||||
|
||||
/* 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) {
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
//--------------------------------------------------------------------+
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
//--------------------------------------------------------------------+
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
*------------------------------------------------------------------*/
|
||||
|
@ -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
|
||||
|
@ -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 \
|
||||
|
||||
|
@ -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 \
|
||||
|
@ -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}
|
||||
# )
|
||||
|
Loading…
x
Reference in New Issue
Block a user