aboutsummaryrefslogtreecommitdiffhomepage
path: root/targets/cortex-m-qemu.s
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2019-11-29 21:35:59 +0100
committerRon Evans <[email protected]>2019-12-07 16:47:40 +0100
commit0105f815c6349043645fcc0bbf06d00a545882be (patch)
tree837054eceab1df5f3b86c471cd429c96be84635f /targets/cortex-m-qemu.s
parentd441f0152fb5943c960544cd39675bb7792b641e (diff)
downloadtinygo-0105f815c6349043645fcc0bbf06d00a545882be.tar.gz
tinygo-0105f815c6349043645fcc0bbf06d00a545882be.zip
targets: rename qemu target to cortex-m-qemu
The target is intended to emulate the Cortex-M, not to be a generic QEMU target.
Diffstat (limited to 'targets/cortex-m-qemu.s')
-rw-r--r--targets/cortex-m-qemu.s52
1 files changed, 52 insertions, 0 deletions
diff --git a/targets/cortex-m-qemu.s b/targets/cortex-m-qemu.s
new file mode 100644
index 000000000..2e2fa010d
--- /dev/null
+++ b/targets/cortex-m-qemu.s
@@ -0,0 +1,52 @@
+// Generic Cortex-M interrupt vector.
+// This vector is used by the Cortex-M QEMU target.
+
+.syntax unified
+
+// This is the default handler for interrupts, if triggered but not defined.
+.section .text.Default_Handler
+.global Default_Handler
+.type Default_Handler, %function
+Default_Handler:
+ wfe
+ b Default_Handler
+
+// Avoid the need for repeated .weak and .set instructions.
+.macro IRQ handler
+ .weak \handler
+ .set \handler, Default_Handler
+.endm
+
+.section .isr_vector, "a", %progbits
+.global __isr_vector
+ // Interrupt vector as defined by Cortex-M, starting with the stack top.
+ // On reset, SP is initialized with *0x0 and PC is loaded with *0x4, loading
+ // _stack_top and Reset_Handler.
+ .long _stack_top
+ .long Reset_Handler
+ .long NMI_Handler
+ .long HardFault_Handler
+ .long MemoryManagement_Handler
+ .long BusFault_Handler
+ .long UsageFault_Handler
+ .long 0
+ .long 0
+ .long 0
+ .long 0
+ .long SVC_Handler
+ .long DebugMon_Handler
+ .long 0
+ .long PendSV_Handler
+ .long SysTick_Handler
+
+ // Define default implementations for interrupts, redirecting to
+ // Default_Handler when not implemented.
+ IRQ NMI_Handler
+ IRQ HardFault_Handler
+ IRQ MemoryManagement_Handler
+ IRQ BusFault_Handler
+ IRQ UsageFault_Handler
+ IRQ SVC_Handler
+ IRQ DebugMon_Handler
+ IRQ PendSV_Handler
+ IRQ SysTick_Handler