|
|
|
|
|
|
|
|
extern void __libc_init_array(void); // C++ standard library |
|
|
extern void __libc_init_array(void); // C++ standard library |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void startup_default_early_hook(void) {} |
|
|
|
|
|
void startup_early_hook(void) __attribute__ ((weak, alias("startup_default_early_hook"))); |
|
|
|
|
|
void startup_default_late_hook(void) {} |
|
|
|
|
|
void startup_late_hook(void) __attribute__ ((weak, alias("startup_default_late_hook"))); |
|
|
__attribute__((section(".startup"), optimize("no-tree-loop-distribute-patterns"), naked)) |
|
|
__attribute__((section(".startup"), optimize("no-tree-loop-distribute-patterns"), naked)) |
|
|
void ResetHandler(void) |
|
|
void ResetHandler(void) |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
SNVS_HPCR |= SNVS_HPCR_RTC_EN | SNVS_HPCR_HP_TS; |
|
|
SNVS_HPCR |= SNVS_HPCR_RTC_EN | SNVS_HPCR_HP_TS; |
|
|
|
|
|
|
|
|
|
|
|
startup_early_hook(); |
|
|
while (millis() < 20) ; // wait at least 20ms before starting USB |
|
|
while (millis() < 20) ; // wait at least 20ms before starting USB |
|
|
usb_init(); |
|
|
usb_init(); |
|
|
analog_init(); |
|
|
analog_init(); |
|
|
pwm_init(); |
|
|
pwm_init(); |
|
|
tempmon_init(); |
|
|
tempmon_init(); |
|
|
|
|
|
|
|
|
|
|
|
startup_late_hook(); |
|
|
while (millis() < 300) ; // wait at least 300ms before calling user code |
|
|
while (millis() < 300) ; // wait at least 300ms before calling user code |
|
|
//printf("before C++ constructors\n"); |
|
|
//printf("before C++ constructors\n"); |
|
|
__libc_init_array(); |
|
|
__libc_init_array(); |