Files
lt16lab/programs/interrupt_test.prog

55 lines
778 B
Plaintext

reset:
br always >main
nop
hardfault:
reti
nop
memfault:
reti
nop
switches_interrupt:
br >switches_interrupt_handler
nop
can_interrupt:
br >can_interrupt_handler
nop
.align
led_addr: .word 0x000F0000
switches_addr: .word 0x000F0004
dmem_start_addr: .word 0x00000400
dmem_end_addr: .word 0x000004FC
priority_mask: .word 0xFFFFFF03
main:
// Initialize stack pointer to the end of the data memory
ldr r12, >dmem_end_addr
// Set runtime priority
ldr r0, >priority_mask
and r14, r0, r14
ldr r0, >led_addr
ldr r1, >switches_addr
loop:
br >loop
nop
switches_interrupt_handler:
ld32 r2, r1
// Set LED to pattern
st08 r0, r2
reti
nop
can_interrupt_handler:
reti
nop