Glad the tip got you to that Adriano, I knew it was there.
It was the "confuse some USB hubs" issue I was referring to with "allow computers to deal better with the startup". I knew Adriano was using USB - provided sample and details didn't say it was for debug only.
Paul - Though that usb_init() code always runs - could the delay be made conditional on the sketch having USB compiled in?
I didn't know about these (gosh a wiki would be cool):
Code:
void startup_early_hook(void) __attribute__ ((weak, alias("startup_default_early_hook")));
void startup_late_hook(void) __attribute__ ((weak, alias("startup_default_late_hook")));
// ...
void ResetHandler(void)
{
// ...
// programs using the watchdog timer or needing to initialize hardware as
// early as possible can implement startup_early_hook()
startup_early_hook();
Indeed rushing some cold devices on fast Teensy startup is a problem.
The other common issue I see is so many sample sketches have the inherited "while (!Serial);" in them when they run without a serial monitor online, or are offline on battery. That really makes the Teensy look dead - and thus qBlink() was born - and a timeout in that while().
I was in ResetHandler(void) the other day with Kurt's code on the HSRUN Serial# edits and had no idea how I got there - I see the context for this now and how it gets there:
Code:
void (* const _VectorsFlash[NVIC_NUM_INTERRUPTS+16])(void) =
{
(void (*)(void))((unsigned long)&_estack), // 0 ARM: Initial Stack Pointer
ResetHandler, // 1 ARM: Initial Program Counter