View Full Version : New ARM toolchain for Teensy 3.0

01-08-2013, 09:20 PM
I've been working to build a newer ARM toolchain, based on gcc 4.7.2. Currently we're using 4.4.1. My hope is to start using 4.7.2 in beta #11.

Here are the latest files.

Linux, 64 bit (http://www.pjrc.com/teensy/beta/arm-none-eabi-linux64-test8jan12.tar.gz)
Mac OS-X (http://www.pjrc.com/teensy/beta/arm-none-eabi-macosx-test8jan12.zip)
Windows (http://www.pjrc.com/teensy/beta/arm-none-eabi-windows-test8jan12.zip)
Source Code (http://www.pjrc.com/teensy/beta/arm-none-eabi-source-test8jan12.tar.gz)

To try these, replace the "arm-none-eabi" folder within Arduino. On Linux and Windows, it's in hardware/tools. On Mac, control-click on Arduino, choose "show package contents", and look in Contents/Resources/Java/hardware/tools.

If you try any of these, please reply to this topic. Did they work? Can you find any program/sketch/library that fails, but works on the old version?

The linux version has been discussed here (http://forum.pjrc.com/threads/14825-Linux-64-bit-Please-help-test-new-toolchain).

01-08-2013, 10:45 PM
Hi Paul,
On Win7, the behaviour of the serial port seems to have changed. In vanilla beta 10, this code will wait until the serial monitor is started before printing to the display.

void setup(void)

Serial.println("Hello World");

void loop(void)

But with the new toolchain it doesn't print anything. It also doesn't work if I change it to use Serial3.


01-08-2013, 11:04 PM

I tried a couple of my simple programs and they work.

Out of curiosity, are you using newlib or glibc or ...? I've been using newlib with gcc 4.8 but maybe there's downsides to that (like I'm noticing implementations of syscalls like _read that are probably not worth taking up space in my binary).

I'm really psyched that you're upgrading. I'm sure this was a lot of work. I'm particularly interested in using C++ lambdas for event handlers.



01-11-2013, 04:30 AM
Seems to work for me.

Generates slightly smaller, and slightly slower, code. Not much though, slows down my SPI test by maybe 3%.

- Peter

01-11-2013, 08:04 AM
But with the new toolchain it doesn't print anything.

Thanks for reporting this!

I was able to reproduce the problem. After some investigation, I discovered one of the variables in usb_serial.c that should have been "volatile" wasn't. My mistake! Using the older compiler, it doesn't matter. But the new compiler apparently can optimize more. It was optimizing away repetitively checking the handshaking variable, because it wasn't volatile.

It also doesn't work if I change it to use Serial3.

I tested Serial3 and it seems to work. Serial3 is hardware serial, so it doesn't have this boolean check to see if the other side is connected.

Could you post a test program that reproduces the problem?

01-11-2013, 03:29 PM
Hi Paul,
Sorry, I forgot that Serial3 doesn't work the same way as Serial. There is still the known problem that an uploaded sketch is already running before the Serial Manager is started but that's not caused by the new toolchain.
FYI: I've been playing with DSP instructions using a 128 tap FIR filter and with the new toolchain my test program runs about 3% faster.


01-11-2013, 03:46 PM
I'm going publish beta 11 with the new toolchain and minimal changes (perhaps only the !Serial fix).