Go to Post Start respecting your mentors more or they might just leave. - Eric Bareiss [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
  #1   Spotlight this post!  
Unread 18-12-2004, 18:49
Michael Auchter Michael Auchter is offline
Registered User
#0068 (Truck Town Thunder)
 
Join Date: Jan 2004
Location: Clarkston, MI
Posts: 15
Michael Auchter is on a distinguished road
Perl FRC builder in Linux

I developed a program for building the robot code in Perl. I know that there is already an actual makefile which makes use of "make," but on my laptop, I have several directories full of code, and thought it would be nice to have one centralized utility to build them.

When you execute the program, it will compile all .c files in the current directory.

Installation Instructions:
cp ./frcbuild /usr/bin
chmod 755 /usr/bin/frcbuild

Type "frcbuild" in your code directory to build.

Comments/criticism would be greatly appreciated.

Code:
#!/usr/bin/perl -w

# Builder for MCC18
# FIRST Team 68, Truck Town Thunder

# Coded by: Michael Auchter (auchter.phire.org)
# Questions? Comments? michael.auchter@gmail.com

use strict;
# Variable Declaration.  Pretty self explanatory...
my $MCC   = "/opt/mcc18";
my $MCC18 = "$MCC/bin/mcc18.exe -p=18F8520";
my $LINK  = "$MCC/bin/mplink.exe";
my $WINE  = "/usr/bin/wine";
my $OPT   = "\"$MCC/h\" -D_FRC_BOARD -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa-";
my $DRIVE = "Z";
my $LIB = "$DRIVE:$MCC/lib/";

# Compilation
while (<*.c>) {                 # Case sensitive, change if .C
 print "Compiling: $_\n";
 my $o = $_;
 $o =~ s|\.c$|\.o|i;
 system("$WINE $MCC18 \"$_\" -fo=\"$o\" /i$OPT") unless (/print_f/);
 system("$WINE $MCC18 \"$_\" -fo=\"$o\" /i\"$MCC/h\"") if (/print_f/);
}

# Build
print "Building FrcCode.hex\n";
my $files = "";
$files = "$files $_ " while (<*.o>);
system("$WINE $LINK /l\"$DRIVE:$MCC/lib/\" \"18f8520user.lkr\" $files \"FRC_library.lib\" /m\"FrcCode.map\" /o\"FrcCode.cof\"");

print "Removing *.o\n";
system("rm $_") while (<*.o>);
Attached Files
File Type: txt frcbuild.txt (1.0 KB, 17 views)

Last edited by Michael Auchter : 18-12-2004 at 21:12.
  #2   Spotlight this post!  
Unread 05-01-2005, 00:54
BrianJennings BrianJennings is offline
Sleep is optional
None #1519 (Mechanical Mayhem)
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Merrimack
Posts: 24
BrianJennings is an unknown quantity at this point
Send a message via AIM to BrianJennings
Re: Perl FRC builder in Linux

Does this code work on Windows and Linux?


It sounds very cool to me.


Have you thought about using PAR to compile it to an executable that is non relient on haveing Perl on the system? or adding a GUI with perl TK? If you haven't I could probably help you out, becuae I have done a bit of stuff with both...
  #3   Spotlight this post!  
Unread 05-01-2005, 02:07
phrontist's Avatar
phrontist phrontist is offline
Proto-Engineer
AKA: Bjorn Westergard
FRC #1418 (Vae Victus)
Team Role: College Student
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Falls Church, VA
Posts: 828
phrontist has a reputation beyond reputephrontist has a reputation beyond reputephrontist has a reputation beyond reputephrontist has a reputation beyond reputephrontist has a reputation beyond reputephrontist has a reputation beyond reputephrontist has a reputation beyond reputephrontist has a reputation beyond reputephrontist has a reputation beyond reputephrontist has a reputation beyond reputephrontist has a reputation beyond repute
Send a message via AIM to phrontist
Re: Perl FRC builder in Linux

Quote:
Originally Posted by BrianJennings
Does this code work on Windows and Linux?


It sounds very cool to me.


Have you thought about using PAR to compile it to an executable that is non relient on haveing Perl on the system? or adding a GUI with perl TK? If you haven't I could probably help you out, becuae I have done a bit of stuff with both...
You'd need only modify the file paths by the looks of it. Perl is farily inutive, except when it looks like line noise.
__________________

University of Kentucky - Radio Free Lexington

"I would rather have a really big success or a really spectacular crash and failure then live out the warm eventual death of mediocrity" - Dean Kamen
  #4   Spotlight this post!  
Unread 05-01-2005, 16:40
Michael Auchter Michael Auchter is offline
Registered User
#0068 (Truck Town Thunder)
 
Join Date: Jan 2004
Location: Clarkston, MI
Posts: 15
Michael Auchter is on a distinguished road
Re: Perl FRC builder in Linux

Quote:
Originally Posted by BrianJennings
Does this code work on Windows and Linux?


It sounds very cool to me.


Have you thought about using PAR to compile it to an executable that is non relient on haveing Perl on the system? or adding a GUI with perl TK? If you haven't I could probably help you out, becuae I have done a bit of stuff with both...
Yes, the file paths are all that need to be modified for it to work under Windows. As far as using PAR or a GUI, I had not thought of that, but if you'd like, feel free to modify the code and post it here.
  #5   Spotlight this post!  
Unread 05-01-2005, 18:52
doyler doyler is offline
Rookie / Programmer
#0900 (Infinity)
Team Role: Programmer
 
Join Date: Oct 2004
Rookie Year: 2005
Location: Durham
Posts: 87
doyler is an unknown quantity at this point
Re: Perl FRC builder in Linux

Now this compiles it with using C18?
__________________
  #6   Spotlight this post!  
Unread 07-01-2005, 11:46
BrianJennings BrianJennings is offline
Sleep is optional
None #1519 (Mechanical Mayhem)
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Merrimack
Posts: 24
BrianJennings is an unknown quantity at this point
Send a message via AIM to BrianJennings
Re: Perl FRC builder in Linux

sounds cool... I might give it a go...
__________________
"it's googleable " -- the_undefined
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Using an FRC with the RCX? Astronouth7303 Programming 21 15-04-2004 14:14
Linux SteveC116 3D Animation and Competition 22 25-03-2004 15:07
FRC Program State Frozen at Power-up WillyC Control System 4 14-02-2004 18:05
Linux And Windows XP Raven_Writer Chit-Chat 4 06-08-2003 18:53


All times are GMT -5. The time now is 03:07.

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