Skip to content

Commit e2567e5

Browse files
author
Cruz Monrreal
authored
Merge pull request #6599 from jeromecoutant/PR_WARNING
STM32 compilation warning issues
2 parents fe44dc0 + 71d7d24 commit e2567e5

File tree

30 files changed

+126
-48
lines changed

30 files changed

+126
-48
lines changed

features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_STM/TARGET_STM32F2/TARGET_NUCLEO_F207ZG/stm32f2_eth_init.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,4 +84,4 @@ void HAL_ETH_MspDeInit(ETH_HandleTypeDef* heth)
8484
/* Disable the Ethernet global Interrupt */
8585
NVIC_DisableIRQ(ETH_IRQn);
8686
}
87-
}
87+
}

features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_STM/TARGET_STM32F4/TARGET_ARCH_MAX/stm32f4_eth_init.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,4 @@ void HAL_ETH_MspDeInit(ETH_HandleTypeDef* heth)
7878
/* Disable the Ethernet global Interrupt */
7979
NVIC_DisableIRQ(ETH_IRQn);
8080
}
81-
}
81+
}

features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_STM/TARGET_STM32F4/TARGET_MTB_UBLOX_ODIN_W2/stm32f4_eth_init.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,4 +156,4 @@ uint8_t mbed_otp_mac_address(char *mac)
156156
memcpy(mac, _macAddr, 6);
157157

158158
return 1;
159-
}
159+
}

features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F429ZI/stm32f4_eth_init.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,4 +84,4 @@ void HAL_ETH_MspDeInit(ETH_HandleTypeDef* heth)
8484
/* Disable the Ethernet global Interrupt */
8585
NVIC_DisableIRQ(ETH_IRQn);
8686
}
87-
}
87+
}

features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F439ZI/stm32f4_eth_init.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,4 +84,4 @@ void HAL_ETH_MspDeInit(ETH_HandleTypeDef* heth)
8484
/* Disable the Ethernet global Interrupt */
8585
NVIC_DisableIRQ(ETH_IRQn);
8686
}
87-
}
87+
}

features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_STM/TARGET_STM32F7/TARGET_NUCLEO_F746ZG/stm32f7_eth_init.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,4 +86,4 @@ void HAL_ETH_MspDeInit(ETH_HandleTypeDef* heth)
8686
/* Disable the Ethernet global Interrupt */
8787
NVIC_DisableIRQ(ETH_IRQn);
8888
}
89-
}
89+
}

features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_STM/TARGET_STM32F7/TARGET_NUCLEO_F756ZG/stm32f7_eth_init.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,4 +86,4 @@ void HAL_ETH_MspDeInit(ETH_HandleTypeDef* heth)
8686
/* Disable the Ethernet global Interrupt */
8787
NVIC_DisableIRQ(ETH_IRQn);
8888
}
89-
}
89+
}

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

targets/TARGET_STM/TARGET_STM32F1/serial_device.c

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

4242
// Defined in serial_api.c
43-
inline int8_t get_uart_index(UARTName uart_name);
43+
extern int8_t get_uart_index(UARTName uart_name);
4444

4545
/******************************************************************************
4646
* INTERRUPTS HANDLING

targets/TARGET_STM/TARGET_STM32F2/device/stm32f2xx_hal_mmc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1309,7 +1309,7 @@ HAL_StatusTypeDef HAL_MMC_Erase(MMC_HandleTypeDef *hmmc, uint32_t BlockStartAdd,
13091309
hmmc->State = HAL_MMC_STATE_BUSY;
13101310

13111311
/* Check if the card command class supports erase command */
1312-
if((hmmc->MmcCard.Class) & SDIO_CCCC_ERASE == 0U)
1312+
if(((hmmc->MmcCard.Class) & SDIO_CCCC_ERASE) == 0U)
13131313
{
13141314
/* Clear all the static flags */
13151315
__HAL_MMC_CLEAR_FLAG(hmmc, SDIO_STATIC_FLAGS);

targets/TARGET_STM/TARGET_STM32F2/serial_device.c

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

4242
// Defined in serial_api.c
43-
inline int8_t get_uart_index(UARTName uart_name);
43+
extern int8_t get_uart_index(UARTName uart_name);
4444

4545
/******************************************************************************
4646
* INTERRUPTS HANDLING

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

targets/TARGET_STM/TARGET_STM32F4/device/stm32f4xx_hal_can_legacy.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@
136136
#error 'The HAL CAN driver cannot be used with its legacy, Please ensure to enable only one HAL CAN module at once in stm32f4xx_hal_conf.h file'
137137
#endif /* HAL_CAN_MODULE_ENABLED */
138138

139-
#warning 'Legacy HAL CAN driver is enabled! It can be used with known limitations, refer to the release notes. However it is recommended to use rather the new HAL CAN driver'
139+
// #warning 'Legacy HAL CAN driver is enabled! It can be used with known limitations, refer to the release notes. However it is recommended to use rather the new HAL CAN driver'
140140

141141
/* Private typedef -----------------------------------------------------------*/
142142
/* Private define ------------------------------------------------------------*/

targets/TARGET_STM/TARGET_STM32F4/serial_device.c

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

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

5555
/******************************************************************************
5656
* INTERRUPTS HANDLING

targets/TARGET_STM/TARGET_STM32F7/device/stm32f7xx_hal_can_legacy.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@
130130
#error 'The HAL CAN driver cannot be used with its legacy, Please ensure to enable only one HAL CAN module at once in stm32f7xx_hal_conf.h file'
131131
#endif /* HAL_CAN_MODULE_ENABLED */
132132

133-
#warning 'Legacy HAL CAN driver is enabled! It can be used with known limitations, refer to the release notes. However it is recommended to use rather the new HAL CAN driver'
133+
// #warning 'Legacy HAL CAN driver is enabled! It can be used with known limitations, refer to the release notes. However it is recommended to use rather the new HAL CAN driver'
134134

135135
/* Private typedef -----------------------------------------------------------*/
136136
/* Private define ------------------------------------------------------------*/

targets/TARGET_STM/TARGET_STM32F7/device/stm32f7xx_hal_crc.c

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -405,9 +405,18 @@ uint32_t HAL_CRC_Calculate(CRC_HandleTypeDef *hcrc, uint32_t pBuffer[], uint32_t
405405
return temp;
406406
}
407407

408-
/**
408+
#if __GNUC__
409+
# define MAY_ALIAS __attribute__ ((__may_alias__))
410+
#else
411+
# define MAY_ALIAS
412+
#endif
413+
414+
typedef __IO uint8_t MAY_ALIAS uint8_io_t;
415+
typedef __IO uint16_t MAY_ALIAS uint16_io_t;
416+
417+
/**
409418
* @brief Enter 8-bit input data to the CRC calculator.
410-
* Specific data handling to optimize processing time.
419+
* Specific data handling to optimize processing time.
411420
* @param hcrc CRC handle
412421
* @param pBuffer pointer to the input data buffer
413422
* @param BufferLength input data buffer length
@@ -429,16 +438,16 @@ static uint32_t CRC_Handle_8(CRC_HandleTypeDef *hcrc, uint8_t pBuffer[], uint32_
429438
{
430439
if(BufferLength%4 == 1)
431440
{
432-
*(__IO uint8_t*) (&hcrc->Instance->DR) = pBuffer[4*i];
441+
*(uint8_io_t*) (&hcrc->Instance->DR) = pBuffer[4*i];
433442
}
434443
if(BufferLength%4 == 2)
435444
{
436-
*(__IO uint16_t*) (&hcrc->Instance->DR) = (uint16_t)((uint16_t)((uint16_t)(pBuffer[4*i])<<8) | (uint16_t)(pBuffer[4*i+1]));
445+
*(uint16_io_t*) (&hcrc->Instance->DR) = (uint16_t)((uint16_t)((uint16_t)(pBuffer[4*i])<<8) | (uint16_t)(pBuffer[4*i+1]));
437446
}
438447
if(BufferLength%4 == 3)
439448
{
440-
*(__IO uint16_t*) (&hcrc->Instance->DR) = (uint16_t)((uint16_t)((uint16_t)(pBuffer[4*i])<<8) | (uint16_t)(pBuffer[4*i+1]));
441-
*(__IO uint8_t*) (&hcrc->Instance->DR) = pBuffer[4*i+2];
449+
*(uint16_io_t*) (&hcrc->Instance->DR) = (uint16_t)((uint16_t)((uint16_t)(pBuffer[4*i])<<8) | (uint16_t)(pBuffer[4*i+1]));
450+
*(uint8_io_t*) (&hcrc->Instance->DR) = pBuffer[4*i+2];
442451
}
443452
}
444453

@@ -467,7 +476,7 @@ static uint32_t CRC_Handle_16(CRC_HandleTypeDef *hcrc, uint16_t pBuffer[], uint3
467476
}
468477
if((BufferLength%2) != 0)
469478
{
470-
*(__IO uint16_t*) (&hcrc->Instance->DR) = pBuffer[2*i];
479+
*(uint16_io_t*) (&hcrc->Instance->DR) = pBuffer[2*i];
471480
}
472481

473482
/* Return the CRC computed value */

targets/TARGET_STM/TARGET_STM32F7/device/stm32f7xx_ll_spi.h

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ extern "C" {
4848
* @{
4949
*/
5050

51-
#if defined (SPI1) || defined (SPI2) || defined (SPI3) || defined(SPI4) || defined(SPI5) || defined(SPI6)
51+
#if defined (SPI1) || defined (SPI2) || defined (SPI3) || defined(SPI4) || defined(SPI5) || defined(SPI6)
5252

5353
/** @defgroup SPI_LL SPI
5454
* @{
@@ -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_STM32F7/serial_device.c

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

4141
// Defined in serial_api.c
42-
inline int8_t get_uart_index(UARTName uart_name);
42+
extern int8_t get_uart_index(UARTName uart_name);
4343

4444
/******************************************************************************
4545
* INTERRUPTS HANDLING

targets/TARGET_STM/TARGET_STM32L0/device/stm32l0xx_hal_crc.c

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,14 @@ uint32_t HAL_CRC_Calculate(CRC_HandleTypeDef *hcrc, uint32_t pBuffer[], uint32_t
421421
return temp;
422422
}
423423

424+
#if __GNUC__
425+
# define MAY_ALIAS __attribute__ ((__may_alias__))
426+
#else
427+
# define MAY_ALIAS
428+
#endif
424429

430+
typedef __IO uint8_t MAY_ALIAS uint8_io_t;
431+
typedef __IO uint16_t MAY_ALIAS uint16_io_t;
425432

426433
/**
427434
* @}
@@ -486,16 +493,16 @@ static uint32_t CRC_Handle_8(CRC_HandleTypeDef *hcrc, uint8_t pBuffer[], uint32_
486493
{
487494
if (BufferLength%4U == 1U)
488495
{
489-
*(uint8_t volatile*) (&hcrc->Instance->DR) = pBuffer[4U*i];
496+
*(uint8_io_t*) (&hcrc->Instance->DR) = pBuffer[4U*i];
490497
}
491498
if (BufferLength%4U == 2U)
492499
{
493-
*(uint16_t volatile*) (&hcrc->Instance->DR) = ((uint32_t)pBuffer[4U*i]<<8U) | (uint32_t)pBuffer[4U*i+1U];
500+
*(uint16_io_t*) (&hcrc->Instance->DR) = ((uint32_t)pBuffer[4U*i]<<8U) | (uint32_t)pBuffer[4U*i+1U];
494501
}
495502
if (BufferLength%4U == 3U)
496503
{
497-
*(uint16_t volatile*) (&hcrc->Instance->DR) = ((uint32_t)pBuffer[4U*i]<<8U) | (uint32_t)pBuffer[4U*i+1U];
498-
*(uint8_t volatile*) (&hcrc->Instance->DR) = pBuffer[4U*i+2U];
504+
*(uint16_io_t*) (&hcrc->Instance->DR) = ((uint32_t)pBuffer[4U*i]<<8U) | (uint32_t)pBuffer[4U*i+1U];
505+
*(uint8_io_t*) (&hcrc->Instance->DR) = pBuffer[4U*i+2U];
499506
}
500507
}
501508

@@ -524,7 +531,7 @@ static uint32_t CRC_Handle_16(CRC_HandleTypeDef *hcrc, uint16_t pBuffer[], uint3
524531
}
525532
if ((BufferLength%2U) != 0U)
526533
{
527-
*(uint16_t volatile*) (&hcrc->Instance->DR) = pBuffer[2U*i];
534+
*(uint16_io_t*) (&hcrc->Instance->DR) = pBuffer[2U*i];
528535
}
529536

530537
/* Return the CRC computed value */

0 commit comments

Comments
 (0)