freertos10_xilinx: FreeRTOS tick runs 10x slow when generate_runtime_stats=1 on MicroBlaze + AXI Timer
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 78/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- c
- Ambito
- embedded-iot
Direzione di ricerca
Leggi Source/portable/GCC/MicroBlazeV9/portmicroblaze.c e confronta il calcolo del periodo di AXI Timer con i percorsi TTCPS e xiltimer, che tengono conto delle statistiche di runtime. Aggiorna il calcolo di AXI Timer per configGENERATE_RUN_TIME_STATS, quindi verifica che il periodo dell’interrupt del timer sia dieci volte la frequenza dei tick quando è abilitato e rimanga pari alla frequenza dei tick altrimenti.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Environment
- Vitis Classic 2023.2, freertos10_xilinx v1_14 (FreeRTOS kernel V10.3.0)
- MicroBlaze (v11.0) + AXI Timer + AXI INTC, no PS, no xiltimer (legacy timer mode)
- Verified the same code is still present in current embeddedsw master (kernel V10.6.1 file)
Steps to reproduce
- Create a FreeRTOS BSP for MicroBlaze with an AXI Timer as tick source.
- Enable BSP setting
generate_runtime_stats = 1(generates configGENERATE_RUN_TIME_STATS=1). - configTICK_RATE_HZ = 100, timer clock 125 MHz.
Actual behavior
The FreeRTOS tick runs 10x slow: real tick period is 100 ms instead of 10 ms. vTaskDelay(1000) takes 10 s wall time. No warning is emitted anywhere.
Root cause
Source/portable/GCC/MicroBlazeV9/port.c, vPortTickISR: when configGENERATE_RUN_TIME_STATS == 1, xTaskIncrementTick() is called only every 10th interrupt:
#if (configGENERATE_RUN_TIME_STATS == 1)
ulHighFrequencyTimerTicks++;
if (!(ulHighFrequencyTimerTicks % 10))
#endif
{ xTaskIncrementTick(); ... }
This requires the timer interrupt to be configured at configTICK_RATE_HZ * 10. The TTCPS path and the xiltimer path both implement this (with comments stating the ×10 is required and hard coded). However the AXI Timer path in portmicroblaze.c computes the period unconditionally, with no configGENERATE_RUN_TIME_STATS branch:
const unsigned long ulCounterValue = ( ( XPAR_TMRCTR_0_CLOCK_FREQ_HZ / configTICK_RATE_HZ ) - 1UL );
(Line ~185 in v1_14; same in master: ThirdParty/bsp/freertos10_xilinx/src/Source/portable/GCC/MicroBlazeV9/portmicroblaze.c)
So the interrupt still fires at tick rate, the ISR divides by 10, and the tick comes out 10x slow.
Suggested fix
#if ( configGENERATE_RUN_TIME_STATS == 1 )
const unsigned long ulCounterValue = ( ( XPAR_TMRCTR_0_CLOCK_FREQ_HZ / ( configTICK_RATE_HZ * 10UL ) ) - 1UL );
#else
const unsigned long ulCounterValue = ( ( XPAR_TMRCTR_0_CLOCK_FREQ_HZ / configTICK_RATE_HZ ) - 1UL );
#endif
Workaround (verified on hardware)
The application overrides the weak vApplicationSetupTimerInterrupt() with a copy of the default implementation using the corrected period above. Tick returns to the correct rate; runtime stats counter then increments at 10x tick rate as intended.
Impact
Any MicroBlaze + AXI Timer design that enables the documented generate_runtime_stats BSP option silently gets 10x-slow system timing. See also a similar user report: reddit.com/r/Xilinx/comments/1m1dz6l
- Lingua principale
- HTML
- Stelle
- 1.2k
- Fork
- 1.2k
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di Xilinx/embeddedsw
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
Xilinx/embeddedsw#400 ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
Xilinx/embeddedsw#399 ·
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 82/100
Xilinx/embeddedsw#398 ·
-
XSpiPs_Abort Infinite LoopsAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
Xilinx/embeddedsw#388 · 2 commenti ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
Xilinx/embeddedsw#385 ·
Tutte le issue di Xilinx/embeddedsw
Issue simili
-
external converter
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
Koenkk/zigbee2mqtt#33803 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
Yaskawa-Global/motoros2#518 ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 71/100