Merge branch 'efm32'
this adds support for energy micro's efm32 tiny gecko, gecko, leopard gecko and giant gecko series. also, the experimental libopencmsis is included in this branch, as it is required for full operation of the free energymicro standard library
This commit is contained in:
@@ -99,7 +99,19 @@ template_vector_nvic_c = '''\
|
||||
{vectortableinitialization}
|
||||
'''
|
||||
|
||||
def convert(infile, outfile_nvic, outfile_vectornvic):
|
||||
template_cmsis_h = '''\
|
||||
/* This file is part of the libopencm3 project.
|
||||
*
|
||||
* It was generated by the irq2nvic_h script.
|
||||
*
|
||||
* These definitions bend every interrupt handler that is defined CMSIS style
|
||||
* to the weak symbol exported by libopenmc3.
|
||||
*/
|
||||
|
||||
{cmsisbends}
|
||||
'''
|
||||
|
||||
def convert(infile, outfile_nvic, outfile_vectornvic, outfile_cmsis):
|
||||
data = yaml.load(infile)
|
||||
|
||||
irq2name = list(enumerate(data['irqs']) if isinstance(data['irqs'], list) else data['irqs'].items())
|
||||
@@ -114,9 +126,11 @@ def convert(infile, outfile_nvic, outfile_vectornvic):
|
||||
data['isrprototypes'] = "\n".join('void WEAK %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['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)
|
||||
|
||||
outfile_nvic.write(template_nvic_h.format(**data))
|
||||
outfile_vectornvic.write(template_vector_nvic_c.format(**data))
|
||||
outfile_cmsis.write(template_cmsis_h.format(**data))
|
||||
|
||||
def makeparentdir(filename):
|
||||
try:
|
||||
@@ -140,6 +154,7 @@ def main():
|
||||
raise ValueError("Arguent must match ./include/libopencm3/**/irq.yaml")
|
||||
nvic_h = infile.replace('irq.yaml', 'nvic.h')
|
||||
vector_nvic_c = infile.replace('./include/libopencm3/', './lib/').replace('irq.yaml', 'vector_nvic.c')
|
||||
cmsis = infile.replace('irq.yaml', 'irqhandlers.h').replace('/libopencm3/', '/libopencmsis/')
|
||||
|
||||
if remove:
|
||||
if os.path.exists(nvic_h):
|
||||
@@ -153,8 +168,9 @@ def main():
|
||||
|
||||
makeparentdir(nvic_h)
|
||||
makeparentdir(vector_nvic_c)
|
||||
makeparentdir(cmsis)
|
||||
|
||||
convert(open(infile), open(nvic_h, 'w'), open(vector_nvic_c, 'w'))
|
||||
convert(open(infile), open(nvic_h, 'w'), open(vector_nvic_c, 'w'), open(cmsis, 'w'))
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user