Bläddra i källkod

(Hopefully) fix C++ constructors

main
PaulStoffregen 5 år sedan
förälder
incheckning
4d620d12cd
2 ändrade filer med 5 tillägg och 7 borttagningar
  1. +0
    -5
      teensy4/imxrt.ld
  2. +5
    -2
      teensy4/startup.c

+ 0
- 5
teensy4/imxrt.ld Visa fil

@@ -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 Visa fil

@@ -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");

Laddar…
Avbryt
Spara