STM32L0 : correct compilation warnings

pull/6697/head
jeromecoutant 2018-04-11 10:05:16 +02:00 committed by adbridge
parent 452dbbc538
commit 8fb7cbe041
3 changed files with 22 additions and 7 deletions

View File

@ -421,7 +421,14 @@ uint32_t HAL_CRC_Calculate(CRC_HandleTypeDef *hcrc, uint32_t pBuffer[], uint32_t
return temp; return temp;
} }
#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;
/** /**
* @} * @}
@ -486,16 +493,16 @@ static uint32_t CRC_Handle_8(CRC_HandleTypeDef *hcrc, uint8_t pBuffer[], uint32_
{ {
if (BufferLength%4U == 1U) if (BufferLength%4U == 1U)
{ {
*(uint8_t volatile*) (&hcrc->Instance->DR) = pBuffer[4U*i]; *(uint8_io_t*) (&hcrc->Instance->DR) = pBuffer[4U*i];
} }
if (BufferLength%4U == 2U) if (BufferLength%4U == 2U)
{ {
*(uint16_t volatile*) (&hcrc->Instance->DR) = ((uint32_t)pBuffer[4U*i]<<8U) | (uint32_t)pBuffer[4U*i+1U]; *(uint16_io_t*) (&hcrc->Instance->DR) = ((uint32_t)pBuffer[4U*i]<<8U) | (uint32_t)pBuffer[4U*i+1U];
} }
if (BufferLength%4U == 3U) if (BufferLength%4U == 3U)
{ {
*(uint16_t volatile*) (&hcrc->Instance->DR) = ((uint32_t)pBuffer[4U*i]<<8U) | (uint32_t)pBuffer[4U*i+1U]; *(uint16_io_t*) (&hcrc->Instance->DR) = ((uint32_t)pBuffer[4U*i]<<8U) | (uint32_t)pBuffer[4U*i+1U];
*(uint8_t volatile*) (&hcrc->Instance->DR) = pBuffer[4U*i+2U]; *(uint8_io_t*) (&hcrc->Instance->DR) = pBuffer[4U*i+2U];
} }
} }
@ -524,7 +531,7 @@ static uint32_t CRC_Handle_16(CRC_HandleTypeDef *hcrc, uint16_t pBuffer[], uint3
} }
if ((BufferLength%2U) != 0U) if ((BufferLength%2U) != 0U)
{ {
*(uint16_t volatile*) (&hcrc->Instance->DR) = pBuffer[2U*i]; *(uint16_io_t*) (&hcrc->Instance->DR) = pBuffer[2U*i];
} }
/* Return the CRC computed value */ /* Return the CRC computed value */

View File

@ -1121,6 +1121,14 @@ __STATIC_INLINE void LL_SPI_TransmitData8(SPI_TypeDef *SPIx, uint8_t TxData)
*((__IO uint8_t *)&SPIx->DR) = 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 * @brief Write 16-Bits in the data register
* @rmtoll DR DR LL_SPI_TransmitData16 * @rmtoll DR DR LL_SPI_TransmitData16
@ -1130,7 +1138,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) __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

@ -46,7 +46,7 @@ UART_HandleTypeDef uart_handlers[UART_NUM];
static uart_irq_handler irq_handler; static uart_irq_handler irq_handler;
// Defined in serial_api.c // 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 * INTERRUPTS HANDLING