overriding osDelay function
Hello,
stm32F4
FreeRTOS
Cube 1.4.2
My code sometimes run pretty long osDelay. In fact "long" means "longer than watchdog"..
I thought about cutting the delay in smaller delays and call a watchdog kick after each delay. Something like this:
osStatus delay(uint32_t delay) {
#if INCLUDE_vTaskDelay
uint32_t remainingDelay = delay;
while (remainingDelay > WATCHDOG_DELAY / 2) {
TickType_t ticks = (WATCHDOG_DELAY / 2) / portTICK_PERIOD_MS;
vTaskDelay(ticks ? ticks : 1); /* Minimum delay = 1 tick */
remainingDelay -= WATCHDOG_DELAY / 2;
watchdogSignal(testTaskId);
}
TickType_t ticks = remainingDelay / portTICK_PERIOD_MS;
vTaskDelay(ticks ? ticks : 1); /* Minimum delay = 1 tick */
watchdogSignal(testTaskId);
return osOK;
#else
(void) millisec;
return osErrorResource;
#endif
}But the thing is, I would like all the code to use this snippet, ie replacing osDelay.
BUT osDelay is not declared weak.
Do you know a way to do this without having to :
- modify the cmsis_os.c file
- replacing all calls to osDelay to the above function.
?
Or maybe, is there a better way to do this?
Thanks
Julien
