Skip to content

Commit c2ee8f3

Browse files
committed
STM32F0 : correct compilation warnings
1 parent f41cf08 commit c2ee8f3

File tree

3 files changed

+24
-7
lines changed

3 files changed

+24
-7
lines changed

targets/TARGET_STM/TARGET_STM32F0/device/stm32f0xx_hal_crc.c

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,15 @@ uint32_t HAL_CRC_Calculate(CRC_HandleTypeDef *hcrc, uint32_t pBuffer[], uint32_t
421421
* @{
422422
*/
423423

424+
#if __GNUC__
425+
# define MAY_ALIAS __attribute__ ((__may_alias__))
426+
#else
427+
# define MAY_ALIAS
428+
#endif
429+
430+
typedef __IO uint8_t MAY_ALIAS uint8_io_t;
431+
typedef __IO uint16_t MAY_ALIAS uint16_io_t;
432+
424433
/**
425434
* @brief Return the CRC handle state.
426435
* @param hcrc CRC handle
@@ -468,16 +477,16 @@ static uint32_t CRC_Handle_8(CRC_HandleTypeDef *hcrc, uint8_t pBuffer[], uint32_
468477
{
469478
if (BufferLength%4U == 1U)
470479
{
471-
*(uint8_t volatile*) (&hcrc->Instance->DR) = pBuffer[4*i];
480+
*(uint8_io_t*) (&hcrc->Instance->DR) = pBuffer[4*i];
472481
}
473482
if (BufferLength%4U == 2U)
474483
{
475-
*(uint16_t volatile*) (&hcrc->Instance->DR) = ((uint32_t)pBuffer[4*i]<<8) | (uint32_t)pBuffer[4*i+1];
484+
*(uint16_io_t*) (&hcrc->Instance->DR) = ((uint32_t)pBuffer[4*i]<<8) | (uint32_t)pBuffer[4*i+1];
476485
}
477486
if (BufferLength%4U == 3U)
478487
{
479-
*(uint16_t volatile*) (&hcrc->Instance->DR) = ((uint32_t)pBuffer[4*i]<<8) | (uint32_t)pBuffer[4*i+1];
480-
*(uint8_t volatile*) (&hcrc->Instance->DR) = pBuffer[4*i+2];
488+
*(uint16_io_t*) (&hcrc->Instance->DR) = ((uint32_t)pBuffer[4*i]<<8) | (uint32_t)pBuffer[4*i+1];
489+
*(uint8_io_t*) (&hcrc->Instance->DR) = pBuffer[4*i+2];
481490
}
482491
}
483492

@@ -508,7 +517,7 @@ static uint32_t CRC_Handle_16(CRC_HandleTypeDef *hcrc, uint16_t pBuffer[], uint3
508517
}
509518
if ((BufferLength%2U) != 0U)
510519
{
511-
*(uint16_t volatile*) (&hcrc->Instance->DR) = pBuffer[2*i];
520+
*(uint16_io_t*) (&hcrc->Instance->DR) = pBuffer[2*i];
512521
}
513522

514523
/* Return the CRC computed value */

targets/TARGET_STM/TARGET_STM32F0/device/stm32f0xx_ll_spi.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1376,6 +1376,14 @@ __STATIC_INLINE void LL_SPI_TransmitData8(SPI_TypeDef *SPIx, uint8_t TxData)
13761376
*((__IO uint8_t *)&SPIx->DR) = TxData;
13771377
}
13781378

1379+
#if __GNUC__
1380+
# define MAY_ALIAS __attribute__ ((__may_alias__))
1381+
#else
1382+
# define MAY_ALIAS
1383+
#endif
1384+
1385+
typedef __IO uint16_t MAY_ALIAS uint16_io_t;
1386+
13791387
/**
13801388
* @brief Write 16-Bits in the data register
13811389
* @rmtoll DR DR LL_SPI_TransmitData16
@@ -1385,7 +1393,7 @@ __STATIC_INLINE void LL_SPI_TransmitData8(SPI_TypeDef *SPIx, uint8_t TxData)
13851393
*/
13861394
__STATIC_INLINE void LL_SPI_TransmitData16(SPI_TypeDef *SPIx, uint16_t TxData)
13871395
{
1388-
*((__IO uint16_t *)&SPIx->DR) = TxData;
1396+
*((uint16_io_t*)&SPIx->DR) = TxData;
13891397
}
13901398

13911399
/**

targets/TARGET_STM/TARGET_STM32F0/serial_device.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ UART_HandleTypeDef uart_handlers[UART_NUM];
4848
static uart_irq_handler irq_handler;
4949

5050
// Defined in serial_api.c
51-
inline int8_t get_uart_index(UARTName uart_name);
51+
extern int8_t get_uart_index(UARTName uart_name);
5252

5353
/******************************************************************************
5454
* INTERRUPTS HANDLING

0 commit comments

Comments
 (0)