Set function to specific address in PIC18F with the HI-TECH C compiler

chi-tech-compilermplabxpic

I want to put a function in an specific address of memory like PIC C Compiler (#org).
I'm using MPLAB X, HI-TECH compiler and PIC18F4550.

In PIC C compiler:

#org 0x1000, 0x2000
void MyFunction()
{
}

//In other part of code I'll use: asm("goto 0x1000");

How to do this in MPLAB X with the HI-TECH compiler?

Best Answer

IIRC, you can set a function to an absolute address by using the "@" qualifier:

void MyFunction() @ 0x2A0
{
    ...
}

So the function MyFunction will be placed at address 0x2A0 in Program Memory.