Old thread... but the easiest way to to get the compiled teensy_loader_cli for your OS is to use PlatformIO, install the Teensy board and then get the file out of it. The paths:
Linux: `$ENV{HOME}/.platformio`
Windows...
No idea what the real issue was here, but it was more complicated than just "linker order" considering I was using PlatformIO and I got different results based on code (not config).
I ended up removing platformio, detail here...
Old thread, but I finally had to remove platformio. Posting this here for anyone else that comes by.
This has only been used on Linux. Not sure what happens on Windows or macOS.
### Arduino
The Arduino IDE is used for the compiler, Teensy cores...
Exactly.
The commit where my proposed change is in the Arduino code explains the issue.
https://github.com/arduino/ArduinoCore-avr/commit/4e469e0c83799ad6d3698e7cfa51ef8a5f2a2c76
It's not clear that this problem is reproducible in the arduino ide as it doesn't support multiple files. I believe this to be a linking order issue. Without multiple source files you can't have ordering.
The issue is easy to see. The original...
Paul any reason to not mark the new and delete functions as weak?
It seems that at one point the arduino code did not, but looking at this code now they are.
https://github.com/arduino/ArduinoCore-avr/blob/master/cores/arduino/new
If I manually add the weak attribute to the delete functions in new.cpp it works. Again, not a good idea.
__attribute__((weak)) void operator delete(void * ptr)
{
free(ptr);
}
__attribute__((weak)) void operator delete[](void * ptr)
{...
Ive made some progress but still dont fully understand. What I think is going on is that when the stdlib is being included it somewhere includes the same functions that are in "\.platformio\packages\framework-arduinoteensy\cores\teensy4\new.cpp"...
Teensy 4.1 1.58
Clion 2023.3.4
PlatformIO 6.1.13
toolchain-gccarmnoneeabi-teensy 11.3.1
Windows 11
platformio.ini (nothing interesting)
Im trying to create a function callback in a class. If the callback takes an argument it fails.
This works...