Go to Post FIRST is a pretty decent microcosm of real life, those who work hard, accomplish more decent lesson to learn, and FIRST is allowing us to learn it. - Aren_Hill [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 19-01-2006, 00:56
AL_E AL_E is offline
Registered User
AKA: Al Evangelista
None #0703 (Phoenix)
Team Role: Coach
 
Join Date: Jan 2005
Rookie Year: 2004
Location: Saginaw, MI
Posts: 5
AL_E is an unknown quantity at this point
.hex file too large for 2004 controller?

Gang,

While attempting to test a program based on Kevin's "bells and whistles" camera code (with the addition of our own autonomous and RC mode drive code) we ran into a problem when loading the .hex file into the 2004 controller.

The download appears to complete correctly however the program state LED goes to red and the controller does not operate. We double checked the compile options (Device = PIC18F8520) and confirmed that the correct linker script and library have been selected for the 8520.

The .map file reports "30471 out of 33816 program addresses used, program memory utilization is 90%" I do not see a corresponding space usage summary report for the data area (RAM).

My question is this: Does the memory utilization figure reported in the .map file tell the whole story or are there other considerations (RAM usage or other factors) which would contribute to this problem. In short, is there a way to determine from the .map file whether or not the .hex file is too large for the 2004 controller?

Thanks in advance for the assistance

-Al
  #2   Spotlight this post!  
Unread 19-01-2006, 06:51
Bharat Nain's Avatar
Bharat Nain Bharat Nain is offline
Registered User
no team
Team Role: Alumni
 
Join Date: Jan 2004
Rookie Year: 2003
Location: New York
Posts: 2,000
Bharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond repute
Send a message via AIM to Bharat Nain Send a message via MSN to Bharat Nain
Re: .hex file too large for 2004 controller?

Unless you modified the code, the bells and whistles version code is not supposed to work with the older controllers. It is meant for the 2006 controller.
__________________
-= Bharat Nain =-

Whatever you do, you need courage. Whatever course you decide upon, there is always someone to tell you that you are wrong. There are always difficulties arising that tempt you to believe your critics are right. To map out a course of action and follow it to an end requires some of the same courage that a soldier needs. Peace has its victories, but it takes brave men and women to win them. - Ralph Waldo Emerson
  #3   Spotlight this post!  
Unread 19-01-2006, 09:24
steveg's Avatar
steveg steveg is offline
Livin' the Dream
AKA: Stephen Guerrera
no team
Team Role: Mentor
 
Join Date: Jan 2003
Rookie Year: 2003
Location: Boston, MA
Posts: 70
steveg is a splendid one to beholdsteveg is a splendid one to beholdsteveg is a splendid one to beholdsteveg is a splendid one to beholdsteveg is a splendid one to beholdsteveg is a splendid one to beholdsteveg is a splendid one to beholdsteveg is a splendid one to behold
Send a message via AIM to steveg
Re: .hex file too large for 2004 controller?

From the Documentation:

Code:
To compile this project to work with your 2005 [or 2004!] FRC (18F8520) system do the following:

  1.  Select the correct device from the MPLAB IDE. 

      Configure->Select Device->PIC18F8520

  2.  Replace the library file with the appropriate one.

      Remove the FRC_Library.lib file and replace it with FRC_Library_8520.lib
       
                                        or

      Remove the FRC_alltimers.lib file and replace it with FRC_alltimers_8520.lib

  3.  Remove the 18f8722.lkr file and replace it with the 18f8520.lkr file

  4.  Rebuild your project and download the HEX file to your controller.
  #4   Spotlight this post!  
Unread 19-01-2006, 10:00
Mark McLeod's Avatar
Mark McLeod Mark McLeod is online now
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,825
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: .hex file too large for 2004 controller?

The two risk areas where we can try to stuff too much are the Program Space and the Data Space. Either one will blow your code out of the figurative water.

90% as reported in the .map file represents full Program Space as far as the user is concerned. The other 10% of that space gets taken up by IFI overhead not covered by the report.

The .map file doesn't have a neat report for the Data Space. You have to check it yourself using the Data Space memory mapping at the end of the .map report. Compare the linked addresses to the blocks open to the user in the .lkr file.
From my notes 1,343 bytes of ram were available to the user after the 2004 default code (IFI, stack, etc), but that has to cover dynamically allocated local function variables as well that won't show up in the linker report.

There are usually some distinctive behaviors that indicate we are trying to stuff too much into the controller, but with the latest version of the IFI_Loader those symptoms may have all changed. I usually take time to experiment and measure the RC limitations, but there's no time yet. Today I'll be at four different schools.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 19-01-2006 at 10:15.
  #5   Spotlight this post!  
Unread 19-01-2006, 18:31
AL_E AL_E is offline
Registered User
AKA: Al Evangelista
None #0703 (Phoenix)
Team Role: Coach
 
Join Date: Jan 2005
Rookie Year: 2004
Location: Saginaw, MI
Posts: 5
AL_E is an unknown quantity at this point
Re: .hex file too large for 2004 controller?

Thanks for the quick and substantive responses folks.

We had made the changes to the "bells and whistles" camera code as required for the 04 controller and it worked fine on our 04 controller until we loaded our old autonomous and RC code into the build. We suspect program size too large and from what I understand from the above posts we are at risk in the data space area. -- will dig in to it more tonight and followup. Funny thing though, we receive no linker errors. I would expect at least a warning if we were beyond the limit of the data space.

Thanks, Al
  #6   Spotlight this post!  
Unread 20-01-2006, 09:29
steveg's Avatar
steveg steveg is offline
Livin' the Dream
AKA: Stephen Guerrera
no team
Team Role: Mentor
 
Join Date: Jan 2003
Rookie Year: 2003
Location: Boston, MA
Posts: 70
steveg is a splendid one to beholdsteveg is a splendid one to beholdsteveg is a splendid one to beholdsteveg is a splendid one to beholdsteveg is a splendid one to beholdsteveg is a splendid one to beholdsteveg is a splendid one to beholdsteveg is a splendid one to behold
Send a message via AIM to steveg
Re: .hex file too large for 2004 controller?

Instead of the bells and whistles version, you might want to try the streamlined version. It should take up less space and probably generally be better suited to the 2004 RC.
  #7   Spotlight this post!  
Unread 21-01-2006, 22:54
AL_E AL_E is offline
Registered User
AKA: Al Evangelista
None #0703 (Phoenix)
Team Role: Coach
 
Join Date: Jan 2005
Rookie Year: 2004
Location: Saginaw, MI
Posts: 5
AL_E is an unknown quantity at this point
Re: .hex file too large for 2004 controller?

Bharat, Steve, Mark,

Thanks all for your responses to my question. It turns out that when I added our autonomous mode code to Kevin's default camera code I overlaid the 2006 InterruptHandlerLow () function with last year's version. This apparently caused the processor fault. One of our students found this.

Mark, One of these days I'd like to dig into the details of data space usage a bit more - I have a lot to learn in that area. I notice that most of our variables are loaded in lower memory while some "system" variables seem to be loaded in high memory. The map shows a gap between the end of our variables and the start of the system variables - I assume that this is available data memory.

Steve, We may end up using the streamlined verison of the code for our production build. At this point we are using the full version to get a handle on camera setup parameters. With the default settings from Kevin's code we are able to track the standard target at about 30 feet although we need to be about 10 feet away to acquire it. (camera lens screwed out about 3/4 of way) More testing / setup is obviously needed...

Best Regards, Al
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
Robot Controller File Size Limit ?? RoboGeek Programming 1 17-01-2005 19:59
heres the code. y this not working omega Programming 16 31-03-2004 15:18
How do we convert a modified user routines file into a valid .HEX file HuskieRobotics Programming 13 28-02-2004 12:12
File Sharing and Revision Tracking Madison FIRST-related Organizations 14 04-06-2003 18:01
serious problem found - robot controller resets when jarred! KenWittlief Electrical 23 19-03-2003 13:30


All times are GMT -5. The time now is 10:38.

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