EmbeddedRelated.com
Forums

Please help with "cannot fit the section" error.

Started by Basic Poke May 16, 2008
I am getting the following error in MPLAB 8.10. Any idea what's going
on? I don't even see any uninitialized variables in Main.c.

MPLINK 4.20, Linker
Copyright (c) 2008 Microchip Technology Inc.
Error - section '.udata_Main.o' can not fit the section.
Section '.udata_Main.o' length=0x00000648
Errors : 1

Thanks
BasicPoke
> I am getting the following error in MPLAB 8.10. Any idea what's going
> on? I don't even see any uninitialized variables in Main.c.
>
> MPLINK 4.20, Linker
> Copyright (c) 2008 Microchip Technology Inc.
> Error - section '.udata_Main.o' can not fit the section.
> Section '.udata_Main.o' length=0x00000648
> Errors : 1

This is my NUMBER ONE grouch with PIC's, the banked data sections. What
this error means is that you have either defined more variables than you
have data space for or that you have a struct or array that is too big
to fit into a randomly selected data section which may have other stuff
in it. Each data section in a PIC is 256 bytes, so any structure larger
than that will require you to play games with the linker to combine
blocks and you will need to use #pragma commands to assign those bigger
structures to that section. I have found that if you just have a large
structure that is less than or equal to 256 bytes that you can do this:

#pragma udata commandparsebuffer //holds the serial command to be parsed
char commandBuf[256];
#pragma udata

This will cause the C18 compiler to assign this and ONLY this to its own
256 data section.

have fun,
DLC

> Thanks
> BasicPoke
>
>
> to unsubscribe, go to http://www.yahoogroups.com and follow the
> instructions