-
Bug
-
Resolution: Fixed
-
High
-
PDK
-
PDK-12893
-
NA
-
PROCESSOR_SDK_09.00.00
-
PROCESSOR_SDK_09.00.00
-
Issue Description
(1) Race conditions in uiPortgetRuntimeCounterValue and uxPortReadPmuCounter in R5 FreeRTOS port
Issue in uxPortReadPmuCounter: ulPmuTsOverFlowCount may be increased multiple times, if it is handled from task and ISR context, during context switch.
(2) Integer underflow due to incorrect handling of critical section. Tick timer interrupt may occur after pmuCounterRead in line, uxDeltaTs = pmuCounterRead - ullPortLastTickPmuTs;. The value of uxDeltaTs will be corrupted, as ullPortLastTickPmuTs will be greated than pmuCounterRead.
Resolution
(1) Added check in the uxPortReadPmuCounter API to make sure that the overflow is handled only from ISR context. PMU counter overflows in every 4.2 Seconds, and its sufficient to handle overflow in Tick ISR(i.e., in ISR context).
(2) Made sure that the ullPortLastTickPmuTs is not larger than pmuCounterRead while calculating uxDeltaTs.