This error occurs when the program is too big to fit in the memory you
specified in memory.x. I don't have your memory.x so
I can't tell what
is your limit but in the following example:
page0 (rwx) : ORIGIN = 0x0, LENGTH = 256
/* Board with 32K ROM. */
text (rx) : ORIGIN = 0x8000, LENGTH = 0x8000
/* And 32K RAM. */
data : ORIGIN = 0x1040, LENGTH = 0x8000-0x1040
the program memory is limited by the text region which is 32Kb.
This can happen if you try to link with too many files (whose total
exceeds your text region size). It is often the case if
you use the Newlib or use floating
point operations. The -mshort and -fshort-double may
help in reducing that
but in many cases this is not enough.
The printf() which comes with Newlib is pretty big and as far as I'm concerned
I prefer not to use it. However, it is useful for gcc validation.
- Try compiling with -mshort -fshort-double -Os
- Consider using linker relaxation with -mrelax
- Try using garbage collection of sections
- Avoid using Newlib and printf