FASTRUN void loop() {
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
C:\Arduino\libraries\Audio\effect_fade.cpp:31:22: warning: type of 'fader_table' does not match original declaration [enabled by default]
extern const int16_t fader_table[256];
^
C:\Arduino\libraries\Audio\data_waveforms.c:81:15: note: previously declared here
const int16_t fader_table[257] = {
Here's an example. A rather silly one, since you'd want to use FASTRUN on functions that matter for performance.
Code:FASTRUN void loop() { digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level) delay(1000); // wait for a second digitalWrite(led, LOW); // turn the LED off by making the voltage LOW delay(1000); // wait for a second }
Sometimes FASTRUN can help a lot, especially when running at faster clock speeds (eg, overclocking stuff that's disabled by default in boards.txt), but more often than not it gives little to no benefit, for a lot of extra RAM usage, when used on functions that don't matter for performance.
No, the FASTRUN macro uses an __attribute__ to put the code for the function into the .fastrun data section, instead of the the .text section. The linker script puts the .fastrun section into the read/write SRAM instead of the read-only FLASH memory that normally the code goes into. I would imagine the trade off is SRAM is much faster to reference, but by using it, you have less data for your data. Because it is in read/write memory, you also run the risk of something that writes outside of its bounds changing the code.Thanks for the example. How does it make things faster, inlining to avoid call and return overhead?
#elif defined(__arm__) && defined(TEENSYDUINO)
#elif defined(__arm__) && defined(CORE_TEENSY)