c - Force minimum size of linker script section -
i have set of linker script sections interrupt vector table. sections located in ram , loaded ram code. each vector must @ absolute location, there separate section (and separate memory region) each vector.
some vectors may not used application, whilst others will. ensure copy code still works need make sure that, if vector not present, equivalent space in rom (two bytes) filled. tried advancing location pointer of course affects vma , doesn't me @ all.
how can ensure section takes required amount of space in rom? i.e. how can move lma on if there no data in section?
any hints or tips appreciated.
i have abridged 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 }
i have created work around. in retrospect it's obvious, in case helps else, describe here.
my location pointer advancement doesn't because if there no data in input section linker discards output section. means no data added rom. need there padding added rom because need vector table same size. worked around using location pointer advancement putting of interrupt vectors single section:
output_arch(msp430) entry(_start) memory { rom (rx) : origin = 0x9c02, length = 0x61fe vectable : origin = 0x5b80, length = 0x007e } sections { .vector_table : { __vectable_load__ = loadaddr(.vector_table); __vectable_start__ = .; __interrupt_vector_1__ = .; keep (*(__interrupt_vector_1)) . = __interrupt_vector_1__ + 2; __interrupt_vector_2__ = .; keep (*(__interrupt_vector_2)) . = __interrupt_vector_2__ + 2; ... __interrupt_vector_63__ = .; keep (*(__interrupt_vector_63)) keep (*(__interrupt_vector_sysnmi)) . = __interrupt_vector_63__ + 2; __vectable_end__ = .; } > vectable at> rom }
now necessary padding added both ram , rom provided vector table not empty. if doesn't bother me, doesn't copied, main thing vectors don't end in wrong places.
Comments
Post a Comment