more with -Wcast-qual

This commit is contained in:
hathach
2021-10-17 16:26:27 +07:00
parent 0b249618b0
commit a5f516893b
34 changed files with 70 additions and 48 deletions

View File

@@ -101,9 +101,14 @@ int board_uart_read(uint8_t* buf, int len)
int board_uart_write(void const * buf, int len)
{
int32_t offset = 0;
uint8_t const* buf8 = (uint8_t const*) buf;
for (offset = 0; offset < len; offset++)
if (! (messible_status_read() & CSR_MESSIBLE_STATUS_FULL_OFFSET))
messible_in_write(((uint8_t *)buf)[offset]);
{
if (!(messible_status_read() & CSR_MESSIBLE_STATUS_FULL_OFFSET))
{
messible_in_write(buf8[offset]);
}
}
return len;
}

View File

@@ -158,7 +158,7 @@ int board_uart_write(void const* buf, int len) {
#if defined(UART_DEV)
int txsize = len;
while (txsize--) {
usart_write(UART_DEV, *(uint8_t*)buf);
usart_write(UART_DEV, *(uint8_t const*)buf);
buf++;
}
return len;

View File

@@ -172,7 +172,7 @@ int board_uart_read(uint8_t* buf, int len)
int board_uart_write(void const * buf, int len)
{
LPUART_WriteBlocking(UART_PORT, (uint8_t*)buf, len);
LPUART_WriteBlocking(UART_PORT, (uint8_t const*)buf, len);
return len;
}

View File

@@ -15,7 +15,7 @@ CFLAGS += \
-DCFG_TUSB_MEM_ALIGN='__attribute__((aligned(64)))'
# mcu driver cause following warnings
CFLAGS += -Wno-error=strict-prototypes -Wno-error=unused-parameter -Wno-error=unused-variable
CFLAGS += -Wno-error=strict-prototypes -Wno-error=unused-parameter -Wno-error=unused-variable -Wno-error=cast-qual
MCU_DIR = hw/mcu/nxp/lpcopen/lpc15xx/lpc_chip_15xx

View File

@@ -13,7 +13,7 @@ CFLAGS += \
-DCFG_TUSB_MCU=OPT_MCU_LPC18XX
# mcu driver cause following warnings
CFLAGS += -Wno-error=unused-parameter -Wno-error=strict-prototypes
CFLAGS += -Wno-error=unused-parameter -Wno-error=strict-prototypes -Wno-error=cast-qual
MCU_DIR = hw/mcu/nxp/lpcopen/lpc18xx/lpc_chip_18xx

View File

@@ -210,7 +210,7 @@ int board_uart_read(uint8_t* buf, int len)
int board_uart_write(void const * buf, int len)
{
USART_WriteBlocking(UART_DEV, (uint8_t *)buf, len);
USART_WriteBlocking(UART_DEV, (uint8_t const *) buf, len);
return 0;
}

View File

@@ -265,7 +265,7 @@ int board_uart_read(uint8_t* buf, int len)
int board_uart_write(void const * buf, int len)
{
USART_WriteBlocking(UART_DEV, (uint8_t *)buf, len);
USART_WriteBlocking(UART_DEV, (uint8_t const *) buf, len);
return len;
}

View File

@@ -14,7 +14,7 @@ CFLAGS += \
-DCFG_TUSB_MCU=OPT_MCU_MM32F327X
# suppress warning caused by vendor mcu driver
CFLAGS += -Wno-error=unused-parameter -Wno-error=maybe-uninitialized
CFLAGS += -Wno-error=unused-parameter -Wno-error=maybe-uninitialized -Wno-error=cast-qual
SRC_C += \
src/portable/mindmotion/mm32/dcd_mm32f327x_otg.c \

View File

@@ -228,7 +228,7 @@ int board_uart_read(uint8_t* buf, int len)
int board_uart_write(void const *buf, int len)
{
sci0_buf[0].buf = (uint8_t*)buf;
sci0_buf[0].buf = (uint8_t*)(uintptr_t) buf;
sci0_buf[0].cnt = len;
SCI0.SCR.BYTE |= SCI_SCR_TE | SCI_SCR_TIE;
while (SCI0.SCR.BIT.TE) ;

View File

@@ -273,7 +273,7 @@ int board_uart_read(uint8_t* buf, int len)
int board_uart_write(void const *buf, int len)
{
sci_buf[0].buf = (uint8_t*)buf;
sci_buf[0].buf = (uint8_t*)(uintptr_t) buf;
sci_buf[0].cnt = len;
SCI5.SCR.BYTE |= SCI_SCR_TE | SCI_SCR_TIE;
while (SCI5.SCR.BIT.TE) ;

View File

@@ -11,6 +11,9 @@ CFLAGS += \
-DOSC32K_OVERWRITE_CALIBRATION=0 \
-DCFG_TUSB_MCU=OPT_MCU_SAMD11
# suppress warning caused by vendor mcu driver
CFLAGS += -Wno-error=cast-qual
SRC_C += \
src/portable/microchip/samd/dcd_samd.c \
hw/mcu/microchip/samd11/gcc/gcc/startup_samd11.c \

View File

@@ -12,6 +12,9 @@ CFLAGS += \
-DCONF_DFLL_OVERWRITE_CALIBRATION=0 \
-DCFG_TUSB_MCU=OPT_MCU_SAMD21
# suppress warning caused by vendor mcu driver
CFLAGS += -Wno-error=cast-qual
SRC_C += \
src/portable/microchip/samd/dcd_samd.c \
hw/mcu/microchip/samd21/gcc/gcc/startup_samd21.c \

View File

@@ -13,7 +13,8 @@ CFLAGS += \
-nostdlib -nostartfiles \
-DCFG_TUSB_MCU=OPT_MCU_SAMD51
CFLAGS += -Wno-error=undef
# suppress warning caused by vendor mcu driver
CFLAGS += -Wno-error=cast-qual
SRC_C += \
src/portable/microchip/samd/dcd_samd.c \

View File

@@ -13,6 +13,9 @@ CFLAGS += \
-DCONF_OSC32K_CALIB_ENABLE=0 \
-DCFG_TUSB_MCU=OPT_MCU_SAML22
# suppress warning caused by vendor mcu driver
CFLAGS += -Wno-error=cast-qual
SRC_C += \
src/portable/microchip/samd/dcd_samd.c \
$(MCU_DIR)/gcc/gcc/startup_$(SAML_VARIANT).c \

View File

@@ -134,7 +134,7 @@ int board_uart_read(uint8_t* buf, int len)
int board_uart_write(void const * buf, int len)
{
HAL_UART_Transmit(&UartHandle, (uint8_t*) buf, len, 0xffff);
HAL_UART_Transmit(&UartHandle, (uint8_t*)(uintptr_t) buf, len, 0xffff);
return len;
}

View File

@@ -18,7 +18,7 @@ CFLAGS += \
-DCFG_TUSB_MCU=OPT_MCU_STM32F0
# suppress warning caused by vendor mcu driver
CFLAGS += -Wno-error=unused-parameter -Wno-error=cast-align
CFLAGS += -Wno-error=unused-parameter -Wno-error=cast-align -Wno-error=cast-qual
SRC_C += \
src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c \

View File

@@ -160,7 +160,7 @@ int board_uart_read(uint8_t* buf, int len)
int board_uart_write(void const * buf, int len)
{
#ifdef UART_DEV
HAL_UART_Transmit(&UartHandle, (uint8_t*) buf, len, 0xffff);
HAL_UART_Transmit(&UartHandle, (uint8_t*)(uintptr_t) buf, len, 0xffff);
return len;
#else
(void) buf; (void) len; (void) UartHandle;

View File

@@ -284,7 +284,7 @@ int board_uart_read(uint8_t* buf, int len)
int board_uart_write(void const * buf, int len)
{
HAL_UART_Transmit(&UartHandle, (uint8_t*) buf, len, 0xffff);
HAL_UART_Transmit(&UartHandle, (uint8_t*)(uintptr_t) buf, len, 0xffff);
return len;
}

View File

@@ -237,7 +237,7 @@ int board_uart_read(uint8_t* buf, int len)
int board_uart_write(void const * buf, int len)
{
HAL_UART_Transmit(&UartHandle, (uint8_t*) buf, len, 0xffff);
HAL_UART_Transmit(&UartHandle, (uint8_t*)(uintptr_t) buf, len, 0xffff);
return len;
}