Confusing Compiler Error

I’m sure this is simply due to inexperience, but I’m stuck!

MPLINK 3.40, Linker
Copyright © 2003 Microchip Technology Inc.
Error - section ‘.udata_user_routines.o’ can not fit the section. Section ‘.udata_user_routines.o’ length=0x00001f4e
Errors : 1

BUILD FAILED: Wed Oct 27 16:48:17 2004

What is wrong here? This isn’t from a specific line of code (no line number). Is this the error received when you exceed your memory allocation?

Thank you!

As far as I can tell from the C18 manual available from microchip, you are correct, you have exceeded the allowable size for the udata section which stores “udata – contains statically allocated uninitialized user variables.” (Too many static (includes global) uninitialized (not given a value on declaration) variables in your user_routines.c/h files?). Read section 2.9.1 for more information about sections.

I’ll backup Max on this one.

Although, it isn’t due to your using up all of the available data space. The common reason for this (note the “.udata”) is that a data block is limited to 256 bytes. The total for global variables declared within a single MPLAB project file (e.g., user_routines.c/.h) cannot exceed 256 bytes. Use of “static” not withstanding.
It’s a byproduct of how the linker allocates the available 256 byte blocks of data space.

P.S. Care to test what the declaration limit is per routine within a project file?
It’s not 256.:slight_smile: