defragster
Senior Member+
In response to a query about code/RAM used on base USB sketch - I did this to see the current numbers without USB. I started with Teensy :: arduino-1.8.4\examples\01.Basics\Blink
This fails on a T_3.1 - 'No USB' - compiled 'smallest code' { with and without LTO } [also fails FAST w/LTO}.
Uploading with TeensyLoader 1.39 and IDE 1.8.4 on Windows, Larger code executed with no problem when using PJRC yield(). NOTE: Another recent post with a 'void yield()' in library code was dying on start, removing that allowed it to run.
Blink as below fails to show 'LED' signs of running when using this to further reduce base code: void yield(void) {};
This fails on a T_3.1 - 'No USB' - compiled 'smallest code' { with and without LTO } [also fails FAST w/LTO}.
Uploading with TeensyLoader 1.39 and IDE 1.8.4 on Windows, Larger code executed with no problem when using PJRC yield(). NOTE: Another recent post with a 'void yield()' in library code was dying on start, removing that allowed it to run.
Blink as below fails to show 'LED' signs of running when using this to further reduce base code: void yield(void) {};
Code:
void yield(void) {};
int led = 13;
void setup() {
// initialize the digital pin as an output.
pinMode(led, OUTPUT);
digitalWriteFast(led, HIGH); // turn the LED on (HIGH is the voltage level)
}
void loop() {
digitalWriteFast(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWriteFast(led, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
// USB type : No USB
// ------------------------------
// Smallest Code - PJRC Yield - T_3.1 :: Uploads and Blinks
// Sketch uses 3508 bytes (1%)
// Global variables use 900 bytes (1%)
// Smallest Code - void Yield - T_3.1 :: Uploads, then Blink fails
// Sketch uses 2280 bytes (0%)
// Global variables use 488 bytes (0%)
// Smallest Code w/LTO - void Yield - T_3.1 :: Uploads, then Blink fails
// Sketch uses 1680 bytes (0%)
// Global variables use 480 bytes (0%)
// Fast w/LTO - void Yield - T_3.1 :: Uploads, then Blink fails
// Sketch uses 3104 bytes (1%)
// Global variables use 1544 bytes (2%)