summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhathach <[email protected]>2020-05-18 13:03:41 +0700
committerhathach <[email protected]>2020-05-18 13:03:41 +0700
commit550746097b81c07cdc2459371c809a3678fe1ff4 (patch)
tree6be8654ae1d2fd78e257783b2535455df2597d9c
parenta7db945cff33522062818d3c4a68296b7ddccf9a (diff)
fix cast-align warning for nuc505
-rw-r--r--hw/bsp/nutiny_sdk_nuc505/board.mk3
-rw-r--r--src/portable/nuvoton/nuc505/dcd_nuc505.c5
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 874d4ae42..5fb2119b8 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 02f0b35a6..e67b69ab2 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--)