📄 entry.s
字号:
#include <c220hw.h> .text .align#define FLASH_START 0x40000000/*--------------------------------- * SRAM extension card addresses * -------------------------------- */#define SMEC_BASE 0x00000000#define SMEC_DATA_START 0x400#define STACK 0x800000/* ------------------------ List of Exported resources -------------------------*/ .globl __entry,_entry .globl __stext,_stext .globl _start,start/*------------------------------------------------------------------------------*//* Define the vector table.*//* The reset vector jumps to the handler code.*//* All others just dead loop on themselves!*//*------------------------------------------------------------------------------*//*------------------------------------------------------------------------------*//* InitReset. This code is executed with the FLASH at address 0.*//*------------------------------------------------------------------------------*/startoftext: b InitResetundefvec: b undefvecswivec: b swivecpabtvec: b pabtvecdabtvec: b dabtvecrsvdvec: b rsvdvecirqvec: b irqvecfiqvec: b fiqvec .long 0InitReset:start:_start:_stext:_entry:__stext:__entry:/* Program the clock at full speed */ ldr r0, =0xff000000 ldr r1, =0x00000041 str r1, [r0] ldr r1, =0x00000001 str r1, [r0]/* Wait for the PLL to lock */waitLock: ldr r2, [r0, #12] cmp r2, #1 bne waitLock/* Perform the Remapping of FLASH and SMEC *//* Copy the Image of the SMC & SDMC Memory Controller*/ adr r10, InitTableSMC /* get the address of the SMC chip select image */ adr r11, InitTableSDMC /* get the address of the DMC chip select image */ /* Load the address where to jump, Zero out the most significant bits.*/ ldr r0, =InitRemap /* get the real jump address ( after remap )*/ mov r0, r0, LSL #12 mov r0, r0, LSR #12/* Calculate new PC after the SMC and DMC have been reconfigured.*/ ldr r1, [r10] ldr r2, =0xfff00000 and r1, r2, r1 add r12, r0, r1/* Configure the SMC and SDMC *//* Note that the SDMC has to be configured although it's not used ! */ ldmia r11!, {r5-r6} /* Load the SDMC values */ ldmia r10!, {r0-r4} /* Load the SMC values */ stmia r6, {r5} /* Store the SDMC values */ stmia r4!, {r0-r3} /* Store the SMC values */ stmia r6, {r5} /* Store the SDMC values */ mov pc, r12 /* jump and break the pipeline*//*------------------------------------------------------------------------------*//* InitReset.*//*------------------------------------------------------------------------------*/InitRemap:/* Setup the SVC mode and stack pointer on the top of the internal RAM */ mov r0, #(ARM_MODE_SVC | ARM_I_BIT | ARM_F_BIT ) /* No interrupts */ msr cpsr, r0 ldr r0, =FLASH_START ldr r2, =startoftext ldr r13, =STACK ldr r1, =SMEC_DATA_START b _main/*------------------------------------------------------------------------------*//* SMC Memory controller configurations - FLASH 16 bit, 2 chips of 2Mb*//*------------------------------------------------------------------------------ */InitTableSMC: .long 0x400020bd /* SMC CSR0 */ .long 0x000020a1 /* SMC CSR1 */ .long 0x004020a1 /* SMC CSR2 */ .long 0x300020fd /* SMC CSR3 */ .long SMC_BASE /* SMC Base Address */ InitTableSDMC: .long 0x00000080 /* Base address of CS0 */ .long SDMC_BASE+16 /* SDMC Base */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -