Browse Source

(Hopefully) fix C++ constructors

teensy4-core
PaulStoffregen 6 years ago
parent
commit
4d620d12cd
2 changed files with 5 additions and 7 deletions
  1. +0
    -5
      teensy4/imxrt.ld
  2. +5
    -2
      teensy4/startup.c

+ 0
- 5
teensy4/imxrt.ld View File

@@ -20,18 +20,13 @@ SECTIONS
KEEP(*(.startup))
*(.progmem*)
. = ALIGN(4);
/*
TODO: how much of this C++ stuff is really needed?
KEEP(*(.init))
. = ALIGN(4);
__preinit_array_start = .;
KEEP (*(.preinit_array))
__preinit_array_end = .;
__init_array_start = .;
KEEP (*(SORT(.init_array.*)))
KEEP (*(.init_array))
__init_array_end = .;
*/
. = ALIGN(16);
} > FLASH


+ 5
- 2
teensy4/startup.c View File

@@ -86,12 +86,15 @@ void ResetHandler(void)
printf("AHB divisor = %u\n", ((cbcdr >> 10) & 7) + 1);
printf("IPG divisor = %u\n", ((cbcdr >> 8) & 3) + 1);

// TODO: wait at least 20ms before starting USB
while (millis() < 20) ; // wait at least 20ms before starting USB
usb_init();
analog_init();
pwm_init();

// TODO: wait tat least 300ms before calling setup
while (millis() < 300) ; // wait at least 300ms before calling user code
printf("before C++ constructors\n");
__libc_init_array();
printf("after C++ constructors\n");
printf("before setup\n");
setup();
printf("after setup\n");

Loading…
Cancel
Save