Linking Errors: "section '????' can not fit the section. ..."

I keep on getting an error when ever I compile.


MPLINK 3.90, Linker
Copyright © 2004 Microchip Technology Inc.
Error - section ‘.code_fxd3232u.o’ can not fit the section. Section ‘{SECTION}’ length=0x00000048
Errors : 1

{SECTION} has been different things at various times:

  • ASM_LIB
  • .code_fxd3232u.o
  • A few others I can’t remember currently…

The current section is .code_fxd3232u.o, but that’s a math library I’ve never even touched! (.\mcc18\src raditional\math\fxd3232u.c, which is “Unsigned Integer Division: 32-bit by 32-bit”) All I know is that for those that I checked, they were all really short routines with inline ASM that I hadn’t messed with. If I turn off DDT, it still doesn’t work.

That’s usually what you see when you overflow your Program Space. You run out of space and it can’t fit in some of the later stuff like the libraries.
Check your .map file. The maximum you can get is about 90% of total program space.

For a quick test you can turn on the optimizers if you haven’t already and it should fit in (for now anyways).

Yeah, that’s it.

All the stuff that fits goes to 7FF0h. With the next section, it goes to 8038h (The PIC18F8520 has 8000h bytes of program memory).

So I guess the next step is to figure out how to cut down on space. (The libraries are so freakin’ huge!) My biggest file is PID.c, at 1334h. Fun.

That’s why the thread on how easy everything was now made me laugh.