Skip to content

Commit 2d0dce1

Browse files
committed
STM32F7 : correct compilation warnings
1 parent 2fcf8d8 commit 2d0dce1

File tree

6 files changed

+30
-13
lines changed

6 files changed

+30
-13
lines changed

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_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

0 commit comments

Comments
 (0)