cancel
Showing results for 
Search instead for 
Did you mean: 

__weak & CLANG

dcurran2
Associate II
Posted on October 04, 2017 at 16:26

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

2 REPLIES 2
Posted on October 04, 2017 at 18:02

Hello!

0690X00000608UDQAY.png

Change the C Language  settings droplist to an appropriate to HAL C variant.

Regards

vf

dcurran2
Associate II
Posted on October 05, 2017 at 13:15

Vangelis 

Thanks for that, makes it a lot easier than messing about. Will have to start to RTFM.

Danny