Go to Post Lexan $20.... Stock Aluminum $30.... Having a OI that is heavier than the robot PRICELESS.... - GBIT [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 28-03-2005, 21:46
EricWilliams EricWilliams is offline
Registered User
FRC #2039 (Rockford Robotics)
Team Role: Mentor
 
Join Date: Mar 2005
Rookie Year: 2001
Location: Rockford, IL
Posts: 103
EricWilliams is a glorious beacon of lightEricWilliams is a glorious beacon of lightEricWilliams is a glorious beacon of lightEricWilliams is a glorious beacon of lightEricWilliams is a glorious beacon of lightEricWilliams is a glorious beacon of light
Multiple Files

Since the default code is made of multiple files, it requires a specific linking script, correct? I am a programmer that can make simple VB, C, C++, and Java programs work but I don't understand much about coding theory. Can anyone explain what the benefit of multiple files is?

Along that same line, the linker provides a way for a method in one file call a method in another file, right? How are these linking scripts made?

Any answer would be greatly appreciated.
Thanks in advance,
Eric
  #2   Spotlight this post!  
Unread 29-03-2005, 01:08
dm0ney's Avatar
dm0ney dm0ney is offline
Will Code For Food (Food Optional)
AKA: Deepak Mishra
None #0217 (The ThunderChickens)
Team Role: Alumni
 
Join Date: Jan 2005
Rookie Year: 2004
Location: Shelby Twp., MI
Posts: 48
dm0ney will become famous soon enough
Send a message via AIM to dm0ney
Re: Multiple Files

Quote:
Originally Posted by Ewilliams2006
Since the default code is made of multiple files, it requires a specific linking script, correct? I am a programmer that can make simple VB, C, C++, and Java programs work but I don't understand much about coding theory. Can anyone explain what the benefit of multiple files is?

Along that same line, the linker provides a way for a method in one file call a method in another file, right? How are these linking scripts made?

Any answer would be greatly appreciated.
Thanks in advance,
Eric

The main benefit of multiple files is organization!
Technically... every function and call you make slows your program down since current commands are put on hold to the stack and the new function is addressed, things are put to the stack and then taken care of in order.

The multiple files also allow one to split up code for different people to work on as well as allowing you or somebody else to change code rapidly if you can go to a specific file instead of one monster file that you must use search to find areas in.

I cant tell you exactly how linker scripts are done... I know the linker is run and thats about where my knowledge ends.
The linker does have all functions and callings done so they can be called from different files.
__________________

Alumni
Team #217, The ThunderChickens



Student, Class of 2009
California Institute of Technology


  #3   Spotlight this post!  
Unread 29-03-2005, 11:14
AIBob's Avatar
AIBob AIBob is offline
AI Programmer
AKA: Bob Frank DOT org
FRC #0358 (Hauppauge Robotic Eagles)
Team Role: Alumni
 
Join Date: Jan 2005
Rookie Year: 2003
Location: Long Island, NY (in Binghamton now)
Posts: 297
AIBob is a splendid one to beholdAIBob is a splendid one to beholdAIBob is a splendid one to beholdAIBob is a splendid one to beholdAIBob is a splendid one to beholdAIBob is a splendid one to beholdAIBob is a splendid one to behold
Send a message via ICQ to AIBob Send a message via AIM to AIBob Send a message via MSN to AIBob Send a message via Yahoo to AIBob
Re: Multiple Files

Quote:
Originally Posted by Ewilliams2006
Since the default code is made of multiple files, it requires a specific linking script, correct? I am a programmer that can make simple VB, C, C++, and Java programs work but I don't understand much about coding theory. Can anyone explain what the benefit of multiple files is?

Along that same line, the linker provides a way for a method in one file call a method in another file, right? How are these linking scripts made?

Any answer would be greatly appreciated.
Thanks in advance,
Eric
Linkers do just as they are named, they link together different files and create an file able to be executed.
They take libraries that you included with the linker script (or the command line), and connect the code so that calls that you make to functions outside of each file actually call the right function and do not call nothing.
They also take each of the object files that was created from the compiler, and connects them in a similar fashion to what was done for the libraries.
And like 'dm0ney' said, more files = more organization, and easier to spread the code to multiple people.
And you do not need a linker script for most linkers.... you can generally just place the files you want to link into the command line... I believe that is what the Microchip IDE does... although I would have to check when I have that available to me.
__________________
- from B B frank

  #4   Spotlight this post!  
Unread 29-03-2005, 11:47
Dave Scheck's Avatar
Dave Scheck Dave Scheck is offline
Registered User
FRC #0111 (WildStang)
Team Role: Engineer
 
Join Date: Feb 2003
Rookie Year: 2002
Location: Arlington Heights, IL
Posts: 574
Dave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond repute
Re: Multiple Files

Quote:
Originally Posted by Ewilliams2006
Can anyone explain what the benefit of multiple files is?
In a word organization...this was mentioned before, but I'll expand a bit....

There are 14185 lines written for the Wildstang robot (including comments, headers and some of the default ifi provided files) If we were to put this into a single file, it would quickly become unmanageable (not to mention uncompilable due to mcc18 limitations).

To make this more manageable, we have broken this into 33 C files and 26 H files. Each file contains functions and/or definitions for a specific portion of our robot.

For example, ws_drive_input.c handles joystick input as it relates to the drive train (i.e. left speed, right speed, shifter positions) as well as acceleration.

ws_lift.c handles joystick input as it relates to the lift (i.e. height, tilt, top/bottom spear positions).

As you can see, we have a naming convention for our files such that any custom code is prepended with a ws_. The names are also well named such that as long as you know what it is you're trying to accomplish, you should be able to determine which file to modify. For example, if you want to use tank steering instead of single stick, you could easilly tell you wouldn't want to modify ws_lift.c, but rather ws_drive_input.c.

The modularization of your code (i.e. multiple files) also allows more programmers to be involved. With this type of system, one person can go off and write lift code while another works on drive code. Since these modules are completely independent, there is no risk of duplicating effort.

All in all, making your programs modular will make your code more readable and maintainable.
  #5   Spotlight this post!  
Unread 30-03-2005, 15:51
Astronouth7303's Avatar
Astronouth7303 Astronouth7303 is offline
Why did I come back?
AKA: Jamie Bliss
FRC #4967 (That ONE Team)
Team Role: Mentor
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Grand Rapids, MI
Posts: 2,071
Astronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud of
Re: Multiple Files

Quote:
Originally Posted by dm0ney
I cant tell you exactly how linker scripts are done... I know the linker is run and thats about where my knowledge ends.
The linker does have all functions and callings done so they can be called from different files.
In the case of MCC18, the linker script just defines memory blocks. Which files to link are passed on the command line.
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
Combining multiple objects in different files into the same scene and file? DinkyDogg 3D Animation and Competition 8 19-02-2005 19:14
problem with .c files incognito_NICK Programming 5 31-01-2005 13:19
CAD Help needed. Mech Desktop 6 files backwards to AutoCAD 14? (2d files) Elgin Clock Inventor 0 30-08-2004 23:06
**IMPORTANT FIRST EMAIL**/DXF files posted on FIRST website miketwalker FIRST E-Mail Blast Archive 0 19-01-2004 19:53
Multiple files usage punarhero Programming 2 12-01-2003 11:45


All times are GMT -5. The time now is 06:31.

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