📄 rominit.s
字号:
/* romInit.s - Atmel AT91M55800A project:H6K */
/* Copyright 1999 ARM Limited */
.data
.globl _copyright_arm_limited
_copyright_arm_limited:
.long 0
/*
modification history
--------------------
12.23.2004 The first version
*/
/*
DESCRIPTION
This module contains the entry code for VxWorks images that start
running from ROM, such as 'bootrom' and 'vxWorks_rom'. The entry
point, romInit(), is the first code executed on power-up. It performs
the minimal setup needed to call the generic C routine romStart() with
parameter BOOT_COLD.
romInit() masks interrupts in the processor and the interrupt
controller and sets the initial stack pointer (to STACK_ADRS which is
defined in configAll.h). Other hardware and device initialisation is
performed later in the sysHwInit routine in sysLib.c.
The routine sysToMonitor() jumps to a location after the beginning of
romInit, (defined by ROM_WARM_ADRS) to perform a "warm boot". This
entry point allows a parameter to be passed to romStart().
The routines in this module don't use the "C" frame pointer %r11@ ! or
establish a stack frame.
SEE ALSO:
.I "ARM Architecture Reference Manual,"
.I "ARM 7TDMI Data Sheet,"
.I "Atmel AT91M40400 16/32-Bit Microcontroller, Data Sheet,"
.I "Atmel AT91EB01 Evaluation Board, User Guide."
*/
#define _ASMLANGUAGE
#include "vxWorks.h"
#include "sysLib.h"
#if ((CPU == ARM7TDMI) || (CPU == ARM7TDMI_T))
#include "arch/arm/arm.h" /* included by default on new architectures */
#endif
#include "regs.h"
#include "config.h"
/* internals */
.globl _romInit /* start of system code */
.globl _sdata /* start of data */
/* externals */
.extern _romStart /* system initialization routine */
.data
_sdata:
.asciz "start of data"
.balign 4
.text
.balign 4
/*******************************************************************************
*
* romInit - entry point for VxWorks in ROM
*
* romInit
* (
* int startType /@ only used by 2nd entry point @/
* )
* INTERNAL
* sysToMonitor examines the ROM for the first instruction and the string
* "Copy" in the third word so if this changes, sysToMonitor must be updated.
*/
_ARM_FUNCTION(_romInit)
cold:
MOV r0, #BOOT_COLD /* fall through to warm boot entry */
warm:
B start
/* copyright notice appears at beginning of ROM (in TEXT segment) */
.ascii "Copyright 1999 ARM Limited"
.balign 4
start:
/* disable interrupts and force SVC32 mode, just like reset */
MRS r1, cpsr
BIC r1, r1, #MASK_MODE
ORR r1, r1, #MODE_SVC32 | I_BIT | F_BIT
MSR cpsr, r1
/* disable individual interrupts in the interrupt controller */
LDR r2, =AT91_AIC_BASE /* R2-> interrupt controller */
MVN r1, #0 /* R1 = FFFFFFFF */
STR r1, [r2, #AT91_AIC_IDCR - AT91_AIC_BASE] /* IRQs & FIQ */
/* clear interrupts as well */
STR r1, [r2, #AT91_AIC_ICCR - AT91_AIC_BASE] /* IRQs & FIQ */
/*
* Perform 8 End of Interrupt Commands as well, to ensure that
* no interrupt is stacked, leaving the hardware stack in the
* interrupt controller unbalanced.
*/
MOV r1, #8
1:
STR r1, [r2, #AT91_AIC_EOICR - AT91_AIC_BASE]
SUBS r1, r1, #1
BPL 1b
/*
* Initialise stack pointer: set it so stack grows down.
*/
MOV sp, #(AT91_ON_CHIP_RAM_BASE_ADRS+AT91_ON_CHIP_RAM_BANK_SIZE)
MOV fp, #0 /* zero frame pointer */
/* jump to C entry point in ROM: routine - entry point + ROM base */
#if (ARM_THUMB)
LDR r12, L$_romStart
ORR r12, r12, #1 /* force Thumb state */
BX r12
#else
LDR pc, L$_romStart
#endif /* (ARM_THUMB) */
/******************************************************************************/
/*
* PC-relative-addressable pointers - these cannot be done with
* LDR Rn,=<expr> because of the symbol references
*/
.balign 4
L$_romStart:
.long ROM_TEXT_ADRS + _romStart - _romInit
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -