2025-08-31 8:44 AM
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.
2025-08-31 4:52 PM
Most implementations I can find on ST's GitHub already have __weak and/or a relevant USER CODE section.
How are you generating these? Chip family? Can you share the IOC?