Skip to content

STM32 compilation warning issues #6599

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Apr 16, 2018
Merged

Conversation

jeromecoutant
Copy link
Collaborator

Description

This PR follow @pauluap work in #6262
and correct ("only") compilation warning in the ST driver files.

Internal tickets has been raised in ST side to align code.

Thx

Pull request type

[x] Fix
[ ] Refactor
[ ] New target
[ ] Feature
[ ] Breaking change

@pauluap
Copy link

pauluap commented Apr 11, 2018

I have compiler messages covering this set of changes

https://github.com/pauluap/mbed-os/tree/compiler_warning_declaration_not_provided

../targets/TARGET_STM/stm_spi_api.c: In function 'spi_master_start_asynch_transfer':
../targets/TARGET_STM/stm_spi_api.c:531:5: warning: implicit declaration of function 'HAL_SPIEx_FlushRxFifo' [-Wimplicit-function-declaration]
     HAL_SPIEx_FlushRxFifo(handle);
     ^~~~~~~~~~~~~~~~~~~~~

https://github.com/pauluap/mbed-os/commits/compiler_warning_inline_keyword_misuse

Compile: serial_device.c
../targets/TARGET_STM/TARGET_STM32F7/serial_device.c:42:15: warning: inline function 'get_uart_index' declared but never defined
 inline int8_t get_uart_index(UARTName uart_name);
               ^~~~~~~~~~~~~~

https://github.com/pauluap/mbed-os/commits/compiler_warning_strict_antialiasing
This warning appears at the -O3 optimization level

Compile: stm32f7xx_hal_crc.c
../targets/TARGET_STM/TARGET_STM32F7/device/stm32f7xx_hal_crc.c: In function 'CRC_Handle_8':
../targets/TARGET_STM/TARGET_STM32F7/device/stm32f7xx_hal_crc.c:436:8: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
        *(__IO uint16_t*) (&hcrc->Instance->DR) = (uint16_t)((uint16_t)((uint16_t)(pBuffer[4*i])<<8) | (uint16_t)(pBuffer[4*i+1]));
        ^
../targets/TARGET_STM/TARGET_STM32F7/device/stm32f7xx_hal_crc.c:440:8: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
        *(__IO uint16_t*) (&hcrc->Instance->DR) = (uint16_t)((uint16_t)((uint16_t)(pBuffer[4*i])<<8) | (uint16_t)(pBuffer[4*i+1]));
        ^
../targets/TARGET_STM/TARGET_STM32F7/device/stm32f7xx_hal_crc.c: In function 'CRC_Handle_16':
../targets/TARGET_STM/TARGET_STM32F7/device/stm32f7xx_hal_crc.c:470:6: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
      *(__IO uint16_t*) (&hcrc->Instance->DR) = pBuffer[2*i];
      ^

Compile: stm_spi_api.c
In file included from .././targets/TARGET_STM/TARGET_STM32F7/spi_device.h:33:0,
                 from ../targets/TARGET_STM/stm_spi_api.c:42:
.././targets/TARGET_STM/TARGET_STM32F7/device/stm32f7xx_ll_spi.h: In function 'LL_SPI_TransmitData16':
.././targets/TARGET_STM/TARGET_STM32F7/device/stm32f7xx_ll_spi.h:1388:3: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
   *((__IO uint16_t *)&SPIx->DR) = TxData;
   ^

Copy link

@pauluap pauluap left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I currently think that this function needs further work to handle other potential negative number issues. I've generated a pull request for this particular set of changes - #6609

@jeromecoutant
Copy link
Collaborator Author

PCD warnings are now followed by #6609
I removed then this part from this PR

@0xc0170
Copy link
Contributor

0xc0170 commented Apr 12, 2018

@pauluap Please rereview

@pauluap
Copy link

pauluap commented Apr 12, 2018

Ok, I checked out the PCD comments and I now agree with the ST driver team that my more extensive changes aren't required. I'll clean up #6609 to get things back in line with the ilen variant.

@@ -454,6 +454,15 @@ HAL_CRC_StateTypeDef HAL_CRC_GetState(CRC_HandleTypeDef *hcrc)
* @{
*/

#if __GNUC__
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is this solving for GCC?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pauluap@27425bc

The warning messages that this change clears is shown in the commit message. The warning only appears at the -O3 optimization level

@0xc0170
Copy link
Contributor

0xc0170 commented Apr 13, 2018

/morph build

@mbed-ci
Copy link

mbed-ci commented Apr 13, 2018

Build : SUCCESS

Build number : 1743
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/6599/

Triggering tests

/morph test
/morph uvisor-test
/morph export-build
/morph mbed2-build

@mbed-ci
Copy link

mbed-ci commented Apr 13, 2018

@mbed-ci
Copy link

mbed-ci commented Apr 14, 2018

@cmonr cmonr merged commit e2567e5 into ARMmbed:master Apr 16, 2018
@jeromecoutant jeromecoutant deleted the PR_WARNING branch April 16, 2018 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants