add -Wextra for more warnings to example

non-stack warning (probably mcu driver) should be suppressed in the
board.mk
This commit is contained in:
hathach 2019-09-27 00:15:43 +07:00
parent 7ba8e81852
commit 6183dbd0ce
30 changed files with 95 additions and 43 deletions

View File

@ -56,6 +56,7 @@ CFLAGS += \
-Wno-endif-labels \
-Wstrict-prototypes \
-Wall \
-Wextra \
-Werror \
-Werror-implicit-function-declaration \
-Wfatal-errors \

View File

@ -9,7 +9,10 @@ CFLAGS += \
-DCONFIG_GPIO_AS_PINRESET
# nrfx issue undef _ARMCC_VERSION usage https://github.com/NordicSemiconductor/nrfx/issues/49
CFLAGS += -Wno-error=undef
CFLAGS += -Wno-error=undef -Wno-error=unused-parameter
# due to tusb_hal_nrf_power_event
CFLAGS += -Wno-error=cast-function-type
# All source paths should be relative to the top level.
LD_FILE = hw/bsp/circuitplayground_bluefruit/nrf52840_s140_v6.ld

View File

@ -8,8 +8,8 @@ CFLAGS += \
-DCFG_TUSB_MEM_SECTION='__attribute__((section(".data.$$RAM2")))' \
-D__USE_LPCOPEN
# lpc_types.h cause following errors
CFLAGS += -Wno-error=strict-prototypes
# mcu driver cause following warnings
CFLAGS += -Wno-error=strict-prototypes -Wno-error=unused-parameter
MCU_DIR = hw/mcu/nxp/lpc_driver/lpc40xx/lpc_chip_40xx

View File

@ -7,8 +7,8 @@ CFLAGS += \
-DCFG_TUSB_MCU=OPT_MCU_LPC43XX \
-D__USE_LPCOPEN
# lpc_types.h cause following errors
CFLAGS += -Wno-error=strict-prototypes
# mcu driver cause following warnings
CFLAGS += -Wno-error=unused-parameter -Wno-error=strict-prototypes
MCU_DIR = hw/mcu/nxp/lpc_driver/lpc43xx/lpc_chip_43xx

View File

@ -9,7 +9,10 @@ CFLAGS += \
-DCONFIG_GPIO_AS_PINRESET
# nrfx issue undef _ARMCC_VERSION usage https://github.com/NordicSemiconductor/nrfx/issues/49
CFLAGS += -Wno-error=undef
CFLAGS += -Wno-error=undef -Wno-error=unused-parameter
# due to tusb_hal_nrf_power_event
CFLAGS += -Wno-error=cast-function-type
# All source paths should be relative to the top level.
LD_FILE = hw/bsp/feather_nrf52840_express/nrf52840_s140_v6.ld

View File

@ -10,8 +10,8 @@ CFLAGS += \
-DCFG_TUSB_MEM_SECTION='__attribute__((section(".data.$$RAM2")))' \
-DCFG_TUSB_MEM_ALIGN='__attribute__((aligned(64)))'
# startup.c and lpc_types.h cause following errors
CFLAGS += -Wno-error=nested-externs -Wno-error=strict-prototypes
# mcu driver cause following warnings
CFLAGS += -Wno-error=nested-externs -Wno-error=strict-prototypes -Wno-error=unused-parameter
MCU_DIR = hw/mcu/nxp/lpc_driver/lpc11uxx/lpc_chip_11uxx

View File

@ -7,8 +7,8 @@ CFLAGS += \
-DCFG_TUSB_MEM_SECTION='__attribute__((section(".data")))' \
-DCFG_TUSB_MEM_ALIGN='__attribute__((aligned(64)))'
# system_LPC51U68.c cause following errors
CFLAGS += -Wno-error=nested-externs
# mcu driver cause following warnings
CFLAGS += -Wno-error=nested-externs -Wno-error=unused-parameter
MCU_DIR = hw/mcu/nxp/lpc_driver/lpc51u6x/devices/LPC51U68

View File

@ -9,6 +9,9 @@ CFLAGS += \
-DCFG_TUSB_MEM_SECTION='__attribute__((section(".data")))' \
-DCFG_TUSB_MEM_ALIGN='__attribute__((aligned(64)))'
# mcu driver cause following warnings
CFLAGS += -Wno-error=unused-parameter
MCU_DIR = hw/mcu/nxp/lpc_driver/lpc54xxx/devices/LPC54114
# All source paths should be relative to the top level.

View File

@ -7,10 +7,10 @@ CFLAGS += \
-DCPU_LPC55S69JBD100_cm33_core0 \
-DCFG_TUSB_MCU=OPT_MCU_LPC55XX \
-DCFG_TUSB_MEM_SECTION='__attribute__((section(".data")))' \
-DCFG_TUSB_MEM_ALIGN='__attribute__((aligned(64)))'
-DCFG_TUSB_MEM_ALIGN='__attribute__((aligned(64)))'
# system_LPC55S69_cm33_core0.c cause following errors
CFLAGS += -Wno-error=float-equal -Wno-error=nested-externs
# mcu driver cause following warnings
CFLAGS += -Wno-error=unused-parameter -Wno-error=float-equal -Wno-error=nested-externs
MCU_DIR = hw/mcu/nxp/lpc_driver/lpc55xx/devices/LPC55S69

View File

@ -7,8 +7,8 @@ CFLAGS += \
-DCFG_TUSB_MCU=OPT_MCU_LPC18XX \
-D__USE_LPCOPEN
# lpc_types.h cause following errors
CFLAGS += -Wno-error=strict-prototypes
# mcu driver cause following warnings
CFLAGS += -Wno-error=unused-parameter -Wno-error=strict-prototypes
MCU_DIR = hw/mcu/nxp/lpc_driver/lpc18xx/lpc_chip_18xx

View File

@ -7,8 +7,8 @@ CFLAGS += \
-DCFG_TUSB_MCU=OPT_MCU_LPC43XX \
-D__USE_LPCOPEN
# lpc_types.h cause following errors
CFLAGS += -Wno-error=strict-prototypes
# mcu driver cause following warnings
CFLAGS += -Wno-error=strict-prototypes -Wno-error=unused-parameter
MCU_DIR = hw/mcu/nxp/lpc_driver/lpc43xx/lpc_chip_43xx

View File

@ -9,7 +9,10 @@ CFLAGS += \
-DCFG_TUSB_MCU=OPT_MCU_NRF5X
# nrfx issue undef _ARMCC_VERSION usage https://github.com/NordicSemiconductor/nrfx/issues/49
CFLAGS += -Wno-error=undef
CFLAGS += -Wno-error=undef -Wno-error=unused-parameter
# due to tusb_hal_nrf_power_event
CFLAGS += -Wno-error=cast-function-type
# All source paths should be relative to the top level.
LD_FILE = hw/mcu/nordic/nrfx/mdk/nrf52840_xxaa.ld

View File

@ -96,7 +96,8 @@ void board_init(void)
nrfx_power_init(&pwr_cfg);
// Register tusb function as USB power handler
const nrfx_power_usbevt_config_t config = { .handler = (nrfx_power_usb_event_handler_t) tusb_hal_nrf_power_event };
// cause cast-function-type warning
const nrfx_power_usbevt_config_t config = { .handler = ((nrfx_power_usb_event_handler_t) tusb_hal_nrf_power_event) };
nrfx_power_usbevt_init(&config);
nrfx_power_usbevt_enable();

View File

@ -9,7 +9,10 @@ CFLAGS += \
-DCFG_TUSB_MCU=OPT_MCU_NRF5X
# nrfx issue undef _ARMCC_VERSION usage https://github.com/NordicSemiconductor/nrfx/issues/49
CFLAGS += -Wno-error=undef
CFLAGS += -Wno-error=undef -Wno-error=unused-parameter
# due to tusb_hal_nrf_power_event
CFLAGS += -Wno-error=cast-function-type
# All source paths should be relative to the top level.
LD_FILE = hw/bsp/$(BOARD)/$(BOARD).ld

View File

@ -9,6 +9,9 @@ CFLAGS += \
-DCFG_EXAMPLE_MSC_READONLY \
-DCFG_TUSB_MCU=OPT_MCU_STM32F0
# mcu driver cause following warnings
CFLAGS += -Wno-error=unused-parameter
ST_HAL_DRIVER = hw/mcu/st/st_driver/STM32F0xx_HAL_Driver
ST_CMSIS = hw/mcu/st/st_driver/CMSIS/Device/ST/STM32F0xx

View File

@ -9,6 +9,9 @@ CFLAGS += \
-DCFG_EXAMPLE_MSC_READONLY \
-DCFG_TUSB_MCU=OPT_MCU_STM32F0
# mcu driver cause following warnings
CFLAGS += -Wno-error=unused-parameter
ST_HAL_DRIVER = hw/mcu/st/st_driver/STM32F0xx_HAL_Driver
ST_CMSIS = hw/mcu/st/st_driver/CMSIS/Device/ST/STM32F0xx

View File

@ -8,7 +8,7 @@ CFLAGS += \
-nostdlib -nostartfiles \
-DCFG_TUSB_MCU=OPT_MCU_STM32F2
# Suppress following warnings/error is required due to STM32F2xx_HAL_Driver.
# mcu driver cause following warnings
CFLAGS += -Wno-error=sign-compare
ST_HAL_DRIVER = hw/mcu/st/st_driver/STM32F2xx_HAL_Driver

View File

@ -9,6 +9,9 @@ CFLAGS += \
-nostdlib -nostartfiles \
-DCFG_TUSB_MCU=OPT_MCU_STM32F3
# mcu driver cause following warnings
CFLAGS += -Wno-error=unused-parameter
ST_HAL_DRIVER = hw/mcu/st/st_driver/STM32F3xx_HAL_Driver
ST_CMSIS = hw/mcu/st/st_driver/CMSIS/Device/ST/STM32F3xx

View File

@ -9,6 +9,9 @@ CFLAGS += \
-nostdlib -nostartfiles \
-DCFG_TUSB_MCU=OPT_MCU_STM32F4
# mcu driver cause following warnings
CFLAGS += -Wno-error=maybe-uninitialized
ST_HAL_DRIVER = hw/mcu/st/st_driver/STM32F4xx_HAL_Driver
ST_CMSIS = hw/mcu/st/st_driver/CMSIS/Device/ST/STM32F4xx

View File

@ -9,8 +9,8 @@ CFLAGS += \
-nostdlib -nostartfiles \
-DCFG_TUSB_MCU=OPT_MCU_STM32F7
# Suppress following warnings/error is required due to STM32F7xx_HAL_Driver.
CFLAGS += -Wno-error=shadow
# mcu driver cause following warnings
CFLAGS += -Wno-error=shadow
ST_HAL_DRIVER = hw/mcu/st/st_driver/STM32F7xx_HAL_Driver
ST_CMSIS = hw/mcu/st/st_driver/CMSIS/Device/ST/STM32F7xx

View File

@ -174,15 +174,16 @@ uint32_t board_button_read(void)
int board_uart_read(uint8_t* buf, int len)
{
(void) buf; (void) len;
return 0;
}
int board_uart_write(void const * buf, int len)
{
(void) buf; (void) len;
return 0;
}
#if CFG_TUSB_OS == OPT_OS_NONE
volatile uint32_t system_ticks = 0;
void SysTick_Handler (void)

View File

@ -9,6 +9,9 @@ CFLAGS += \
-nostdlib -nostartfiles \
-DCFG_TUSB_MCU=OPT_MCU_STM32H7
# mcu driver cause following warnings
CFLAGS += -Wno-error=maybe-uninitialized
ST_HAL_DRIVER = hw/mcu/st/st_driver/STM32H7xx_HAL_Driver
ST_CMSIS = hw/mcu/st/st_driver/CMSIS/Device/ST/STM32H7xx

View File

@ -197,11 +197,13 @@ uint32_t board_button_read(void)
int board_uart_read(uint8_t* buf, int len)
{
(void) buf; (void) len;
return 0;
}
int board_uart_write(void const * buf, int len)
{
(void) buf; (void) len;
return 0;
}

View File

@ -9,6 +9,8 @@ CFLAGS += \
-DCFG_EXAMPLE_MSC_READONLY \
-DCFG_TUSB_MCU=OPT_MCU_STM32L0
# mcu driver cause following warnings
CFLAGS += -Wno-error=unused-parameter -Wno-error=maybe-uninitialized
ST_HAL_DRIVER = hw/mcu/st/st_driver/STM32L0xx_HAL_Driver
ST_CMSIS = hw/mcu/st/st_driver/CMSIS/Device/ST/STM32L0xx

View File

@ -86,16 +86,19 @@ bool tud_midi_n_mounted (uint8_t itf)
//--------------------------------------------------------------------+
uint32_t tud_midi_n_available(uint8_t itf, uint8_t jack_id)
{
(void) jack_id;
return tu_fifo_count(&_midid_itf[itf].rx_ff);
}
uint32_t tud_midi_n_read(uint8_t itf, uint8_t jack_id, void* buffer, uint32_t bufsize)
{
(void) jack_id;
return tu_fifo_read_n(&_midid_itf[itf].rx_ff, buffer, bufsize);
}
void tud_midi_n_read_flush (uint8_t itf, uint8_t jack_id)
{
(void) jack_id;
tu_fifo_clear(&_midid_itf[itf].rx_ff);
}
@ -128,6 +131,8 @@ void midi_rx_done_cb(midid_interface_t* midi, uint8_t const* buffer, uint32_t bu
static bool maybe_transmit(midid_interface_t* midi, uint8_t itf_index)
{
(void) itf_index;
// skip if previous transfer not complete
TU_VERIFY( !usbd_edpt_busy(TUD_OPT_RHPORT, midi->ep_in) );
@ -309,11 +314,15 @@ bool midid_open(uint8_t rhport, tusb_desc_interface_t const * p_interface_desc,
bool midid_control_complete(uint8_t rhport, tusb_control_request_t const * p_request)
{
return false;
(void) rhport;
(void) p_request;
return true;
}
bool midid_control_request(uint8_t rhport, tusb_control_request_t const * p_request)
{
(void) rhport;
//------------- Class Specific Request -------------//
if (p_request->bmRequestType_bit.type != TUSB_REQ_TYPE_CLASS) return false;
@ -322,6 +331,8 @@ bool midid_control_request(uint8_t rhport, tusb_control_request_t const * p_requ
bool midid_xfer_cb(uint8_t rhport, uint8_t ep_addr, xfer_result_t result, uint32_t xferred_bytes)
{
(void) result;
// TODO Support multiple interfaces
uint8_t const itf = 0;
midid_interface_t* p_midi = &_midid_itf[itf];

View File

@ -145,6 +145,8 @@ typedef osal_queue_def_t* osal_queue_t;
// lock queue by disable usb isr
static inline void _osal_q_lock(osal_queue_t qhdl)
{
(void) qhdl;
#if TUSB_OPT_DEVICE_ENABLED
if (qhdl->role == OPT_MODE_DEVICE) dcd_int_disable(TUD_OPT_RHPORT);
#endif
@ -157,6 +159,8 @@ static inline void _osal_q_lock(osal_queue_t qhdl)
// unlock queue
static inline void _osal_q_unlock(osal_queue_t qhdl)
{
(void) qhdl;
#if TUSB_OPT_DEVICE_ENABLED
if (qhdl->role == OPT_MODE_DEVICE) dcd_int_enable(TUD_OPT_RHPORT);
#endif

View File

@ -103,17 +103,17 @@
#include "tusb_option.h"
#define STM32F1_FSDEV ( \
defined(STM32F102x6) || defined(STM32F102xB) || \
#if defined(STM32F102x6) || defined(STM32F102xB) || \
defined(STM32F103x6) || defined(STM32F103xB) || \
defined(STM32F103xE) || defined(STM32F103xG) \
)
defined(STM32F103xE) || defined(STM32F103xG)
#define STM32F1_FSDEV
#endif
#if (TUSB_OPT_DEVICE_ENABLED) && ( \
(CFG_TUSB_MCU == OPT_MCU_STM32F0 ) || \
(CFG_TUSB_MCU == OPT_MCU_STM32F1 && STM32F1_FSDEV ) || \
(CFG_TUSB_MCU == OPT_MCU_STM32F3 ) || \
(CFG_TUSB_MCU == OPT_MCU_STM32L0 ) \
(CFG_TUSB_MCU == OPT_MCU_STM32F0 ) || \
(CFG_TUSB_MCU == OPT_MCU_STM32F1 && defined(STM32F1_FSDEV)) || \
(CFG_TUSB_MCU == OPT_MCU_STM32F3 ) || \
(CFG_TUSB_MCU == OPT_MCU_STM32L0 ) \
)
// In order to reduce the dependance on HAL, we undefine this.

View File

@ -52,7 +52,7 @@
// 070RB: 2 x 16 bits/word memory LPM Support, BCD Support
// PMA dedicated to USB (no sharing with CAN)
#elif STM32F1_FSDEV
#elif defined(STM32F1_FSDEV)
#include "stm32f1xx.h"
#define PMA_LENGTH (512u)
// NO internal Pull-ups

View File

@ -27,19 +27,19 @@
#include "tusb_option.h"
#define STM32L4_SYNOPSYS ( \
defined (STM32L475xx) || defined (STM32L476xx) || \
#if defined (STM32L475xx) || defined (STM32L476xx) || \
defined (STM32L485xx) || defined (STM32L486xx) || defined (STM32L496xx) || \
defined (STM32L4R5xx) || defined (STM32L4R7xx) || defined (STM32L4R9xx) || \
defined (STM32L4S5xx) || defined (STM32L4S7xx) || defined (STM32L4S9xx) \
)
defined (STM32L4S5xx) || defined (STM32L4S7xx) || defined (STM32L4S9xx)
#define STM32L4_SYNOPSYS
#endif
#if TUSB_OPT_DEVICE_ENABLED && \
( CFG_TUSB_MCU == OPT_MCU_STM32F2 || \
CFG_TUSB_MCU == OPT_MCU_STM32F4 || \
CFG_TUSB_MCU == OPT_MCU_STM32F7 || \
CFG_TUSB_MCU == OPT_MCU_STM32H7 || \
(CFG_TUSB_MCU == OPT_MCU_STM32L4 && STM32L4_SYNOPSYS) \
(CFG_TUSB_MCU == OPT_MCU_STM32L4 && defined(STM32L4_SYNOPSYS)) \
)
// TODO Support OTG_HS

View File

@ -46,13 +46,13 @@ for example in all_examples:
build_result = build_example(example, board)
build_duration = time.monotonic() - start_time
if build_result.returncode != 0:
if build_result.returncode == 0:
success = "\033[32msucceeded\033[0m"
success_count += 1
else:
exit_status = build_result.returncode
success = "\033[31mfailed\033[0m "
fail_count += 1
else:
success = "\033[32msucceeded\033[0m"
success_count += 1
if travis:
print('travis_fold:start:build-{}-{}\\r'.format(example, board))