On 29/05/18 19:45, DJ Delorie wrote:
The reason I required interrupt handlers to be non-static is because the
linker builds the interrupt handler table using weak references.  If the
handler is static, it won't be added to the table, and never called.

So you'd need a test to ensure that the handler was properly entered
into the table as well.

If an argument is passed to the interrupt attribute, GCC will create a section
for the interrupt vector when outputting the assembly. This, combined with the
code to ensure the interrupt function doesn't get optimized out, ensures the
symbol for the interrupt function is available when it comes to linking.

KEEP directives in the linker script for the interrupt vector sections will
prevent the interrupt function from getting optimized out in the final
executable, even with -Os and --gc-sections.

The only difference between a static interrupt and a regular interrupt
function in the linked executable is that the symbol for the interrupt
function name is global for the regular interrupt, but local for the static
interrupt. However, in both cases the address for the interrupt function name
is successfully added to the handler table.

So I believe that as long as the tests scanning the assembly output for the
interrupt vector section name pass, the interrupt function address will be
loaded into the vector table, provided the user has correctly used KEEP
directives in the linker script.

It doesn't really seem possible (as far as I'm aware), to coerce the GCC
testsuite into checking the address of the function loaded into the vector
table matches the address of the function in the text section, in a linked
executable. I could perhaps add something along these lines to the msp430 ld
testsuite in binutils if you think it's necessary.

I did also test on hardware that static interrupts works as expected, and they
do.

Thanks,
Jozef


Reply via email to