$VECTORS - Define reset and interrupt vectors

Language reference ›› Directives ››
Parent Previous Next

vectors-directive = $VECTORS vector-item { "," vector-item } .



This directive allows the programmer to change the vectors so that he is able to install his own start-up code (a boot-loader or any) that installs itself at $0000.


PIC18:

vector-item = ( reset-vector | int-low-vector | int-high-vector ) .


Others:

vectors-item = ( reset-vector | int-vector ) .


reset-vector = RESET "=" address-expression .
int-low-vector = INT_LOW "=" address-expression .
int-high-vector = INT_HIGH "=" address-expression .
int-vector = INT "=" address-expression .


<address-expression> defines the given vector (RESET or interrupt vector) to the given value.

This is where PMP places a jump to the appropriate code.


All items are optional, if not given the default address is used.


If a RESET vector is given alone, and no other previous $VECTORS has defined them, the interrupt vectors are automatically translated from the default value to the default value plus the reset vector (that is: all vectors are translated by the same amount).


This directive cannot be used if some code has been already generated.

This directive is only available in a program (project-wide directive).


Note: If RESET is specified, the area from $0000 up to the RESET vector is automatically removed from the linker script, allowing space for a bootloader.



{$IFDEF BOOTLOADER}
 {$VECTORS RESET=$800, INT=$804}
{$ENDIF}