Skip to content

Commit a63105a

Browse files
committed
sw: Fix perf_cnt test
Starting the performance counter takes very long for some reason, and DMA transfer starts before counter starts tracking
1 parent a5f5326 commit a63105a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

sw/tests/perf_cnt.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,12 @@ int main() {
8282
snrt_start_perf_counter(0);
8383
snrt_start_perf_counter(1);
8484

85+
// Wait for some cycles, since DMA instruction is faster than the
86+
// register configuration
87+
for (int i = 0; i < 50; i++) {
88+
asm volatile("nop");
89+
}
90+
8591
// Start DMA transfer and wait for completion
8692
snrt_dma_txid_t txid_1d = snrt_dma_start_1d(dst, src, WIDE_WORD_SIZE);
8793
snrt_dma_wait_all();

0 commit comments

Comments
 (0)