⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rominit.s

📁 菲利普22系列 vxworks bsp 可以用来可以和其他版本的ARM vxworks bsp(特别是7内核的进行比较)进行比较可以加深对BSP的理解和掌握
💻 S
字号:
/* romInit.s - LPC2210 initialization module */

#define    _ASMLANGUAGE
#include "vxWorks.h"
#include "sysLib.h"
#include "arch/arm/arm.h"
/*#include "arch/arm/mmuArmLib.h"*/
#include "config.h"
#include "regs.h"
#include "lpc2210.h"    

    .data
    .globl   FUNC(copyright_wind_river)
    .long    FUNC(copyright_wind_river)

/* internals */

    .globl    FUNC(romInit)    /* start of system code */
    .globl    FUNC(sdata)      /* start of data */
    .globl    _sdata
    
/* externals */

    .globl    FUNC(romStart)    /* system initialization routine */

    .extern FUNC(excEnterUndef)
    .extern FUNC(excEnterSwi)
    .extern FUNC(excEnterPrefetchAbort)
    .extern FUNC(excEnterDataAbort)
    .extern FUNC(intEnt)

_sdata:
FUNC_LABEL(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)
_romInit:
/*  : 在Flash存储器的开始处添加硬件中断入口,VxWorks只提供5个异常入口 */
        LDR     PC, ResetAddr
        LDR     PC, UndefinedAddr
        LDR     PC, SWI_Addr
        LDR     PC, PrefetchAddr
        LDR     PC, DataAbortAddr
        .long   0xb9205f80
        LDR     PC, IRQ_Addr
        LDR     PC, FIQ_Addr

ResetAddr:           
	.long    cold
UndefinedAddr:       
	.long    excEnterUndef
SWI_Addr:            
	.long    excEnterSwi
PrefetchAddr:
        .long    excEnterPrefetchAbort
DataAbortAddr:
        .long    excEnterDataAbort
IRQ_Addr:            
	.long    intEnt
FIQ_Addr:
        .long    FIQ_Handler

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 1984-2001 Wind River Systems, Inc."
    .balign 4

start:
    MOV    r13, r0    /* Save starttype in r13 so that r0 can be used for other purposes */
/*  : 设置CPU核心寄存器 */
    LDR     R0, L$_PINSEL2
    LDR     R1, L$_PINSEL2VAL      /* 0x0f814914 */
    STR     R1, [R0]

    LDR     R0, L$_BCFG0
    LDR     R1, L$_BCFG0VAL        /* 0x1000ffef */
    STR     R1, [R0]

    LDR     R0, L$_BCFG1
    LDR     R1, L$_BCFG1VAL        /* 0x1000ffef */
    STR     R1, [R0]

/*  : 设置结束 */


    /*
     * Initialize the stack pointer to just before where the
     * uncompress code, copied from ROM to RAM, will run.
     */

    MOV    r0, r13        /* restore starttype to r0 from r13 */
    LDR    sp, L$_STACK_ADDR
    MOV    fp, #0            /* zero frame pointer , fp = R11 */

    /* jump to C entry point in ROM: routine - entry point + ROM base */
    LDR    pc, L$_rStrtInRom

/******************************************************************************/

/*  中断、异常的入口 */
_ARM_FUNCTION(FIQ_Handler)	
	B FIQ_Handler    
	
/******************************************************************************/

/*
 * PC-relative-addressable pointers - LDR Rn,=sym is broken
 * note "_" after "$" to stop preprocessor preforming substitution
 */

    .balign    4

L$_rStrtInRom:
    .long    ROM_TEXT_ADRS + FUNC(romStart) - FUNC(romInit)

L$_PINSEL0:
    .long    0xE002C000	/* PINSEL0 */

L$_PINSEL1:
    .long    0xE002C004 /* PINSEL1 */

L$_PINSEL2:
    .long    0xE002C014 /* PINSEL2 */

L$_BCFG0:
    .long    0xFFE00000 /* BCFG0 */

L$_BCFG1:
    .long    0xFFE00004 /* BCFG1 */

L$_PINSEL2VAL:
    .long    0x0f814914
    
L$_BCFG0VAL:
    .long    0x1000ffef
    
L$_BCFG1VAL:
    .long    0x1000ffef
    
L$_IO0DIR:
    .long    0xE0028008 /* IO0DIR */
    
L$_IO0CLR:
    .long    0xE002800C /* IO0CLR */
    
L$_IO0SET:
    .long    0xE0028004 /* IO0SET */
    
    
L$_STACK_ADDR:
    .long    STACK_ADRS

L$_RomCopySize:
    .long    L$_RomCopySize - FUNC(romInit)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -