enable -Wcast-align

suppress vendor sdk driver at board.mk
This commit is contained in:
hathach
2020-05-17 14:24:15 +07:00
parent 17869f0999
commit 1a8ce043ed
23 changed files with 50 additions and 41 deletions

View File

@@ -63,11 +63,9 @@ CFLAGS += \
-Wwrite-strings \ -Wwrite-strings \
-Wsign-compare \ -Wsign-compare \
-Wmissing-format-attribute \ -Wmissing-format-attribute \
-Wunreachable-code -Wunreachable-code \
-Wcast-align
# This causes lots of warning with nrf5x build due to nrfx code
# CFLAGS += -Wcast-align
# Debugging/Optimization # Debugging/Optimization
ifeq ($(DEBUG), 1) ifeq ($(DEBUG), 1)
CFLAGS += -Og -ggdb CFLAGS += -Og -ggdb

View File

@@ -9,8 +9,8 @@ CFLAGS += \
-DNRF52840_XXAA \ -DNRF52840_XXAA \
-DCONFIG_GPIO_AS_PINRESET -DCONFIG_GPIO_AS_PINRESET
# nrfx issue undef _ARMCC_VERSION usage https://github.com/NordicSemiconductor/nrfx/issues/49 # suppress warning caused by vendor mcu driver
CFLAGS += -Wno-error=undef -Wno-error=unused-parameter CFLAGS += -Wno-error=undef -Wno-error=unused-parameter -Wno-error=cast-align
# due to tusb_hal_nrf_power_event # due to tusb_hal_nrf_power_event
GCCVERSION = $(firstword $(subst ., ,$(shell arm-none-eabi-gcc -dumpversion))) GCCVERSION = $(firstword $(subst ., ,$(shell arm-none-eabi-gcc -dumpversion)))

View File

@@ -9,8 +9,8 @@ CFLAGS += \
-DNRF52840_XXAA \ -DNRF52840_XXAA \
-DCONFIG_GPIO_AS_PINRESET -DCONFIG_GPIO_AS_PINRESET
# nrfx issue undef _ARMCC_VERSION usage https://github.com/NordicSemiconductor/nrfx/issues/49 # suppress warning caused by vendor mcu driver
CFLAGS += -Wno-error=undef -Wno-error=unused-parameter CFLAGS += -Wno-error=undef -Wno-error=unused-parameter -Wno-error=cast-align
# due to tusb_hal_nrf_power_event # due to tusb_hal_nrf_power_event
GCCVERSION = $(firstword $(subst ., ,$(shell arm-none-eabi-gcc -dumpversion))) GCCVERSION = $(firstword $(subst ., ,$(shell arm-none-eabi-gcc -dumpversion)))

View File

@@ -9,8 +9,8 @@ CFLAGS += \
-DNRF52840_XXAA \ -DNRF52840_XXAA \
-DCONFIG_GPIO_AS_PINRESET -DCONFIG_GPIO_AS_PINRESET
# nrfx issue undef _ARMCC_VERSION usage https://github.com/NordicSemiconductor/nrfx/issues/49 # suppress warning caused by vendor mcu driver
CFLAGS += -Wno-error=undef -Wno-error=unused-parameter CFLAGS += -Wno-error=undef -Wno-error=unused-parameter -Wno-error=cast-align
# due to tusb_hal_nrf_power_event # due to tusb_hal_nrf_power_event
GCCVERSION = $(firstword $(subst ., ,$(shell arm-none-eabi-gcc -dumpversion))) GCCVERSION = $(firstword $(subst ., ,$(shell arm-none-eabi-gcc -dumpversion)))

View File

@@ -9,8 +9,8 @@ CFLAGS += \
-DNRF52840_XXAA \ -DNRF52840_XXAA \
-DCONFIG_GPIO_AS_PINRESET -DCONFIG_GPIO_AS_PINRESET
# nrfx issue undef _ARMCC_VERSION usage https://github.com/NordicSemiconductor/nrfx/issues/49 # suppress warning caused by vendor mcu driver
CFLAGS += -Wno-error=undef -Wno-error=unused-parameter CFLAGS += -Wno-error=undef -Wno-error=unused-parameter -Wno-error=cast-align
# due to tusb_hal_nrf_power_event # due to tusb_hal_nrf_power_event
GCCVERSION = $(firstword $(subst ., ,$(shell arm-none-eabi-gcc -dumpversion))) GCCVERSION = $(firstword $(subst ., ,$(shell arm-none-eabi-gcc -dumpversion)))

View File

@@ -9,8 +9,8 @@ CFLAGS += \
-DNRF52840_XXAA \ -DNRF52840_XXAA \
-DCONFIG_GPIO_AS_PINRESET -DCONFIG_GPIO_AS_PINRESET
# nrfx issue undef _ARMCC_VERSION usage https://github.com/NordicSemiconductor/nrfx/issues/49 # suppress warning caused by vendor mcu driver
CFLAGS += -Wno-error=undef -Wno-error=unused-parameter CFLAGS += -Wno-error=undef -Wno-error=unused-parameter -Wno-error=cast-align
# due to tusb_hal_nrf_power_event # due to tusb_hal_nrf_power_event
GCCVERSION = $(firstword $(subst ., ,$(shell arm-none-eabi-gcc -dumpversion))) GCCVERSION = $(firstword $(subst ., ,$(shell arm-none-eabi-gcc -dumpversion)))

View File

@@ -9,6 +9,9 @@ CFLAGS += \
-DSTM32F405xx \ -DSTM32F405xx \
-DCFG_TUSB_MCU=OPT_MCU_STM32F4 -DCFG_TUSB_MCU=OPT_MCU_STM32F4
# suppress warning caused by vendor mcu driver
CFLAGS += -Wno-error=cast-align
ST_HAL_DRIVER = hw/mcu/st/st_driver/STM32F4xx_HAL_Driver ST_HAL_DRIVER = hw/mcu/st/st_driver/STM32F4xx_HAL_Driver
ST_CMSIS = hw/mcu/st/st_driver/CMSIS/Device/ST/STM32F4xx ST_CMSIS = hw/mcu/st/st_driver/CMSIS/Device/ST/STM32F4xx

View File

@@ -8,8 +8,8 @@ CFLAGS += \
-DNRF52840_XXAA \ -DNRF52840_XXAA \
-DCFG_TUSB_MCU=OPT_MCU_NRF5X -DCFG_TUSB_MCU=OPT_MCU_NRF5X
# nrfx issue undef _ARMCC_VERSION usage https://github.com/NordicSemiconductor/nrfx/issues/49 # suppress warning caused by vendor mcu driver
CFLAGS += -Wno-error=undef -Wno-error=unused-parameter CFLAGS += -Wno-error=undef -Wno-error=unused-parameter -Wno-error=cast-align
# due to tusb_hal_nrf_power_event # due to tusb_hal_nrf_power_event
GCCVERSION = $(firstword $(subst ., ,$(shell arm-none-eabi-gcc -dumpversion))) GCCVERSION = $(firstword $(subst ., ,$(shell arm-none-eabi-gcc -dumpversion)))

View File

@@ -7,6 +7,9 @@ CFLAGS += \
-mfpu=fpv4-sp-d16 \ -mfpu=fpv4-sp-d16 \
-DCFG_TUSB_MCU=OPT_MCU_NUC505 -DCFG_TUSB_MCU=OPT_MCU_NUC505
# TODO this cast-align is caused by dcd_nuc505 should be fixed
CFLAGS += -Wno-error=cast-align
# All source paths should be relative to the top level. # All source paths should be relative to the top level.
LD_FILE = hw/bsp/$(BOARD)/nuc505_flashtoram.ld LD_FILE = hw/bsp/$(BOARD)/nuc505_flashtoram.ld
@@ -19,13 +22,11 @@ SRC_C += \
hw/mcu/nuvoton/nuc505/StdDriver/src/i2s.c \ hw/mcu/nuvoton/nuc505/StdDriver/src/i2s.c \
hw/mcu/nuvoton/nuc505/StdDriver/src/pwm.c \ hw/mcu/nuvoton/nuc505/StdDriver/src/pwm.c \
hw/mcu/nuvoton/nuc505/StdDriver/src/rtc.c \ hw/mcu/nuvoton/nuc505/StdDriver/src/rtc.c \
hw/mcu/nuvoton/nuc505/StdDriver/src/sd.c \
hw/mcu/nuvoton/nuc505/StdDriver/src/spi.c \ hw/mcu/nuvoton/nuc505/StdDriver/src/spi.c \
hw/mcu/nuvoton/nuc505/StdDriver/src/spim.c \ hw/mcu/nuvoton/nuc505/StdDriver/src/spim.c \
hw/mcu/nuvoton/nuc505/StdDriver/src/sys.c \ hw/mcu/nuvoton/nuc505/StdDriver/src/sys.c \
hw/mcu/nuvoton/nuc505/StdDriver/src/timer.c \ hw/mcu/nuvoton/nuc505/StdDriver/src/timer.c \
hw/mcu/nuvoton/nuc505/StdDriver/src/uart.c \ hw/mcu/nuvoton/nuc505/StdDriver/src/uart.c \
hw/mcu/nuvoton/nuc505/StdDriver/src/usbd.c \
hw/mcu/nuvoton/nuc505/StdDriver/src/wdt.c \ hw/mcu/nuvoton/nuc505/StdDriver/src/wdt.c \
hw/mcu/nuvoton/nuc505/StdDriver/src/wwdt.c hw/mcu/nuvoton/nuc505/StdDriver/src/wwdt.c

View File

@@ -9,8 +9,8 @@ CFLAGS += \
-DCONFIG_GPIO_AS_PINRESET \ -DCONFIG_GPIO_AS_PINRESET \
-DCFG_TUSB_MCU=OPT_MCU_NRF5X -DCFG_TUSB_MCU=OPT_MCU_NRF5X
# nrfx issue undef _ARMCC_VERSION usage https://github.com/NordicSemiconductor/nrfx/issues/49 # suppress warning caused by vendor mcu driver
CFLAGS += -Wno-error=undef -Wno-error=unused-parameter CFLAGS += -Wno-error=undef -Wno-error=unused-parameter -Wno-error=cast-align
# due to tusb_hal_nrf_power_event # due to tusb_hal_nrf_power_event
GCCVERSION = $(firstword $(subst ., ,$(shell arm-none-eabi-gcc -dumpversion))) GCCVERSION = $(firstword $(subst ., ,$(shell arm-none-eabi-gcc -dumpversion)))

View File

@@ -9,8 +9,8 @@ CFLAGS += \
-DCONFIG_GPIO_AS_PINRESET \ -DCONFIG_GPIO_AS_PINRESET \
-DCFG_TUSB_MCU=OPT_MCU_NRF5X -DCFG_TUSB_MCU=OPT_MCU_NRF5X
# nrfx issue undef _ARMCC_VERSION usage https://github.com/NordicSemiconductor/nrfx/issues/49 # suppress warning caused by vendor mcu driver
CFLAGS += -Wno-error=undef -Wno-error=unused-parameter CFLAGS += -Wno-error=undef -Wno-error=unused-parameter -Wno-error=cast-align
# due to tusb_hal_nrf_power_event # due to tusb_hal_nrf_power_event
GCCVERSION = $(firstword $(subst ., ,$(shell arm-none-eabi-gcc -dumpversion))) GCCVERSION = $(firstword $(subst ., ,$(shell arm-none-eabi-gcc -dumpversion)))

View File

@@ -9,8 +9,8 @@ CFLAGS += \
-DCONFIG_GPIO_AS_PINRESET \ -DCONFIG_GPIO_AS_PINRESET \
-DCFG_TUSB_MCU=OPT_MCU_NRF5X -DCFG_TUSB_MCU=OPT_MCU_NRF5X
# nrfx issue undef _ARMCC_VERSION usage https://github.com/NordicSemiconductor/nrfx/issues/49 # suppress warning caused by vendor mcu driver
CFLAGS += -Wno-error=undef -Wno-error=unused-parameter CFLAGS += -Wno-error=undef -Wno-error=unused-parameter -Wno-error=cast-align
# due to tusb_hal_nrf_power_event # due to tusb_hal_nrf_power_event
GCCVERSION = $(firstword $(subst ., ,$(shell arm-none-eabi-gcc -dumpversion))) GCCVERSION = $(firstword $(subst ., ,$(shell arm-none-eabi-gcc -dumpversion)))

View File

@@ -8,8 +8,8 @@ CFLAGS += \
-DNRF52840_XXAA \ -DNRF52840_XXAA \
-DCFG_TUSB_MCU=OPT_MCU_NRF5X -DCFG_TUSB_MCU=OPT_MCU_NRF5X
# nrfx issue undef _ARMCC_VERSION usage https://github.com/NordicSemiconductor/nrfx/issues/49 # suppress warning caused by vendor mcu driver
CFLAGS += -Wno-error=undef -Wno-error=unused-parameter CFLAGS += -Wno-error=undef -Wno-error=unused-parameter -Wno-error=cast-align
# due to tusb_hal_nrf_power_event # due to tusb_hal_nrf_power_event
GCCVERSION = $(firstword $(subst ., ,$(shell arm-none-eabi-gcc -dumpversion))) GCCVERSION = $(firstword $(subst ., ,$(shell arm-none-eabi-gcc -dumpversion)))

View File

@@ -9,8 +9,8 @@ CFLAGS += \
-DCFG_EXAMPLE_MSC_READONLY \ -DCFG_EXAMPLE_MSC_READONLY \
-DCFG_TUSB_MCU=OPT_MCU_STM32F0 -DCFG_TUSB_MCU=OPT_MCU_STM32F0
# mcu driver cause following warnings # suppress warning caused by vendor mcu driver
CFLAGS += -Wno-error=unused-parameter CFLAGS += -Wno-error=unused-parameter -Wno-error=cast-align
ST_HAL_DRIVER = hw/mcu/st/st_driver/STM32F0xx_HAL_Driver ST_HAL_DRIVER = hw/mcu/st/st_driver/STM32F0xx_HAL_Driver
ST_CMSIS = hw/mcu/st/st_driver/CMSIS/Device/ST/STM32F0xx ST_CMSIS = hw/mcu/st/st_driver/CMSIS/Device/ST/STM32F0xx

View File

@@ -9,8 +9,8 @@ CFLAGS += \
-DCFG_EXAMPLE_MSC_READONLY \ -DCFG_EXAMPLE_MSC_READONLY \
-DCFG_TUSB_MCU=OPT_MCU_STM32F0 -DCFG_TUSB_MCU=OPT_MCU_STM32F0
# mcu driver cause following warnings # suppress warning caused by vendor mcu driver
CFLAGS += -Wno-error=unused-parameter CFLAGS += -Wno-error=unused-parameter -Wno-error=cast-align
ST_HAL_DRIVER = hw/mcu/st/st_driver/STM32F0xx_HAL_Driver ST_HAL_DRIVER = hw/mcu/st/st_driver/STM32F0xx_HAL_Driver
ST_CMSIS = hw/mcu/st/st_driver/CMSIS/Device/ST/STM32F0xx ST_CMSIS = hw/mcu/st/st_driver/CMSIS/Device/ST/STM32F0xx

View File

@@ -9,6 +9,9 @@ CFLAGS += \
-DSTM32F407xx \ -DSTM32F407xx \
-DCFG_TUSB_MCU=OPT_MCU_STM32F4 -DCFG_TUSB_MCU=OPT_MCU_STM32F4
# suppress warning caused by vendor mcu driver
CFLAGS += -Wno-error=cast-align
ST_HAL_DRIVER = hw/mcu/st/st_driver/STM32F4xx_HAL_Driver ST_HAL_DRIVER = hw/mcu/st/st_driver/STM32F4xx_HAL_Driver
ST_CMSIS = hw/mcu/st/st_driver/CMSIS/Device/ST/STM32F4xx ST_CMSIS = hw/mcu/st/st_driver/CMSIS/Device/ST/STM32F4xx

View File

@@ -9,6 +9,9 @@ CFLAGS += \
-DSTM32F411xE \ -DSTM32F411xE \
-DCFG_TUSB_MCU=OPT_MCU_STM32F4 -DCFG_TUSB_MCU=OPT_MCU_STM32F4
# suppress warning caused by vendor mcu driver
CFLAGS += -Wno-error=cast-align
ST_HAL_DRIVER = hw/mcu/st/st_driver/STM32F4xx_HAL_Driver ST_HAL_DRIVER = hw/mcu/st/st_driver/STM32F4xx_HAL_Driver
ST_CMSIS = hw/mcu/st/st_driver/CMSIS/Device/ST/STM32F4xx ST_CMSIS = hw/mcu/st/st_driver/CMSIS/Device/ST/STM32F4xx

View File

@@ -9,8 +9,8 @@ CFLAGS += \
-DSTM32F412Zx \ -DSTM32F412Zx \
-DCFG_TUSB_MCU=OPT_MCU_STM32F4 -DCFG_TUSB_MCU=OPT_MCU_STM32F4
# mcu driver cause following warnings # suppress warning caused by vendor mcu driver
CFLAGS += -Wno-error=maybe-uninitialized CFLAGS += -Wno-error=cast-align
ST_HAL_DRIVER = hw/mcu/st/st_driver/STM32F4xx_HAL_Driver ST_HAL_DRIVER = hw/mcu/st/st_driver/STM32F4xx_HAL_Driver
ST_CMSIS = hw/mcu/st/st_driver/CMSIS/Device/ST/STM32F4xx ST_CMSIS = hw/mcu/st/st_driver/CMSIS/Device/ST/STM32F4xx

View File

@@ -9,8 +9,8 @@ CFLAGS += \
-DSTM32F746xx \ -DSTM32F746xx \
-DCFG_TUSB_MCU=OPT_MCU_STM32F7 -DCFG_TUSB_MCU=OPT_MCU_STM32F7
# mcu driver cause following warnings # suppress warning caused by vendor mcu driver
CFLAGS += -Wno-error=shadow CFLAGS += -Wno-error=cast-align -Wno-error=shadow
ST_HAL_DRIVER = hw/mcu/st/st_driver/STM32F7xx_HAL_Driver ST_HAL_DRIVER = hw/mcu/st/st_driver/STM32F7xx_HAL_Driver
ST_CMSIS = hw/mcu/st/st_driver/CMSIS/Device/ST/STM32F7xx ST_CMSIS = hw/mcu/st/st_driver/CMSIS/Device/ST/STM32F7xx

View File

@@ -9,8 +9,8 @@ CFLAGS += \
-DSTM32F767xx \ -DSTM32F767xx \
-DCFG_TUSB_MCU=OPT_MCU_STM32F7 -DCFG_TUSB_MCU=OPT_MCU_STM32F7
# mcu driver cause following warnings # suppress warning caused by vendor mcu driver
CFLAGS += -Wno-error=shadow CFLAGS += -Wno-error=cast-align -Wno-error=shadow
ST_HAL_DRIVER = hw/mcu/st/st_driver/STM32F7xx_HAL_Driver ST_HAL_DRIVER = hw/mcu/st/st_driver/STM32F7xx_HAL_Driver
ST_CMSIS = hw/mcu/st/st_driver/CMSIS/Device/ST/STM32F7xx ST_CMSIS = hw/mcu/st/st_driver/CMSIS/Device/ST/STM32F7xx

View File

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

View File

@@ -106,7 +106,7 @@ static inline uint16_t tu_max16 (uint16_t x, uint16_t y) { return (x > y) ? x :
static inline uint32_t tu_max32 (uint32_t x, uint32_t y) { return (x > y) ? x : y; } static inline uint32_t tu_max32 (uint32_t x, uint32_t y) { return (x > y) ? x : y; }
// Align // Align
static inline uint32_t tu_align_n(uint32_t value, uint32_t alignment) static inline uint32_t tu_align(uint32_t value, uint32_t alignment)
{ {
return value & ((uint32_t) ~(alignment-1)); return value & ((uint32_t) ~(alignment-1));
} }

View File

@@ -273,7 +273,8 @@ typedef struct {
dcd_qtd_t qtd[QHD_MAX] TU_ATTR_ALIGNED(32); // for portability, TinyUSB only queue 1 TD for each Qhd dcd_qtd_t qtd[QHD_MAX] TU_ATTR_ALIGNED(32); // for portability, TinyUSB only queue 1 TD for each Qhd
}dcd_data_t; }dcd_data_t;
static dcd_data_t _dcd_data CFG_TUSB_MEM_SECTION TU_ATTR_ALIGNED(2048); CFG_TUSB_MEM_SECTION TU_ATTR_ALIGNED(2048)
static dcd_data_t _dcd_data;
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
// CONTROLLER API // CONTROLLER API
@@ -478,7 +479,8 @@ bool dcd_edpt_xfer(uint8_t rhport, uint8_t ep_addr, uint8_t * buffer, uint16_t t
// Force the CPU to flush the buffer. We increase the size by 32 because the call aligns the // Force the CPU to flush the buffer. We increase the size by 32 because the call aligns the
// address to 32-byte boundaries. // address to 32-byte boundaries.
CleanInvalidateDCache_by_Addr((uint32_t*) buffer, total_bytes + 31); // void* cast to suppress cast-align warning, buffer must be
CleanInvalidateDCache_by_Addr((uint32_t*) tu_align((uint32_t) buffer, 4), total_bytes + 31);
//------------- Prepare qtd -------------// //------------- Prepare qtd -------------//
qtd_init(p_qtd, buffer, total_bytes); qtd_init(p_qtd, buffer, total_bytes);