12.4.2 Importing an MPLAB IDE v8 Project – Modified Linker Scripts

If you have modified your MPLAB IDE v8 project linker script so that it includes an object file, the linker will be unable to find the file when it is imported into MPLAB X IDE, because the build paths for MPLAB IDE v8 and MPLAB X IDE are different.

So you may see an error like:

<install path>ld.exe: cannot find file.o

since in MPLAB IDE v8 all build-related files are in one directory, whereas in MPLAB X IDE build files are in different subdirectories.

You can edit your linker script to work with MPLAB X IDE by using wild cards. For example, change:

/* Global-namespace object initialization - MPLAB v8*/
.init   :
{
KEEP (crti.o(.init))
:
} >kseg0_program_mem

to:

/* Global-namespace object initialization - MPLAB X*/
.init   :
{
KEEP (*crti.o(.init))
:
} >kseg0_program_mem

Alternatively, you can use an address attribute that allows you to place functions in C code.

int __attribute__((address(0x9D001000))) myfunction (void) {}

This allows you to place a function at an address without modifying the default linker script.