tsandmann / freertos-teensy

FreeRTOS port with C++ std::thread support for ARM boards Teensy 3.5, 3.6, 4.0 and 4.1 (cortex-m4f and cortex-m7f)
95 stars 16 forks source link

Avoid Linker issue w/gettimeofday() on Teensy 4.0 #13

Closed mjs513 closed 2 years ago

mjs513 commented 2 years ago

Teensyduino 1.58-beta2 now adds a gettimeofday() function in rtc.c of the Teensy4 core which now causes a linker error when using the library with the T4.

This was reported in a thread on the forum: https://forum.pjrc.com/threads/71198-Linker-issue-about-gettimeofday()-on-Teensy-4-0-with-FreeRTOS along with the recommended solution by @PaulStoffregen which this PR incorporates. I did test it with the BLINK sketch and it works, ie. not linker error and the sketch runs correctly.

tsandmann commented 2 years ago

Thank you for figuring this out :-) The drawback might be a reduced resolution for things that use gettimeofday() like std::chrono or std::thread. But I think it's fine as a workaround, at least as long as Teensyduino 1.58 is still beta.