mirror of
https://github.com/hathach/tinyusb.git
synced 2025-01-17 05:32:55 +08:00
fix build warnings
This commit is contained in:
parent
a7f330fa94
commit
e754795d3a
2
.github/workflows/build_iar.yml
vendored
2
.github/workflows/build_iar.yml
vendored
@ -32,7 +32,7 @@ jobs:
|
||||
# Alphabetical order
|
||||
# Note: bundle multiple families into a matrix since there is only one self-hosted instance can
|
||||
# run IAR build. Too many matrix can hurt due to setup/teardown overhead.
|
||||
- 'stm32f0 stm32f1 stm32f4 stm32f7 stm32g4 stm32h7 stm32l4'
|
||||
- 'stm32f0 stm32f1 stm32f7 stm32h7 stm32l4'
|
||||
steps:
|
||||
- name: Clean workspace
|
||||
run: |
|
||||
|
@ -268,7 +268,7 @@ bool tud_audio_set_req_entity_cb(uint8_t rhport, tusb_control_request_t const *
|
||||
|
||||
sampFreq = (uint32_t)((audio_control_cur_4_t *)pBuff)->bCur;
|
||||
|
||||
TU_LOG2("Clock set current freq: %d\r\n", sampFreq);
|
||||
TU_LOG2("Clock set current freq: %lu\r\n", sampFreq);
|
||||
|
||||
return true;
|
||||
break;
|
||||
|
@ -21,6 +21,13 @@ target_sources(${PROJECT} PUBLIC
|
||||
${TOP}/lib/fatfs/source/ffunicode.c
|
||||
)
|
||||
|
||||
# Suppress warnings on fatfs
|
||||
set_source_files_properties(
|
||||
${TOP}/lib/fatfs/source/ff.c
|
||||
PROPERTIES
|
||||
COMPILE_FLAGS "-Wno-conversion -Wno-cast-qual"
|
||||
)
|
||||
|
||||
# Example include
|
||||
target_include_directories(${PROJECT} PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
|
@ -28,6 +28,7 @@ SRC_C += \
|
||||
src/common/tusb_fifo.c \
|
||||
src/device/usbd.c \
|
||||
src/device/usbd_control.c \
|
||||
src/typec/usbc.c \
|
||||
src/class/audio/audio_device.c \
|
||||
src/class/cdc/cdc_device.c \
|
||||
src/class/dfu/dfu_device.c \
|
||||
|
@ -63,9 +63,6 @@ int main(void)
|
||||
|
||||
tuc_init(0, TUSB_TYPEC_PORT_SNK);
|
||||
|
||||
uint32_t start_ms = 0;
|
||||
bool led_state = false;
|
||||
|
||||
while (1) {
|
||||
led_blinking_task();
|
||||
|
||||
@ -155,6 +152,7 @@ bool tuc_pd_data_received_cb(uint8_t rhport, pd_header_t const* header, uint8_t
|
||||
}
|
||||
|
||||
bool tuc_pd_control_received_cb(uint8_t rhport, pd_header_t const* header) {
|
||||
(void) rhport;
|
||||
switch (header->msg_type) {
|
||||
case PD_CTRL_ACCEPT:
|
||||
printf("PD Request Accepted\r\n");
|
||||
|
@ -19,6 +19,33 @@ if (NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/${FAMILY}/family.cmake)
|
||||
message(FATAL_ERROR "Family '${FAMILY}' is not known/supported")
|
||||
endif()
|
||||
|
||||
set(WARNING_FLAGS_GNU
|
||||
-Wall
|
||||
-Wextra
|
||||
-Werror
|
||||
-Wfatal-errors
|
||||
-Wdouble-promotion
|
||||
-Wstrict-prototypes
|
||||
-Wstrict-overflow
|
||||
-Werror-implicit-function-declaration
|
||||
-Wfloat-equal
|
||||
-Wundef
|
||||
-Wshadow
|
||||
-Wwrite-strings
|
||||
-Wsign-compare
|
||||
-Wmissing-format-attribute
|
||||
-Wunreachable-code
|
||||
-Wcast-align
|
||||
-Wcast-function-type
|
||||
-Wcast-qual
|
||||
-Wnull-dereference
|
||||
-Wuninitialized
|
||||
-Wunused
|
||||
-Wreturn-type
|
||||
-Wredundant-decls
|
||||
)
|
||||
|
||||
set(WARNINGS_FLAGS_IAR "")
|
||||
|
||||
function(family_filter RESULT DIR)
|
||||
get_filename_component(DIR ${DIR} ABSOLUTE BASE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
@ -121,6 +148,8 @@ function(family_configure_common TARGET)
|
||||
COMMAND ${CMAKE_SIZE} $<TARGET_FILE:${TARGET}>
|
||||
)
|
||||
|
||||
target_compile_options(${TARGET} PUBLIC ${WARNING_FLAGS_${CMAKE_C_COMPILER_ID}})
|
||||
|
||||
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
||||
# Generate map file
|
||||
target_link_options(${TARGET} PUBLIC
|
||||
|
@ -26,12 +26,23 @@
|
||||
|
||||
#include "bsp/board.h"
|
||||
#include "board.h"
|
||||
|
||||
// Suppress warning caused by mcu driver
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wunused-parameter"
|
||||
#endif
|
||||
|
||||
#include "fsl_device_registers.h"
|
||||
#include "fsl_gpio.h"
|
||||
#include "fsl_iomuxc.h"
|
||||
#include "fsl_clock.h"
|
||||
#include "fsl_lpuart.h"
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
#include "clock_config.h"
|
||||
|
||||
#if defined(BOARD_TUD_RHPORT) && CFG_TUD_ENABLED
|
||||
|
@ -102,6 +102,7 @@ function(family_configure_example TARGET)
|
||||
# external driver
|
||||
${TOP}/lib/sct_neopixel/sct_neopixel.c
|
||||
)
|
||||
|
||||
target_include_directories(${TARGET} PUBLIC
|
||||
# family, hw, board
|
||||
${CMAKE_CURRENT_FUNCTION_LIST_DIR}
|
||||
|
@ -27,6 +27,15 @@
|
||||
#include "bsp/board.h"
|
||||
#include "board.h"
|
||||
|
||||
// Suppress warning caused by mcu driver
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wcast-qual"
|
||||
#pragma GCC diagnostic ignored "-Wcast-align"
|
||||
#pragma GCC diagnostic ignored "-Wunused-parameter"
|
||||
#pragma GCC diagnostic ignored "-Wundef"
|
||||
#endif
|
||||
|
||||
#include "nrfx.h"
|
||||
#include "hal/nrf_gpio.h"
|
||||
#include "drivers/include/nrfx_power.h"
|
||||
@ -37,6 +46,11 @@
|
||||
#include "nrf_soc.h"
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// Forward USB interrupt events to TinyUSB IRQ Handler
|
||||
//--------------------------------------------------------------------+
|
||||
|
@ -36,6 +36,7 @@ IAR_ASFLAGS += --cpu cortex-m4 --fpu VFPv4
|
||||
|
||||
SRC_C += \
|
||||
src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c \
|
||||
src/portable/st/typec/typec_stm32.c \
|
||||
$(ST_CMSIS)/Source/Templates/system_stm32$(ST_FAMILY)xx.c \
|
||||
$(ST_HAL_DRIVER)/Src/stm32$(ST_FAMILY)xx_hal.c \
|
||||
$(ST_HAL_DRIVER)/Src/stm32$(ST_FAMILY)xx_hal_cortex.c \
|
||||
|
@ -183,9 +183,9 @@ bool tcd_init(uint8_t rhport, uint32_t port_type) {
|
||||
|
||||
// Read Voltage State on CC1 & CC2 fore initial state
|
||||
uint32_t v_cc[2];
|
||||
(void) v_cc;
|
||||
v_cc[0] = (UCPD1->SR >> UCPD_SR_TYPEC_VSTATE_CC1_Pos) & 0x03;
|
||||
v_cc[1] = (UCPD1->SR >> UCPD_SR_TYPEC_VSTATE_CC2_Pos) & 0x03;
|
||||
|
||||
TU_LOG1("Initial VState CC1 = %lu, CC2 = %lu\r\n", v_cc[0], v_cc[1]);
|
||||
|
||||
// Enable CC1 & CC2 Interrupt
|
||||
@ -308,8 +308,11 @@ void tcd_int_handler(uint8_t rhport) {
|
||||
|
||||
if (!(sr & UCPD_SR_RXERR)) {
|
||||
// response with good crc
|
||||
_good_crc.msg_id = ((pd_header_t const*) _rx_buf)->msg_id;
|
||||
dma_tx_start(rhport, &_good_crc, 2);
|
||||
// TODO move this to usbc stack
|
||||
if (_rx_buf) {
|
||||
_good_crc.msg_id = ((pd_header_t const *) _rx_buf)->msg_id;
|
||||
dma_tx_start(rhport, &_good_crc, 2);
|
||||
}
|
||||
|
||||
result = XFER_RESULT_SUCCESS;
|
||||
}else {
|
||||
|
@ -35,32 +35,6 @@ set(TOOLCHAIN_EXE_LINKER_FLAGS
|
||||
-Wl,--cref
|
||||
)
|
||||
|
||||
set(TOOLCHAIN_WARNING_FLAGS
|
||||
-Wall
|
||||
-Wextra
|
||||
-Werror
|
||||
-Wfatal-errors
|
||||
-Wdouble-promotion
|
||||
-Wstrict-prototypes
|
||||
-Wstrict-overflow
|
||||
-Werror-implicit-function-declaration
|
||||
-Wfloat-equal
|
||||
-Wundef
|
||||
-Wshadow
|
||||
-Wwrite-strings
|
||||
-Wsign-compare
|
||||
-Wmissing-format-attribute
|
||||
-Wunreachable-code
|
||||
-Wcast-align
|
||||
-Wcast-function-type
|
||||
-Wcast-qual
|
||||
-Wnull-dereference
|
||||
-Wuninitialized
|
||||
-Wunused
|
||||
-Wreturn-type
|
||||
-Wredundant-decls
|
||||
)
|
||||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/set_flags.cmake)
|
||||
|
||||
# try_compile is cmake test compiling its own example,
|
||||
|
@ -28,7 +28,4 @@ list(APPEND TOOLCHAIN_COMMON_FLAGS
|
||||
list(APPEND TOOLCHAIN_EXE_LINKER_FLAGS
|
||||
)
|
||||
|
||||
list(APPEND TOOLCHAIN_WARNING_FLAGS
|
||||
)
|
||||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/set_flags.cmake)
|
||||
|
Loading…
x
Reference in New Issue
Block a user