2005/06/09 01:33:23
kerryb
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
2005/06/09 01:47:45
Deenayd
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.
2005/06/09 20:12:51
DEKTRON
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.
2005/06/10 11:01:14
wunger
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
2005/06/10 19:17:19
kerryb
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.
2005/09/23 10:05:01
KajitaJ2
Also see these related threads.
2006/02/15 13:56:00
Guest
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,
2006/03/16 15:26:17
Guest
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
2006/12/01 00:34:55
GregToombs
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.
2006/12/11 18:13:38
cscotthendry
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
© 2021 APG vNext Commercial Version 4.5

Use My Existing Forum Account