diff options
author | keepkeyjon <jon@keepkey.com> | 2018-03-07 18:01:44 +0300 |
---|---|---|
committer | Karl Palsson <karlp@tweak.net.au> | 2018-07-29 23:31:17 +0300 |
commit | 8071c6cf012f1829338df19fe371dbcfe28cd2b7 (patch) | |
tree | 8dace02339c53a1cdabe93a016e38b1d55ec75e2 | |
parent | f53e12d2da3f9730dd842bdf7d1e680cb5877a15 (diff) |
irq2nvic: Use weak-alias declarations instead of #pragma weak
... since Clang doesn't infer the function type on '#pragma weak x = y'-style
declarations, and instead leaves it as "<overloaded function type>", thus
leading to a type conflict when assigning the ISRs to the interrupt vector.
This has no impact on normal use, but it makes it more compatible, nd
that's always a good thing.
Before (vector_nvic.c generated)
...
#pragma weak usart1_isr = blocking_handler
...
After:
...
void usart1_isr(void) __attribute__((weak, alias("blocking_handler")));
...
-rwxr-xr-x | scripts/irq2nvic_h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/scripts/irq2nvic_h b/scripts/irq2nvic_h index 0a99603c..c36273bf 100755 --- a/scripts/irq2nvic_h +++ b/scripts/irq2nvic_h @@ -79,12 +79,12 @@ template_vector_nvic_c = '''\ */ -/** @defgroup CM3_nvic_isrpragmas_{partname_doxygen} User interrupt service routines (ISR) defaults for {partname_humanreadable} - @ingroup CM3_nvic_isrpragmas +/** @defgroup CM3_nvic_isrdecls_{partname_doxygen} User interrupt service routines (ISR) defaults for {partname_humanreadable} + @ingroup CM3_nvic_isrdecls @{{*/ -{isrpragmas} +{isrdecls} /**@}}*/ @@ -122,7 +122,7 @@ def convert(infile, outfile_nvic, outfile_vectornvic, outfile_cmsis): data['irqdefinitions'] = "\n".join('#define NVIC_%s_IRQ %d'%(v.upper(),int(k)) for (k,v) in irq2name) data['isrprototypes'] = "\n".join('void %s_isr(void);'%name.lower() for name in irqnames) - data['isrpragmas'] = "\n".join('#pragma weak %s_isr = blocking_handler'%name.lower() for name in irqnames) + data['isrdecls'] = "\n".join('void %s_isr(void) __attribute__((weak, alias("blocking_handler")));'%name.lower() for name in irqnames) data['vectortableinitialization'] = ', \\\n '.join('[NVIC_%s_IRQ] = %s_isr'%(name.upper(), name.lower()) for name in irqnames) data['cmsisbends'] = "\n".join("#define %s_IRQHandler %s_isr"%(name.upper(), name.lower()) for name in irqnames) |