I am working with Invensense IMU3000 and a PIC18 microcontroller. I am migrating a library, written in MSVS2005, to MPLAB, doing the proper modifications to run on it.. the code itself provides just warnings, but when it comes to linking, I get this:

Error - section '.idata_dmpDefault.o' can not fit the section. Section '.idata_dmpDefault.o' length=0x000004b0

What does it mean?

  • \$\begingroup\$ I cannot give a really solid answer yet, but there is a section defined in your code that data/variables/code is going into(probably variables) that is not defined as a large enough section in the linker. \$\endgroup\$
    – Kortuk
    Dec 21, 2010 at 16:57
  • \$\begingroup\$ What PIC18 are you using? Does it have enough RAM for your application? Which compiler/assembler are you using for your code? \$\endgroup\$
    – mjh2007
    Dec 21, 2010 at 20:08
  • \$\begingroup\$ @Stefano: What does your VS library do? The chip you mention only communicates with I2C, and the only way I could imagine VS having any direct access to it (or one like it) would be via SMBus (the chip would be on your motherboard). Does the VS library communicate with the ARM dev board? \$\endgroup\$
    – Nick T
    Dec 21, 2010 at 21:04
  • \$\begingroup\$ @mjh2007 I just have 2K, that's the problem I suppose.. I will try to reduce the need of it.. \$\endgroup\$
    – stef
    Dec 22, 2010 at 9:25
  • \$\begingroup\$ @Nick T The library provided by Invensense communicates via the ARM board with the chip. I am modifing it to be used on the the PIC18. The I2C communication is just the bottom layer, then there is all the register setting and DMP (Dynamic Motion Processor) settings and use (you cannot use without this library, stright register use is not provided in the datasheet). Basically, there's a whole processor embedded into the IMU which must the controlled, and from this comes the huge RAM need. \$\endgroup\$
    – stef
    Dec 22, 2010 at 9:29

4 Answers 4


All the variables in the program take space, and you're using too much for the chip you're trying to compile it for. The program you're trying to compile needs 0x4B0 bytes (1200 in decimal), and you have something less than this.

Figure out how much RAM space your PIC18 has. Make sure it matches what you're compiling against. There's possibly a linker definition file someplace defining the sizes of the various sections. Section IDATA is your current problem.

Someone more familiar with MPLAB may be able to fill in details on what your actual constraints are and how to properly configure the compiler for your chip.


Reading FAQ-8 and FAQ-10 In the Microchip C18 Compiler Getting Started Guide should help you resolve the issues. I'm not sure if you are using C18 or not to compile your code, but even if you aren't you will likely need to modify your linker script to increase the RAM bank size.


You are either

(A) running out of flash memory to store the initial values of variables, or
(B) your variables are bigger than the segment.

The linker is trying to link the dmpDefault file but it overflows the linker's defined memory segments.


With MCC18, each file creates 1 data section with a maximum of 256 bytes (1 bank). .idata_dmpDefault is much larger than that. You can create named data sections by combining banks in the linker and put #pragmas around the variables to locate those variables in that section.


Thank you all for your kind help!

Maybe a part of the solution can be of general help: I found out I had large constant arrays (I hadn't written the code myself..) and I drastically reduced the RAM need by putting them into Flash instad of RAM by using the "rom" keyword in their declaration.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.