Code without Eclipse!

Do you, like me, have an irrational aversion to IDEs? Do you just want to stick to your gedit, vi, or nano? Well, never fear, I have come to the rescue! After a few hours of digging through the Eclipse plugins and the FRC toolchain, I have created something to replace Eclipse: a makefile. Simply head over to, download the repository as a zip archive, and you’re ready to start coding. I’ve tried this on Ubuntu, but it should work on all Linux distros. I have no idea if it will work on Mac OS, but I’m sure it won’t work on Windows. If you have any problems/suggestions, open an issue on GitHub.

Nice job, looks good. FYI we explicitly set up gcc to be as standard as possible so in theory every standard compliant enviroment should be able to compile with
arm-frc-linux-gnueabi-g++ -I${HOME}/wpilib/cpp/current/include file.cpp -o file.o
and link with
arm-frc-linux-gnueabi-g++ -L${HOME}/wpilib/cpp/current/lib -lwpi files.o -o FRCUserProgram

There is even a CMake toolchain file distributed with the ubuntu toolchains in the package frcmake (nothing prevents it from being distributed with windows and mac but that would require re-building the toolchains, while ubuntu it was a single package addition): Note it doesn’t have a deploy target but I’ll gladly accept pull requests.

I don’t really have any experience with CMake, that’s why I wrote a makefile. If I have time I’ll learn and submit a pull request with deploy capabilities.

So does the FRC toolchain just use the armel gcc with links to NI libraries? I haven’t delved deep into gcc before but that’s what it looked like when I was browsing your repository.

You should, CMake is awesome. WPILib is compiled with it as it is actually a build system generator. Tell it your sources and what you want to happen, and then anyone can compile it using standard makefiles, mingw/msys makefiles, nmake, eclipse, netbeans, qt creator, or another build system.

Its a near-stock GCC build for the armel target on linux. The only thing NI-specific is the build of the linux-headers and eglibc library, but are otherwise mostly stock. Before I got everything worked out, I was able to successfully run with pure stock linux-headers and eglibc sources, but that caused some warnings when debugging. GDB and binutils are pure stock, no patches applied. The only patch on GCC is to change the output name of libstdc++ so we can use the latest C++14 features while the system still uses the old version it was tested against: This makes upgrades very easy so we won’t be stuck with ancient versions of GCC like Windriver with GCC 3.4.

I’m sure I can write off learning CMake as an important programming activity somehow… :wink:

So the roboRIO supports C++14? I’ll have to update my makefile accordingly if so.

The toolchain supports C++14. GCC 4.9.1 supports most of C++14. flag -std=c++1y. Its in the default eclipse config, though there aren’t any C++14-specific features in WPILib.

That’s awesome! So for a novice person to the in-depths of the roboRIO, how would you “deploy” it? Just ssh into it and replace the image with the one generated?

By deploy it, do you mean the robot program? Take a look at the ~/wpilib/cpp/current/ant directory. The build.xml there is the ant script we use to deploy the program. Basically, we run a command on the robot to stop the currently running program. We then replace the /home/lvuser/FRCUserProgram and the /home/lvuser/robotCommand files. The FRCUserProgram is the generated code, and robotCommand is the script in the ~/wpilib/cpp/current/ant folder. We then run a command to exec that script. That script is what takes care of setting up stdout to go to a log file and output over netconsole so you can see it in RioLog. The relevant ant task you’re looking for is deploy, along with some properties in the file.
You might also be able to just use ant to call that script, as I’m not sure how make does with ssh and scp.

Yeah, that’s what I meant :stuck_out_tongue: .

I also just remembered: what does the “-t” option for the robot kill script actually do? I know it says something like start the program as a text program, but I don’t know what that means.

You could use NetBeans. Been using that for coding under Linux.

Once you get the project to compile the first time, you can alter code with VI or whatever. Then when it comes time to recompile, it can be done from the command line by issuing a make. Really nice for those time you need a quick code change and need to do it over ssh.

Just out of curiosity, would it work if FRCUserProgram were a shell script which fired off a bunch of other binaries? Asking for a friend :cool:

Yes. Or do what the even cooler kids do and point robotCommand at your shell script directly. I never can remember the capitalization on this stuff.

Possibly. However, you’ll likely start running into issues with the restarting logic. If your program dies during a match it’s restarted, and what that means is when your script exits, it would be ran again. Additionally, restart code would not work, as that kills FRCUserProgram and restarts it. The better question is: what are you trying to do?

Sent from my Nexus 5X using Tapatalk

Short version is that we’re trying to run roscore on the Rio along with a some ROS nodes to control Rio-connected hardware. The nodes are each separate processes. There’s a top level script (roslaunch) which runs all of them with correct parameters. Still working to figure out how to fit this into what the typical FRC startup code … right now we’re just testing by running things by hand from an ssh session into the Rio.

Hopefully what you mentioned about restarts would be ok - killing roslaunch should force all the child processes to be killed. But that’s yet another thing to test.

I’m going to bring back this super old thread as the programmer actually trying to get a script to run at startup. The suggestions about replacing FRCUserProgram or pointing robotCommand at the script haven’t helped me much, as I can’t seem to find anything under /home/lvuser to implement this. Any help would be much appreciated!

That awkward moment when someone necro’s a thread started by a former student on the team you mentor…

Anyway, for the most recent question, just use GradleRIO. It’s much easier, much more recent, and has an active community supporting it (but mostly just Jaci, who does an awesome job!)