AnsweredAssumed Answered

__weak &  CLANG

Question asked by curran.danny on Oct 4, 2017
Latest reply on Oct 5, 2017 by curran.danny

Using the 5.24a Keil tool & MXCube v4.22 with V1.16 libs for F4 devices

 

Have a project based on mxCube and my code that works correctly .

 

linking...
Program Size: Code=53948 RO-data=8468 RW-data=67988 ZI-data=55308 
"..\Output\dogs danglies.axf" - 0 Error(s), 0 Warning(s).
Build Time Elapsed:  00:00:13

 

So out of interest instead of trying the default compiler I tried 6.7 ( CLANG I believe) 

 

So code now compiles with issues around the HAL driver code e.g.

 

creating preprocessor file for stm32f4xx_hal_adc.c...
../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dac.c(305): error: unknown type name '__weak'
__weak void HAL_DAC_MspInit(DAC_HandleTypeDef* hdac)

 

so I understand in v6.7  __weak is  defined as   __WEAK and that's defined in cmsis_armclang.h

Looking at 

core_cmFunc.h

core_cmInstr.h

core_cmSimd.h

 

there is this 

/*------------------ ARM Compiler V6 -------------------*/
#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
  #include "cmsis_armcc_V6.h"

 

in the file cmsis_compiler.h there is this   ( RTX_Config.c calls it) 
/*
 * ARM Compiler 6 (armclang)
 */
#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
  #include "cmsis_armclang.h"

 

 

So apart from waiting till the CMSIS Libs are updated to include the cnsis_armclang.h is there a quick easy way of getting around this issue rather than sticking this in the code that have issues 

 

#ifndef   __WEAK
  #define __WEAK                                 __attribute__((weak))
#endif

 

 

Thanks

Outcomes