ART accelerator
Posted: Thu Jan 09, 2020 3:11 pm
while playing with my PILL_F401 board, i got a little curious about the 'ART accelerator'. the ART accelerator is also available for F411, F405, F407 various F4* (note different from the 'ChromART' accelerator, ChromART is one level 'up' and does DMA2D - i.e. graphics acceleration, if you want to play with DMA2D 'ChromART' a board is STM32F429 discovery https://www.st.com/en/evaluation-tools/ ... overy.html)
this post is purely about the mcu cache for flash.
it turns out the ART accelerator is basically the cache settings for flash
i found this stackoverflow thread:
https://stackoverflow.com/questions/113 ... 6/12020932
in which one those replies referred to this doc for F2 code, check for "ART configuration"
https://www.st.com/content/ccc/resource ... 033348.pdf
i used this codes to toggle the caches to visualise the differences, currently these defines are only valid in official core.
a sample run looks like this: (this is -O3 compiled, so maybe the optimizer cheats a little for the mflops)
but for any reason if you think it isn't (enabled) you could try the above codes, it works even in setup() from arduino codes.
it is the same codes as PILL_F401 whetstone blinky for official core with the above test codes added
viewtopic.php?f=14&p=509#p509
serial terminal commands
p - print temperature
s - stop printing
w - run whetstone benchmark
a - toggle 'ART accelerator'
this article gives a good background on that 'ART accelerator'
https://eda360insider.wordpress.com/201 ... -in-1000s/
this post is purely about the mcu cache for flash.
it turns out the ART accelerator is basically the cache settings for flash
i found this stackoverflow thread:
https://stackoverflow.com/questions/113 ... 6/12020932
in which one those replies referred to this doc for F2 code, check for "ART configuration"
https://www.st.com/content/ccc/resource ... 033348.pdf
i used this codes to toggle the caches to visualise the differences, currently these defines are only valid in official core.
Code: Select all
void ARTtoggle() {
if((FLASH->ACR & FLASH_ACR_ICEN)!=FLASH_ACR_ICEN) { // art disabled
/* enable the ART accelerator */
/* enable prefetch buffer */
FLASH->ACR |= FLASH_ACR_PRFTEN;
/* Enable flash instruction cache */
FLASH->ACR |= FLASH_ACR_ICEN;
/* Enable flash data cache */
FLASH->ACR |= FLASH_ACR_DCEN;
asm("wfi"); //wait for a systick interrupt i.e. delay(1)
Serial.println("ART enabled");
} else {
/* disable the ART accelerator */
/* disable flash instruction cache */
FLASH->ACR &= ~FLASH_ACR_ICEN;
/* disable flash data cache */
FLASH->ACR &= ~FLASH_ACR_DCEN;
/* enable prefetch buffer */
FLASH->ACR |= FLASH_ACR_PRFTEN;
asm("wfi"); //wait for a systick interrupt, i.e. delay(1)
Serial.println("ART disabled");
}
}

the 'ART accelerator' is enabled default i.e. the cache flags are enabled at least for the F401 that i played with in the official coreART disabled
Beginning Whetstone benchmark at 84 MHz ...
Loops:10000, Iterations:1, Duration:5596.96 millisec
C Converted Single Precision Whetstones:178.67 Mflops
ART enabled
Beginning Whetstone benchmark at 84 MHz ...
Loops:10000, Iterations:1, Duration:4654.92 millisec
C Converted Single Precision Whetstones:214.83 Mflops
but for any reason if you think it isn't (enabled) you could try the above codes, it works even in setup() from arduino codes.
it is the same codes as PILL_F401 whetstone blinky for official core with the above test codes added
viewtopic.php?f=14&p=509#p509
serial terminal commands
p - print temperature
s - stop printing
w - run whetstone benchmark
a - toggle 'ART accelerator'
this article gives a good background on that 'ART accelerator'
https://eda360insider.wordpress.com/201 ... -in-1000s/