Go to Post I got dragged into FIRST against my will, and it was the best thing that's ever happened to me. - Liz C [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 17-02-2005, 00:34
Unsung FIRST Hero
miketwalker miketwalker is offline
Robot Lifeguard
FRC #1902 (Exploding Bacon)
 
Join Date: Dec 2001
Rookie Year: 2002
Location: Orlando, FL
Posts: 878
miketwalker has a reputation beyond reputemiketwalker has a reputation beyond reputemiketwalker has a reputation beyond reputemiketwalker has a reputation beyond reputemiketwalker has a reputation beyond reputemiketwalker has a reputation beyond reputemiketwalker has a reputation beyond reputemiketwalker has a reputation beyond reputemiketwalker has a reputation beyond reputemiketwalker has a reputation beyond reputemiketwalker has a reputation beyond repute
Send a message via AIM to miketwalker
Program error - "can not fit the section"

For some reason I've suddenly started getting an error saying:

Error - section '.code_adcread.o' can not fit the section.

When I comment a bit of code out, it will build again though. When I check my memory map, I'm only using 86% of the memory... so why is it building when I comment some code out (and it isnt too much I have to comment out) yet I still seem to have a reasonable bit of memory to work with?

-Mike
  #2   Spotlight this post!  
Unread 17-02-2005, 07:19
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: Program error - "can not fit the section"

It may be longer than it appears to be.
You may have declared thing that you are not using, included excess things, and some other things, I recommend that you check over the code again, you may notice somthing you did on accident.
__________________
- from B B frank

  #3   Spotlight this post!  
Unread 17-02-2005, 09:48
Dave Flowerday Dave Flowerday is offline
Software Engineer
VRC #0111 (Wildstang)
Team Role: Engineer
 
Join Date: Feb 2002
Rookie Year: 1995
Location: North Barrington, IL
Posts: 1,366
Dave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond repute
Re: Program error - "can not fit the section"

Quote:
Originally Posted by miketwalker
I'm only using 86% of the memory... so why is it building when I comment some code out (and it isnt too much I have to comment out) yet I still seem to have a reasonable bit of memory to work with?
Microchip's C compiler has a limit on the amount of space that any one object file can consume (yes, it seems dumb to me too), so this is probably why you're seeing the error. Try moving some functionality from that file (probably adcread.c?) to another file instead.
  #4   Spotlight this post!  
Unread 17-02-2005, 13:10
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,848
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: Program error - "can not fit the section"

I found the Program Space is max'ed out at 90% of total, rather than the 100% you naturally expect.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
  #5   Spotlight this post!  
Unread 17-02-2005, 15:20
Unsung FIRST Hero
miketwalker miketwalker is offline
Robot Lifeguard
FRC #1902 (Exploding Bacon)
 
Join Date: Dec 2001
Rookie Year: 2002
Location: Orlando, FL
Posts: 878
miketwalker has a reputation beyond reputemiketwalker has a reputation beyond reputemiketwalker has a reputation beyond reputemiketwalker has a reputation beyond reputemiketwalker has a reputation beyond reputemiketwalker has a reputation beyond reputemiketwalker has a reputation beyond reputemiketwalker has a reputation beyond reputemiketwalker has a reputation beyond reputemiketwalker has a reputation beyond reputemiketwalker has a reputation beyond repute
Send a message via AIM to miketwalker
Re: Program error - "can not fit the section"

It seems like their is overall very little space for coding. I removed most of the code in the default routines, and I haven't put too much code in for my positioning system, yet it's taking up most of the memory. It's very weird, I just can't see how I'd be taking up all of the memory with my code, unless there in fact is very very little programming space on these controllers.

I'll look into the limit of space with the single object file, I have my calibration/sensors/positioning calculations all in one file so perhaps the problem lies in there... however the user_camera.c file seems to use more space then my thing, which makes me wonder. Oh well, thanks for the ideas! I'll try playing around with it some more.
  #6   Spotlight this post!  
Unread 17-02-2005, 15:34
Dave Flowerday Dave Flowerday is offline
Software Engineer
VRC #0111 (Wildstang)
Team Role: Engineer
 
Join Date: Feb 2002
Rookie Year: 1995
Location: North Barrington, IL
Posts: 1,366
Dave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond repute
Re: Program error - "can not fit the section"

Quote:
Originally Posted by miketwalker
It seems like their is overall very little space for coding.
I agree. 32K was plenty for remote-control robots, but now they're asking us to do a lot of autonomous work which can be quite a bit more complicated to code. Honestly, I'm not sure how some teams even manage to make it work! We've offloaded a good percentage of stuff to our custom circuit and we're still running dangerously close to the limit on our RC. The last few days we've had to put a lot of effort into optimization, mainly by looking at the generated assembly file (.lst) and looking for any lines of C that generated too much assembly and working on optimizing them. We're also ready to move back to our stripped-down printf library that we used last year, and to turn back on most of the compiler optimization if needed to gain some extra space. That's something you could look into as well - unfortunately I'm not sure where the setting is in MPLAB since we run it all command-line with makefiles, but somewhere in there is a bunch of flags like this:
Code:
-p=18F8520 -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa- -nw=2066
You could look into removing some of those options (they turn off individual compiler optimizations) to free up some space, but be aware that it could introduce problems with your code (by exposing bugs that were hidden before without optimization, etc). If you're just playing around a good one to try removing is (-Ou-) as that turns off the "dead code" removal - if that optimization is on then the compiler will remove any code which isn't called by anyone (which should be a fairly safe optimization).
  #7   Spotlight this post!  
Unread 18-02-2005, 00:46
Chris_Elston's Avatar
Chris_Elston Chris_Elston is online now
Controls Engineer
AKA: chakorules
FRC #1501 (Team THRUST)
Team Role: Engineer
 
Join Date: Feb 2004
Rookie Year: 2001
Location: Huntington, Indiana
Posts: 751
Chris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond repute
Re: Program error - "can not fit the section"

Quote:
Originally Posted by Dave Flowerday
I agree. 32K was plenty for remote-control robots, but now they're asking us to do a lot of autonomous work which can be quite a bit more complicated to code. Honestly, I'm not sure how some teams even manage to make it work!

Oh my goodness, don't even get me started. Our team is literally BALD...everytime we code it we run out of space...very sad...
__________________
Team T.H.R.U.S.T. 1501
Download all of our past robot's source code here:Repository

Favorite CD quote:
"That can't be their 'bot. not nearly enough (if any) rivets to be a 1501 machine." ~RogerR: Team #1369
  #8   Spotlight this post!  
Unread 18-02-2005, 15:06
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: Program error - "can not fit the section"

Quote:
Originally Posted by Dave Flowerday
I agree. 32K was plenty for remote-control robots, but now they're asking us to do a lot of autonomous work which can be quite a bit more complicated to code. Honestly, I'm not sure how some teams even manage to make it work!
What my team did is just get rid of all the stuff in the default code that we do not use, and the FRC does not require; for instance the print functions last year were too big, so Mr. McLeod made special print functions that were much smaller and we used those.
__________________
- from B B frank

  #9   Spotlight this post!  
Unread 18-02-2005, 18:33
TechnocratiK TechnocratiK is offline
Registered User
AKA: Patrick Diez
None #0296 (Northern Knights)
Team Role: Programmer
 
Join Date: Sep 2003
Location: Montreal, Canada
Posts: 22
TechnocratiK is an unknown quantity at this point
Re: Program error - "can not fit the section"

Using the compiler optimizations helps a bunch. I haven't had the time to prove this, but I don't think the compiler treats floating point operations as functions. What I noticed was that changing my code from floating point operations to integer operations made a very big difference. In fact, it let me fit Kevin's camera code in no prob (not to mention made it run a hell of a lot faster). I wonder if creating and using a function like:
Code:
float fmul(float x, float y) {
  return (x * y);
}
would actually save code space...
Well, it would, if one didn't enable procedural abstraction, which does exactly this: treat operations as functions. A "-Opa-" on your command line signifies that you have this disabled, which can make a pretty big difference.

One big advantage to removing the debug options is that it cuts out the extra functions in the math library that one would never use, like asinh.
__________________
TechnocratiK out.

Last edited by TechnocratiK : 19-02-2005 at 01:19.
  #10   Spotlight this post!  
Unread 20-02-2005, 01:21
Don Reid Don Reid is offline
Registered User
#0997
Team Role: Mentor
 
Join Date: Jan 2003
Rookie Year: 2002
Location: Corvallis, Oregon
Posts: 45
Don Reid will become famous soon enough
Re: Program error - "can not fit the section"

We got this error today after adding several autonomous scripts in commads.h.
The way that code is set up, it creates a large variable command_list in RAM
and also specifies that it be initialize which uses ROM space.

The processor we have has much less RAM space that ROM!

You don't need that data as a read/write variable, it will never change.

So we found that it could be declared like this:

rom struct commands comand_list[]....
^^

The "rom" tells the compiler to just put the data into ROM and not use RAM space. Be sure to change the declaration in robots.h and the defenition in commands.h to match.
__________________
Don Reid
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
2-week FIRST summer program @ WPI ColleenShaver General Forum 20 31-05-2009 03:02
how to add steps in the provided encoder program for the edu Zaramel2002 Programming 3 11-02-2004 08:35
Fried program slots? Jeff Waegelin Programming 18 19-03-2003 18:08
Ahh! Program trick confusing! archiver 2001 9 24-06-2002 02:26
Credits for FIRST program. archiver 2000 6 24-06-2002 00:16


All times are GMT -5. The time now is 08:17.

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