Log in

View Full Version : complie error can not fit the section. Section xxxx


Doug Leppard
11-02-2008, 15:23
The error is:
.code__UF8.O' can not fit the section. Section '.code__UF8.O' length=0x0000005e

Reading through the forums it looks like it is a memory error. I cleaned things up. Largest array is three 10 array int. I do use float with trig math only a few variables.

I went back to code that compiled a few days ago and it has as similar compile error but might be in a different function.

Chaos in a Can
11-02-2008, 16:03
If any of your arrays are constant, try putting them in rom.
The C18 User's Guide (http://www.kevin.org/frc/C18_2.4_users_guide.pdf) shows how to do this in section 2.4.3
Basically, you use it like you would use "const", but any pointers to rom data must also be specified as rom pointers.

If you can't stick anything in rom, you can avoid using floats and trig functions by approximating them with integers. You would probably have to approximate the trig functions with lookup tables, which can be placed in rom as well.

dcbrown
11-02-2008, 16:03
How much program code & romdata do you have!?

Look at the partial map file that was generated.



CODEPAGES:
Memory Start End Section Address Size(Bytes)
--------- --------- --------- --------- --------- ---------
page 0x0800 0xffff _entry_scn 0x0800 0x0006
InterruptVectorHigh 0x0808 0x0006
InterruptVectorLow 0x0818 0x0006
.cinit 0x081e 0x00b6
.romdata_drv_Interrupts.o 0x08d4 0x7700

Look for large sections of code/romdata in the size/bytes column. Essentially the linker says you are out of rom space for program instructions (since this is a .code section).

Not generating a map file? Project->Build options->Project, MPLINK Linker tab, check "Generate map file", Apply, OK, Project->Clean, Project->Build All.

ericand
11-02-2008, 18:31
When we saw a similar problem, we also had some floating point code that seemed to be contributing. The code was doing a bunch of floating point calculations, and then casting the result back to a double. I think that generated a lot of compiler generated temporary floating point variables that filled up a .udata section.

We are still trying to figure out what went wrong, since it looks like there should have been enough room if the addressing went to another section, but it didn't (couldn't?).

Check out the mplink manual from Microchip. (Assembler/Linker/Librarian User's Guide). http://ww1.microchip.com/downloads/en/DeviceDoc/33014J.pdf

Doug Leppard
12-02-2008, 05:50
Turns out my error was nothing related to the issues.

I had programmed a VEX and then went back to FRC. In the process I had not realized it set the processor back to the 2004 RC. Once that changed the problems went away.

dcbrown
12-02-2008, 09:44
The issue was the linker ran out program rom space as the message indicated. The reason was not large amounts of code or big rom tables but because the processor selected in the project file (the 2004/2005 PIC was the PIC18F8520 w/32kb of program space) has very little program space as compared to the current PIC18F8722 which has 128kb program space -- a lot more.