cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F4 DFP HAL Drivers Compatibility with ARM Compiler 6

MKari.1
Associate II

Just started to migrate to the ARM compiler 6 and I noticed __weak is incompatible language extension in this version and it needs to be written __attribute__((weak)).

In STM32F4 HAL Drivers and almost all of the STM32 MCUs, there are lots of functions that have __weak in their declaration while it is not supported in ARM compiler V6.

As for ARM Compiler and the DFPs, I have installed the latest versions.

Are we having a problematic kind of situation here?

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Guru

ARM compiler appears to have changed how this works in v6 compared to v5.

https://www.keil.com/appnotes/files/apnt_298.pdf

It's easy enough to adapt by putting the define somewhere before including files:

#define __weak __attribute__((weak))

This is done within stm32f4xx_hal_def.h but doesn't appear compatible with v6.

If you feel a post has answered your question, please click "Accept as Solution".

View solution in original post

4 REPLIES 4
TDK
Guru

ARM compiler appears to have changed how this works in v6 compared to v5.

https://www.keil.com/appnotes/files/apnt_298.pdf

It's easy enough to adapt by putting the define somewhere before including files:

#define __weak __attribute__((weak))

This is done within stm32f4xx_hal_def.h but doesn't appear compatible with v6.

If you feel a post has answered your question, please click "Accept as Solution".
MKari.1
Associate II

Thanks for the reply. Actually I knew how to get around this, but isn't it better that ST fixes this problem, not the users. My question was about __weak, but there maybe lots of other incompatibilities that users should find them. It's better for everyone that ST gives an update for the DFPs or at least some kind of warning to the users, so that they can be aware of such issues.

As you have mentioned, it's really easy to adapt them. Then it is safe to use the DFPs with V6 and not to worry about basic compatibilities.

Thanks for the reply. Actually I knew how to get around this, but isn't it better that ST fixes this problem, not the users. My question was about __weak, but there maybe lots of other incompatibilities that users should find them. It's better for everyone that ST gives an update for the DFPs or at least some kind of warning to the users, so that they can be aware of such issues.

As you have mentioned, it's really easy to adapt them. Then it is safe to use the DFPs with V6 and not to worry about basic compatibilities.

Seems reasonable. It also seems reasonable to expect compilers to not change how basic features work between versions. Why change how __weak works? My guess is they are trying to standardize to how it's done in GNU GCC, but in the process broke compatibility.

If you feel a post has answered your question, please click "Accept as Solution".