A Long Road Already, Just Want to Compile and Upload

Status
Not open for further replies.

ChrispyChris

New member
So I've ordered a couple Teensy 4.1 boards after playing with Arduino as I've realized how awesome these little things are! First issue was the arduino ide software since it's built with Java, that caused issues with my window manager. After MANY hours of working on that, I've decided to go a little more manual, and now after many hours, I'm asking for help haha. I'm about to lose my mind.

I've installed the Teensyduino software over top my Arduino install. I just want to start writing my own programs in C++, compile them, and then since I'm having trouble using Arduino IDE with TeensyLoader because TeensyLoader requires GTK and with my workaround to fix the Arduino IDE for DWM I had to do a Java hack which when installing the gtk library it breaks my entire IDE so then I'm back to square one. Hopefully this kind of outlines a bit of my frustrations too haha. Anyways, I looked inside teensy4 and saw the Makefile, GLORIOUS DAY! Well I copied that and also copied the entire /tools folder from Arduino, the /libraries folder, and the /arm/bin folder. Then I saw in my arduino/teensy/avr/cores/teensy4/ there were Arduino.h and all those libraries. I threw those in my libraries folder as well and got the naming right in my Makefile, tried running Make and got an error. The first time I realized I just grabbed the Arduino.h from teensy4 but it was asking for some other headers, so that's when I pulled in all the teensy4 library files. Now I tried make again and now I'm seeing avr/pgmspace.h is missing haha. It's one thing after another.

Is there something that I'm looking past to make this all somewhat simple for the command line? I'm in the terminal most of my day, so I'm not new to that, or Linux really. I'm no pro either, and I'm new to embedded, but I figured it wouldn't be super difficult to get avr-gcc set up so I could write a C++ program, maybe use a library I find online or whatever, throw a little Makefile together, make, and then take the hex file and I was going to use tytools to upload because it's built in QT so I don't deal with the Java issues from Arduino IDE, but even flashing with avr-dude if possible would be cool.

TL;DR After many issues at this point I want to get an environment going with avr-gcc and makefiles so I can write C++ for Teensy 4.1, using additional libraries I find online or whatever as I go, obviously. I would really appreciate any help and honestly at this point, I would even pay someone to one on one just help me get the environment going. I'm pulling my hair out now haha. I am running Arch Linux again, just so you're aware.



I am still very interested in getting this setup without the Arduino IDE, but in the meantime I have figured out another hack if ANYONE on the internet ever comes across the same issue with DWM, the Arduino IDE, and TeensyLoader not loading because of gtk and the conflict with gtk, Java, DWM, and Arduino IDE (the perfect storm). What I did was actually install gtk2 and ran "ldd" on the teensyloader to see which specific libgtk-x11 libraries it wanted. After that I copied those to my home folder and removed gtk2 completely. After that I just threw those two libraries (libgtk-x11-2.0.so.0 and libgdk-x11-2.0.so.0) in my /usr/lib and now when I run through the Arduino IDE and compile and stuff, the actual TeensyLoader pops up after like ten hours of messing with this. Hopefully this saves someone some time in the future.
 
Last edited:
Which Linux distro is this? It's been a while since I've heard of one so terrible. (eg, Gentoo...)

EDIT: oh, I see it's Arch, missed that earlier.

Reality is PJRC only tests the x86 build on Ubuntu 18, and the ARM builds on Raspbian and Jetson's Ubuntu fork. Most other distros these days "just work", but of course it is possible to have a Linux system which diverges from the norm (Ubuntu).
 
Anyways, I looked inside teensy4 and saw the Makefile, GLORIOUS DAY! Well I copied that and also copied the entire /tools folder from Arduino, the /libraries folder, and the /arm/bin folder. Then I saw in my arduino/teensy/avr/cores/teensy4/ there were Arduino.h and all those libraries. I threw those in my libraries folder as well and got the naming right in my Makefile, tried running Make and got an error. The first time I realized I just grabbed the Arduino.h from teensy4 but it was asking for some other headers, so that's when I pulled in all the teensy4 library files. Now I tried make again and now I'm seeing avr/pgmspace.h is missing haha. It's one thing after another.

It's supposed to "just work" if you change to that folder and just run "make" with all the files still located in the places the installer wrote them.

I can understand why you probably want to copy and arrange everything in a different way that makes sense to you. But I want to say as clearly as possible, you're making everything so much harder and more painful by rearranging everything.

Please, do yourself a huge favor and just run it the way it was intended *before* you change the locations of files & folders. On the download page, scroll down to "Command Line Install". Get it working first the easy way. Then mess around with things after you know it works, and you have a known-working copy for comparison.
 
Which Linux distro is this? It's been a while since I've heard of one so terrible. (eg, Gentoo...)

EDIT: oh, I see it's Arch, missed that earlier.

Reality is PJRC only tests the x86 build on Ubuntu 18, and the ARM builds on Raspbian and Jetson's Ubuntu fork. Most other distros these days "just work", but of course it is possible to have a Linux system which diverges from the norm (Ubuntu).

Oh I'm not putting the blame on you haha. It's definitely the Arduino stuff that's causing me all this pain. I was at this point hoping to just set up an environment with basically gcc, makefiles, and a way to flash that compiled file to the Teensy 4.1, without a bunch of fluff and all. I'm going to start and try dissecting what each command is running behind the scenes and try to go from there I guess at this point haha.
 
Status
Not open for further replies.
Back
Top