Go to Post Ask questions; don't be afraid to talk to "powerhouse" teams. - CalTran [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #16   Spotlight this post!  
Unread 27-06-2012, 09:31
rbmj rbmj is offline
Registered User
FRC #0612 (Chantilly Robotics)
Team Role: Alumni
 
Join Date: Apr 2011
Rookie Year: 2011
Location: DC Area/Fairfax County
Posts: 192
rbmj is a jewel in the roughrbmj is a jewel in the roughrbmj is a jewel in the rough
Re: Custom C++ Toolchain

OK, so a few slight changes to the build process.

headers-build.patch is no longer necessary. Instead, best solution (read: least kludgey) is to manually copy gccdist/WindRiver/vxworks-6.3/target/h to /usr/powerpc-wrs-vxworks/sys-include, and then symlink /usr/powerpc-wrs-vxworks/include to sys-include/wrn/coreip. Yes, this is less kludgey.

Actually all of the patches that are there have been deprecated. The latest GCC incorporates some, and there are others that fix things "better". These haven't been incorporated into mainline yet, but the main issue is that I'm going off to school and won't have internet until late august (no working around this either). So I'm hoping that somebody can make sure that the work is not lost and that these make it in. [1] is approved, but not yet committed, and handles all of the patches to the WRS headers inside of GCC through the fixincludes process. It is a patch series, of which every patch depends on the first in the series. [2] is also approved, but not yet committed, and allows one to force a build of libstdc++-v3 with --enable-libstdc++-v3 passed to configure. A fix for the first gcov issue (obvious) is at [3]. A fix for the second gcov issue (approved, not committed) is at [4]. With those things done correctly, a complete build works.

The other issue is that some of the targets appear to be mis-configuring themselves, as they are allowing implicit declaration of functions in the configure process, which results in bad detection of the target platform's available functions. Hopefully somebody can fix this :-D.

I'm looking for someone to take this over, at least until the regular school year starts, at which point I should be able to maintain everything again (at least for a little while).

[1]: http://gcc.gnu.org/ml/gcc-patches/2012-06/msg00382.html
[2]: http://gcc.gnu.org/ml/gcc-patches/2012-05/msg01525.html
[3]: http://gcc.gnu.org/ml/gcc-patches/2012-06/msg01508.html
[4]: http://gcc.gnu.org/ml/gcc-patches/2012-06/msg01548.html

I'm going to try and get one of the GCC maintainers to adopt this, but if the conversation doesn't say committed, then it means I wasn't annoying enough.

NOTE: if you look at a patch message and it says a certain file needs to be regenerated, then you'll need to do that otherwise things won't work. The configure files can be regened with autoconf2.64, and the fixincl.x file can be regened by going into the fixincludes directory of gcc and running ./genfixes.
  #17   Spotlight this post!  
Unread 17-08-2012, 17:26
nightpool's Avatar
nightpool nightpool is offline
robotRectifier
AKA: Evan
no team (formerly of CORE 2062)
Team Role: Alumni
 
Join Date: Oct 2011
Rookie Year: 2011
Location: Waukesha, WI
Posts: 81
nightpool is on a distinguished road
Re: Custom C++ Toolchain

It would be nice if you put the realpath dependency more prominently in the first post. It doesn't come by default with Ubuntu (the most popular linux distribution, and common among newbies), and the error message when you don't have it is pretty opaque (It'll complain about it a few times, but start downloading anyway, only to fatal later.)
__________________
Proud alum of CORE 2062.
www.core2062.com

Last edited by nightpool : 17-08-2012 at 17:50.
  #18   Spotlight this post!  
Unread 27-09-2012, 00:33
agartner01 agartner01 is offline
Captain + Control Sys & Design
FRC #4174
Team Role: Engineer
 
Join Date: Feb 2012
Rookie Year: 2012
Location: Hector MN
Posts: 109
agartner01 is an unknown quantity at this point
Re: Custom C++ Toolchain

I get the following error when running the make command.
Code:
couldn't read file "/usr/local/powerpc-wrs-vxworks/host/resource/hutils/tcl/munch.tcl": no such file or directory
(terminal.txt)
The frc_userprogram still appears to build. Is it alright to just ignore this error?

Edit: So I decided to try and deploy the frc_userprogram.out to the robot. I used the wput, reset the robot, and then on the driver station it said no robot code. I checked to make sure the program got on via the web-ftp interface. In addition to that, I also flashed the v43 image... Included is the output from the cmake and make commands.
Attached Files
File Type: txt terminal.txt (1.3 KB, 5 views)
File Type: txt cmake and make outputs.txt (3.7 KB, 4 views)

Last edited by agartner01 : 27-09-2012 at 02:20.
  #19   Spotlight this post!  
Unread 27-09-2012, 07:11
rbmj rbmj is offline
Registered User
FRC #0612 (Chantilly Robotics)
Team Role: Alumni
 
Join Date: Apr 2011
Rookie Year: 2011
Location: DC Area/Fairfax County
Posts: 192
rbmj is a jewel in the roughrbmj is a jewel in the roughrbmj is a jewel in the rough
Re: Custom C++ Toolchain

@agartner01: That's due to a bug in the installation, which will be fixed when I come out with a new release (I'm waiting on some patches upstream right now). Read flameout's post and see if that helps.
  #20   Spotlight this post!  
Unread 27-09-2012, 12:48
rbmj rbmj is offline
Registered User
FRC #0612 (Chantilly Robotics)
Team Role: Alumni
 
Join Date: Apr 2011
Rookie Year: 2011
Location: DC Area/Fairfax County
Posts: 192
rbmj is a jewel in the roughrbmj is a jewel in the roughrbmj is a jewel in the rough
Re: Custom C++ Toolchain

Also, If you still have difficulty, please post NetConsole output. That usually helps. But because of some bugs in the cmake files you have to make those symlinks.
  #21   Spotlight this post!  
Unread 27-09-2012, 13:52
agartner01 agartner01 is offline
Captain + Control Sys & Design
FRC #4174
Team Role: Engineer
 
Join Date: Feb 2012
Rookie Year: 2012
Location: Hector MN
Posts: 109
agartner01 is an unknown quantity at this point
Re: Custom C++ Toolchain

Quote:
Originally Posted by rbmj View Post
@agartner01: That's due to a bug in the installation, which will be fixed when I come out with a new release (I'm waiting on some patches upstream right now). Read flameout's post and see if that helps.
Alright, I added the symlinks. Everything appears to build alright now. But when I deploy, I still get the no robot code message on the driver station... I'm just building the simple template fyi...

EDIT: Somehow I managed to miss your message. I'll get the netconsole output and post it...

Last edited by agartner01 : 27-09-2012 at 15:00. Reason: Noticed other message
  #22   Spotlight this post!  
Unread 27-09-2012, 19:08
agartner01 agartner01 is offline
Captain + Control Sys & Design
FRC #4174
Team Role: Engineer
 
Join Date: Feb 2012
Rookie Year: 2012
Location: Hector MN
Posts: 109
agartner01 is an unknown quantity at this point
Re: Custom C++ Toolchain

Here's my netcosole output. There are two files. One without any program. One with the Simple Template deployed (built on linux).

Edit: I added the log from a normal WindRiver program too...
Attached Files
File Type: txt netlogafterdeploy.txt (11.2 KB, 13 views)
File Type: txt netlogbeforedeploy.txt (1.7 KB, 4 views)
File Type: txt netlogwithwindriverprogram.txt (2.1 KB, 7 views)

Last edited by agartner01 : 27-09-2012 at 19:19. Reason: Added File
  #23   Spotlight this post!  
Unread 28-09-2012, 14:51
CodeYeti's Avatar
CodeYeti CodeYeti is offline
FRC Addict
AKA: Matt Coffin
FRC #0662 (Rocky Mountain Robotics)
Team Role: Mentor
 
Join Date: Feb 2011
Rookie Year: 2010
Location: Colorado
Posts: 81
CodeYeti is an unknown quantity at this point
Re: Custom C++ Toolchain

I noticed that the last commits to the the repositories on github were quite a while ago despite the last posts in the thread being relatively recent. Are they still up to date?
  #24   Spotlight this post!  
Unread 30-09-2012, 23:54
agartner01 agartner01 is offline
Captain + Control Sys & Design
FRC #4174
Team Role: Engineer
 
Join Date: Feb 2012
Rookie Year: 2012
Location: Hector MN
Posts: 109
agartner01 is an unknown quantity at this point
Re: Custom C++ Toolchain

@rbmj any thoughts?
  #25   Spotlight this post!  
Unread 17-10-2012, 16:16
CodeYeti's Avatar
CodeYeti CodeYeti is offline
FRC Addict
AKA: Matt Coffin
FRC #0662 (Rocky Mountain Robotics)
Team Role: Mentor
 
Join Date: Feb 2011
Rookie Year: 2010
Location: Colorado
Posts: 81
CodeYeti is an unknown quantity at this point
Re: Custom C++ Toolchain

To anybody that's still dealing with this, I've posted some reworking and numerous bugfixes to rbmj's cmake toolchain. Off of the top of my head:
  1. Fixed bug with whitespace in CMAKE_COMMAND path
  2. Moved WPILib to a cmake find module
  3. Added GCC version to the toolchain files configuration
The moving of WPILib to a find module adds a line of code to the CMakeLists.txt file for the actual robot project, but it makes sense. WPILib is not an integral part of VxWorks, and shouldn't be part of the toolchain. Rather, it is an optional library, and should be treated as one.

I'd also like to give a little shoutout to Ross Light's frctool, which I'm using to push the FRC_UserProgram.out file up to the cRIO.

I'm putting in a pull request to rbmj as we speak, but if anybody wants to see my changes now, and any future changes, my fork of cmake_vxworks can be found at https://github.com/mcoffin/cmake_vxworks.
  #26   Spotlight this post!  
Unread 20-10-2012, 21:17
agartner01 agartner01 is offline
Captain + Control Sys & Design
FRC #4174
Team Role: Engineer
 
Join Date: Feb 2012
Rookie Year: 2012
Location: Hector MN
Posts: 109
agartner01 is an unknown quantity at this point
Re: Custom C++ Toolchain

Quote:
Originally Posted by CodeYeti View Post
To anybody that's still dealing with this, I've posted some reworking and numerous bugfixes to rbmj's cmake toolchain. Off of the top of my head:
  1. Fixed bug with whitespace in CMAKE_COMMAND path
  2. Moved WPILib to a cmake find module
  3. Added GCC version to the toolchain files configuration
The moving of WPILib to a find module adds a line of code to the CMakeLists.txt file for the actual robot project, but it makes sense. WPILib is not an integral part of VxWorks, and shouldn't be part of the toolchain. Rather, it is an optional library, and should be treated as one.

I'd also like to give a little shoutout to Ross Light's frctool, which I'm using to push the FRC_UserProgram.out file up to the cRIO.

I'm putting in a pull request to rbmj as we speak, but if anybody wants to see my changes now, and any future changes, my fork of cmake_vxworks can be found at https://github.com/mcoffin/cmake_vxworks.
Did you build the compiler or install the binaries? I've been trying to get this to work for some time now, without any success. Any thoughts? Anyone?
  #27   Spotlight this post!  
Unread 22-10-2012, 14:41
CodeYeti's Avatar
CodeYeti CodeYeti is offline
FRC Addict
AKA: Matt Coffin
FRC #0662 (Rocky Mountain Robotics)
Team Role: Mentor
 
Join Date: Feb 2011
Rookie Year: 2010
Location: Colorado
Posts: 81
CodeYeti is an unknown quantity at this point
Re: Custom C++ Toolchain

Quote:
Originally Posted by agartner01 View Post
Did you build the compiler or install the binaries? I've been trying to get this to work for some time now, without any success. Any thoughts? Anyone?
I built the compiler because I'm planning on adding support for other languages.
  #28   Spotlight this post!  
Unread 26-10-2012, 12:01
CodeYeti's Avatar
CodeYeti CodeYeti is offline
FRC Addict
AKA: Matt Coffin
FRC #0662 (Rocky Mountain Robotics)
Team Role: Mentor
 
Join Date: Feb 2011
Rookie Year: 2010
Location: Colorado
Posts: 81
CodeYeti is an unknown quantity at this point
Re: Custom C++ Toolchain

Anybody that is using my repositories for the toolchain/cmake/wpilib should no longer have to create any symlinks to the munch.sh, strip_syms.sh scripts or the host directory. It was just a bug in where the cmake toolchain file was looking for them. I'll also write a little comprehensive "howto" on installing the toolchain. Please note that I have not yet tried putting this code onto the robot, but if what rbmj did works, this should as well.

I've also added gcc-4.7.2 support to the vxworks-gcc-patches repository. If you want to use gcc-4.7.2, you may even though it is experimental. Just checkout the gcc-4.7.2 branch after cloning in to the repository, then continue as normal.

Begin Simple Install Tutorial
First, we'll need to create a directory to do all of our building in. I use ~/workspace in my home directory, but thats just me. This is NOT, I repeat NOT where the toolchain and things are installed, so it doesn't need to be on the PATH or anything. Run the following commands to get all the projects "cloned" from github.
Code:
mkdir -p ~/workspace
cd ~/workspace
git clone git://github.com/mcoffin/vxworks-gcc-patches.git
git clone git://github.com/mcoffin/cmake_vxworks.git cmake-vxworks
git clone git://github.com/mcoffin/wpilib.git
You will now have the subdirectories "vxworks-gcc-patches", "cmake-vxworks", and "wpilib" under your workspace. The first thing to do is have the vxworks-gcc-patches project download and compile GCC for you.Run the following commands to do this.
Code:
cd vxworks-gcc-patches
sudo make install
If you don't get any errors, the toolchain should have installed to "/usr/local". Next, you'll need to set the WIND_BASE variable just to satisfy gcc.
Code:
export WIND_BASE=/usr/local/powerpc-wrs-vxworks/wind_base
Finally, you'll have to build WPILib, so that you can link it with your robot's code. For some reason, on one of my machines, I have to run cmake twice to get the install directory to be set properly. I would recommend doing just to make sure you don't install WPILib to some weird place.
Code:
cd ~/workspace/wpilib
cmake . -DCMAKE_TOOLCHAIN_FILE=/path/to/workspace/cmake-vxworks/vxworks_toolchain.cmake
cmake . -DCMAKE_TOOLCHAIN_FILE=/path/to/workspace/cmake-vxworks/vxworks_toolchain.cmake
make
sudo make install
Then, you'll have to write a simple CMakeLists.txt file to compile your robot code. Assuming your robot code is stored in a directory called 'src' under the CMakeLists.txt file, the following CMakeLists.txt will work. It would be really easy to modify this for your robot's needs.
Code:
cmake_minimum_required(VERSION 2.8)

project(FRC)
set(CMAKE_MODULE_PATH /path/to/cmake-vxworks/cmake/Modules)

find_package(WPILib REQUIRED)
include_directories(${WPILib_INCLUDE_DIR})

include_directories(src)
file(GLOB_RECURSE SOURCES "src/*.cpp")

add_executable(FRC_UserProgram ${SOURCES})
set_target_properties(FRC_UserProgram PROPERTIES
	SUFFIX .out
	RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
)

target_link_libraries(${WPILib_LIBRARY})
Finally, change directory to your your robot's CMakeLists.txt file, run cmake the same way we did for WPILib, then
Code:
make
If you don't get any errors, then your program should be compiled to bin/FRC_UserProgram.out. This can then be pushed to the robot with Ross Light's frctool or just an FTP client.
  #29   Spotlight this post!  
Unread 12-12-2012, 03:12
PaulDavis1968's Avatar
PaulDavis1968 PaulDavis1968 is offline
Embedded Software/Systems Engineer
AKA: Master of Complexity
FRC #2053 (TigerTronics)
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2012
Location: Endicot NY
Posts: 91
PaulDavis1968 is just really nicePaulDavis1968 is just really nicePaulDavis1968 is just really nicePaulDavis1968 is just really nicePaulDavis1968 is just really nice
Re: Custom C++ Toolchain

Quote:
Originally Posted by CodeYeti View Post
Anybody that is using my repositories for the toolchain/cmake/wpilib should no longer have to create any symlinks to the munch.sh, strip_syms.sh scripts or the host directory. It was just a bug in where the cmake toolchain file was looking for them. I'll also write a little comprehensive "howto" on installing the toolchain. Please note that I have not yet tried putting this code onto the robot, but if what rbmj did works, this should as well.

I've also added gcc-4.7.2 support to the vxworks-gcc-patches repository. If you want to use gcc-4.7.2, you may even though it is experimental. Just checkout the gcc-4.7.2 branch after cloning in to the repository, then continue as normal.

Begin Simple Install Tutorial
First, we'll need to create a directory to do all of our building in. I use ~/workspace in my home directory, but thats just me. This is NOT, I repeat NOT where the toolchain and things are installed, so it doesn't need to be on the PATH or anything. Run the following commands to get all the projects "cloned" from github.
Code:
mkdir -p ~/workspace
cd ~/workspace
git clone git://github.com/mcoffin/vxworks-gcc-patches.git
git clone git://github.com/mcoffin/cmake_vxworks.git cmake-vxworks
git clone git://github.com/mcoffin/wpilib.git
You will now have the subdirectories "vxworks-gcc-patches", "cmake-vxworks", and "wpilib" under your workspace. The first thing to do is have the vxworks-gcc-patches project download and compile GCC for you.Run the following commands to do this.
Code:
cd vxworks-gcc-patches
sudo make install
If you don't get any errors, the toolchain should have installed to "/usr/local". Next, you'll need to set the WIND_BASE variable just to satisfy gcc.
Code:
export WIND_BASE=/usr/local/powerpc-wrs-vxworks/wind_base
Finally, you'll have to build WPILib, so that you can link it with your robot's code. For some reason, on one of my machines, I have to run cmake twice to get the install directory to be set properly. I would recommend doing just to make sure you don't install WPILib to some weird place.
Code:
cd ~/workspace/wpilib
cmake . -DCMAKE_TOOLCHAIN_FILE=/path/to/workspace/cmake-vxworks/vxworks_toolchain.cmake
cmake . -DCMAKE_TOOLCHAIN_FILE=/path/to/workspace/cmake-vxworks/vxworks_toolchain.cmake
make
sudo make install
Then, you'll have to write a simple CMakeLists.txt file to compile your robot code. Assuming your robot code is stored in a directory called 'src' under the CMakeLists.txt file, the following CMakeLists.txt will work. It would be really easy to modify this for your robot's needs.
Code:
cmake_minimum_required(VERSION 2.8)

project(FRC)
set(CMAKE_MODULE_PATH /path/to/cmake-vxworks/cmake/Modules)

find_package(WPILib REQUIRED)
include_directories(${WPILib_INCLUDE_DIR})

include_directories(src)
file(GLOB_RECURSE SOURCES "src/*.cpp")

add_executable(FRC_UserProgram ${SOURCES})
set_target_properties(FRC_UserProgram PROPERTIES
	SUFFIX .out
	RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
)

target_link_libraries(${WPILib_LIBRARY})
Finally, change directory to your your robot's CMakeLists.txt file, run cmake the same way we did for WPILib, then
Code:
make
If you don't get any errors, then your program should be compiled to bin/FRC_UserProgram.out. This can then be pushed to the robot with Ross Light's frctool or just an FTP client.

Is this different than this? : http://www.chiefdelphi.com/forums/sh...=109385&page=2

Thanks
  #30   Spotlight this post!  
Unread 22-12-2012, 20:53
PaulDavis1968's Avatar
PaulDavis1968 PaulDavis1968 is offline
Embedded Software/Systems Engineer
AKA: Master of Complexity
FRC #2053 (TigerTronics)
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2012
Location: Endicot NY
Posts: 91
PaulDavis1968 is just really nicePaulDavis1968 is just really nicePaulDavis1968 is just really nicePaulDavis1968 is just really nicePaulDavis1968 is just really nice
Thumbs up Re: Custom C++ Toolchain

Just for a heads up. This all worked great. I did scratch my head on some installs I needed for a fresh Ubuntu install. Most are things that are listed in the other post. This one had me scratching my head when I built the WPILIB.

There is a program in a batch file that took me a minute to find that I needed. Once I read the error message and went through the batch script it became obvious.

export WIND_BASE=$(realpath "$WIND_BASE")

realpath had to be apt-get installed.

Then there is replacing /path/to

/home/paul but that is because I am stupid.

Thanks for the hard work.

Last edited by PaulDavis1968 : 22-12-2012 at 21:44.
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 13:44.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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