Snooze not working with any T4.x on TD1.56

Rezo

Well-known member
I haven't tested this on older versions of Teensyduino, but I get the same behavior on a Teensy 4.0, 4.1 and MicroMod when compiling and uploading from TD1.56

I took the following example code and uploaded it to each Teensy and get the same behavior - the boot led will blink 9 times.
I can also confirm this happens when just including the Snooze library in the sketch, and not actually initializing any of it's components.

Obviously something has changed in the recent versions of TD that would cause the teensy to not even boot up.

Code:
/*************************************************
  This example uses the Bounce library to make sure
  the button is still pressed for 3 seconds after
  waking up from low power mode. If it released
  before the 3 seconds are up, go back to sleep.
  Supported Micros: T-LC/3.x/4.0
 *************************************************/

#include <Snooze.h>
#include <Bounce.h>

// Load drivers
// Always use SnoozeUSBSerial with T4.0.
// SnoozeUSBSerial driver does what Serial does like "print", -
// "println", "prinf", etc and also handles the effects of using -
// the Arduino Serial monitor and sleeping. Use it when you -
// want to print to serial monitor for sleeping applications.
SnoozeUSBSerial usb;
// pin wakeup driver
SnoozeDigital digital;// this is the pin wakeup driver
#if defined(__MKL26Z64__)
// configures the lc's 5v data buffer (OUTPUT, LOW) for low power
Snoozelc5vBuffer lc5vBuffer;
#endif

const uint8_t BUTTON = 6;

// debounce of 5ms
Bounce button = Bounce(BUTTON, 5);

// install driver into SnoozeBlock
#if defined(__IMXRT1062__) || defined(__MK66FX1M0__) || defined(__MK64FX512__) || defined(__MK20DX256__)
SnoozeBlock config_teensy(usb, digital);
#elif defined(__MKL26Z64__)
SnoozeBlock config_teensyLC(usb, digital, lc5vBuffer);
#endif
// ------------------------------------------------------------------
void setup() {
  // Configure pin 6 for bounce library
  pinMode(BUTTON, INPUT_PULLUP);
  // debug led
  pinMode(LED_BUILTIN, OUTPUT);
  while (!usb);
  delay(100);
  usb.println("start...");
  delay(20);
  //pin, mode, type
  digital.pinMode(BUTTON, INPUT_PULLUP, FALLING);
}
// ------------------------------------------------------------------
void loop() {
SLEEP:
  digitalWrite(LED_BUILTIN, LOW);

  // you need to update before sleeping.
  button.update();

  usb.println("Going to deepSleep now.\n");
  delay(5);

  // returns module that woke processor after waking from low power mode.
#if defined(__IMXRT1062__) || defined(__MK66FX1M0__) || defined(__MK64FX512__) || defined(__MK20DX256__)
  Snooze.deepSleep( config_teensy );
#elif defined(__MKL26Z64__)
  Snooze.deepSleep( config_teensyLC );
#endif

  // indicate the button woke it up, hold led high for as long as the button
  // is held down.
  digitalWrite(LED_BUILTIN, HIGH);

  elapsedMillis timeout = 0;
  // bounce needs to call update longer than the debounce time = 5ms,
  // which is set in constructor.
  while (timeout < 6) button.update();

  // now check for 3 second button hold
  bool awake = threeSecondHold();

  // if not held for 3 seconds go back to sleep
  if (!awake) goto SLEEP;

  usb.println("Button Wakeup Activated.");

  // the button was held for at least 3 seconds if
  // you get here do some stuff for 7 seconds then
  // go to sleep.
  elapsedMillis time = 0;

  while (1) {
    unsigned int t = time;
    if (t > 7000) goto SLEEP;
    usb.printf("doin stuff for: %i milliseconds.\n", t);
    // back to sleep after 7 seconds
    digitalWrite(LED_BUILTIN, HIGH);
    delay(25);
    digitalWrite(LED_BUILTIN, LOW);
    delay(25);
  }
}
// ------------------------------------------------------------------
bool threeSecondHold() {
  // this is the 3 sec button press check
  while (button.duration() < 3000) {

    // get the current pin state, must have this!
    button.update();

    // Check button state, if the button
    // is not pressed for 3 seconds go
    // back to sleep.
    if (button.read() != 0) return false;
  }
  // button was held for 3 seconds so now we are awake
  return true;
}

And here is the verbose output if it's of any use
/Applications/Teensyduino.app/Contents/Java/arduino-builder -dump-prefs -logger=machine -hardware /Applications/Teensyduino.app/Contents/Java/hardware -tools /Applications/Teensyduino.app/Contents/Java/tools-builder -tools /Applications/Teensyduino.app/Contents/Java/hardware/tools/avr -built-in-libraries /Applications/Teensyduino.app/Contents/Java/libraries -libraries /Users/davidresnik/Documents/Arduino/libraries -fqbn=teensy:avr:teensy40:usb=serial,speed=600,opt=o2std,keys=en-us -ide-version=10819 -build-path /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786 -warnings=all -build-cache /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_cache_987787 -verbose /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_modified_sketch_400143/sketch_feb01a.ino
/Applications/Teensyduino.app/Contents/Java/arduino-builder -compile -logger=machine -hardware /Applications/Teensyduino.app/Contents/Java/hardware -tools /Applications/Teensyduino.app/Contents/Java/tools-builder -tools /Applications/Teensyduino.app/Contents/Java/hardware/tools/avr -built-in-libraries /Applications/Teensyduino.app/Contents/Java/libraries -libraries /Users/davidresnik/Documents/Arduino/libraries -fqbn=teensy:avr:teensy40:usb=serial,speed=600,opt=o2std,keys=en-us -ide-version=10819 -build-path /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786 -warnings=all -build-cache /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_cache_987787 -verbose /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_modified_sketch_400143/sketch_feb01a.ino
Using board 'teensy40' from platform in folder: /Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr
Using core 'teensy4' from platform in folder: /Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr
Detecting libraries used...
/Applications/Teensyduino.app/Contents/Java/hardware/teensy/../tools/arm/bin/arm-none-eabi-g++ -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=156 -DARDUINO=10819 -DARDUINO_TEENSY40 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/cores/teensy4 /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/sketch/sketch_feb01a.ino.cpp -o /dev/null
Alternatives for Snooze.h: [Snooze@6.3.9]
ResolveLibrary(Snooze.h)
-> candidates: [Snooze@6.3.9]
/Applications/Teensyduino.app/Contents/Java/hardware/teensy/../tools/arm/bin/arm-none-eabi-g++ -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=156 -DARDUINO=10819 -DARDUINO_TEENSY40 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/cores/teensy4 -I/Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/libraries/Snooze/src /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/sketch/sketch_feb01a.ino.cpp -o /dev/null
Alternatives for Bounce.h: [Bounce]
ResolveLibrary(Bounce.h)
-> candidates: [Bounce]
/Applications/Teensyduino.app/Contents/Java/hardware/teensy/../tools/arm/bin/arm-none-eabi-g++ -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=156 -DARDUINO=10819 -DARDUINO_TEENSY40 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/cores/teensy4 -I/Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/libraries/Snooze/src -I/Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/libraries/Bounce /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/sketch/sketch_feb01a.ino.cpp -o /dev/null
Using cached library dependencies for file: /Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/libraries/Snooze/src/Snooze.cpp
Using cached library dependencies for file: /Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/libraries/Snooze/src/SnoozeBlock.cpp
Using cached library dependencies for file: /Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/libraries/Snooze/src/hal/TEENSY_32/SnoozeAlarm.cpp
Using cached library dependencies for file: /Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/libraries/Snooze/src/hal/TEENSY_32/SnoozeAudio.cpp
Using cached library dependencies for file: /Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/libraries/Snooze/src/hal/TEENSY_32/SnoozeCompare.cpp
Using cached library dependencies for file: /Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/libraries/Snooze/src/hal/TEENSY_32/SnoozeDigital.cpp
Using cached library dependencies for file: /Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/libraries/Snooze/src/hal/TEENSY_32/SnoozeSPI.cpp
Using cached library dependencies for file: /Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/libraries/Snooze/src/hal/TEENSY_32/SnoozeTimer.cpp
Using cached library dependencies for file: /Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/libraries/Snooze/src/hal/TEENSY_32/SnoozeTouch.cpp
Using cached library dependencies for file: /Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/libraries/Snooze/src/hal/TEENSY_32/SnoozeUSBSerial.cpp
Using cached library dependencies for file: /Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/libraries/Snooze/src/hal/TEENSY_32/hal.c
Using cached library dependencies for file: /Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/libraries/Snooze/src/hal/TEENSY_35/SnoozeAlarm.cpp
Using cached library dependencies for file: /Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/libraries/Snooze/src/hal/TEENSY_35/SnoozeAudio.cpp
Using cached library dependencies for file: /Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/libraries/Snooze/src/hal/TEENSY_35/SnoozeCompare.cpp
Using cached library dependencies for file: /Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/libraries/Snooze/src/hal/TEENSY_35/SnoozeDigital.cpp
Using cached library dependencies for file: /Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/libraries/Snooze/src/hal/TEENSY_35/SnoozeSPI.cpp
Using cached library dependencies for file: /Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/libraries/Snooze/src/hal/TEENSY_35/SnoozeTimer.cpp
Using cached library dependencies for file: /Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/libraries/Snooze/src/hal/TEENSY_35/SnoozeUSBSerial.cpp
Using cached library dependencies for file: /Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/libraries/Snooze/src/hal/TEENSY_35/hal.c
Using cached library dependencies for file: /Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/libraries/Snooze/src/hal/TEENSY_36/SnoozeAlarm.cpp
Using cached library dependencies for file: /Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/libraries/Snooze/src/hal/TEENSY_36/SnoozeAudio.cpp
Using cached library dependencies for file: /Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/libraries/Snooze/src/hal/TEENSY_36/SnoozeCompare.cpp
Using cached library dependencies for file: /Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/libraries/Snooze/src/hal/TEENSY_36/SnoozeDigital.cpp
Using cached library dependencies for file: /Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/libraries/Snooze/src/hal/TEENSY_36/SnoozeSPI.cpp
Using cached library dependencies for file: /Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/libraries/Snooze/src/hal/TEENSY_36/SnoozeTimer.cpp
Using cached library dependencies for file: /Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/libraries/Snooze/src/hal/TEENSY_36/SnoozeTouch.cpp
Using cached library dependencies for file: /Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/libraries/Snooze/src/hal/TEENSY_36/SnoozeUSBSerial.cpp
Using cached library dependencies for file: /Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/libraries/Snooze/src/hal/TEENSY_36/hal.c
Using cached library dependencies for file: /Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/libraries/Snooze/src/hal/TEENSY_40/SnoozeAlarm.cpp
Using cached library dependencies for file: /Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/libraries/Snooze/src/hal/TEENSY_40/SnoozeCompare.cpp
Using cached library dependencies for file: /Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/libraries/Snooze/src/hal/TEENSY_40/SnoozeDigital.cpp
Using cached library dependencies for file: /Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/libraries/Snooze/src/hal/TEENSY_40/SnoozeSPI.cpp
Using cached library dependencies for file: /Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/libraries/Snooze/src/hal/TEENSY_40/SnoozeTimer.cpp
Using cached library dependencies for file: /Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/libraries/Snooze/src/hal/TEENSY_40/SnoozeUSBSerial.cpp
Using cached library dependencies for file: /Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/libraries/Snooze/src/hal/TEENSY_40/hal.c
Using cached library dependencies for file: /Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/libraries/Snooze/src/hal/TEENSY_LC/SnoozeAlarm.cpp
Using cached library dependencies for file: /Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/libraries/Snooze/src/hal/TEENSY_LC/SnoozeCompare.cpp
Using cached library dependencies for file: /Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/libraries/Snooze/src/hal/TEENSY_LC/SnoozeDigital.cpp
Using cached library dependencies for file: /Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/libraries/Snooze/src/hal/TEENSY_LC/SnoozeSPI.cpp
Using cached library dependencies for file: /Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/libraries/Snooze/src/hal/TEENSY_LC/SnoozeTimer.cpp
Using cached library dependencies for file: /Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/libraries/Snooze/src/hal/TEENSY_LC/SnoozeTouch.cpp
Using cached library dependencies for file: /Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/libraries/Snooze/src/hal/TEENSY_LC/SnoozeUSBSerial.cpp
Using cached library dependencies for file: /Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/libraries/Snooze/src/hal/TEENSY_LC/Snoozelc5vBuffer.cpp
Using cached library dependencies for file: /Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/libraries/Snooze/src/hal/TEENSY_LC/hal.c
Using cached library dependencies for file: /Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/libraries/Bounce/Bounce.cpp
Generating function prototypes...
/Applications/Teensyduino.app/Contents/Java/hardware/teensy/../tools/arm/bin/arm-none-eabi-g++ -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=156 -DARDUINO=10819 -DARDUINO_TEENSY40 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/cores/teensy4 -I/Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/libraries/Snooze/src -I/Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/libraries/Bounce /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/sketch/sketch_feb01a.ino.cpp -o /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/preproc/ctags_target_for_gcc_minus_e.cpp
/Applications/Teensyduino.app/Contents/Java/tools-builder/ctags/5.8-arduino11/ctags -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/preproc/ctags_target_for_gcc_minus_e.cpp
Compiling sketch...
/Applications/Teensyduino.app/Contents/Java/hardware/teensy/../tools/precompile_helper /Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/cores/teensy4 /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786 /Applications/Teensyduino.app/Contents/Java/hardware/teensy/../tools/arm/bin/arm-none-eabi-g++ -x c++-header -O2 -g -Wall -ffunction-sections -fdata-sections -nostdlib -MMD -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=156 -DARDUINO=10819 -DARDUINO_TEENSY40 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/cores/teensy4 /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/pch/Arduino.h -o /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/pch/Arduino.h.gch
Using previously compiled file: /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/pch/Arduino.h.gch
/Applications/Teensyduino.app/Contents/Java/hardware/teensy/../tools/arm/bin/arm-none-eabi-g++ -c -O2 -g -Wall -ffunction-sections -fdata-sections -nostdlib -MMD -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=156 -DARDUINO=10819 -DARDUINO_TEENSY40 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/pch -I/Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/cores/teensy4 -I/Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/libraries/Snooze/src -I/Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/libraries/Bounce /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/sketch/sketch_feb01a.ino.cpp -o /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/sketch/sketch_feb01a.ino.cpp.o
Compiling libraries...
Compiling library "Snooze"
Using previously compiled file: /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/SnoozeBlock.cpp.o
Using previously compiled file: /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/Snooze.cpp.o
Using previously compiled file: /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_32/hal.c.o
Using previously compiled file: /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_32/SnoozeAlarm.cpp.o
Using previously compiled file: /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_32/SnoozeCompare.cpp.o
Using previously compiled file: /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_32/SnoozeAudio.cpp.o
Using previously compiled file: /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_32/SnoozeDigital.cpp.o
Using previously compiled file: /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_32/SnoozeTimer.cpp.o
Using previously compiled file: /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_32/SnoozeSPI.cpp.o
Using previously compiled file: /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_32/SnoozeTouch.cpp.o
Using previously compiled file: /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_32/SnoozeUSBSerial.cpp.o
Using previously compiled file: /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_35/hal.c.o
Using previously compiled file: /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_35/SnoozeAlarm.cpp.o
Using previously compiled file: /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_35/SnoozeAudio.cpp.o
Using previously compiled file: /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_35/SnoozeCompare.cpp.o
Using previously compiled file: /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_35/SnoozeUSBSerial.cpp.o
Using previously compiled file: /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_35/SnoozeTimer.cpp.o
Using previously compiled file: /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_35/SnoozeDigital.cpp.o
Using previously compiled file: /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_35/SnoozeSPI.cpp.o
Using previously compiled file: /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_36/hal.c.o
Using previously compiled file: /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_36/SnoozeAlarm.cpp.o
Using previously compiled file: /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_36/SnoozeSPI.cpp.o
Using previously compiled file: /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_36/SnoozeAudio.cpp.o
Using previously compiled file: /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_36/SnoozeTimer.cpp.o
Using previously compiled file: /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_36/SnoozeTouch.cpp.o
Using previously compiled file: /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_36/SnoozeCompare.cpp.o
Using previously compiled file: /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_36/SnoozeDigital.cpp.o
Using previously compiled file: /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_36/SnoozeUSBSerial.cpp.o
Using previously compiled file: /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_40/hal.c.o
Using previously compiled file: /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_40/SnoozeAlarm.cpp.o
Using previously compiled file: /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_40/SnoozeSPI.cpp.o
Using previously compiled file: /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_40/SnoozeTimer.cpp.o
Using previously compiled file: /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_40/SnoozeDigital.cpp.o
Using previously compiled file: /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_40/SnoozeUSBSerial.cpp.o
Using previously compiled file: /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_40/SnoozeCompare.cpp.o
Using previously compiled file: /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_LC/hal.c.o
Using previously compiled file: /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_LC/SnoozeAlarm.cpp.o
Using previously compiled file: /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_LC/SnoozeSPI.cpp.o
Using previously compiled file: /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_LC/SnoozeCompare.cpp.o
Using previously compiled file: /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_LC/SnoozeTouch.cpp.o
Using previously compiled file: /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_LC/SnoozeTimer.cpp.o
Using previously compiled file: /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_LC/SnoozeUSBSerial.cpp.o
Using previously compiled file: /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_LC/Snoozelc5vBuffer.cpp.o
Using previously compiled file: /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_LC/SnoozeDigital.cpp.o
Compiling library "Bounce"
Using previously compiled file: /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Bounce/Bounce.cpp.o
Compiling core...
Using precompiled core: /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_cache_987787/core/core_fc57fc92e7726a6589d7ab7730fbf489.a
Linking everything together...
/Applications/Teensyduino.app/Contents/Java/hardware/teensy/../tools/arm/bin/arm-none-eabi-gcc -O2 -Wl,--gc-sections,--relax -T/Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/cores/teensy4/imxrt1062.ld -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -o /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/sketch_feb01a.ino.elf /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/sketch/sketch_feb01a.ino.cpp.o /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/Snooze.cpp.o /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/SnoozeBlock.cpp.o /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_32/hal.c.o /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_32/SnoozeAlarm.cpp.o /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_32/SnoozeAudio.cpp.o /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_32/SnoozeCompare.cpp.o /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_32/SnoozeDigital.cpp.o /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_32/SnoozeSPI.cpp.o /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_32/SnoozeTimer.cpp.o /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_32/SnoozeTouch.cpp.o /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_32/SnoozeUSBSerial.cpp.o /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_35/hal.c.o /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_35/SnoozeAlarm.cpp.o /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_35/SnoozeAudio.cpp.o /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_35/SnoozeCompare.cpp.o /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_35/SnoozeDigital.cpp.o /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_35/SnoozeSPI.cpp.o /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_35/SnoozeTimer.cpp.o /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_35/SnoozeUSBSerial.cpp.o /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_36/hal.c.o /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_36/SnoozeAlarm.cpp.o /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_36/SnoozeAudio.cpp.o /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_36/SnoozeCompare.cpp.o /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_36/SnoozeDigital.cpp.o /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_36/SnoozeSPI.cpp.o /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_36/SnoozeTimer.cpp.o /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_36/SnoozeTouch.cpp.o /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_36/SnoozeUSBSerial.cpp.o /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_40/hal.c.o /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_40/SnoozeAlarm.cpp.o /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_40/SnoozeCompare.cpp.o /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_40/SnoozeDigital.cpp.o /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_40/SnoozeSPI.cpp.o /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_40/SnoozeTimer.cpp.o /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_40/SnoozeUSBSerial.cpp.o /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_LC/hal.c.o /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_LC/SnoozeAlarm.cpp.o /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_LC/SnoozeCompare.cpp.o /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_LC/SnoozeDigital.cpp.o /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_LC/SnoozeSPI.cpp.o /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_LC/SnoozeTimer.cpp.o /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_LC/SnoozeTouch.cpp.o /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_LC/SnoozeUSBSerial.cpp.o /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Snooze/hal/TEENSY_LC/Snoozelc5vBuffer.cpp.o /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/libraries/Bounce/Bounce.cpp.o /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/../arduino_cache_987787/core/core_fc57fc92e7726a6589d7ab7730fbf489.a -L/var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786 -larm_cortexM7lfsp_math -lm -lstdc++
/Applications/Teensyduino.app/Contents/Java/hardware/teensy/../tools/arm/bin/arm-none-eabi-objcopy -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/sketch_feb01a.ino.elf /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/sketch_feb01a.ino.eep
/Applications/Teensyduino.app/Contents/Java/hardware/teensy/../tools/arm/bin/arm-none-eabi-objcopy -O ihex -R .eeprom /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/sketch_feb01a.ino.elf /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/sketch_feb01a.ino.hex
/Applications/Teensyduino.app/Contents/Java/hardware/teensy/../tools/teensy_secure encrypthex TEENSY40 /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/sketch_feb01a.ino.hex
No key .pem file found, skipping .ehex encryption
/Applications/Teensyduino.app/Contents/Java/hardware/teensy/../tools/teensy_post_compile -file=sketch_feb01a.ino -path=/var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786 -tools=/Applications/Teensyduino.app/Contents/Java/hardware/teensy/../tools/ -board=TEENSY40
/Applications/Teensyduino.app/Contents/Java/hardware/teensy/../tools/stdout_redirect /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/sketch_feb01a.ino.sym /Applications/Teensyduino.app/Contents/Java/hardware/teensy/../tools/arm/bin/arm-none-eabi-objdump -t -C /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/sketch_feb01a.ino.elf
/Applications/Teensyduino.app/Contents/Java/hardware/teensy/../tools/teensy_size /var/folders/ht/p18mrc393sx9k812hmxqkw3w0000gn/T/arduino_build_543786/sketch_feb01a.ino.elf
Memory Usage on Teensy 4.0:
FLASH: code:33848, data:6040, headers:8236 free for files:1983492
RAM1: variables:7296, code:32136, padding:632 free for local variables:484224
RAM2: variables:12416 free for malloc/new:511872
Using library Snooze at version 6.3.9 in folder: /Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/libraries/Snooze
Using library Bounce in folder: /Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/libraries/Bounce (legacy)
 
I've just come across this problem today as well. I updated to TD1.56 today and I get them same symptoms when I include the snooze library into my sketch.
 
@Rezo - I know I am sticking my nose in here without good facts but I ran into the same problem using @FrankB T4_PowerButton library (the original one before the last update). Using Arduino 1.8.19 and TD1.56. If I included T4_PowerButton.h I would get the 9 blinks from the red LED (T4.1). Using Franks last version, there was no problem. Comparing the two versions and doing a process of elimination I discovered that the function "startup_early_hook()" in the original library was causing the problem with the latest 1.56 TD. That function was not used in Frank last version of T4_PowerButton. In the snooze library I see in "hal.c" the same function "startup_early_hook()". Maybe it's causing the same conflict with TD 1.56 that I saw. I have not played with the Snooze library at all but thought I would mention it:)
 
Not sure if this is the reason here, in this special case:

Startup-c has a bug. There is (often) an interrupt happening, quite early , in the first lines of startup.c
Paul didn't want to insert my proposed change, so this is still the case.
Teensy crashes, because the interrupt happens before the interrupt vectors are set.
Fix: Disable the interrups as very first step, and re-enable them somewhere after the loop that sets the interrupt-vectors. (use a volatile asm .... ::memory" to be sure everything got written)

But..as said.. I did not investigate this special case. Quite possible that it has an other reason. I' don't fix things anymore. Too much effort for a 1% chance that a fix gets merged.
 
Last edited:
Disable them after this line:
Code:
void ResetHandler(void)
{
    unsigned int i;
!!here!!
enable them here:
Code:
    // set up blank interrupt & exception vector table
    for (i=0; i < NVIC_NUM_INTERRUPTS + 16; i++) _VectorsRam[i] = &unused_interrupt_vector;
    for (i=0; i < NVIC_NUM_INTERRUPTS; i++) NVIC_SET_PRIORITY(i, 128);
    SCB_VTOR = (uint32_t)_VectorsRam;
!!here!!
 
Last edited:
@Tim, probably something wrong with your install.
I do not get linking errors with T4.0 / TD1.56 - only two warnings:
Code:
C:\Arduino\hardware\teensy\avr\libraries\Snooze\src\hal\TEENSY_40\SnoozeCompare.cpp: In member function 'virtual void SnoozeCompare::disableDriver(uint8_t)':
C:\Arduino\hardware\teensy\avr\libraries\Snooze\src\hal\TEENSY_40\SnoozeCompare.cpp:174:18: warning: 'IRQ_CMP' may be used uninitialized in this function [-Wmaybe-uninitialized]
     IRQ_NUMBER_t IRQ_CMP;
                  ^
C:\Arduino\hardware\teensy\avr\libraries\Snooze\src\hal\TEENSY_40\SnoozeCompare.cpp: In member function 'virtual void SnoozeCompare::enableDriver(uint8_t)':
C:\Arduino\hardware\teensy\avr\libraries\Snooze\src\hal\TEENSY_40\SnoozeCompare.cpp:302:18: warning: 'IRQ_CMP' may be used uninitialized in this function [-Wmaybe-uninitialized]
     IRQ_NUMBER_t IRQ_CMP;
 
Disable them after this line:
Code:
void ResetHandler(void)
{
    unsigned int i;
!!here!!
enable them here:
Code:
    // set up blank interrupt & exception vector table
    for (i=0; i < NVIC_NUM_INTERRUPTS + 16; i++) _VectorsRam[i] = &unused_interrupt_vector;
    for (i=0; i < NVIC_NUM_INTERRUPTS; i++) NVIC_SET_PRIORITY(i, 128);
    SCB_VTOR = (uint32_t)_VectorsRam;
!!here!!

@Frank B where are these functions referenced from?
And how would I enable/disable all interrupts?
Should I use NVIC_ENABLE_IRQ(n) and NVIC_DISABLE_IRQ(n) and loop through the IRQ_NUMBER_t range?

@TimChown I get the same warning as frank, but no errors.
 
__disable_irq()
__enable_irq()

These are global, take no parameter, and disable/enable _all_ interrupts (but NMI)
 
With TD1.56 I don't get error linking that's just TD1.55.
With 1.56 I get the 9 flashes of the boot LED.

I've got a deadline coming up so going to stick with 1.53 for now but will play about with the interrupts after that. Good luck!
 
@Re: 9 Blinks:
it works for me to just add a FLASHMEM to TEENSY40\hal.c (Line 652):
Code:
//----------------------------------------------------------------------------------
FLASHMEM
void startup_early_hook( void ) {
    uint32_t OR_D_GPR = IOMUXC_GPR_GPR4 | IOMUXC_GPR_GPR7 | IOMUXC_GPR_GPR8 | IOMUXC_GPR_GPR12;
    if ( OR_D_GPR > 0x0 ) {
        IOMUXC_GPR_GPR1 &= ~IOMUXC_GPR_GPR1_GINT;
 
@Re: 9 Blinks:
it works for me to just add a FLASHMEM to TEENSY40\hal.c (Line 652):
Code:
//----------------------------------------------------------------------------------
FLASHMEM
void startup_early_hook( void ) {
    uint32_t OR_D_GPR = IOMUXC_GPR_GPR4 | IOMUXC_GPR_GPR7 | IOMUXC_GPR_GPR8 | IOMUXC_GPR_GPR12;
    if ( OR_D_GPR > 0x0 ) {
        IOMUXC_GPR_GPR1 &= ~IOMUXC_GPR_GPR1_GINT;

I ended up coming back to this and this fixed it. Thanks you Frank!
 
Placing this function is FLASHMEM worked for me too.
I did see a similar solution to the 9 blinks on a recent thread yesterday while searching for the root cause.
 
@Re: 9 Blinks:
it works for me to just add a FLASHMEM to TEENSY40\hal.c (Line 652):
...

Good find and fix Frank! I was just reading the startup code the other day and it notes that the early_hook is called before code copied from FLASH to ITCM so it has to be marked FLASHMEM to run from there.
 
Hello, not sure if this is related problem

Snooze examples (this case: Snooze\examples\deepsleep\button_hold_wakeup )
not compiling with T3.6/LC/T4, with USB Type: "MTP Disk experimental" chosen , while choosing the default "Serial" it's fine
Code:
arduino-1.8.19\hardware\teensy\avr\libraries\Snooze\src/hal/TEENSY_40/SnoozeUSBSerial.h:56:39: error: 'usb_cdc_line_rtsdtr' was not declared in this scope
         return usb_configuration && ( usb_cdc_line_rtsdtr & USB_SERIAL_DTR ) && ( ( uint32_t )( systick_millis_count - usb_cdc_line_rtsdtr_millis ) >= 15 );
                                       ^
arduino-1.8.19\hardware\teensy\avr\libraries\Snooze\src/hal/TEENSY_40/SnoozeUSBSerial.h:56:61: error: 'USB_SERIAL_DTR' was not declared in this scope
         return usb_configuration && ( usb_cdc_line_rtsdtr & USB_SERIAL_DTR ) && ( ( uint32_t )( systick_millis_count - usb_cdc_line_rtsdtr_millis ) >= 15 );
                                                             ^
arduino-1.8.19\hardware\teensy\avr\libraries\Snooze\src/hal/TEENSY_40/SnoozeUSBSerial.h:56:120: error: 'usb_cdc_line_rtsdtr_millis' was not declared in this scope
         return usb_configuration && ( usb_cdc_line_rtsdtr & USB_SERIAL_DTR ) && ( ( uint32_t )( systick_millis_count - usb_cdc_line_rtsdtr_millis ) >= 15 );
                                                                                                                        ^

I've looked into it a bit,
but it cannot be easily bypass by declaring the three missing inside "SnoozeUSBSerial.h",

tested on 1.8.19&TD1.56
 
Okay :( I saw it's not updated for some time,
With "Serial" chosen it's not working properly with and will reset before going through setup();

The old version of snooze without the USBserial-snooze block can still work with "MTP_experimental" used
so its fine with my old LC sketch,

I guess I will need to dig further on the datasheet to work this time on my new sketch with T4
 
Last edited:
@PaulStoffregen Can we have Teensyduino updated to include this modification to allow the Snooze Library to work correctly with the Teensy 4.1.
Code:
@Re: 9 Blinks:
it works for me to just add a FLASHMEM to TEENSY40\hal.c (Line 652):
Code:
//----------------------------------------------------------------------------------
FLASHMEM
void startup_early_hook( void ) {
    uint32_t OR_D_GPR = IOMUXC_GPR_GPR4 | IOMUXC_GPR_GPR7 | IOMUXC_GPR_GPR8 | IOMUXC_GPR_GPR12;
    if ( OR_D_GPR > 0x0 ) {
        IOMUXC_GPR_GPR1 &= ~IOMUXC_GPR_GPR1_GINT;
Here is the relevant hal.c file (from C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\Snooze\src\hal\TEENSY_40) with the correction:
 

Attachments

  • hal.zip
    7 KB · Views: 12
Back
Top