better way to do irqs
This commit is contained in:
parent
f421cde7f8
commit
2288c9e2ff
4 changed files with 14 additions and 20 deletions
2
Makefile
2
Makefile
|
@ -88,7 +88,7 @@ src/isr.o: src/isr.c
|
|||
%.dis: %.obj
|
||||
$(OBJDUMP) -SD $< > $@
|
||||
|
||||
%.obj: $(LDSCRIPT) %.o #src/interrupt-utils.o
|
||||
%.obj: $(LDSCRIPT) %.o src/isr.o
|
||||
$(LD) $(LDFLAGS) $(AOBJS) \
|
||||
--start-group $(PLATFORM_LIBS) --end-group \
|
||||
-Map $*.map $^ -o $@
|
||||
|
|
8
boot.lds
8
boot.lds
|
@ -28,13 +28,13 @@ ENTRY(_start)
|
|||
SECTIONS
|
||||
{
|
||||
. = 0x00400000;
|
||||
|
||||
|
||||
. = ALIGN(4);
|
||||
.text :
|
||||
{
|
||||
src/start.o (.text)
|
||||
src/isr.o (.text)
|
||||
*(.text)
|
||||
src/start.o (.text)
|
||||
*(.irq)
|
||||
*(.text)
|
||||
}
|
||||
|
||||
. = ALIGN(4);
|
||||
|
|
|
@ -4,8 +4,9 @@
|
|||
|
||||
#define reg32(x) (*(volatile uint32_t *)(x))
|
||||
|
||||
//__attribute__ ((interrupt("IRQ")))
|
||||
void isr(void)
|
||||
__attribute__ ((section (".irq")))
|
||||
__attribute__ ((interrupt("IRQ")))
|
||||
void irq(void)
|
||||
{
|
||||
// ISR_ENTRY();
|
||||
/* check for TMR0 interrupt */
|
||||
|
|
19
src/start.S
19
src/start.S
|
@ -212,19 +212,12 @@ not_used:
|
|||
|
||||
|
||||
.align 5
|
||||
irq:
|
||||
push {lr}
|
||||
movs lr,pc
|
||||
b isr
|
||||
pop {lr}
|
||||
subs pc,r14,#4 // suggested irq return cmd
|
||||
// STMFD sp!, {r0-r12,lr}
|
||||
// MOVNE lr,pc
|
||||
// ldr r0, =isr
|
||||
// BX r0
|
||||
// LDMFD r13!, {r0-r12,r14}
|
||||
// MOVS PC, R14
|
||||
// subs pc, r14, #4
|
||||
//irq:
|
||||
// push {lr}
|
||||
// movs lr,pc
|
||||
// b isr
|
||||
// pop {lr}
|
||||
// subs pc,r14,#4 // suggested irq return cmd
|
||||
fiq:
|
||||
|
||||
.align 5
|
||||
|
|
Loading…
Reference in a new issue