diff --git a/targets/TARGET_NUVOTON/TARGET_M480/device/StdDriver/m480_hsusbd.c b/targets/TARGET_NUVOTON/TARGET_M480/device/StdDriver/m480_hsusbd.c index 1a6920c2d7..22ea97a329 100644 --- a/targets/TARGET_NUVOTON/TARGET_M480/device/StdDriver/m480_hsusbd.c +++ b/targets/TARGET_NUVOTON/TARGET_M480/device/StdDriver/m480_hsusbd.c @@ -41,8 +41,10 @@ static uint8_t g_hsusbd_TestSelector = 0ul; #ifdef __ICCARM__ #pragma data_alignment=4 static uint8_t g_hsusbd_buf[12]; -#else +#elif defined (__CC_ARM) __align(4) static uint8_t g_hsusbd_buf[12]; +#elif defined ( __GNUC__ ) +static uint8_t g_hsusbd_buf[12] __attribute__((aligned (4))); #endif uint8_t g_hsusbd_Configured = 0ul; diff --git a/targets/TARGET_NUVOTON/TARGET_M480/device/StdDriver/m480_sdh.c b/targets/TARGET_NUVOTON/TARGET_M480/device/StdDriver/m480_sdh.c index 7d39cedfca..f09b782a1e 100644 --- a/targets/TARGET_NUVOTON/TARGET_M480/device/StdDriver/m480_sdh.c +++ b/targets/TARGET_NUVOTON/TARGET_M480/device/StdDriver/m480_sdh.c @@ -45,6 +45,8 @@ __align(4) uint8_t _SDH_ucSDHCBuffer[512]; #elif defined ( __ICCARM__ ) /*!< IAR Compiler */ #pragma data_alignment = 4 uint8_t _SDH_ucSDHCBuffer[512]; +#elif defined ( __GNUC__ ) +uint8_t _SDH_ucSDHCBuffer[512] __attribute__((aligned (4))); #endif int SDH_ok = 0;