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

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



+ 5
- 2
teensy4/startup.c View File

printf("AHB divisor = %u\n", ((cbcdr >> 10) & 7) + 1); printf("AHB divisor = %u\n", ((cbcdr >> 10) & 7) + 1);
printf("IPG divisor = %u\n", ((cbcdr >> 8) & 3) + 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(); usb_init();
analog_init(); analog_init();
pwm_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"); printf("before setup\n");
setup(); setup();
printf("after setup\n"); printf("after setup\n");

Loading…
Cancel
Save