I have a set of linker script sections for an interrupt vector table. The sections will be located in RAM and will be loaded into RAM by my code. As each vector must be at an absolute location, there is a separate section (and a separate memory region) for each vector.
Some vectors may not be used by the application, whilst others will. To ensure that the copy code still works I need to make sure that, if a vector is not present, the equivalent space in ROM (two bytes) is filled. I tried to do this by advancing the location pointer but of course this only affects the VMA and so doesn't help me at all.
How can I ensure that a section always takes up the required amount of space in ROM? i.e. how can I move the LMA on if there is no data in the section?
Any hints or tips would be greatly appreciated.
I have abridged my current linker script below:
OUTPUT_ARCH(msp430)
ENTRY(_start)
MEMORY {
ROM (rx) : ORIGIN = 0x9C02, LENGTH = 0x61FE
VECT1 : ORIGIN = 0x5B80, LENGTH = 0x0002
VECT2 : ORIGIN = 0x5B82, LENGTH = 0x0002
...
VECT63 : ORIGIN = 0x5BFC, LENGTH = 0x0002
}
SECTIONS
{
__interrupt_vector_1 :
{
__vectable_load__ = LOADADDR(__interrupt_vector_1);
__vectable_start__ = .;
__interrupt_vector_1__ = .;
KEEP (*(__interrupt_vector_1))
. = __interrupt_vector_1__ + 2;
} > VECT1 AT> ROM
__interrupt_vector_2 :
{
__interrupt_vector_2__ = .;
KEEP (*(__interrupt_vector_2))
. = __interrupt_vector_2__ + 2;
} > VECT2 AT> ROM
...
{
__interrupt_vector_63__ = .;
KEEP (*(__interrupt_vector_63))
KEEP (*(__interrupt_vector_sysnmi))
. = __interrupt_vector_63__ + 2;
__vectable_end__ = .;
} > VECT63 AT> ROM
}