2020-11-01 03:34 AM
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?
Solved! Go to Solution.
2020-11-01 07:59 AM
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.
2020-11-01 07:59 AM
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.
2020-11-01 08:58 PM
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.
2020-11-01 08:59 PM
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.
2020-11-02 06:08 AM
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.