aboutsummaryrefslogtreecommitdiff
path: root/stmhal/gchelper.s
diff options
context:
space:
mode:
authorDave Hylands2014-03-12 18:06:26 -0700
committerDave Hylands2014-03-12 18:15:55 -0700
commitf14b92b9e13c9cb9f54a1d740dbea1eeedeccb5b (patch)
tree303a4e00c9612951c8ab3cfbe926121724173fd1 /stmhal/gchelper.s
parent19438fd30a3184b656221a59062ea32453d0fd16 (diff)
REPl working on UART6 with STMHAL
Diffstat (limited to 'stmhal/gchelper.s')
-rw-r--r--stmhal/gchelper.s62
1 files changed, 62 insertions, 0 deletions
diff --git a/stmhal/gchelper.s b/stmhal/gchelper.s
new file mode 100644
index 000000000..6baedcdd0
--- /dev/null
+++ b/stmhal/gchelper.s
@@ -0,0 +1,62 @@
+ .syntax unified
+ .cpu cortex-m4
+ .thumb
+ .text
+ .align 2
+
+@ uint gc_helper_get_regs_and_sp(r0=uint regs[10])
+ .global gc_helper_get_regs_and_sp
+ .thumb
+ .thumb_func
+ .type gc_helper_get_regs_and_sp, %function
+gc_helper_get_regs_and_sp:
+ @ store registers into given array
+ str r4, [r0], #4
+ str r5, [r0], #4
+ str r6, [r0], #4
+ str r7, [r0], #4
+ str r8, [r0], #4
+ str r9, [r0], #4
+ str r10, [r0], #4
+ str r11, [r0], #4
+ str r12, [r0], #4
+ str r13, [r0], #4
+
+ @ return the sp
+ mov r0, sp
+ bx lr
+
+
+@ this next function is now obsolete
+
+ .size gc_helper_get_regs_and_clean_stack, .-gc_helper_get_regs_and_clean_stack
+@ void gc_helper_get_regs_and_clean_stack(r0=uint regs[10], r1=heap_end)
+ .global gc_helper_get_regs_and_clean_stack
+ .thumb
+ .thumb_func
+ .type gc_helper_get_regs_and_clean_stack, %function
+gc_helper_get_regs_and_clean_stack:
+ @ store registers into given array
+ str r4, [r0], #4
+ str r5, [r0], #4
+ str r6, [r0], #4
+ str r7, [r0], #4
+ str r8, [r0], #4
+ str r9, [r0], #4
+ str r10, [r0], #4
+ str r11, [r0], #4
+ str r12, [r0], #4
+ str r13, [r0], #4
+
+ @ clean the stack from given pointer up to current sp
+ movs r0, #0
+ mov r2, sp
+ b.n .entry
+.loop:
+ str r0, [r1], #4
+.entry:
+ cmp r1, r2
+ bcc.n .loop
+ bx lr
+
+ .size gc_helper_get_regs_and_clean_stack, .-gc_helper_get_regs_and_clean_stack