Skip to content

Commit a540a21

Browse files
committed
STM32F3 : correct compilation warnings
1 parent 4e9e9f5 commit a540a21

File tree

3 files changed

+24
-7
lines changed

3 files changed

+24
-7
lines changed

targets/TARGET_STM/TARGET_STM32F3/device/stm32f3xx_hal_crc.c

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,15 @@ HAL_CRC_StateTypeDef HAL_CRC_GetState(CRC_HandleTypeDef *hcrc)
454454
* @{
455455
*/
456456

457+
#if __GNUC__
458+
# define MAY_ALIAS __attribute__ ((__may_alias__))
459+
#else
460+
# define MAY_ALIAS
461+
#endif
462+
463+
typedef __IO uint8_t MAY_ALIAS uint8_io_t;
464+
typedef __IO uint16_t MAY_ALIAS uint16_io_t;
465+
457466
/**
458467
* @brief Enter 8-bit input data to the CRC calculator.
459468
* Specific data handling to optimize processing time.
@@ -478,16 +487,16 @@ static uint32_t CRC_Handle_8(CRC_HandleTypeDef *hcrc, uint8_t pBuffer[], uint32_
478487
{
479488
if (BufferLength%4U == 1U)
480489
{
481-
*(uint8_t volatile*) (&hcrc->Instance->DR) = pBuffer[4*i];
490+
*(uint8_io_t*) (&hcrc->Instance->DR) = pBuffer[4*i];
482491
}
483492
if (BufferLength%4U == 2U)
484493
{
485-
*(uint16_t volatile*) (&hcrc->Instance->DR) = ((uint32_t)pBuffer[4*i]<<8) | (uint32_t)pBuffer[4*i+1];
494+
*(uint16_io_t*) (&hcrc->Instance->DR) = ((uint32_t)pBuffer[4*i]<<8) | (uint32_t)pBuffer[4*i+1];
486495
}
487496
if (BufferLength%4U == 3U)
488497
{
489-
*(uint16_t volatile*) (&hcrc->Instance->DR) = ((uint32_t)pBuffer[4*i]<<8) | (uint32_t)pBuffer[4*i+1];
490-
*(uint8_t volatile*) (&hcrc->Instance->DR) = pBuffer[4*i+2];
498+
*(uint16_io_t*) (&hcrc->Instance->DR) = ((uint32_t)pBuffer[4*i]<<8) | (uint32_t)pBuffer[4*i+1];
499+
*(uint8_io_t*) (&hcrc->Instance->DR) = pBuffer[4*i+2];
491500
}
492501
}
493502

@@ -518,7 +527,7 @@ static uint32_t CRC_Handle_16(CRC_HandleTypeDef *hcrc, uint16_t pBuffer[], uint3
518527
}
519528
if ((BufferLength%2U) != 0U)
520529
{
521-
*(uint16_t volatile*) (&hcrc->Instance->DR) = pBuffer[2*i];
530+
*(uint16_io_t*) (&hcrc->Instance->DR) = pBuffer[2*i];
522531
}
523532

524533
/* Return the CRC computed value */

targets/TARGET_STM/TARGET_STM32F3/device/stm32f3xx_ll_spi.h

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

1382+
#if __GNUC__
1383+
# define MAY_ALIAS __attribute__ ((__may_alias__))
1384+
#else
1385+
# define MAY_ALIAS
1386+
#endif
1387+
1388+
typedef __IO uint16_t MAY_ALIAS uint16_io_t;
1389+
13821390
/**
13831391
* @brief Write 16-Bits in the data register
13841392
* @rmtoll DR DR LL_SPI_TransmitData16
@@ -1388,7 +1396,7 @@ __STATIC_INLINE void LL_SPI_TransmitData8(SPI_TypeDef *SPIx, uint8_t TxData)
13881396
*/
13891397
__STATIC_INLINE void LL_SPI_TransmitData16(SPI_TypeDef *SPIx, uint16_t TxData)
13901398
{
1391-
*((__IO uint16_t *)&SPIx->DR) = TxData;
1399+
*((uint16_io_t*)&SPIx->DR) = TxData;
13921400
}
13931401

13941402
/**

targets/TARGET_STM/TARGET_STM32F3/serial_device.c

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

4646
// Defined in serial_api.c
47-
inline int8_t get_uart_index(UARTName uart_name);
47+
extern int8_t get_uart_index(UARTName uart_name);
4848

4949
/******************************************************************************
5050
* INTERRUPTS HANDLING

0 commit comments

Comments
 (0)