Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   C/C++ (http://www.chiefdelphi.com/forums/forumdisplay.php?f=183)
-   -   Code without Eclipse! (http://www.chiefdelphi.com/forums/showthread.php?t=132117)

Spectare 04-01-2015 22:28

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 https://github.com/brpylko/FRCMakeProject, 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.

byteit101 05-01-2015 13:41

Re: Code without Eclipse!
 
Quote:

Originally Posted by Spectare (Post 1421603)
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 https://github.com/brpylko/FRCMakeProject, 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): https://bitbucket.org/byteit101/tool...ake?at=default Note it doesn't have a deploy target but I'll gladly accept pull requests.

Spectare 05-01-2015 19:15

Re: Code without Eclipse!
 
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.

byteit101 05-01-2015 20:06

Re: Code without Eclipse!
 
Quote:

Originally Posted by Spectare (Post 1422255)
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.

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.

Quote:

Originally Posted by Spectare (Post 1422255)
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.

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: https://bitbucket.org/byteit101/tool...ame?at=default This makes upgrades very easy so we won't be stuck with ancient versions of GCC like Windriver with GCC 3.4.

Spectare 05-01-2015 21:07

Re: Code without Eclipse!
 
Quote:

Originally Posted by byteit101 (Post 1422289)
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.

I'm sure I can write off learning CMake as an important programming activity somehow... ;)

Quote:

Originally Posted by byteit101 (Post 1422289)
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

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

byteit101 06-01-2015 12:37

Re: Code without Eclipse!
 
Quote:

Originally Posted by Spectare (Post 1422330)
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.

Sparkyshires 06-01-2015 15:16

Re: Code without Eclipse!
 
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?

fsilberberg 06-01-2015 17:39

Re: Code without Eclipse!
 
Quote:

Originally Posted by Sparkyshires (Post 1422901)
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 build.properties 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.

Spectare 06-01-2015 18:46

Re: Code without Eclipse!
 
Quote:

Originally Posted by byteit101 (Post 1422743)
The toolchain supports C++14.

Yeah, that's what I meant :p .

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.


All times are GMT -5. The time now is 12:08.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi