From 1a8ce043ed937012454e5b79396455f9c5568a68 Mon Sep 17 00:00:00 2001 From: hathach Date: Sun, 17 May 2020 14:24:15 +0700 Subject: [PATCH 1/3] enable -Wcast-align suppress vendor sdk driver at board.mk --- examples/make.mk | 8 +++----- hw/bsp/adafruit_clue/board.mk | 4 ++-- hw/bsp/arduino_nano33_ble/board.mk | 4 ++-- hw/bsp/circuitplayground_bluefruit/board.mk | 4 ++-- hw/bsp/feather_nrf52840_express/board.mk | 4 ++-- hw/bsp/feather_nrf52840_sense/board.mk | 4 ++-- hw/bsp/feather_stm32f405/board.mk | 3 +++ hw/bsp/nrf52840_mdk_dongle/board.mk | 4 ++-- hw/bsp/nutiny_sdk_nuc505/board.mk | 5 +++-- hw/bsp/pca10056/board.mk | 4 ++-- hw/bsp/pca10059/board.mk | 4 ++-- hw/bsp/pca10100/board.mk | 4 ++-- hw/bsp/raytac_mdbt50q_rx/board.mk | 4 ++-- hw/bsp/stm32f070rbnucleo/board.mk | 4 ++-- hw/bsp/stm32f072disco/board.mk | 4 ++-- hw/bsp/stm32f407disco/board.mk | 3 +++ hw/bsp/stm32f411disco/board.mk | 3 +++ hw/bsp/stm32f412disco/board.mk | 4 ++-- hw/bsp/stm32f746nucleo/board.mk | 4 ++-- hw/bsp/stm32f767nucleo/board.mk | 4 ++-- hw/bsp/stm32h743nucleo/board.mk | 1 - src/common/tusb_common.h | 2 +- src/portable/nxp/transdimension/dcd_transdimension.c | 6 ++++-- 23 files changed, 50 insertions(+), 41 deletions(-) diff --git a/examples/make.mk b/examples/make.mk index 449dc899..2ea50753 100644 --- a/examples/make.mk +++ b/examples/make.mk @@ -63,11 +63,9 @@ CFLAGS += \ -Wwrite-strings \ -Wsign-compare \ -Wmissing-format-attribute \ - -Wunreachable-code - -# This causes lots of warning with nrf5x build due to nrfx code -# CFLAGS += -Wcast-align - + -Wunreachable-code \ + -Wcast-align + # Debugging/Optimization ifeq ($(DEBUG), 1) CFLAGS += -Og -ggdb diff --git a/hw/bsp/adafruit_clue/board.mk b/hw/bsp/adafruit_clue/board.mk index be8c5bf5..5290455c 100644 --- a/hw/bsp/adafruit_clue/board.mk +++ b/hw/bsp/adafruit_clue/board.mk @@ -9,8 +9,8 @@ CFLAGS += \ -DNRF52840_XXAA \ -DCONFIG_GPIO_AS_PINRESET -# nrfx issue undef _ARMCC_VERSION usage https://github.com/NordicSemiconductor/nrfx/issues/49 -CFLAGS += -Wno-error=undef -Wno-error=unused-parameter +# suppress warning caused by vendor mcu driver +CFLAGS += -Wno-error=undef -Wno-error=unused-parameter -Wno-error=cast-align # due to tusb_hal_nrf_power_event GCCVERSION = $(firstword $(subst ., ,$(shell arm-none-eabi-gcc -dumpversion))) diff --git a/hw/bsp/arduino_nano33_ble/board.mk b/hw/bsp/arduino_nano33_ble/board.mk index d217d37c..0a25d0b1 100644 --- a/hw/bsp/arduino_nano33_ble/board.mk +++ b/hw/bsp/arduino_nano33_ble/board.mk @@ -9,8 +9,8 @@ CFLAGS += \ -DNRF52840_XXAA \ -DCONFIG_GPIO_AS_PINRESET -# nrfx issue undef _ARMCC_VERSION usage https://github.com/NordicSemiconductor/nrfx/issues/49 -CFLAGS += -Wno-error=undef -Wno-error=unused-parameter +# suppress warning caused by vendor mcu driver +CFLAGS += -Wno-error=undef -Wno-error=unused-parameter -Wno-error=cast-align # due to tusb_hal_nrf_power_event GCCVERSION = $(firstword $(subst ., ,$(shell arm-none-eabi-gcc -dumpversion))) diff --git a/hw/bsp/circuitplayground_bluefruit/board.mk b/hw/bsp/circuitplayground_bluefruit/board.mk index be8c5bf5..5290455c 100644 --- a/hw/bsp/circuitplayground_bluefruit/board.mk +++ b/hw/bsp/circuitplayground_bluefruit/board.mk @@ -9,8 +9,8 @@ CFLAGS += \ -DNRF52840_XXAA \ -DCONFIG_GPIO_AS_PINRESET -# nrfx issue undef _ARMCC_VERSION usage https://github.com/NordicSemiconductor/nrfx/issues/49 -CFLAGS += -Wno-error=undef -Wno-error=unused-parameter +# suppress warning caused by vendor mcu driver +CFLAGS += -Wno-error=undef -Wno-error=unused-parameter -Wno-error=cast-align # due to tusb_hal_nrf_power_event GCCVERSION = $(firstword $(subst ., ,$(shell arm-none-eabi-gcc -dumpversion))) diff --git a/hw/bsp/feather_nrf52840_express/board.mk b/hw/bsp/feather_nrf52840_express/board.mk index 9f38d679..7b2625cd 100644 --- a/hw/bsp/feather_nrf52840_express/board.mk +++ b/hw/bsp/feather_nrf52840_express/board.mk @@ -9,8 +9,8 @@ CFLAGS += \ -DNRF52840_XXAA \ -DCONFIG_GPIO_AS_PINRESET -# nrfx issue undef _ARMCC_VERSION usage https://github.com/NordicSemiconductor/nrfx/issues/49 -CFLAGS += -Wno-error=undef -Wno-error=unused-parameter +# suppress warning caused by vendor mcu driver +CFLAGS += -Wno-error=undef -Wno-error=unused-parameter -Wno-error=cast-align # due to tusb_hal_nrf_power_event GCCVERSION = $(firstword $(subst ., ,$(shell arm-none-eabi-gcc -dumpversion))) diff --git a/hw/bsp/feather_nrf52840_sense/board.mk b/hw/bsp/feather_nrf52840_sense/board.mk index be8c5bf5..5290455c 100644 --- a/hw/bsp/feather_nrf52840_sense/board.mk +++ b/hw/bsp/feather_nrf52840_sense/board.mk @@ -9,8 +9,8 @@ CFLAGS += \ -DNRF52840_XXAA \ -DCONFIG_GPIO_AS_PINRESET -# nrfx issue undef _ARMCC_VERSION usage https://github.com/NordicSemiconductor/nrfx/issues/49 -CFLAGS += -Wno-error=undef -Wno-error=unused-parameter +# suppress warning caused by vendor mcu driver +CFLAGS += -Wno-error=undef -Wno-error=unused-parameter -Wno-error=cast-align # due to tusb_hal_nrf_power_event GCCVERSION = $(firstword $(subst ., ,$(shell arm-none-eabi-gcc -dumpversion))) diff --git a/hw/bsp/feather_stm32f405/board.mk b/hw/bsp/feather_stm32f405/board.mk index 2d1f8bb8..8233c660 100644 --- a/hw/bsp/feather_stm32f405/board.mk +++ b/hw/bsp/feather_stm32f405/board.mk @@ -9,6 +9,9 @@ CFLAGS += \ -DSTM32F405xx \ -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_CMSIS = hw/mcu/st/st_driver/CMSIS/Device/ST/STM32F4xx diff --git a/hw/bsp/nrf52840_mdk_dongle/board.mk b/hw/bsp/nrf52840_mdk_dongle/board.mk index 0ab5ff2e..9ba04ba1 100644 --- a/hw/bsp/nrf52840_mdk_dongle/board.mk +++ b/hw/bsp/nrf52840_mdk_dongle/board.mk @@ -8,8 +8,8 @@ CFLAGS += \ -DNRF52840_XXAA \ -DCFG_TUSB_MCU=OPT_MCU_NRF5X -# nrfx issue undef _ARMCC_VERSION usage https://github.com/NordicSemiconductor/nrfx/issues/49 -CFLAGS += -Wno-error=undef -Wno-error=unused-parameter +# suppress warning caused by vendor mcu driver +CFLAGS += -Wno-error=undef -Wno-error=unused-parameter -Wno-error=cast-align # due to tusb_hal_nrf_power_event GCCVERSION = $(firstword $(subst ., ,$(shell arm-none-eabi-gcc -dumpversion))) diff --git a/hw/bsp/nutiny_sdk_nuc505/board.mk b/hw/bsp/nutiny_sdk_nuc505/board.mk index 39df77d2..874d4ae4 100644 --- a/hw/bsp/nutiny_sdk_nuc505/board.mk +++ b/hw/bsp/nutiny_sdk_nuc505/board.mk @@ -7,6 +7,9 @@ CFLAGS += \ -mfpu=fpv4-sp-d16 \ -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. 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/pwm.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/spim.c \ hw/mcu/nuvoton/nuc505/StdDriver/src/sys.c \ hw/mcu/nuvoton/nuc505/StdDriver/src/timer.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/wwdt.c diff --git a/hw/bsp/pca10056/board.mk b/hw/bsp/pca10056/board.mk index b2f11962..0971e64c 100644 --- a/hw/bsp/pca10056/board.mk +++ b/hw/bsp/pca10056/board.mk @@ -9,8 +9,8 @@ CFLAGS += \ -DCONFIG_GPIO_AS_PINRESET \ -DCFG_TUSB_MCU=OPT_MCU_NRF5X -# nrfx issue undef _ARMCC_VERSION usage https://github.com/NordicSemiconductor/nrfx/issues/49 -CFLAGS += -Wno-error=undef -Wno-error=unused-parameter +# suppress warning caused by vendor mcu driver +CFLAGS += -Wno-error=undef -Wno-error=unused-parameter -Wno-error=cast-align # due to tusb_hal_nrf_power_event GCCVERSION = $(firstword $(subst ., ,$(shell arm-none-eabi-gcc -dumpversion))) diff --git a/hw/bsp/pca10059/board.mk b/hw/bsp/pca10059/board.mk index 8cce65eb..72dfefdc 100644 --- a/hw/bsp/pca10059/board.mk +++ b/hw/bsp/pca10059/board.mk @@ -9,8 +9,8 @@ CFLAGS += \ -DCONFIG_GPIO_AS_PINRESET \ -DCFG_TUSB_MCU=OPT_MCU_NRF5X -# nrfx issue undef _ARMCC_VERSION usage https://github.com/NordicSemiconductor/nrfx/issues/49 -CFLAGS += -Wno-error=undef -Wno-error=unused-parameter +# suppress warning caused by vendor mcu driver +CFLAGS += -Wno-error=undef -Wno-error=unused-parameter -Wno-error=cast-align # due to tusb_hal_nrf_power_event GCCVERSION = $(firstword $(subst ., ,$(shell arm-none-eabi-gcc -dumpversion))) diff --git a/hw/bsp/pca10100/board.mk b/hw/bsp/pca10100/board.mk index 0ec8f0f6..5231aaf6 100644 --- a/hw/bsp/pca10100/board.mk +++ b/hw/bsp/pca10100/board.mk @@ -9,8 +9,8 @@ CFLAGS += \ -DCONFIG_GPIO_AS_PINRESET \ -DCFG_TUSB_MCU=OPT_MCU_NRF5X -# nrfx issue undef _ARMCC_VERSION usage https://github.com/NordicSemiconductor/nrfx/issues/49 -CFLAGS += -Wno-error=undef -Wno-error=unused-parameter +# suppress warning caused by vendor mcu driver +CFLAGS += -Wno-error=undef -Wno-error=unused-parameter -Wno-error=cast-align # due to tusb_hal_nrf_power_event GCCVERSION = $(firstword $(subst ., ,$(shell arm-none-eabi-gcc -dumpversion))) diff --git a/hw/bsp/raytac_mdbt50q_rx/board.mk b/hw/bsp/raytac_mdbt50q_rx/board.mk index 0960ffe5..47bb430f 100644 --- a/hw/bsp/raytac_mdbt50q_rx/board.mk +++ b/hw/bsp/raytac_mdbt50q_rx/board.mk @@ -8,8 +8,8 @@ CFLAGS += \ -DNRF52840_XXAA \ -DCFG_TUSB_MCU=OPT_MCU_NRF5X -# nrfx issue undef _ARMCC_VERSION usage https://github.com/NordicSemiconductor/nrfx/issues/49 -CFLAGS += -Wno-error=undef -Wno-error=unused-parameter +# suppress warning caused by vendor mcu driver +CFLAGS += -Wno-error=undef -Wno-error=unused-parameter -Wno-error=cast-align # due to tusb_hal_nrf_power_event GCCVERSION = $(firstword $(subst ., ,$(shell arm-none-eabi-gcc -dumpversion))) diff --git a/hw/bsp/stm32f070rbnucleo/board.mk b/hw/bsp/stm32f070rbnucleo/board.mk index 8a073d52..8ae75dd9 100644 --- a/hw/bsp/stm32f070rbnucleo/board.mk +++ b/hw/bsp/stm32f070rbnucleo/board.mk @@ -9,8 +9,8 @@ CFLAGS += \ -DCFG_EXAMPLE_MSC_READONLY \ -DCFG_TUSB_MCU=OPT_MCU_STM32F0 -# mcu driver cause following warnings -CFLAGS += -Wno-error=unused-parameter +# suppress warning caused by vendor mcu driver +CFLAGS += -Wno-error=unused-parameter -Wno-error=cast-align ST_HAL_DRIVER = hw/mcu/st/st_driver/STM32F0xx_HAL_Driver ST_CMSIS = hw/mcu/st/st_driver/CMSIS/Device/ST/STM32F0xx diff --git a/hw/bsp/stm32f072disco/board.mk b/hw/bsp/stm32f072disco/board.mk index 522459d6..e6787b26 100644 --- a/hw/bsp/stm32f072disco/board.mk +++ b/hw/bsp/stm32f072disco/board.mk @@ -9,8 +9,8 @@ CFLAGS += \ -DCFG_EXAMPLE_MSC_READONLY \ -DCFG_TUSB_MCU=OPT_MCU_STM32F0 -# mcu driver cause following warnings -CFLAGS += -Wno-error=unused-parameter +# suppress warning caused by vendor mcu driver +CFLAGS += -Wno-error=unused-parameter -Wno-error=cast-align ST_HAL_DRIVER = hw/mcu/st/st_driver/STM32F0xx_HAL_Driver ST_CMSIS = hw/mcu/st/st_driver/CMSIS/Device/ST/STM32F0xx diff --git a/hw/bsp/stm32f407disco/board.mk b/hw/bsp/stm32f407disco/board.mk index 92e02153..df2ee4ba 100644 --- a/hw/bsp/stm32f407disco/board.mk +++ b/hw/bsp/stm32f407disco/board.mk @@ -9,6 +9,9 @@ CFLAGS += \ -DSTM32F407xx \ -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_CMSIS = hw/mcu/st/st_driver/CMSIS/Device/ST/STM32F4xx diff --git a/hw/bsp/stm32f411disco/board.mk b/hw/bsp/stm32f411disco/board.mk index a5ea8cab..5e0d6c3a 100644 --- a/hw/bsp/stm32f411disco/board.mk +++ b/hw/bsp/stm32f411disco/board.mk @@ -9,6 +9,9 @@ CFLAGS += \ -DSTM32F411xE \ -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_CMSIS = hw/mcu/st/st_driver/CMSIS/Device/ST/STM32F4xx diff --git a/hw/bsp/stm32f412disco/board.mk b/hw/bsp/stm32f412disco/board.mk index 2a3ecbdd..5cf5e9b7 100644 --- a/hw/bsp/stm32f412disco/board.mk +++ b/hw/bsp/stm32f412disco/board.mk @@ -9,8 +9,8 @@ CFLAGS += \ -DSTM32F412Zx \ -DCFG_TUSB_MCU=OPT_MCU_STM32F4 -# mcu driver cause following warnings -CFLAGS += -Wno-error=maybe-uninitialized +# suppress warning caused by vendor mcu driver +CFLAGS += -Wno-error=cast-align ST_HAL_DRIVER = hw/mcu/st/st_driver/STM32F4xx_HAL_Driver ST_CMSIS = hw/mcu/st/st_driver/CMSIS/Device/ST/STM32F4xx diff --git a/hw/bsp/stm32f746nucleo/board.mk b/hw/bsp/stm32f746nucleo/board.mk index 7e070c1c..95445486 100644 --- a/hw/bsp/stm32f746nucleo/board.mk +++ b/hw/bsp/stm32f746nucleo/board.mk @@ -9,8 +9,8 @@ CFLAGS += \ -DSTM32F746xx \ -DCFG_TUSB_MCU=OPT_MCU_STM32F7 -# mcu driver cause following warnings -CFLAGS += -Wno-error=shadow +# suppress warning caused by vendor mcu driver +CFLAGS += -Wno-error=cast-align -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 diff --git a/hw/bsp/stm32f767nucleo/board.mk b/hw/bsp/stm32f767nucleo/board.mk index e5f0736d..fc638ddc 100644 --- a/hw/bsp/stm32f767nucleo/board.mk +++ b/hw/bsp/stm32f767nucleo/board.mk @@ -9,8 +9,8 @@ CFLAGS += \ -DSTM32F767xx \ -DCFG_TUSB_MCU=OPT_MCU_STM32F7 -# mcu driver cause following warnings -CFLAGS += -Wno-error=shadow +# suppress warning caused by vendor mcu driver +CFLAGS += -Wno-error=cast-align -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 diff --git a/hw/bsp/stm32h743nucleo/board.mk b/hw/bsp/stm32h743nucleo/board.mk index 94cc44b5..30e52dfc 100644 --- a/hw/bsp/stm32h743nucleo/board.mk +++ b/hw/bsp/stm32h743nucleo/board.mk @@ -10,7 +10,6 @@ CFLAGS += \ -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 diff --git a/src/common/tusb_common.h b/src/common/tusb_common.h index 2389bfcd..f144cda7 100644 --- a/src/common/tusb_common.h +++ b/src/common/tusb_common.h @@ -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; } // 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)); } diff --git a/src/portable/nxp/transdimension/dcd_transdimension.c b/src/portable/nxp/transdimension/dcd_transdimension.c index fcedc1c0..7baf43e2 100644 --- a/src/portable/nxp/transdimension/dcd_transdimension.c +++ b/src/portable/nxp/transdimension/dcd_transdimension.c @@ -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_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 @@ -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 // 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 -------------// qtd_init(p_qtd, buffer, total_bytes); From a7db945cff33522062818d3c4a68296b7ddccf9a Mon Sep 17 00:00:00 2001 From: hathach Date: Sun, 17 May 2020 15:34:14 +0700 Subject: [PATCH 2/3] temporariyly suppress cast-align warning for net_device and net example --- examples/device/net_lwip_webserver/Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/examples/device/net_lwip_webserver/Makefile b/examples/device/net_lwip_webserver/Makefile index fa93cf87..5279c49e 100644 --- a/examples/device/net_lwip_webserver/Makefile +++ b/examples/device/net_lwip_webserver/Makefile @@ -6,6 +6,9 @@ CFLAGS += \ -DTCP_WND=2*TCP_MSS \ -DHTTPD_USE_CUSTOM_FSDATA=0 +# TODO rndis_reports.c and net_device cause cast algin warnings +CFLAGS += -Wno-error=cast-align + INC += \ src \ $(TOP)/hw \ From 550746097b81c07cdc2459371c809a3678fe1ff4 Mon Sep 17 00:00:00 2001 From: hathach Date: Mon, 18 May 2020 13:03:41 +0700 Subject: [PATCH 3/3] fix cast-align warning for nuc505 --- hw/bsp/nutiny_sdk_nuc505/board.mk | 3 --- src/portable/nuvoton/nuc505/dcd_nuc505.c | 5 ++++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/bsp/nutiny_sdk_nuc505/board.mk b/hw/bsp/nutiny_sdk_nuc505/board.mk index 874d4ae4..5fb2119b 100644 --- a/hw/bsp/nutiny_sdk_nuc505/board.mk +++ b/hw/bsp/nutiny_sdk_nuc505/board.mk @@ -7,9 +7,6 @@ CFLAGS += \ -mfpu=fpv4-sp-d16 \ -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. LD_FILE = hw/bsp/$(BOARD)/nuc505_flashtoram.ld diff --git a/src/portable/nuvoton/nuc505/dcd_nuc505.c b/src/portable/nuvoton/nuc505/dcd_nuc505.c index 02f0b35a..e67b69ab 100644 --- a/src/portable/nuvoton/nuc505/dcd_nuc505.c +++ b/src/portable/nuvoton/nuc505/dcd_nuc505.c @@ -182,7 +182,10 @@ static void dcd_userEP_in_xfer(struct xfer_ctl_t *xfer, USBD_EP_T *ep) /* provided buffers are thankfully 32-bit aligned, allowing most data to be transfered as 32-bit */ while (countdown > 3) { - ep->EPDAT = *(uint32_t *)xfer->data_ptr; + uint32_t u32; + memcpy(&u32, xfer->data_ptr, 4); + + ep->EPDAT = u32; xfer->data_ptr += 4; countdown -= 4; } while (countdown--)