|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
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 Any help would be appreciated! |
|
#2
|
||||
|
||||
|
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
|
||||
|
||||
|
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
|
||||
|
||||
|
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
|
|||
|
|||
|
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; |
|
#6
|
|||||
|
|||||
|
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. |
|
#7
|
||||
|
||||
|
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
|
|||||
|
|||||
|
Re: MATH_DATA can not fit the section
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.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
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 |