* arm/crt0.S: Support armv6-m processors in libgloss.

* arm/swi.h: Likewise.
	* arm/trap.S: Likewise.
	* arm/redboot-crt0.S: Likewise.
	* arm/linux-crt0.c: Likewise.
	* arm/arm.h: New.
This commit is contained in:
Nick Clifton
2011-07-13 15:06:21 +00:00
parent 1d15e018c7
commit 415e1ecce4
7 changed files with 163 additions and 45 deletions

View File

@@ -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)