Building for the Teensy on the Raspberry Pi

Status
Not open for further replies.

jwatte

Well-known member
I have successfully used crosstool-ng to build a compiler that can run on the Raspberry Pi, and can generate code for a Cortex-M4 (the chip on the Teensy3.)
So far so good! The config files I ended up using are available on github:
https://github.com/jwatte/teensy-canadian

However, what I don't have yet is the correct runtime libraries to use the PJRC libraries for Wiring / Teensy3, nor to set up interrupt handlers and whatnot.
Patches welcome :)
 
Congratulations for your effort, jwatte!

I really have some troubles: I have a PV (solar) system and I'm using a Teensy 3.1 to read the battery voltage/charging current and to disconnect the PV panels if the batteries are fully charged.

I'm using a RPi (B+) to read those parameters from Teensy (using the USB serial connection) and to access all those informations from remote locations.

It happens that right now I'm (far) away from home and I have some problems with the charging protocol (Teensy keeps reconnecting the PV panels even the batteries are full charged) due to some erroneus voltage thresholds in the Teensy sketch.

So I have no choice but to modify Teensy sketch to correct those errors. Otherway, the batteries will be drastically overcharged (the overcast is a disaster - three sunny days).

I really need your help, please. Could you explain me how to upload a .hex file using Raspberry Pi? I have full access (VNC) to RPi so I could install/run anything. I could compile the sketch using my laptop (linux/arduino/teensyduino) and copy the .hex file to RPi.

How to properly load that hex file to Teensy??

I'm so sad that Paul S. doesn't care about Teensyduino for ARM processors, as I already have many projects using Teensy 3.1 (great board) and many of them are direct connected to RPi boards. It's a real nightmare to keep disconnecting them to upload some sketches (as RPi has a single UART interface so I have to use the USB connections).
 
First: Boo hiss for hijacking my thread! I really do need some help with the runtime library support files.

Second: To upload to the Teensy from a Raspberry Pi, use the load_linux_only.c tool. You can get the source and compile it yourself (you may need to install some libusb-dev package as well.)
This page has some instructions: https://www.pjrc.com/teensy/loader_cli.html
However, the pre-defined packages won't work, because they are for x86/x64 Linux. Here is the source file:
http://www.pjrc.com/teensy/beta/load_linux_only.c
 
Followup

I have successfully used crosstool-ng to build a compiler that can run on the Raspberry Pi, and can generate code for a Cortex-M4 (the chip on the Teensy3.)
So far so good! The config files I ended up using are available on github:
https://github.com/jwatte/teensy-canadian

However, what I don't have yet is the correct runtime libraries to use the PJRC libraries for Wiring / Teensy3, nor to set up interrupt handlers and whatnot.
Patches welcome :)

Super cool!

I got the cross GCC compiler to load, but I'm still trying to figure out how to pull in everything so that a sketch that works properly on a desktop can be compiled on the rasp-pi. Theoretically, if you compiled and linked everything in the cores/3.x directory using the linker script, would that properly generate a .HEX file that can be uploaded?

It would be cool to generate a script or a makefile that basically does all of these steps from the commandline.

I'd love to be able to have my teensy running my project and then be able to shell into the raspberry pi, refresh source code, recompille and push it to the teensy. That would let me quickly test a change (or recompile with different settings) without having to attach a cable into the raspberry pi.
 
Theoretically, if you compiled and linked everything in the cores/3.x directory using the linker script, would that properly generate a .HEX file that can be uploaded?

Yes.

I thought I left a makefile that did approximately that in the tree somewhere -- if you go look-see you may find it.
There might also be a makefile already in the Teensy support directory that you can use almost as-is (straight from the Teensyduino distribution.)
 
Status
Not open for further replies.
Back
Top