Go to Post Pulling off an off season during a hurricane isn't easy. - Arefin Bari [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 02-02-2008, 21:52
neutrino15's Avatar
neutrino15 neutrino15 is offline
plɹoʍ ollǝɥ
AKA: Jordan Perr
FRC #0694 (Stuypulse)
 
Join Date: Feb 2007
Rookie Year: 2007
Location: New York City
Posts: 162
neutrino15 is just really niceneutrino15 is just really niceneutrino15 is just really niceneutrino15 is just really nice
MATH_DATA can not fit the section

Hello,

The c18 compiler is returning an error
Code:
Error - section 'MATH_DATA' can not fit the section. Section 'MATH_DATA' length=0x000000014
The hex file last time it compiled is only about 40K, so I don't think overall size is an issue. All I did since last compile (successful) was add one more global int and another if statement.. Nothing too drastic..


Any help would be appreciated!
  #2   Spotlight this post!  
Unread 02-02-2008, 21:55
psy_wombats's Avatar
psy_wombats psy_wombats is offline
Registered User
AKA: A. King
FRC #0467 (Duct Tape Bandits)
Team Role: Programmer
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Shrewsbury MA
Posts: 95
psy_wombats has a spectacular aura aboutpsy_wombats has a spectacular aura aboutpsy_wombats has a spectacular aura about
Re: MATH_DATA can not fit the section

In the unlikely event those two changes caused the error, have you reverted and tried to intentionally eat memory? If it cuases the error again, that's the issue, obviously. Global variables do consume a fair amount of memory. Otherwise, I'm at a loss. Maybe it's that a single object can't occupy too large a memory chunk?

Last edited by psy_wombats : 02-02-2008 at 21:56. Reason: More detail
  #3   Spotlight this post!  
Unread 02-02-2008, 22:04
Daniel Bathgate's Avatar
Daniel Bathgate Daniel Bathgate is offline
Registered User
AKA: blacklint
no team
Team Role: College Student
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Needham, MA
Posts: 79
Daniel Bathgate will become famous soon enough
Send a message via AIM to Daniel Bathgate
Re: MATH_DATA can not fit the section

If a giant static array is causing the problem like it was for me, try using the C18 keyword "rom" in the decleration (the microchip C is not pure ANSI C and has additional keywords) to let the compiler know the array can go in program memory.
  #4   Spotlight this post!  
Unread 02-02-2008, 22:07
neutrino15's Avatar
neutrino15 neutrino15 is offline
plɹoʍ ollǝɥ
AKA: Jordan Perr
FRC #0694 (Stuypulse)
 
Join Date: Feb 2007
Rookie Year: 2007
Location: New York City
Posts: 162
neutrino15 is just really niceneutrino15 is just really niceneutrino15 is just really niceneutrino15 is just really nice
Re: MATH_DATA can not fit the section

I added a global short.. What is odd, is when I comment out this block of intense-ish math code, it compiles.. This is weird. The only variable defined there is 1 float. The only other globals besides kevin watson's declarations is one struct with a few longs and a few unsigned ints. It certainly does not seem like I am overloading anything. Do too many equations overflow memory like this?

EDIT:
How do I enable ROM? I am using linux with the adambots makefile, but I can give args to mcc18 if need be. How did you do it?

EDIT2:
I changed 2 LOCAL longs into ints and it COMPILED... Why is this?!?!?!?

Last edited by neutrino15 : 02-02-2008 at 22:12.
  #5   Spotlight this post!  
Unread 02-02-2008, 23:22
Chaos in a Can Chaos in a Can is offline
Joel Spadin
FRC #1736 (Robot Casserole)
Team Role: Programmer
 
Join Date: Mar 2007
Rookie Year: 2007
Location: Peoria, IL
Posts: 58
Chaos in a Can is an unknown quantity at this point
Send a message via MSN to Chaos in a Can
Re: MATH_DATA can not fit the section

From what I can tell, it gives this error when you try to allocate too much memory to one section.
I have no idea how much memory one section can use, or even what one section is, but if you stick stuff into rom or use smaller types, you can probably get rid of this error.

You can also try giving the "-mL" argument to C18 to tell it to use more memory.

I don't believe operations of any sort contribute to the problem, as that is all stored in rom.
Changing the two longs to ints would reduce the amount of ram it needed. Even though they are local, they have to go somewhere when other local variables are still in scope.

You can use "rom" like a variable modifier.
Code:
rom static variable;
I'm quite suprised "const" doesn't put stuff in rom, and I would expect that "rom" makes data unchangeable just like "const".
__________________
2006 Xerox Creativity Award
2007 General Motors Industrial Design Award
2008 Judges' Award
2009 Chrysler Team Spirit Award

  #6   Spotlight this post!  
Unread 02-02-2008, 23:26
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,764
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: MATH_DATA can not fit the section

It only takes one byte to over stuff available memory if you're close to the edge.

The size of your hex file is not directly related to the amount of memory you are using. Generate a link map if you want to see how much you've used up.

Intense math can load extensive math libraries.
The use of floats in the non-floating point processor we use requires extensive overhead to do the simplest floating point operation.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
  #7   Spotlight this post!  
Unread 03-02-2008, 19:26
neutrino15's Avatar
neutrino15 neutrino15 is offline
plɹoʍ ollǝɥ
AKA: Jordan Perr
FRC #0694 (Stuypulse)
 
Join Date: Feb 2007
Rookie Year: 2007
Location: New York City
Posts: 162
neutrino15 is just really niceneutrino15 is just really niceneutrino15 is just really niceneutrino15 is just really nice
Re: MATH_DATA can not fit the section

Hey,

I think that I was pushing the limits of the variable section of memory. I changed the entire trig array to rom, and re-used variables whenever possible. It now compiles smoothly! (Generating a 65K hex file!)

Thanks for your help!
  #8   Spotlight this post!  
Unread 03-02-2008, 21:04
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,112
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: MATH_DATA can not fit the section

Quote:
Originally Posted by neutrino15 View Post
...I changed the entire trig array to rom,...
I think predefined constant arrays like that should always be placed in rom unless you have a good reason not to to it. Back when I was looking into such things a few years ago, I remember discovering a limit of only 256 bytes of global variables for each code module. A single lookup table can easily fill that.
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
Program error - "can not fit the section" miketwalker Programming 9 20-02-2005 01:21
Error - section 'UTIL_LIB' can not fit the section. Section 'UTIL_LIB' length=0x00000 BookerT Programming 13 27-01-2005 09:49
Error - section 'UTIL_LIB' can not fit the section. Section 'UTIL_LIB' length=0x00000 BookerT Programming 0 25-01-2005 19:17
Linking Errors: "section '????' can not fit the section. ..." Astronouth7303 Programming 3 16-01-2005 21:36
Where can I buy Gyros that fit requirments? Salik Syed Programming 16 10-03-2004 10:21


All times are GMT -5. The time now is 22:18.

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