summaryrefslogtreecommitdiffstats
path: root/libgloss/arm/redboot-crt0.S
diff options
context:
space:
mode:
Diffstat (limited to 'libgloss/arm/redboot-crt0.S')
-rw-r--r--libgloss/arm/redboot-crt0.S24
1 files changed, 15 insertions, 9 deletions
diff --git a/libgloss/arm/redboot-crt0.S b/libgloss/arm/redboot-crt0.S
index 2499ac091..dcd042c23 100644
--- a/libgloss/arm/redboot-crt0.S
+++ b/libgloss/arm/redboot-crt0.S
@@ -1,3 +1,4 @@
+#include "arm.h"
.file "crt0.S"
@@ -11,14 +12,14 @@
#endif
.text
+ .syntax unified
/* Setup the assembly entry point. */
-#ifdef __thumb2__
+#ifdef THUMB_V7_V6M
.macro FUNC_START name
.global \name
.thumb_func
\name:
.endm
- .syntax unified
.thumb
#else
.macro FUNC_START name
@@ -29,11 +30,15 @@
#endif
FUNC_START SYM_NAME(start)
FUNC_START SYM_NAME(_start)
+ /* Unnecessary to set fp for v6-m/v7-m, which don't support
+ ARM state. */
+#ifndef THUMB_V7M_V6M
mov fp, #0 /* Null frame pointer. */
- mov r7, #0 /* Null frame pointer for Thumb. */
+#endif
+ movs r7, #0 /* Null frame pointer for Thumb. */
/* Enable interrupts for gdb debugging. */
-#ifdef __thumb2__
+#ifdef THUMB_V7_V6M
cpsie if
#else
mrs r0, cpsr
@@ -41,10 +46,10 @@
msr cpsr, r0
#endif
- mov a2, #0 /* Second arg: fill value. */
+ movs a2, #0 /* Second arg: fill value. */
ldr a1, .LC1 /* First arg: start of memory block. */
ldr a3, .LC2
- sub a3, a3, a1 /* Third arg: length of block. */
+ subs a3, a3, a1 /* Third arg: length of block. */
#ifdef GCRT0
/* Zero out the bss without using memset.
@@ -62,7 +67,8 @@
/* Nothing to left to clear. */
#endif
-#if defined(__thumb__) && !defined(__thumb2__) /* Enter Thumb mode. */
+#if defined(__thumb__) && !defined(THUMB_V7_V6M)
+ /* Enter Thumb mode. */
add a4, pc, #1 /* Get the address of the Thumb block. */
bx a4 /* Go there and start Thumb decoding. */
@@ -76,7 +82,7 @@ __change_mode:
bl SYM_NAME(memset)
#endif
bl SYM_NAME(__get_memtop)
- sub r0, r0, #32
+ subs r0, r0, #32
mov sp, r0
#ifdef __USES_INITFINI__
@@ -89,7 +95,7 @@ __change_mode:
bl SYM_NAME (_init)
#endif
- mov a1, #0
+ movs a1, #0
ldr a2, .LC3
mov a3, a2
bl SYM_NAME(main)