STM32F3 : correct compilation warnings

pull/6599/head
jeromecoutant 2018-04-11 10:00:27 +02:00
parent 4e9e9f5c62
commit a540a21106
3 changed files with 24 additions and 7 deletions

View File

@ -454,6 +454,15 @@ HAL_CRC_StateTypeDef HAL_CRC_GetState(CRC_HandleTypeDef *hcrc)
* @{
*/
#if __GNUC__
# define MAY_ALIAS __attribute__ ((__may_alias__))
#else
# define MAY_ALIAS
#endif
typedef __IO uint8_t MAY_ALIAS uint8_io_t;
typedef __IO uint16_t MAY_ALIAS uint16_io_t;
/**
* @brief Enter 8-bit input data to the CRC calculator.
* Specific data handling to optimize processing time.
@ -478,16 +487,16 @@ static uint32_t CRC_Handle_8(CRC_HandleTypeDef *hcrc, uint8_t pBuffer[], uint32_
{
if (BufferLength%4U == 1U)
{
*(uint8_t volatile*) (&hcrc->Instance->DR) = pBuffer[4*i];
*(uint8_io_t*) (&hcrc->Instance->DR) = pBuffer[4*i];
}
if (BufferLength%4U == 2U)
{
*(uint16_t volatile*) (&hcrc->Instance->DR) = ((uint32_t)pBuffer[4*i]<<8) | (uint32_t)pBuffer[4*i+1];
*(uint16_io_t*) (&hcrc->Instance->DR) = ((uint32_t)pBuffer[4*i]<<8) | (uint32_t)pBuffer[4*i+1];
}
if (BufferLength%4U == 3U)
{
*(uint16_t volatile*) (&hcrc->Instance->DR) = ((uint32_t)pBuffer[4*i]<<8) | (uint32_t)pBuffer[4*i+1];
*(uint8_t volatile*) (&hcrc->Instance->DR) = pBuffer[4*i+2];
*(uint16_io_t*) (&hcrc->Instance->DR) = ((uint32_t)pBuffer[4*i]<<8) | (uint32_t)pBuffer[4*i+1];
*(uint8_io_t*) (&hcrc->Instance->DR) = pBuffer[4*i+2];
}
}
@ -518,7 +527,7 @@ static uint32_t CRC_Handle_16(CRC_HandleTypeDef *hcrc, uint16_t pBuffer[], uint3
}
if ((BufferLength%2U) != 0U)
{
*(uint16_t volatile*) (&hcrc->Instance->DR) = pBuffer[2*i];
*(uint16_io_t*) (&hcrc->Instance->DR) = pBuffer[2*i];
}
/* Return the CRC computed value */

View File

@ -1379,6 +1379,14 @@ __STATIC_INLINE void LL_SPI_TransmitData8(SPI_TypeDef *SPIx, uint8_t TxData)
*((__IO uint8_t *)&SPIx->DR) = TxData;
}
#if __GNUC__
# define MAY_ALIAS __attribute__ ((__may_alias__))
#else
# define MAY_ALIAS
#endif
typedef __IO uint16_t MAY_ALIAS uint16_io_t;
/**
* @brief Write 16-Bits in the data register
* @rmtoll DR DR LL_SPI_TransmitData16
@ -1388,7 +1396,7 @@ __STATIC_INLINE void LL_SPI_TransmitData8(SPI_TypeDef *SPIx, uint8_t TxData)
*/
__STATIC_INLINE void LL_SPI_TransmitData16(SPI_TypeDef *SPIx, uint16_t TxData)
{
*((__IO uint16_t *)&SPIx->DR) = TxData;
*((uint16_io_t*)&SPIx->DR) = TxData;
}
/**

View File

@ -44,7 +44,7 @@ UART_HandleTypeDef uart_handlers[UART_NUM];
static uart_irq_handler irq_handler;
// Defined in serial_api.c
inline int8_t get_uart_index(UARTName uart_name);
extern int8_t get_uart_index(UARTName uart_name);
/******************************************************************************
* INTERRUPTS HANDLING