Go to Post This game is all about dealing with the unexpected and making changes on the fly. - Greg Hainsworth [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-02-2008, 17:12
billbo911's Avatar
billbo911 billbo911 is offline
I prefer you give a perfect effort.
AKA: That's "Mr. Bill"
FRC #2073 (EagleForce)
Team Role: Mentor
 
Join Date: Mar 2005
Rookie Year: 2005
Location: Elk Grove, Ca.
Posts: 2,356
billbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond repute
MPLAB 8.0 error "Can not fit section"

I am getting the following error when compiling some code:

Code:
MPLINK 4.1 Linker
Copywrite...
Error - section '.udata_bob.o' can not fit section. Section ' udata_bob.o length= 0x00000158
I have a feeling it may be caused by my "bob.c" file, we do declare 3 two dimensional arrays in it. Each one is declared like this: "int name [11][5];"

Is this more than MPLAB can handle???
__________________
CalGames 2009 Autonomous Champion Award winner
Sacramento 2010 Creativity in Design winner, Sacramento 2010 Quarter finalist
2011 Sacramento Finalist, 2011 Madtown Engineering Inspiration Award.
2012 Sacramento Semi-Finals, 2012 Sacramento Innovation in Control Award, 2012 SVR Judges Award.
2012 CalGames Autonomous Challenge Award winner ($$$).
2014 2X Rockwell Automation: Innovation in Control Award (CVR and SAC). Curie Division Gracious Professionalism Award.
2014 Capital City Classic Winner AND Runner Up. Madtown Throwdown: Runner up.
2015 Innovation in Control Award, Sacramento.
2016 Chezy Champs Finalist, 2016 MTTD Finalist
  #2   Spotlight this post!  
Unread 19-02-2008, 17:37
StevenB StevenB is offline
is having FRC withdrawal symptoms.
AKA: Steven Bell
no team
Team Role: College Student
 
Join Date: May 2005
Rookie Year: 2005
Location: Stanford, CA
Posts: 412
StevenB has a reputation beyond reputeStevenB has a reputation beyond reputeStevenB has a reputation beyond reputeStevenB has a reputation beyond reputeStevenB has a reputation beyond reputeStevenB has a reputation beyond reputeStevenB has a reputation beyond reputeStevenB has a reputation beyond reputeStevenB has a reputation beyond reputeStevenB has a reputation beyond reputeStevenB has a reputation beyond repute
Re: MPLAB 8.0 error "Can not fit section"

If I remember correctly, the PIC can't have more than 256 bytes in one memory segment. 2x11x5x3 will be 330 bytes, which is too big. You'll have to use a #pragma statement to put each array into its own chunk of memory. Take a look at section 2.9 of the C18 manual.
__________________
Need a physics refresher? Want to know if that motor is big enough for your arm? A FIRST Encounter with Physics

2005-2007: Student | Team #1519, Mechanical Mayhem | Milford, NH
2008-2011: Mentor | Team #2359, RoboLobos | Edmond, OK
2014-??: Mentor | Looking for a team...
  #3   Spotlight this post!  
Unread 19-02-2008, 17:37
chrisstruttmann chrisstruttmann is offline
Registered User
FRC #0386 (Team Voltage)
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Melbourne, Florida
Posts: 18
chrisstruttmann will become famous soon enough
Send a message via AIM to chrisstruttmann
Re: MPLAB 8.0 error "Can not fit section"

386 had this problem...

our solution was changing some static variables to non-static, or making them global.

I apologize in advance for the lack of verbose response, I'm recovering from the all-nighters.
--Chris
  #4   Spotlight this post!  
Unread 19-02-2008, 17:46
billbo911's Avatar
billbo911 billbo911 is offline
I prefer you give a perfect effort.
AKA: That's "Mr. Bill"
FRC #2073 (EagleForce)
Team Role: Mentor
 
Join Date: Mar 2005
Rookie Year: 2005
Location: Elk Grove, Ca.
Posts: 2,356
billbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond repute
Re: MPLAB 8.0 error "Can not fit section"

Steve and Chris,
Thanks for the replies, I had a feeling it was something like this. I will see if I can find a different approach.

All nighters are probably why I tried something like this in the first place.
__________________
CalGames 2009 Autonomous Champion Award winner
Sacramento 2010 Creativity in Design winner, Sacramento 2010 Quarter finalist
2011 Sacramento Finalist, 2011 Madtown Engineering Inspiration Award.
2012 Sacramento Semi-Finals, 2012 Sacramento Innovation in Control Award, 2012 SVR Judges Award.
2012 CalGames Autonomous Challenge Award winner ($$$).
2014 2X Rockwell Automation: Innovation in Control Award (CVR and SAC). Curie Division Gracious Professionalism Award.
2014 Capital City Classic Winner AND Runner Up. Madtown Throwdown: Runner up.
2015 Innovation in Control Award, Sacramento.
2016 Chezy Champs Finalist, 2016 MTTD Finalist
  #5   Spotlight this post!  
Unread 19-02-2008, 23:35
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,567
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: MPLAB 8.0 error "Can not fit section"

You could also break those declarations into separate files.
  #6   Spotlight this post!  
Unread 20-02-2008, 13:55
Orborde Orborde is offline
Registered User
FRC #1747
Team Role: Mentor
 
Join Date: Apr 2004
Rookie Year: 2003
Location: Indianapolis, IN
Posts: 44
Orborde has a spectacular aura aboutOrborde has a spectacular aura about
Send a message via AIM to Orborde
Re: MPLAB 8.0 error "Can not fit section"

If your arrays are tables of constants, you can put them into the much-less-limited ROM by:
Code:
rom const int name [11][5];
  #7   Spotlight this post!  
Unread 20-02-2008, 14:08
billbo911's Avatar
billbo911 billbo911 is offline
I prefer you give a perfect effort.
AKA: That's "Mr. Bill"
FRC #2073 (EagleForce)
Team Role: Mentor
 
Join Date: Mar 2005
Rookie Year: 2005
Location: Elk Grove, Ca.
Posts: 2,356
billbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond repute
Re: MPLAB 8.0 error "Can not fit section"

Quote:
Originally Posted by Joe Ross View Post
You could also break those declarations into separate files.
That would be difficult, but not impossible. We use all three arrays in our Autonomous navigation code. It would be more of an inconvenience than anything else. I believe I found the reason we were having difficulty that made me try this approach. I had initialized an array as a LONG, but tried to dump ints into it without any indication they were ints. (In fact, I don't even know the correct way to do this, but I know it exists. ), I then called the data out without typecasting the values as ints. What I got was garbage. I re-declared the array as an int array, that should fix the original issue.

Quote:
Originally Posted by Orborde View Post
If your arrays are tables of constants, you can put them into the much-less-limited ROM by:
Code:
rom const int name [11][5];
I thought of this, but I am not comfortable enough in it's use to do this without building and loading it to test. (The bot is shipped now.)

Thanks to both for your input. These are both techniques I/we should master in the off season. Thanks for adding to our list of things to learn!!!
__________________
CalGames 2009 Autonomous Champion Award winner
Sacramento 2010 Creativity in Design winner, Sacramento 2010 Quarter finalist
2011 Sacramento Finalist, 2011 Madtown Engineering Inspiration Award.
2012 Sacramento Semi-Finals, 2012 Sacramento Innovation in Control Award, 2012 SVR Judges Award.
2012 CalGames Autonomous Challenge Award winner ($$$).
2014 2X Rockwell Automation: Innovation in Control Award (CVR and SAC). Curie Division Gracious Professionalism Award.
2014 Capital City Classic Winner AND Runner Up. Madtown Throwdown: Runner up.
2015 Innovation in Control Award, Sacramento.
2016 Chezy Champs Finalist, 2016 MTTD Finalist
  #8   Spotlight this post!  
Unread 20-02-2008, 15:26
dcbrown dcbrown is offline
Registered User
AKA: Bud
no team
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Hollis,NH
Posts: 236
dcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud of
Re: MPLAB 8.0 error "Can not fit section"

This is a linker default limitation. There is a method for supporting stacks > 256 as outlined in the MCC18 user guide, it involves merging multiple banks of registers. This seems to work for variable space too, but there may be limitations I'm unaware of. The code would need to be thoroughly reviewed and tested but this should work as I've seen it used on other PIC projects.

In the linker file, change:
Code:
DATABANK   NAME=gpr6       START=0x600          END=0x6FF
DATABANK   NAME=gpr7       START=0x700          END=0x7FF

to 

DATABANK   NAME=gpr6       START=0x600          END=0x7FF
//DATABANK   NAME=gpr7       START=0x700          END=0x7FF
This merges two banks into one available segment. There are run-time costs associated with doing this so it isn't recommended practice.

I built three int [11][5] arrays and got the same linker error. Then I merged the banks and did it again and it will link. I poked at some of the arrays with C code and looked at the machine code -- it looks correct.

Code:
int vars1[11][5];
int vars2[11][5];
int vars3[11][5];
void testtest1( void )
{
static int var;
static int *ptr;
static int row,col;

    var = vars1[4][3];
    var = vars2[8][4];
376:                   var = vars3[3][1];
 05762    C6FF     MOVFF 0x6ff, 0x74d
 05764    F74D     NOP
 05766    C700     MOVFF 0x700, 0x74e
 05768    F74E     NOP
377:                   var = vars3[3][2];
 0576A    C701     MOVFF 0x701, 0x74d
 0576C    F74D     NOP
 0576E    C702     MOVFF 0x702, 0x74e
 05770    F74E     NOP

    var = vars3[6][2];
    for (row=0; row<11; row++)
        for (col=0; col<5; col++)
            var = vars2[row][col];
    ptr = &vars3[0][0];
    var = *ptr++;
}
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
complie error can not fit the section. Section xxxx Doug Leppard Programming 5 12-02-2008 09:44
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


All times are GMT -5. The time now is 00:57.

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