Link Step Failed in MPLAB using P18F4550

Thread Starter

corsair

Joined Mar 6, 2010
51
I'm new to PIC microcontrollers and this is one thing that has been haunting me for a while. I don't understand the cause of this "Link Step Failed" problem.

I am using the P18F4550 uC, which is wired to a 4-digit, 7-seg display and some switches. This is for a school project.

The error I am getting after I try to build is as follows:
Error - file './mows.o', section 'APP_main', Symbol 'main' out of range of relative branch instruction.
Errors : 1

Link step failed.
Here is my code from APP_Reset to main:
Rich (BB code):
APP_Reset code 0x1000
		goto	main	

APP_main code 0x102A	

main:
This is inside of my "18F4550.lkr" file:
Rich (BB code):
CODEPAGE   NAME=vectors    START=0x0            END=0x29           PROTECTED
//CODEPAGE   NAME=page       START=0x2A           END=0x7FFF
CODEPAGE   NAME=page       START=0x1000           END=0x8FFFF
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
I've even commented out most of my code, I just don't know what the cause of this problem is. Any help would be much appreciated, and if more information is needed I would be glad to provide it.
 

Thread Starter

corsair

Joined Mar 6, 2010
51
I observed a fault.

I tried uncommenting my code little by little, and I was able to recover a lot of it. However, when I recover too much, it'll give me the link step failed error- so am I just running out of memory? Is there a way to change this in the linker?
 

Thread Starter

corsair

Joined Mar 6, 2010
51
just in case anyone needs the solution, here it is:

Recall that relative branch instructions can only travel +/- some displacement from the current location -- you need to use absolute jump instructions such as call or goto, which can go anywhere in the entire address space of the processor.
 
Top