[FAQ]MPLINK error: section '<sectionname>' can not fit the absolute section

Page: 12 > Showing page 1 of 2
Post
kerryb
New Member
2005/06/09 01:33:23
I installed MPLAB IDE v7.11 and I am working through the Basic Tutorial in the MPLAB IDE Quick Start Guide DS51281D. I successfully used the Project Wizard to create a project around the 18F452 as shown in the Quick Start Guide.
I then attempted to use the Project Wizard to create a project based around the 16F84A. The build failed, and here is the resultant report.

Clean: Deleting intermediary and output files.
Clean: Done.
Executing: "C:\Program Files\Microchip\MPASM Suite\MPAsmWin.exe" /q /p16F84A "f84atmpo.asm" /l"f84atmpo.lst" /e"f84atmpo.err" /o"f84atmpo.o"
Executing: "C:\Program Files\Microchip\MPASM Suite\MPLink.exe" "16f84a.lkr" "D:\Kerrys\Microchip Projects\f84atmpo.o" /o"T1 16F84A.cof"
MPLINK 3.93, Linker
Copyright (c) 2005 Microchip Technology Inc.
Error - section 'INT_VECTOR' can not fit the absolute section. Section 'INT_VECTOR' start=0x00000004, length=0x00000010
Errors : 1
BUILD FAILED: Mon Jun 06 14:59:42 2005


What must I do to get a successful build?

TIA
post edited by JasonK - 2011/02/08 19:22:58
Deenayd
Super Member
RE: MPLINK error: section '&lt;sectionname&gt;' can not fit the absolute section 2005/06/09 01:47:45
Well, I'd say error message you've got says very much about the problem: Section INT_VECTOR can't fit at address 0x0004. It is supposed to take 0x0010 bytes (or words - check with the documentation).

Take a look at generated map file to check what's occupying those locations and decide which section should be placed where it is now, and which one should be moved.

Note: PIC18F's interrupt vector is 0x0008, not 0x0004. I think you should check if you're properly selecting processors. It looks like you're using a template designed for PIC16F84.
DEKTRON
Super Member
RE: MPLINK error: section '&lt;sectionname&gt;' can not fit the absolute section 2005/06/09 20:12:51
Maybe also check to see if the .asm source file is ABSOLUTE (that is if it includes an org statement and absolute addresses), if so you should remove the .lkr linker script from the project. The linker is only needed when assembling RELOCATABLE code, or a project with more than one source file. -Phil.
wunger
New Member
RE: MPLINK error: section '&lt;sectionname&gt;' can not fit the absolute section 2005/06/10 11:01:14
Hello:

The solution is that you have to modify the linker file.

If there is a vector IRQ, the prog. counter will jump tp some location in prog. memory, say 0X04. But if you're not using interrupts you will have to modify the start address in the linker file.

For an example, check out the file 16f684tempo.asm. There is an example of how to modify the linker.

Also you maybe able to leave out the linker if you plan to use only 1 asm file.

Good Luck
kerryb
New Member
RE: MPLINK error: section '&lt;sectionname&gt;' can not fit the absolute section 2005/06/10 19:17:19
Build succeeded.

I found the solution in the new MPASM MPLINK MPLIB User's Guide DS33014H page 199 to 201. It was necessary to modify the 16f84a.lkr file thus:-

//CODEPAGE NAME=vectors START=0x0 END=0x4 PROTECTED
CODEPAGE NAME=vectors START=0x0 END=0x1F PROTECTED
//CODEPAGE NAME=page START=0x5 END=0x3FF
CODEPAGE NAME=page START=0x20 END=0x3FF

I don,t need to use relocatable code but I was interested to find out why the build failed.

Thank you all for your help and taking the time to reply.
KajitaJ2
Administrator
RE: MPLINK error: section '&lt;sectionname&gt;' can not fit the absolute section 2005/09/23 10:05:01
Also see these related threads.
post edited by JasonK - 2009/03/12 11:31:26
Guest
Super Member
RE: MPLINK error: section '&lt;sectionname&gt;' can not fit the absolute section 2006/02/15 13:56:00
Funny,
I just had this error today and could not find an easy google answer.  But, after a few tear jerking moments, I realized the IDE gives you a way to check your work.
 
Before I got something like this:
 
   MPLINK 3.94, Linker
   Copyright (c) 2005 Microchip Technology Inc.
   Error - section '.org_1' can not fit the absolute section. Section '.org_1' start=0x00000004, length=0x00000004
   Errors    : 1
 
Then, assemble each file individually, and you might  find that some of the microchip files had the "END" command commented out.
 
This is what I have now :)
   MPLINK 3.94, Linker
   Copyright (c) 2005 Microchip Technology Inc.
   Errors    : 0
   MP2COD 3.94, COFF to COD File Converter
   Copyright (c) 2005 Microchip Technology Inc.
   Errors    : 0
   MP2HEX 3.94, COFF to HEX File Converter
   Copyright (c) 2005 Microchip Technology Inc.
   Errors    : 0
 
Hope this helps someone,
Guest
Super Member
RE: MPLINK error: section '&lt;sectionname&gt;' can not fit the absolute section 2006/03/16 15:26:17
I get the same error message as kerryb in his original post.

I applied his fix as described in post#4. That worked until more code lines were added. When the number of code lines exceeded 20 the build failed again with the same error message. Huh ??? What gives? Does the code space start point need to be pushed further down as more lines are added? Won't that eventually reduce program capacity?

rivers
post edited by rivers - 2006/03/22 12:50:02
GregToombs
Starting Member
RE: MPLINK error: section '&lt;sectionname&gt;' can not fit the absolute section 2006/12/01 00:34:55
rivers cites an obvious irritation with the solution from the user's guide. As your interrupt section grows, you'll need to continually modify the end of the interrupt section address in the .lkr. It's also not ideal, in that there will often be some gap of wasted addresses between the end of your interrupt code and the beginning of the next section (unless you modify it to fit every single time you change your code, which would be tedious).

An alternate solution is:


(in your .lkr)

// (...)

// Code pages.

CODEPAGE    NAME=cod_reset        START=0x0000    END=0x0003    PROTECTED
CODEPAGE    NAME=cod_page0_int    START=0x0004    END=0x07FF
CODEPAGE    NAME=cod_page1        START=0x0800    END=0x0FFF
CODEPAGE    NAME=cod_page2        START=0x1000    END=0x17FF
CODEPAGE    NAME=cod_page3        START=0x1800    END=0x1FFF

// Code page sections.

SECTION     NAME=cods_reset       ROM=cod_reset
SECTION     NAME=cods_page0_int   ROM=cod_page0_int
SECTION     NAME=cods_page1       ROM=cod_page1
SECTION     NAME=cods_page2       ROM=cod_page2
SECTION     NAME=cods_page3       ROM=cod_page3


(in your .asm)

cods_reset code
    goto codl_boot

cods_page0_int code
    ; (lots of interrupt code...)
    retfie

cods_boot code
codl_boot:
    ; (the rest of your boot code...)


As long as you make sure to put your interrupt code at the beginning of the page 0/interrupt section, the linker will happily accomodate an interrupt section of any size, and will shove other code around as necessary.
cscotthendry
Super Member
RE: MPLINK error: section '&lt;sectionname&gt;' can not fit the absolute section 2006/12/11 18:13:38
Hi:

I have the same (or similar) problem to what this discussion is about but can't seem to resolve it. Here's the relevant snippets


Here's the section name in the code
CANLib  CODE
;****************************************************************************
;* Function:            void CANPrTxInit(BYTE SJW,
;............code generated by maestro continues from here

Here's the section defined in the linker script
CODEPAGE   NAME=vectors    START=0x0            END=0x1A           PROTECTED
CODEPAGE   NAME=page       START=0x1D           END=0x3FF    
CODEPAGE   NAME=LibCode    START=0x400  END=0x3FFF    PROTECTED
CODEPAGE   NAME=idlocs     START=0x200000       END=0x200007       PROTECTED
CODEPAGE   NAME=config     START=0x300000       END=0x30000D       PROTECTED
CODEPAGE   NAME=devid      START=0x3FFFFE       END=0x3FFFFF       PROTECTED
CODEPAGE   NAME=eedata     START=0xF00000       END=0xF000FF       PROTECTED
SECTION    NAME=CANLib     ROM=LibCode

here's the error I get when I try to assemble

MPLINK 4.03, Linker
Copyright (c) 2006 Microchip Technology Inc.
Error - section 'CANLIB' can not fit the section. Section 'CANLIB' length=0x0000079e
Errors    : 1
BUILD FAILED: Tue Dec 12 11:02:33 2006



What the?[:@]

When I look at the disassembly listing, the CANLib code has been assembled starting at address 0x20 instead of 0x400 like I thought it should. Obviously, that is why the linker is complaining, but why is my code assembled at the wrong address? Do I have to explicitly ORG it as well as section it?
Heeeeeelp!


Cracked It![8D]
For anyone who is interested, It seems that the linker is VERY case sensitive. The offending code is

SECTION    NAME=CANLib     ROM=LibCode

If it is changed to

SECTION    NAME=CANLIB     ROM=LibCode

It works! Couldn't find anything about case sensitivity in the MPLINK manual though[:@]
 
A final edit so everyone knows: When case sensitivity is disabled for MPASM through MPLAB, the assembler uppercases the section names. Then when the linker picks up the object module, it tries to match the name in the module to the names specified in the linker script case sensitively. In my situation "CANLIB" from the object module, did not match "CANLib" in the linker script.
 
So now you knowgrin
 
Moral of the story is: If you set the assembler to ignore case, you may run afoul of the linker if you're not careful with your typing
post edited by cscotthendry - 2006/12/12 16:29:38
microchip_ramya
New Member
RE: MPLINK error: section '&lt;sectionname&gt;' can not fit the absolute section 2006/12/28 15:45:48
I am getting similar error for 18f452.
Error - section '.org_0' can not fit the absolute section. Section '.org_0' start=0x00000008, length=0x00000110
Errors    : 1
May I know the reason for it.
 
Linker file looks like this.
 
LIBPATH  .
CODEPAGE   NAME=vectors  START=0x0        END=0x29       PROTECTED
CODEPAGE   NAME=page     START=0x2A       END=0x7DBF
CODEPAGE   NAME=debug  START=0x7DC0     END=0X7FFF     PROTECTED
CODEPAGE   NAME=idlocs   START=0x200000   END=0x200007   PROTECTED
CODEPAGE   NAME=config   START=0x300000   END=0x30000D   PROTECTED
CODEPAGE   NAME=devid    START=0x3FFFFE   END=0x3FFFFF   PROTECTED
CODEPAGE   NAME=eedata   START=0xF00000   END=0xF000FF   PROTECTED
ACCESSBANK  NAME=accessram  START=0x0      END=0x7F
DATABANK    NAME=gpr0       START=0x80     END=0xFF
DATABANK    NAME=gpr1       START=0x100    END=0x1FF
DATABANK    NAME=gpr2       START=0x200    END=0x2FF
DATABANK    NAME=gpr3       START=0x300    END=0x3FF
DATABANK    NAME=gpr4       START=0x400    END=0x4FF
DATABANK    NAME=gpr5       START=0x500    END=0x5F3
DATABANK    NAME=dbgspr     START=0x5F4    END=0x5FF    PROTECTED
ACCESSBANK  NAME=accesssfr  START=0xF80    END=0xFFF    PROTECTED
SECTION     NAME=STARTUP    ROM=vectors
SECTION     NAME=PROG1      ROM=page

 
 
ORIGINAL: brian_in_allen

Funny,
I just had this error today and could not find an easy google answer.  But, after a few tear jerking moments, I realized the IDE gives you a way to check your work.

Before I got something like this:

  MPLINK 3.94, Linker
  Copyright (c) 2005 Microchip Technology Inc.
  Error - section '.org_1' can not fit the absolute section. Section '.org_1' start=0x00000004, length=0x00000004
  Errors    : 1

Then, assemble each file individually, and you might  find that some of the microchip files had the "END" command commented out.

This is what I have now :)
  MPLINK 3.94, Linker
  Copyright (c) 2005 Microchip Technology Inc.
  Errors    : 0
  MP2COD 3.94, COFF to COD File Converter
  Copyright (c) 2005 Microchip Technology Inc.
  Errors    : 0
  MP2HEX 3.94, COFF to HEX File Converter
  Copyright (c) 2005 Microchip Technology Inc.
  Errors    : 0

Hope this helps someone,

kk90
New Member
RE: MPLINK error: section '&lt;sectionname&gt;' can not fit the absolute section 2007/02/09 07:37:48
hey guys i need help!! i'm using the ZigBee Stack from microchip for pic18f4620 microcontroller. i'm trying to compile the TempDemoCoord Code which comes with the stack but getting this error. i dont know the reason why i'm getting this. can anyone help me please?
 
Executing: "C:\MCC18\bin\mplink.exe" /l"C:\MCC18\lib" "F:\TempDemoCoord\zLink.lkr" "F:\TempDemoCoord\Console.o" "F:\TempDemoCoord\MSPI.o" "F:\TempDemoCoord\sralloc.o" "F:\TempDemoCoord\SymbolTime.o" "F:\TempDemoCoord\zAPS.o" "F:\TempDemoCoord\ZigbeeTasks.o" "F:\TempDemoCoord\zMAC_CC2420.o" "F:\TempDemoCoord\zNVM.o" "F:\TempDemoCoord\zNWK.o" "F:\TempDemoCoord\zPHY_CC2420.o" "F:\TempDemoCoord\zZDO.o" "F:\TempDemoCoord\myZigBee.o" "F:\TempDemoCoord\TempDemoCoord.o" /o"TempDemoCoord.cof" /M"TempDemoCoord.map"
MPLINK 4.02, Linker
Copyright (c) 2006 Microchip Technology Inc.
Error - section '.code_TempDemoCoord.o' can not fit the section. Section '.code_TempDemoCoord.o' length=0x0000074c
Errors    : 1
 
please help me someone...
Thanks,
Kav
eriklidgren
Super Member
RE: MPLINK error: section '&lt;sectionname&gt;' can not fit the absolute section 2007/02/09 07:52:39
You are out of program memory. Have you enabled procedural abstraction optimization? I don't think that it will fit otherwise.
antoonio
Starting Member
RE: MPLINK error: section '&lt;sectionname&gt;' can not fit the absolute section 2007/02/15 03:16:27
I had the same problem - there is mistake with the linker , just use   ORG 0X05   for interrupt section  , because if you use ORG 0X04  - that starts the section on addr 0X04 and that's the end - you can't place any code :)
antoonio
Starting Member
RE: MPLINK error: section '&lt;sectionname&gt;' can not fit the absolute section 2007/02/15 03:20:42
or the alternate solution is to change  

CODEPAGE    NAME=cod_reset        START=0x0000    END=0x0004    PROTECTED

to

CODEPAGE    NAME=cod_reset        START=0x0000    END=0x0003    PROTECTED

in .lkr - file
RSABear
New Member
RE: MPLINK error: section '&lt;sectionname&gt;' can not fit the absolute section 2007/09/06 05:31:52
Hello, I also have a MPLINK problem I can't resolve. Reading the manual and these posts indicates I have to edit the linker file, but I don't know where to start. Your help will be much appreciated. The source file is "SUPMP.ASM" for Luhan Monat's Super Probe 16 on http://mondo-technology.com/ 

- '.org_2' has got me?!? The only changes I ever had to make to a linker file was to accomodate the ISR.

The LINKER message is as follows:
MPLINK 4.06, Linker
Copyright (c) 2006 Microchip Technology Inc.
Error - section '.org_2' can not fit the absolute section. Section '.org_2' start=0x00000004, length=0x00000c1a
Errors    : 1

and the 16f870.lkr file is:

// Sample linker command file for 16F870
// $Id: 16f870.lkr,v 1.5.16.1 2005/11/30 15:15:29 curtiss Exp $
LIBPATH  .
CODEPAGE   NAME=vectors  START=0x0      END=0x4      PROTECTED
CODEPAGE   NAME=page0    START=0x5      END=0x7FF
CODEPAGE   NAME=.idlocs  START=0x2000   END=0x2003   PROTECTED
CODEPAGE   NAME=.config  START=0x2007   END=0x2007   PROTECTED
CODEPAGE   NAME=eedata   START=0x2100   END=0x213F   PROTECTED
DATABANK   NAME=sfr0     START=0x0      END=0x1F     PROTECTED
DATABANK   NAME=sfr1     START=0x80     END=0x9F     PROTECTED
DATABANK   NAME=sfr2     START=0x100    END=0x10F    PROTECTED
DATABANK   NAME=sfr3     START=0x180    END=0x18F    PROTECTED
SHAREBANK   NAME=gprnobnk0     START=0x20     END=0x6F
SHAREBANK   NAME=gprnobnk0     START=0x120    END=0x16F
SHAREBANK   NAME=gprnobnk1     START=0xA0     END=0xBF
SHAREBANK   NAME=gprnobnk1     START=0x1A0    END=0x1BF
SHAREBANK  NAME=gprnobnk2 START=0x70     END=0x7F
SHAREBANK  NAME=gprnobnk2 START=0xF0     END=0xFF
SHAREBANK  NAME=gprnobnk2 START=0x170    END=0x17F
SHAREBANK  NAME=gprnobnk2 START=0x1F0    END=0x1FF
SECTION    NAME=STARTUP  ROM=vectors    // Reset and interrupt vectors
SECTION    NAME=PROG1    ROM=page0      // ROM code space - page0
SECTION    NAME=IDLOCS   ROM=.idlocs    // ID locations
SECTION    NAME=DEEPROM  ROM=eedata     // Data EEPROM

Thank you in advance...
post edited by RSABear - 2007/09/06 05:34:29
Olin Lathrop
Super Member
RE: MPLINK error: section '&lt;sectionname&gt;' can not fit the absolute section 2007/09/06 07:18:04
CODEPAGE   NAME=vectors  START=0x0      END=0x4      PROTECTED
CODEPAGE   NAME=page0    START=0x5      END=0x7FF

Should be just
CODEPAGE   NAME=page0    START=0      END=0x7FF
This comes up regularly due to the brain dead standard linker files that come with MPLAB.  For a detailed discussion see http://forum.microchip.com/fb.aspx?m=229211.
RSABear
New Member
RE: MPLINK error: section '&lt;sectionname&gt;' can not fit the absolute section 2007/09/07 01:22:36
Hi Olin - your proposed change gives the following message:
 
MPLINK 4.06, Linker
Copyright (c) 2006 Microchip Technology Inc.
Error - undefined CODEPAGE 'vectors' for SECTION 'STARTUP'
Errors    : 1
 
I have also had help from the source of the code - simply remove the linker script. As the code does not use any Libraries it compiles to a HEX file. My problem solved by avoidance for this project.
 
 
DarioG
Scheisse Menschen
RE: MPLINK error: section '&lt;sectionname&gt;' can not fit the absolute section 2007/09/07 01:47:07
Not sure, but also any reference to "vectors" in the code should be removed.
RSABear
New Member
RE: MPLINK error: section '&lt;sectionname&gt;' can not fit the absolute section 2007/09/07 04:10:51
You are so correct...
 
MPLINK 4.06, Linker
Copyright (c) 2006 Microchip Technology Inc.
Errors    : 0
MP2COD 4.06, COFF to COD File Converter
Copyright (c) 2006 Microchip Technology Inc.
Errors    : 0
MP2HEX 4.06, COFF to HEX File Converter
Copyright (c) 2006 Microchip Technology Inc.
Errors    : 0
Loaded C:\Projects\Eagle\Super Probe\Code_1\Super_Probe.cof.
BUILD SUCCEEDED: Fri Sep 07 13:12:10 2007

The file for reference:
 
// Sample linker command file for 16F870
// $Id: 16f870.lkr,v 1.5.16.1 2005/11/30 15:15:29 curtiss Exp $
LIBPATH  .
//CODEPAGE   NAME=vectors  START=0x0      END=0x4      PROTECTED
//CODEPAGE   NAME=page0    START=0x5      END=0x7FF
CODEPAGE   NAME=page0    START=0      END=0x7FF
CODEPAGE   NAME=.idlocs  START=0x2000   END=0x2003   PROTECTED
CODEPAGE   NAME=.config  START=0x2007   END=0x2007   PROTECTED
CODEPAGE   NAME=eedata   START=0x2100   END=0x213F   PROTECTED
DATABANK   NAME=sfr0     START=0x0      END=0x1F     PROTECTED
DATABANK   NAME=sfr1     START=0x80     END=0x9F     PROTECTED
DATABANK   NAME=sfr2     START=0x100    END=0x10F    PROTECTED
DATABANK   NAME=sfr3     START=0x180    END=0x18F    PROTECTED
SHAREBANK   NAME=gprnobnk0     START=0x20     END=0x6F
SHAREBANK   NAME=gprnobnk0     START=0x120    END=0x16F
SHAREBANK   NAME=gprnobnk1     START=0xA0     END=0xBF
SHAREBANK   NAME=gprnobnk1     START=0x1A0    END=0x1BF
SHAREBANK  NAME=gprnobnk2 START=0x70     END=0x7F
SHAREBANK  NAME=gprnobnk2 START=0xF0     END=0xFF
SHAREBANK  NAME=gprnobnk2 START=0x170    END=0x17F
SHAREBANK  NAME=gprnobnk2 START=0x1F0    END=0x1FF
//SECTION    NAME=STARTUP  ROM=vectors    // Reset and interrupt vectors
SECTION    NAME=PROG1    ROM=page0      // ROM code space - page0
SECTION    NAME=IDLOCS   ROM=.idlocs    // ID locations
SECTION    NAME=DEEPROM  ROM=eedata     // Data EEPROM
jp_salgueiro
New Member
RE: MPLINK error: section '&lt;sectionname&gt;' can not fit the absolute section 2007/11/26 07:40:12
I had the same problem. That happened because you probably have tried to do your own project with the files provided in the folder TempDemoCoord of the Version 1.0-3.6 of Microchip Stack for the ZigBee™ Protocol instead of open a New MPLAB IDE and then open the  project TempDemoCoord.mcp doing Project>Open... . Be sure that you are not using a expired demo version of MPLAB, because of the Procedural Abstraction, I think.

João Pedro Apóstolo Salgueiro
futurX
New Member
RE: MPLINK error: section '&lt;sectionname&gt;' can not fit the absolute section 2008/05/17 23:00:59
Hi Guys
 
I've been reading a lot of the posts about this issue...and unfortunately for me none of the suggestions to fix it have worked with my code....
 
Here is the message I'm getting
 
MPLINK 4.14, Linker
Copyright (c) 2007 Microchip Technology Inc.
Error - section '.org_1' can not fit the absolute section. Section '.org_1' start=0x00000005, length=0x00000d2e
Errors    : 1

 
And here is the link file I have modified.
 
// Sample linker command file for 16F887
LIBPATH  .
//CODEPAGE   NAME=vectors  START=0x0      END=0x4      PROTECTED
//CODEPAGE   NAME=page0    START=0x5      END=0x7FF
CODEPAGE   NAME=page0    START=0x000 END=0x7FF
CODEPAGE   NAME=page1    START=0x800    END=0xFFF
CODEPAGE   NAME=page2    START=0x1000   END=0x17FF
CODEPAGE   NAME=page3    START=0x1800   END=0x1FFF
CODEPAGE   NAME=.idlocs  START=0x2000   END=0x2003   PROTECTED
CODEPAGE   NAME=.config  START=0x2007   END=0x2008   PROTECTED
CODEPAGE   NAME=eedata   START=0x2100   END=0x21FF   PROTECTED
DATABANK   NAME=sfr0     START=0x0      END=0x1F     PROTECTED
DATABANK   NAME=sfr1     START=0x80     END=0x9F     PROTECTED
DATABANK   NAME=sfr2     START=0x100    END=0x10F    PROTECTED
DATABANK   NAME=sfr3     START=0x180    END=0x18F    PROTECTED
DATABANK   NAME=gpr0     START=0x20     END=0x6F
DATABANK   NAME=gpr1     START=0xA0     END=0xEF
DATABANK   NAME=gpr2     START=0x110    END=0x16F
DATABANK   NAME=gpr3     START=0x190    END=0x1EF
SHAREBANK  NAME=gprnobnk START=0x70     END=0x7F
SHAREBANK  NAME=gprnobnk START=0xF0     END=0xFF
SHAREBANK  NAME=gprnobnk START=0x170    END=0x17F
SHAREBANK  NAME=gprnobnk START=0x1F0    END=0x1FF
//SECTION    NAME=STARTUP  ROM=vectors    // Reset and interrupt vectors
SECTION    NAME=PROG1    ROM=page0      // ROM code space - page0
SECTION    NAME=PROG2    ROM=page1      // ROM code space - page1
SECTION    NAME=PROG3    ROM=page2      // ROM code space - page2
SECTION    NAME=PROG4    ROM=page3      // ROM code space - page3
SECTION    NAME=IDLOCS   ROM=.idlocs    // ID locations
SECTION    NAME=DEEPROM  ROM=eedata     // Data EEPROM

With the first 2 lines commented out and Section in regards to vectors.....it still does not build?
 
Any Ideas?
dchisholm
Super Member
RE: MPLINK error: section '&lt;sectionname&gt;' can not fit the absolute section 2008/05/18 01:14:21
ORIGINAL: futurX

. . . Here is the message I'm getting

MPLINK 4.14, Linker
Copyright (c) 2007 Microchip Technology Inc.
Error - section '.org_1' can not fit the absolute section. Section '.org_1' start=0x00000005, length=0x00000d2e
Errors    : 1 . . .
It says, "You are trying to stuff 3.4 pounds into a 2 pound box.".

More specifically - you have a chunk of code that assembles to 3374 (i.e., 0x0D2E) instructions, but the largest available piece of memory in your microcontroller is only 2047 (0x07FF) instructions long.  Use a couple more "CODE" directives to break up your program into logical segments.  You can go farther, by explicitly assigning each segment to a particular section of codespace.  Whether you do this or not, remember that your program will be split between two or more codepages, so you will need to use "pagesel" directives (or manually manipulate PCLATH) when moving between them.

Dale
pau2756
New Member
RE: MPLINK error: section '&lt;sectionname&gt;' can not fit the absolute section 2008/09/12 06:27:41
Hi

I am very new to this and have just installed MPLAB IDE v8.10 and have worked through the first example.

I am a bit stuck as i get an error the same as what others in this thread are reporting.

My code is as follows

;**********************************************************************

    list      p=12F508            ; list directive to define processor
    #include <p12F508.inc>        ; processor specific variable definitions

    __CONFIG   _MCLRE_ON & _CP_OFF & _WDT_OFF & _IntRC_OSC

; '__CONFIG' directive is used to embed configuration word within .asm file.
; The lables following the directive are located in the respective .inc file.
; See respective data sheet for additional information on configuration word.




;***** VARIABLE DEFINITIONS
TEMP_VAR    UDATA
temp        RES     1             ;example variable definition





;**********************************************************************
RESET_VECTOR    CODE   0x1FF      ; processor reset vector

; Internal RC calibration value is placed at location 0x1FF by Microchip
; as a movlw k, where the k is a literal value.
   
MAIN    CODE    0x000
    movwf   OSCCAL            ; update register with factory cal value


start
    nop                       ; example code
    movlw   0xFF              ; example code
    movwf   temp              ; example code

; remaining code goes here
    org 0
    clrf GPIO                  ;all outputs = 0
   
    movlw b'11111110'
    tris GPIO                  ;lowest bit of GPIO becomes an output

    bsf GPIO,0                  ;bring GPIO bit to high

x    goto x                      ;endless loop

    END                       ; directive 'end of program'

My error is

MPLINK 4.20, Linker
Copyright (c) 2008 Microchip Technology Inc.
Error - section 'MAIN' can not fit the absolute section. Section 'MAIN' start=0x00000000, length=0x00000008
Errors    : 1

I can gather it is something to do with addresses but i do not understand what to do to resolve.

I have 12f508.lkr as my link file and 12f508tmpo.asm as my source file.


Really hope someone can help me here.

Paul.

dchisholm
Super Member
RE: MPLINK error: section '&lt;sectionname&gt;' can not fit the absolute section 2008/09/12 08:36:57
ORIGINAL: pau2756

Hi

I am very new to this and have just installed MPLAB IDE v8.10 and have worked through the first example.

I am a bit stuck as i get an error the same as what others in this thread are reporting.

 . . . .

I have 12f508.lkr as my link file and 12f508tmpo.asm as my source file.


Really hope someone can help me here.
There are several threads on the Forum where this problem, and its solution, are thoroughly discussed.

For now, change your linker file to the "12f508_g.lkr" version supplied with MPLAB 8.10 et seq.

Dale

p.s. - When posting code, please use the "code tags".
pau2756
New Member
RE: MPLINK error: section '&lt;sectionname&gt;' can not fit the absolute section 2008/09/12 08:45:34
Many thanks for the fast reply.

I have changed my lnk file to the 12f508_g.lkr and it still fails.

<%="MPLINK 4.20, Linker
Copyright (c) 2008 Microchip Technology Inc.
Error - section 'MAIN' can not fit the absolute section. Section 'MAIN' start=0x00000000, length=0x00000008
Errors : 1"%>

I am sure it is something to do with the line

<%=" org 0 "%>

as if i remove this it compiles correctly.

I hope you can help me some more.

dchisholm
Super Member
RE: MPLINK error: section '&lt;sectionname&gt;' can not fit the absolute section 2008/09/12 09:03:02
ORIGINAL: pau2756


I am sure it is something to do with the line

<%=" org 0 "%>
Yes, I see now that it does.

You are telling the linker to place two different pieces of code at the same address.  The line:
 MAIN    CODE    0x000 
directs the linker to place the following code segment (4 instructions) at address 0x0000 in codespace.

The line
   org 0 
also directs the linker to place the code that follows at the same address, 0x00.  Yes, removing the "  org 0" will solve your problem.

(I am surprised you didn't get another warning or error message, since the ORG directive shouldn't be used when assembling relocatable (i.e., linked) code.)

Dale
Olin Lathrop
Super Member
RE: MPLINK error: section '&lt;sectionname&gt;' can not fit the absolute section 2008/09/12 09:20:53
I am surprised you didn't get another warning or error message, since the ORG directive shouldn't be used when assembling relocatable (i.e., linked) code.

Unfortunately they have now made it legal.  That means you get less clear notice that there is a ORG lurking in the code somewhere.  The section name is something derived from the fixed address, so each ORG creates a new section.
 
Using ORG is just as bad as before, but now the assembler won't tell you about it.
DarioG
Scheisse Menschen
RE: MPLINK error: section '&lt;sectionname&gt;' can not fit the absolute section 2008/09/15 01:27:33
ORIGINAL: Olin Lathrop

Unfortunately they have now made it legal.  That means you get less clear notice that there is a ORG lurking in the code somewhere.  The section name is something derived from the fixed address, so each ORG creates a new section.


Hmmm, I see...
thanks for pointing this out.
nur53
Super Member
RE: MPLINK error: section '&lt;sectionname&gt;' can not fit the absolute section 2008/11/15 09:33:09
I have solved this problem using the method mentioned on page 194 of Assembler/Linker/Librarian User's Guide DS33014J ( 13.3.3 Finding the Error & 13.3.4 Fixing the Error ) .
mrmadman
New Member
RE: MPLINK error: section '&lt;sectionname&gt;' can not fit the absolute section 2008/11/19 17:02:31
Hi all
 
Just chiming in with a "me too".  Tried to Build All, got the error message, searched the message board, found this thread, deleted the LKR file, and all's well.  This is a most helpful forum.
 
Oh - just to add to the misery, I ran into the maximum pathname limit before I ran into the org_1 error message.  That was a little harder to figure out, because at first it just said file not found.  It also appears that some functions in the assembler/linker don't like white space or underscores.  So I had to watch the output folder to see what files weren't created, and noticed some truncated filenames.
 
Peace out
MADman
RogerStone
New Member
RE: MPLINK error: section '&lt;sectionname&gt;' can not fit the absolute section 2009/03/12 10:37:28
I am working through the projects with the Low Pin Count USB Development Kit. 
 
I can get all the source files to compile, but when linking them I get the following error message:-


Executing: "C:\MCC18\bin\mplink.exe" /l"C:\MCC18\lib" /k"C:\MCC18\lkr" "..\..\MCC18\lkr\18f14k50.lkr" "main.o" "usb_descriptors.o" "usb_device.o" "usb_function_cdc.o" /u_CRUNTIME /u_DEBUG /z__MPLAB_BUILD=1 /z__MPLAB_DEBUG=1 /o"C:\LPCUSBDK_Labs\Lab4_files\output\Project Lab 4.cof" /M"C:\LPCUSBDK_Labs\Lab4_files\output\Project Lab 4.map" /W

MPLINK 4.30.01, Linker
Copyright (c) 2009 Microchip Technology Inc.
Error - section '.udata_usb_function_cdc.o' can not fit the section. Section '.udata_usb_function_cdc.o' length=0x00000019
Errors    : 1 


I am stuck because the previous solutions on this and other threads seem to be applicable to Assembler and  the code provided in Development Kit is in C. I have tried not using the Linker scriptwhich did not help. There are no org statments in the .c files and so I have no way of determining where the linker is trying to put everything.
 
Any help or ideas will be much appreciated.
 
Regards Roger

JasonK
Moderator
RE: MPLINK error: section '&lt;sectionname&gt;' can not fit the absolute section 2009/03/12 11:28:05
Use #pragma udata to separate your variables into multiple sections. I believe that there is an FAQ in the C18 Getting Started Guide that should help.
RogerStone
New Member
RE: MPLINK error: section '&lt;sectionname&gt;' can not fit the absolute section 2009/03/12 16:09:24
Jason,
 
Thank
you for your suggestion.
 
As I broke it up into more sections I found the last one still would not fit in. However adding an extra section with nothing in it seems to have done the trick. I don't understand C enough to know why it worked, maybe 'nothing' can fit in anywhere.
 
Hope this helps the next person who gets stuck !
 
Regards Roger
skranish
New Member
RE: MPLINK error: section `&lt;sectionname&gt;` can not fit the absolute section 2010/01/09 00:26:35
Is there some deep-seated, secret business reason that this particular topic remains the most visited of EVERYTHING under development tools? The hopelessly vague response

"Use #pragma udata to separate your variables into multiple sections. I believe that there is an FAQ in the C18 Getting Started Guide that should help."

really is no help. Translated from Inglish, I think this says "I don't remember the details, and I can't be bothered to look it up".

WHERE is the solution to this? Which document EXACTLY? Which page EXACTLY? Why is the typical Microchip response "it is documented somewhere, you just have to hunt for it..."? How about an ACTUAL, COMPLETE EXAMPLE of the solution?

Why isn't the linker documentation installed when you install C18? Is there some deep-seated, secret business reason for keeping it separate? Why isn't the linker file COMPLETELY explained? Is there some reason for keeping so many details secret - especially when so many people run into the EXACT same problems?

The online help with MPLab/C18 isn't just bad, it is WRONG. The explanation of of this particular error says to use the -m option to create a "linker error map". I have the /m option enabled, it creates a map file that contains essentially NO information because there is... a linker error!

After numerous projects with Microchip MCUs of various flavors, I have simply had enough. I will STRONGLY recommend that we change to something else before going to production (min 50K/year, likely 250K/year), and I will never, ever again recommend using one of your MCUs.


itdontgo
Senior Member
Re:MPLINK error: section '<sectionname>' can not fit the absolute section 2011/04/17 06:07:02
I had a similar problem on one PC and not another.  I had run out of program memory due to being in DEBUG and not RELEASE.  Always worth checking.  This is the second time this problem has occured for me - I happened to know about it the second time!
AlainV
New Member
Re:MPLINK error: section '<sectionname>' can not fit the absolute section 2011/04/26 11:30:30
I have read few explaination on the error I get:
Error - section '.org_1' can not fit the absolute section. Section '.org_1' start=0x00000004, length=0x00000226

 but I am still not able to figure out why.

the lkr file I use is:
 // Sample linker command file for 16F84A
 // $Id: 16f84a.lkr,v 1.4.16.1 2005/11/30 15:15:29 curtiss Exp $
 
 LIBPATH  .
 
 CODEPAGE   NAME=vectors  START=0x0      END=0x4      PROTECTED
 CODEPAGE   NAME=page     START=0x5      END=0x3FF
 CODEPAGE   NAME=.idlocs  START=0x2000   END=0x2003   PROTECTED
 CODEPAGE   NAME=.config  START=0x2007   END=0x2007   PROTECTED
 CODEPAGE   NAME=eedata   START=0x2100   END=0x213F   PROTECTED
 
 DATABANK   NAME=sfr0     START=0x0      END=0xB      PROTECTED
 DATABANK   NAME=sfr1     START=0x80     END=0x8B     PROTECTED
 
 DATABANK   NAME=gprs     START=0xC      END=0x4F
 
 SECTION    NAME=STARTUP  ROM=vectors    // Reset and interrupt vectors
 SECTION    NAME=PROG     ROM=page       // ROM code space
 SECTION    NAME=IDLOCS   ROM=.idlocs    // ID locations
 SECTION    NAME=DEEPROM  ROM=eedata     // Data EEPROM


and the code is :

    list      p=16F84A            ; list directive to define processor
    #include <p16F84A.inc>        ; processor specific variable definitions

    __CONFIG   _CP_OFF & _WDT_OFF & _PWRTE_ON & _HS_OSC



;  VARIABLE DEFINITIONS
w_temp            equ        0X0C        ; variable used for context saving
status_temp        equ        0X0D        ; variable used for context saving

BL_INPUT        equ        0          
LF_INPUT        equ        1          
RF_INPUT        equ        2           

FLAGBLBL        equ        0          
FLAGLF            equ        1           
FLAGRF            equ        2          
FLAGHZ            equ        3      
FLAGHZB            equ        4   
FLAGTL            equ        5        

datagroup1        idata    0xc
PORTB_temp        db        0x00       
DELAY.001SEC    db        0x00       
DELAY.0001SEC    db        0x00      
delay.001sec    db        0x00      
delay.0001sec    db        0x00      
BLFLASHTIMEMSB    db        0x00      
blflashtimemsb    db        0x00       
blflashtimelsb    db        0x00       
BLFLCYCLE        db        0x00    
blflcycle        db        0x00      
BLNEVERHIGH        db        0x00       
blneverhigh        db        0x00       
BLNEVERLOW        db        0x00      
blneverlow        db        0x00      
flasheronmsb    db        0x00      
flasheronlsb    db        0x00      
HZBLON            db        0x00      
hzblon            db        0x00    
HZBLOFF            db        0x00       
hzbloff            db        0x00      
hzonmsb            db        0x00       
hzonlsb            db        0x00      
TLON            db        0x00       
tlon            db        0x00       
TLOFF            db        0x00      
tloff            db        0x00      
FLAGS            db        0x00      
;**********************************************************************
        ORG     0x000                 ; processor reset vector
        goto    Main                 ; go to beginning of program

        ORG     0x004               ; interrupt vector location
        movwf   w_temp                ; save off current W register contents
        movf    STATUS,0            ; move status register into W register
        movwf    status_temp            ; save off contents of STATUS register   
       
        ; isr code can go here or be located as a call subroutine elsewhere

        movf    status_temp,0        ; retrieve copy of STATUS register
        movwf    STATUS                ; restore pre-isr STATUS register contents
        swapf   w_temp,f
        swapf   w_temp,w            ; restore pre-isr W register contents
        retfie                        ; return from interrupt

; remaining code goes here


Main   
   
        bcf        STATUS,RP0            ; bank0
        movlw    0x0f   
        movwf    TRISA              
        bcf        STATUS,RP0            ; bank0
        clrf    PORTA
        bsf        STATUS,RP0            ; bank1
        movlw    0x00
        movwf    TRISB                ; set all pin on portB as output
        bcf        STATUS,RP0            ; bank0
        clrf    PORTB
etc...


anyone as an idea why


majic79
Starting Member
Re:MPLINK error: section '<sectionname>' can not fit the absolute section 2011/08/05 17:39:06
I don't know if this will help things at all, I've got a similar problem, but it lies with a UDATA block

I'm developing for a PIC16F882 and I've got four modules (with their own UDATA and CODE declarations) that if I leave UDATA declared as just "LIBNAME_VARS UDATA", it compiles fine. Looking at the memory map though, it puts everyting starting at A0. I'm using 39 bytes of memory and overflowing that data area - why does the compiler pick the second (smaller) databank when there's a huge area in bank0??

If I change some of the declarations to "LIBNAME_VARS UDATA 0x20" then I get some vars in bank0 and the rest in bank1, but any attempt to put all my data in bank1 leads to a

Error - section 'RTC_LIB_DATA' can not fit the absolute section. Section 'RTC_LIB_DATA' start=0x00000020, length=0x0000000b

If my file registers area starting at 0x20 is 96 bytes long (it says so in the lkr script and the datasheet) and I should be able to use that surely?!!

And for that matter, if I leave everything blank, why does it happily compile and overflow the data area at 0xA0 and not report any error?
cchma
New Member
Re:MPLINK error: section '<sectionname>' can not fit the absolute section 2012/11/24 02:55:09
I got a similar problem when I did 'Build All' within MPLab IDE V8.88, for a project which still gets built successfully in a previous version of the MPLab IDE. The error message is:
 
MPLINK 4.45, Linker
Device Database Version 1.10
Copyright (c) 1998-2011 Microchip Technology Inc.
Error - section '.org_9' can not fit the absolute section. Section '.org_9' start=0x00000004, length=0x000009ca
Errors    : 1
I don't have "org_9" anywhere in my programs, and I checked all the settings for the linker (as far as I could) and they look the same as for the previous version of the MPLab IDE.
So, this is strange. Is there a bug in MPLINK 4.45 (too)????
 
marec
Starting Member
Re:MPLINK error: section '<sectionname>' can not fit the absolute section 2015/01/25 20:35:01
If you use generic linker script, everything goes ok  if the generic script is correct. For example, the 16f84a cited in first message has a generic script which doesnt have definition for the RAM area, but brings a wrong SHAREBANK definition that doesnt exist in device. I was trying to compile a 16F630 relocatable code and found the same errors in its script. To fix the 16f84a.lkr file, change :
add this two lines: (they missing)
DATABANK   NAME=gpr0       START=0x0C              END=0x4F           
DATABANK   NAME=gpr0       START=0x8C              END=0xCF           PROTECTED
 
delete this two lines: (doesnt exist that RAM)
SHAREBANK  NAME=gpr0       START=0xC               END=0x4F           
SHAREBANK  NAME=gpr0       START=0x8C              END=0xCF          PROTECTED
 
Then everyting compiles ok. Many LKR files are wrong, I see.
It is strange that nobody saw this before... It is a shame Microchip let pass those ridiculous simple errors...
 
So, lets ask Microchip debug the LKR scripts, then relocatable code will be as easy as absolute code.
Page: 12 > Showing page 1 of 2