Go to Post The entire season, when someone yelled "Robot" I would yell back "Human" and stand my ground. - DonRotolo [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 14-05-2010, 15:17
masoug's Avatar
masoug masoug is offline
Food Consumer
FRC #0114
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2009
Location: Planet Earth
Posts: 78
masoug is an unknown quantity at this point
Lightbulb DIY Static Library

Hi,
After my 1st-year experience of programming stuff for the robot, I thought it might be a good idea start a library archive.
So is there a way I can use WindRiver to make our own "lib.a" libraries and use it?

THANKS!!!

-Masoug
__________________

JabbaScript
Reply With Quote
  #2   Spotlight this post!  
Unread 14-05-2010, 23:24
taichichuan's Avatar
taichichuan taichichuan is offline
Software Mentor
AKA: Mike Anderson
FRC #0116 (Epsilon Delta)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2010
Location: Herndon, VA
Posts: 328
taichichuan has much to be proud oftaichichuan has much to be proud oftaichichuan has much to be proud oftaichichuan has much to be proud oftaichichuan has much to be proud oftaichichuan has much to be proud oftaichichuan has much to be proud oftaichichuan has much to be proud oftaichichuan has much to be proud oftaichichuan has much to be proud of
Send a message via AIM to taichichuan
Re: DIY Static Library

Absolutely. I've created two libraries for our team. Although I sure that you can create them from the Workbench environment, I find it is easier from the command line. I've included the Makefile, but if you don't speak Makefile, then ask questions and I'll try to answer them.

Here is the Makefile that I used to create the CANJaguarLib.a:

# source files.
SRC = CANJaguar.cpp

OBJ = $(SRC:.cpp=.o)

OUT = CANJaguarLib.a

# include directories
INCLUDES = -I. -I$(WIND_BASE)/target/h -IC:/Team_116_2010/Jaguar -IC:/windriver/
vxworks-6.3/target/h/WPIlib

# C++ compiler flags (-g -O2 -Wall)
CCFLAGS = -g

# compiler
CCC = ccppc

# library paths
LIBS = -LC:/Team_116_2010/lib -lm

# compile flags
LDFLAGS = -g
.SUFFIXES: .cpp

default: dep $(OUT)

.cpp.o:
$(CCC) $(INCLUDES) $(CCFLAGS) -c $< -o $@

$(OUT): $(OBJ)
arppc rcs $(OUT) $(OBJ)

depend: dep

dep:

clean:
rm -f $(OBJ) $(OUT) Makefile.bak
Reply With Quote
  #3   Spotlight this post!  
Unread 15-05-2010, 01:52
mikets's Avatar
mikets mikets is online now
Software Engineer
FRC #0492 (Titan Robotics)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Bellevue, WA
Posts: 667
mikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of light
Re: DIY Static Library

Alternatively, you can write the method body right into the class definition in the .h file. I found this easier for development when I still need to change the library code quite often. Compile it to separate library module take several more steps if you need to change it.
__________________
Reply With Quote
  #4   Spotlight this post!  
Unread 15-05-2010, 10:10
masoug's Avatar
masoug masoug is offline
Food Consumer
FRC #0114
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2009
Location: Planet Earth
Posts: 78
masoug is an unknown quantity at this point
Re: DIY Static Library

Cool thanks!
Quote:
Originally Posted by taichichuan
# source files.
SRC = CANJaguar.cpp

OBJ = $(SRC:.cpp=.o)

OUT = CANJaguarLib.a

# include directories
INCLUDES = -I. -I$(WIND_BASE)/target/h -IC:/Team_116_2010/Jaguar -IC:/windriver/
vxworks-6.3/target/h/WPIlib

# C++ compiler flags (-g -O2 -Wall)
CCFLAGS = -g

# compiler
CCC = ccppc

# library paths
LIBS = -LC:/Team_116_2010/lib -lm

# compile flags
LDFLAGS = -g
.SUFFIXES: .cpp

default: dep $(OUT)

.cpp.o:
$(CCC) $(INCLUDES) $(CCFLAGS) -c $< -o $@

$(OUT): $(OBJ)
arppc rcs $(OUT) $(OBJ)

depend: dep

dep:

clean:
rm -f $(OBJ) $(OUT) Makefile.bak
Do you use Windows or Linux? I found out that Makefiles are different on different operating systems...

THANKS!!!

-Masoug
__________________

JabbaScript
Reply With Quote
  #5   Spotlight this post!  
Unread 17-05-2010, 18:29
taichichuan's Avatar
taichichuan taichichuan is offline
Software Mentor
AKA: Mike Anderson
FRC #0116 (Epsilon Delta)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2010
Location: Herndon, VA
Posts: 328
taichichuan has much to be proud oftaichichuan has much to be proud oftaichichuan has much to be proud oftaichichuan has much to be proud oftaichichuan has much to be proud oftaichichuan has much to be proud oftaichichuan has much to be proud oftaichichuan has much to be proud oftaichichuan has much to be proud oftaichichuan has much to be proud of
Send a message via AIM to taichichuan
Re: DIY Static Library

Actually, I use both. But, the Makefile approach used by WRS *is* the same as you find in Linux right down to the whitespace (e.g., tabs *not* spaces). Both use the GNU make facility and the binutils from GNU.

It's just that WRS puts a wrapper around the tools that check the license before allowing you to compile/link code. So, the easiest approach is to use the "host shell" option in the WRS Workbench tool to get to a command line and then invoke the make from there. That shell sets up the environment variables and paths needed for the WRS build system to work.

HTH,

Mike
Reply With Quote
  #6   Spotlight this post!  
Unread 18-05-2010, 12:08
virtuald's Avatar
virtuald virtuald is offline
RobotPy Guy
AKA: Dustin Spicuzza
FRC #1418 (), FRC #1973, FRC #4796, FRC #6367 ()
Team Role: Mentor
 
Join Date: Dec 2008
Rookie Year: 2003
Location: Boston, MA
Posts: 1,039
virtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant future
Re: DIY Static Library

An interesting thing with our build environment is that since we're compiling as kernel modules, your robot program is actually its own dynamic library (as opposed to a static *.a library).

My development pattern is that I tend to make a lot of little projects to test various things, and setting up linkage to a set of libraries each time would get annoying. So instead of setting up a static library, I compile it as a regular project, and then FTP the object file (*.out) to the robot and edit ni-rt.ini to load the library before it loads FRC_UserProgram.out. Then my installation program for the library copies the header files to the wind river include directory, and I just include the header files and it all magically works.

The other reasoning for this is that my library uses boost, and setting up that is a pain, so I'd rather just have a quick installer that installs the relevant header files and object files on our other development computers instead of trying to do it on each machine.

Of course, if your library changes a lot, then this is a bad approach. Its more suited to something that you are going to redistribute to other teams. See my project website for more information: http://code.google.com/p/webdma/
__________________
Maintainer of RobotPy - Python for FRC
Creator of pyfrc (Robot Simulator + utilities for Python) and pynetworktables/pynetworktables2js (NetworkTables for Python & Javascript)

2017 Season: Teams #1973, #4796, #6369
Team #1418 (remote mentor): Newton Quarterfinalists, 2016 Chesapeake District Champion, 2x Innovation in Control award, 2x district event winner
Team #1418: 2015 DC Regional Innovation In Control Award, #2 seed; 2014 VA Industrial Design Award; 2014 Finalists in DC & VA
Team #2423: 2012 & 2013 Boston Regional Innovation in Control Award


Resources: FIRSTWiki (relaunched!) | My Software Stuff
Reply With Quote
Reply


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
DIY drive belt dpeterson3 Technical Discussion 10 01-09-2009 20:38
MIT/FIRST DIY Segway chris31 General Forum 10 26-08-2007 21:41
DIY open exhaust Mike Chit-Chat 3 06-06-2007 22:57
DIY water cooling Morenoh149 Chit-Chat 2 28-02-2006 23:44
DIY Active Noise Cancellation phrontist Technical Discussion 20 28-08-2004 07:45


All times are GMT -5. The time now is 02:49.

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