STMicroelectronics / STM32CubeWB

Full Firmware Package for the STM32WB series: HAL+LL drivers, CMSIS, BSP, MW, plus a set of Projects (examples and demos) running on all boards provided by ST (Nucleo, Evaluation and Discovery Kits).
https://www.st.com/en/embedded-software/stm32cubewb.html
Other
227 stars 138 forks source link

svc_ctl.c is missing a definition of __weak #14

Closed tim-nordell-nimbelink closed 2 years ago

tim-nordell-nimbelink commented 4 years ago

The svc_ctl.c is depending on a compiler specified include to provide the weak definition. The .c file should include either #include "stm32wbxx_hal_def.h", or using the CMSIS provided WEAK definition via "cmsis_compiler.h". Without modifying this file (or the compiler include directives), you end up with:

     Middlewares/ST/STM32_WPAN/ble/svc/Src/svc_ctl.c:71:7: error: expected ';' before 'void'
       71 | __weak void DIS_Init( void )
          |       ^~~~~
          |       ;
    Middlewares/ST/STM32_WPAN/ble/svc/Src/svc_ctl.c:75:7: error: expected ';' before 'void'
       75 | __weak void EDS_STM_Init( void )
          |       ^~~~~
          |       ;
...
ASELSTM commented 4 years ago

Hi @tim-nordell-nimbelink,

Thank you for this other report. Your request has been forwarded to our development team. We will get back to you as soon as they provide us with their feedback.

With regards,

ASELSTM commented 4 years ago

Hi @tim-nordell-nimbelink,

The issue has been reported to our development team and they confirmed it. A fix will be implemented and made available in future release. Thank you once again for your contribution.

With regards,

ASELSTM commented 4 years ago

ST Internal Reference: 94220

ASELSTM commented 3 years ago

Hi @tim-nordell-nimbelink,

I hope you are fine. The issue you reported has been fixed in the frame of version v1.10.0 of the STM32CubeWB published recently on GitHub.

Thank you again for having reported.

With regards,

tim-nordell-nimbelink commented 3 years ago

Hi @ASELSTM -

Unfortunately, the fix isn't quite correct. The code was changed to use "cmsis_compiler.h", but that provides a WEAK definition, not a weak definition. The rest of the code in the .c file was left with __weak. The end result is this:

Middlewares/ST/STM32_WPAN/ble/svc/Src/svc_ctl.c:64:7: error: expected ';' before 'void'
   64 | __weak void BLS_Init( void )
      |       ^~~~~
      |       ;
Middlewares/ST/STM32_WPAN/ble/svc/Src/svc_ctl.c:68:7: error: expected ';' before 'void'
   68 | __weak void CRS_STM_Init( void )
      |       ^~~~~
      |       ;
Middlewares/ST/STM32_WPAN/ble/svc/Src/svc_ctl.c:72:7: error: expected ';' before 'void'
   72 | __weak void DIS_Init( void )
      |       ^~~~~
      |       ;
Middlewares/ST/STM32_WPAN/ble/svc/Src/svc_ctl.c:76:7: error: expected ';' before 'void'
   76 | __weak void EDS_STM_Init( void )
      |       ^~~~~
      |       ;
...

Changing the definitions to __WEAK fixes it:

-__weak void BLS_Init( void )
+__WEAK void BLS_Init( void )
...
-__weak void CRS_STM_Init( void )
+__WEAK void CRS_STM_Init( void )
...

since that matches the include file that was added.

Thanks, Tim

ASELSTM commented 3 years ago

Hi @tim-nordell-nimbelink,

Thank you for bringing this to our attention, I will let our development team know about this. Thank you once again for your contribution.

Best regards,

ASELSTM commented 2 years ago

ST Internal Reference: 120815.

karlp commented 2 years ago

Please definitely change the weak to WEAK so that things "just work" please definitely don't add a HAL dependency to this core library :) Most of the rest of the STM32_WPAN middleware uses WEAK correctly, there's just a few files that have weak instead.

tim-nordell-nimbelink commented 2 years ago

This looks like this was fixed in v1.13.2.