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

📄 rominit.s

📁 vxworks bsp,s3c2410的vxworks开发资料
💻 S
📖 第 1 页 / 共 2 页
字号:
/* romInit.s - Samsung SBC ARM7 ROM initialization module *//* Copyright 2004-2005 Amine@263.net *//* Copyright 1984-2001 Wind River Systems, Inc. *//*modification history--------------------01o,05aug04,a_m  BSP定制 for 思创S3C44B0X黄金开发板01f,18jan02,m_h  CLKCON initialization (74497), _sdata for vxWorks.res*01e,30nov01,m_h  additional label with "_" on entry point functions01d,15oct01,jb  Removing pre-pended underscores for new compilers (Diab/Gnu                 elf)01c,26apr01,m_h  fix thumb mode01b,26apr01,m_h  convert tabs to spaces for readability01a,12apr01,m_h  created from snds100 template.*//*DESCRIPTIONThis module contains the entry code for VxWorks images that startrunning from ROM, such as 'bootrom' and 'vxWorks_rom'.  The entrypoint, romInit(), is the first code executed on power-up.  It performsthe minimal setup needed to call the generic C routine romStart() withparameter BOOT_COLD.romInit() masks interrupts in the processor and the interruptcontroller and sets the initial stack pointer (to STACK_ADRS which isdefined in configAll.h).  Other hardware and device initialisation isperformed later in the sysHwInit routine in sysLib.c.The routine sysToMonitor() jumps to a location after the beginning ofromInit, (defined by ROM_WARM_ADRS) to perform a "warm boot".  Thisentry point allows a parameter to be passed to romStart().The routines in this module don't use the "C" frame pointer %r11@ ! orestablish a stack frame.SEE ALSO:.I "ARM Architecture Reference Manual,".I "Samsung KS32C50100 Microcontroller User's Manual,".I "Samsung KS32C5000(A)/50100 Microcontroller Application Notes."*/#define    _ASMLANGUAGE#include "vxWorks.h"#include "sysLib.h"#include "arch/arm/arm.h"#include "arch/arm/mmuArmLib.h"#include "config.h"#include "regs.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 */_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:/* Amine: 在Flash存储器的开始处添加硬件中断入口,VxWorks只提供5个异常入口 */    B       cold    B       _romUndef    B       _romSwi    B       _romPrefetch    B       _romDataAbort    B       cold		/* _romReserved */    B       _romIRQ    B       cold		/* _romFIQ */    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 2004-2005 Amine@263.net"    .ascii   "Copyright 1984-2001 Wind River Systems, Inc."    .balign 4start:/* Amine: 设置CPU核心寄存器 */    LDR    r2, L$_S3C44B0XWtcon		/*watch dog disable*/    MOV    r1, #0     STR    r1, [r2]        LDR    r2, L$_SBCARM7Intmsk		/*all interrupt disable*/    MOV    r1, #0x07ffffff    STR    r1, [r2]        LDR    r2, L$_SBCARM7Locktime	/*set clock control registers*/    LDR    r1, L$_LockTime    STR    r1, [r2]	    LDR    r2, L$_SBCARM7Pllcon		/*temporary setting of PLL*/    LDR    r1, L$_PllCon    STR    r1, [r2]    LDR    r2, L$_SBCARM7ClkCon		/*all unit block CLK enable*/    LDR    r1, L$_ClkCon    STR    r1, [r2]/* Amine: 设置结束 */      #if 0	/* Amine: deleted */    /* disable interrupts in CPU and switch to SVC32 mode */    MRS    r1, cpsr    BIC    r1, r1, #MASK_MODE    ORR    r1, r1, #MODE_SVC32 | I_BIT | F_BIT    MSR    cpsr, r1#endif    MOV    r13, r0    /* Save starttype in r13 so that r0 can be used for other purposes */#if 0	/* Amine: deleted */    /*     * CPU INTERRUPTS DISABLED     *     * disable individual interrupts in the interrupt controller     */    LDR    r2, L$_SBCARM7Intmsk        /* R2->interrupt controller */    MVN    r1, #0                /* &FFFFFFFF */    STR    r1, [r2]            /* disable all interrupt sources */#endif        /*     * If not BOOT_COLD, bypass memory configuration, memory region     * switching etc.     */    CMP    r0, #BOOT_COLD    BNE    HiPosn#if 0	/* Amine: deleted */    /*     * We are now executing in the normal (higher, still in ROM)     * position in the memory map.  Remap memory to post-reset state,     * so that the ROM is not now dual-mapped to zero upwards, but     * RAM is mapped from zero, instead.     */    MOV    r0, #DRAM_TYPE  /* R0-> DRAM type */    CMP    r0, #0x01       /* SDRAM = 0x01, EDO DRAM = 0x00 */    BNE    EDO_RAM#endifSYNC_DRAM:    LDR    r0, L$_SBCARM7Syscfg    LDR    r1, L$_SysCfgSdram    STR    r1, [r0]             /* Cache,WB disable *//* ROM and RAM Configuration(Multiple Load and Store).  Multiple load * LDMIA instruction cannot be used as there is no way to load the * address L$_SystemInitDataSDRAM into a register (LDR Rn,=sym is broken) */    LDR    r1, L$_SystemInitDataSDRAM     LDR    r2, L$_SystemInitDataSDRAM + 0x04    LDR    r3, L$_SystemInitDataSDRAM + 0x08    LDR    r4, L$_SystemInitDataSDRAM + 0x0c    LDR    r5, L$_SystemInitDataSDRAM + 0x10    LDR    r6, L$_SystemInitDataSDRAM + 0x14    LDR    r7, L$_SystemInitDataSDRAM + 0x18    LDR    r8, L$_SystemInitDataSDRAM + 0x1c    LDR    r9, L$_SystemInitDataSDRAM + 0x20    LDR    r10,L$_SystemInitDataSDRAM + 0x24    LDR    r11,L$_SystemInitDataSDRAM + 0x28    LDR    r12,L$_SystemInitDataSDRAM + 0x2c    LDR    r0, L$_SBCARM7Extdbwth         /* Extdbwth Offset : 0x3010 */    STMIA  r0, {r1-r12}    /* Amine: r13存储启动类型,不能使用 */    LDR    r0, L$_SBCARM7Mrsrb7    LDR    r1, L$_SystemInitDataSDRAM +0x30    STR    r1, [r0]	#if 0	/* Amine: deleted */    LDR    r1, L$_ClkCon    LDR    r0, L$_SBCARM7ClkCon         /* CLKCON Offset : 0x3000 */    STR    r1, [r0]    LDR    r1, L$_ExtACon    LDR    r2, L$_ExtACon + 0x04    LDR    r0, L$_SBCARM7ExtACon         /* EXTACON Offset : 0x3008 */    STMIA  r0, {r1-r2}#endif/*============================================================= * Copy to DRAM the section of ROM in which we are currently executing. * Soon, we will set the base pointer of DRAM to where the base pointer of * ROM used to be.  At that point the PC will suddenly be set in RAM and * must have legitimate code to execute. *============================================================= */    MOV    r0, #RESET_ROM_START         /* Get pointer to ROM data */    LDR    r1, L$_RomCopySize           /* number of ROM bytes to copy into RAM */    MOV    r2, #RESET_DRAM_START        /* Copy DRAM area base */ROM2SDRAM_COPY_LOOP:    LDR    r3, [r0], #4    STR    r3, [r2], #4    SUBS   r1, r1, #4         /* Down Count */    BNE    ROM2SDRAM_COPY_LOOP#if 0	/* Amine: deleted *//*==================================== * Change Base address of ROM and DRAM *==================================== *//* Multiple load LDMIA instruction cannot be used as there is  * no way to load the address L$_SystemInitDataSDRAM_S into a  * register (LDR Rn,=sym is broken) */    LDR    r1, L$_SystemInitDataSDRAM_S    LDR    r2, L$_SystemInitDataSDRAM_S + 0x04    LDR    r3, L$_SystemInitDataSDRAM_S + 0x08    LDR    r4, L$_SystemInitDataSDRAM_S + 0x0c    LDR    r5, L$_SystemInitDataSDRAM_S + 0x10    LDR    r6, L$_SystemInitDataSDRAM_S + 0x14    LDR    r7, L$_SystemInitDataSDRAM_S + 0x18    LDR    r8, L$_SystemInitDataSDRAM_S + 0x1c    LDR    r9, L$_SystemInitDataSDRAM_S + 0x20    LDR    r10,L$_SystemInitDataSDRAM_S + 0x24    LDR    r11,L$_SystemInitDataSDRAM_S + 0x28    LDR    r12,L$_SystemInitDataSDRAM_S + 0x2c    LDR    r0, L$_SBCARM7Extdbwth     /* ROMCntr Offset : 0x3010 */    STMIA  r0, {r1-r12}#endif    LDR    PC, L$_HiPosn    #if 0	/* Amine: deleted */EDO_RAM:    LDR    r0, L$_SBCARM7Syscfg    LDR    r1, L$_SysCfg    STR    r1, [r0]/* ROM and RAM Configuration(Multiple Load and Store) * Multiple load LDMIA instruction cannot be used as there is  * no way to load the address L$_SystemInitData into a  * register (LDR Rn,=sym is broken) */    LDR    r1, L$_SystemInitData     LDR    r2, L$_SystemInitData + 0x04    LDR    r3, L$_SystemInitData + 0x08    LDR    r4, L$_SystemInitData + 0x0c    LDR    r5, L$_SystemInitData + 0x10    LDR    r6, L$_SystemInitData + 0x14    LDR    r7, L$_SystemInitData + 0x18    LDR    r8, L$_SystemInitData + 0x1c    LDR    r9, L$_SystemInitData + 0x20    LDR    r10,L$_SystemInitData + 0x24    LDR    r11,L$_SystemInitData + 0x28    LDR    r12,L$_SystemInitData + 0x2c    LDR    r0, L$_SBCARM7Extdbwth    /* ROMCntr Offset : 0x3010 */    STMIA  r0, {r1-r12}/*============================================================= * Copy to DRAM the section of ROM in which we are currently executing. * Soon, we will set the base pointer of DRAM to where the base pointer of * ROM used to be.  At that point the PC will suddenly be set in RAM and * must have legitimate code to execute. *============================================================= */    MOV    r0, #RESET_ROM_START         /* Get pointer to ROM data */    LDR    r1, L$_RomCopySize           /* number of ROM bytes to copy into RAM */    MOV    r2, #RESET_DRAM_START        /* Copy DRAM area base */ROM2DRAM_COPY_LOOP:    LDR    r3, [r0], #4    STR    r3, [r2], #4    SUBS   r1, r1, #4            /* Down Count */    BNE    ROM2DRAM_COPY_LOOP

⌨️ 快捷键说明

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