Teensyduino 1.62 Beta #1 - Toolchain Update

I did try 0.62b1 briefly (Win 11, IDE 2.3.9). It compiled my current project OK, in fact much smaller than 1.61, but the code crashed at line 1278 of SPI.begin() with a null pointer. A minimal program didn’t, but unfortunately I don’t have the bandwidth right now to do a deep dive to find out the root cause.
 
What I'm getting from this either might be faster for various reasons.

I tried a quick test on my Windows 11 laptop, which has Intel Core Ultra 7 165U processor and 16GB RAM. I used a kitchen timer to measure how long compiling the Audio WavFilePlayer takes.

32 bit toolchain took 31 seconds
64 bit toolchain took 27 seconds.
I forgot one other thing, in that you are actually running the GCC compiler, not random code compiled by GCC.

Internally, GCC uses a 64-bit integer type (called HOST_WIDE_INT) to hold constants and such, In modern GCC's, this must be explicitly a 64-bit type (i.e. 'long long int' on a 32-bit system). So all calculations of user stuff, addresses, offsets, and such is done with HOST_WIDE_INT and unsigned HOST_WIDE_INT. When GCC itself is built using a 64-bit system, all of these calculations are typically done with a single instruction. If GCC is built as a 32-bit program, then all of these 64-bit operations are done as multiple instructions.
  • Multiple instructions are needed to do the calculations (2 for adds, 8 for multiply, function call for divide, 5-8 for comparisons)
  • Each load now involves 2 loads to load each 32-bit part into registers and 2 stores
  • Because more registers are used for the wider type, it means the compiler has to do more spilling of registers to the stack
So I can imagine that this makes 32-bit GCC compilers slower.

However, the issue is whether some users are still using older Windows on 32-bit only systems. These users would not be able to run the new version of TeensyDuino. Of course there is the other side of the issue where new versions of the OSes are removing the support for running 32-bit programs, and you have to convert to 64-bit.
 
Maybe the SPI crash is another static initialization order issue? I'll take a quick look and see if I can get SPI back to fully compile time init before wrapping up beta2. Even if the SPI crash is something else, compile time init really does need to get fixed anyway.

I did a quick test with Arduino IDE 2.3.9 on my Windows laptop. Given options for both 32 and 64 bit toolchains, it did indeed install the 64 bit version.

For the toolchain used with Arduino 1.8.19, changing anything about the way those installers are built would very likely turn into sucking a few weeks weeks of my time. I'm already years behind on so many other things. We really do need newer gcc long-term, but pouring more time into old Arduino IDE just doesn't feel like a good way to allocate my time.

If anyone really wants the Windows 64 bit toolchain with Arduino IDE 1.8.19, it can probably be done manually by just deleting the installed 32 bit toolchain and replace it with a 64 bit version.
 
I've committed the fix for SPI compile time init on Teensy 4.

I ran SD listfiles example on Teensy 4.1, Teensy 4.0, Teensy 3.2 and Teensy LC with a SD card on the SPI bus. All worked. But I haven't run more complex programs.

My const init test only works for Teensy 4. Will port it to the older boards, but after wrapping up beta2.
 
Bummer the IDE 1.8.19 is difficult to swap the x32 to x64. Will give the IDE 2 a try on next Beta and maybe it will be faster and not quit so soon when left open with a few files as it seemed to with the latest. Maybe a simple batch file will work to reliably take the supplied ide 2 tools to IDE 1?

SPI worked fine on display sketch tested - will check SD next Beta.
 
Thanks for testing SPI so quickly!

Please remind me of the SPI version number after I've looked into const init on Teensy 3. It's almost certainly broken too by gcc 15.2. My test program only works with Teensy 4. Will take some effort to improve testing before I can work on SPI for Teensy 3.

Right now, I'm going to package up beta2. That will give us 2 convenient files for Windows 32 and 64 bit. It will also update all 7 with some changes I made, mostly to trim away excess stuff we never use so the downloads are a few MB smaller.
 
Back
Top