cancel
Showing results for 
Search instead for 
Did you mean: 

weak attribute needed in app.freertos.c

in app_freertos.c, the hook prototypes are not all defined as __weak.  This requires either deleting those prototypes or rewriting them with the __weak attribute to avoid multiple definitions when they're actually used in user code.  

I generally do not like to modify the IOC provided code unless it's main.c.  Even though there are user sections, I'd like to have to modify as few things as possible to get a working project

I do use the hook prototypes frequently, but the hook definitions are autogenerated and not in a user area.

Please change your code to add the __weak attribute, as shown in the segment below.  I've got them commented out because I transplanted the definitions into the user area so I would at least keep them.

/* Hook prototypes */
//__weak void configureTimerForRunTimeStats(void);
//__weak unsigned long getRunTimeCounterValue(void);
//__weak void vApplicationStackOverflowHook(xTaskHandle xTask, signed char *pcTaskName);
//__weak void vApplicationMallocFailedHook(void);

 

This would have no impact if the functions were not used, since the prototypes exist and would not be overridden.  For someone who defines those routines and uses them, the multiple definition problems would be eliminated.

thanks.

 

10 REPLIES 10

I don't see a recommended workflow here.  

I was looking for consistency between user code sections 1 and 4.

I'm not sure who would be redefining the hook functions for FreeRTOS, but if that's someone else's code, I'll find it when it breaks.  

Your argument for weak definitions, well, it's all in user sections, so not sure if that's as good an argument as it might be.

I think we just code differently.

Thanks