共2条
1/1 1 跳转至页
S3C4510B 关于S3C4510B的启动部分的代码,请各位指导一下,谢谢!
问
void SysSetInterrupt(REG32 vector, void (*handler)())
{
InterruptHandlers[vector] = handler;
}
我将三星snds100开发板上的程序(其中包含串口、HDLC、中断等)移植到我的S3C4510B板子上,目前在板子上用仿真器仿真,程序跑起来正常(含串口、HDLC、中断等),但我不知道如何把此程序装载到我的板子上让其掉电不丢失,我使用的init.s程序如下,哪位大侠伸伸手、帮帮
忙,谢谢了。都折腾7天了没出来,我都快急疯了。
使用此init.s程序,不能正常启动。
SYNC_DRAM_CONFIGURATION
LDR r0, =0x3FF0000
LDR r1, =0x83FFFF90 ; SetValue = 0x83FFFF91
STR r1, [r0] ; Cache,WB disable
; Start_addr = 0x3FF00000
;ROM and RAM Configuration(Multiple Load and Store)
LDR r0, =SystemInitDataSDRAM
LDMIA r0, {r1-r12}
LDR r0, =0x3FF0000 + 0x3010 ; ROMCntr Offset : 0x3010
STMIA r0, {r1-r12}
还有我不明白的是此程序上电只做了一次映像,没做重映像,不知为何?
我用Twentyone(xuzhouhe@hotmail.com)大侠告诉的方法写一启动代码也不好用。
init.s文件为
;====================================================
;//SRAM的基地址(=0x3FE0000),共8k空间
;====================================================
SystemStackAdr EQU 0x3FE0000
USR_STACK_SIZE EQU 1024
UDF_STACK_SIZE EQU 512
ABT_STACK_SIZE EQU 512
IRQ_STACK_SIZE EQU 2048
FIQ_STACK_SIZE EQU 2048
SUP_STACK_SIZE EQU 2048
USR_STACK EQU SystemStackAdr + USR_STACK_SIZE
UDF_STACK EQU USR_STACK + UDF_STACK_SIZE
ABT_STACK EQU UDF_STACK + ABT_STACK_SIZE
IRQ_STACK EQU ABT_STACK + IRQ_STACK_SIZE
FIQ_STACK EQU IRQ_STACK + FIQ_STACK_SIZE
SUP_STACK EQU FIQ_STACK + SUP_STACK_SIZE
AREA Init, CODE, READONLY
CODE32
GET memory.s
GET snds.s
ENTRY
B Reset_Handler
B Undefined_Handler
B SWI_Handler
B Prefetch_Handler
B Abort_Handler
NOP ; Reserved vector
B IRQ_Handler
B FIQ_Handler
;==========================================================
; The Default Exception Handler Vector Entry Pointer Setup
;==========================================================
FIQ_Handler
SUB sp, sp, #4
STMFD sp!, {r0}
LDR r0, =HandleFiq
LDR r0, [r0]
STR r0, [sp, #4]
LDMFD sp!, {r0, pc}
IRQ_Handler
SUB sp, sp, #4
STMFD sp!, {r0}
LDR r0, =HandleIrq
LDR r0, [r0]
STR r0, [sp, #4]
LDMFD sp!, {r0, pc}
Prefetch_Handler
SUB sp, sp, #4
STMFD sp!, {r0}
LDR r0, =HandlePrefetch
LDR r0, [r0]
STR r0, [sp, #4]
LDMFD sp!, {r0, pc}
Abort_Handler
SUB sp, sp, #4
STMFD sp!, {r0}
LDR r0, =HandleAbort
LDR r0, [r0]
STR r0, [sp, #4]
LDMFD sp!, {r0, pc}
Undefined_Handler
SUB sp, sp, #4
STMFD sp!, {r0}
LDR r0, =HandleUndef
LDR r0, [r0]
STR r0, [sp, #4]
LDMFD sp!, {r0, pc}
SWI_Handler
SUB sp, sp, #4
STMFD sp!, {r0}
LDR r0, =HandleSwi
LDR r0, [r0]
STR r0, [sp, #4]
LDMFD sp!, {r0, pc}
AREA Main, CODE, READONLY
;==========================================================
; The Reset Entry Point
;==========================================================
EXPORT Reset_Handler
Reset_Handler ;/* Reset Entry Point */
LDR r1, =IntMask
LDR r0, =0xFFFFFFFF
STR r0, [r1]
;=====================================
; Initialise STACK
;=====================================
INITIALIZE_STACK
MRS r0, cpsr
BIC r0, r0, #LOCKOUT | MODE_MASK
ORR r2, r0, #USR_MODE
ORR r1, r0, #LOCKOUT | FIQ_MODE
MSR cpsr_cf, r1
MSR spsr_cf, r2
LDR sp, =FIQ_STACK
ORR r1, r0, #LOCKOUT | IRQ_MODE
MSR cpsr_cf, r1
MSR spsr_cf, r2
LDR sp, =IRQ_STACK
ORR r1, r0, #LOCKOUT | ABT_MODE
MSR cpsr_cf, r1
MSR spsr_cf, r2
LDR sp, =ABT_STACK
ORR r1, r0, #LOCKOUT | UDF_MODE
MSR cpsr_cf, r1
MSR spsr_cf, r2
LDR sp, =UDF_STACK
ORR r1, r0, #LOCKOUT | SUP_MODE
MSR cpsr_cf, r1
MSR spsr_cf, r2
LDR sp, =SUP_STACK ; Change CPSR to SVC mode
;=====================================
; LED Display
;=====================================
LDR r1, =IOPMODE
LDR r0, =0xFF
STR r0, [r1]
LDR r1, =IOPDATA
LDR r0, =0x55
STR r0, [r1]
;==================================================
; Special Register Configuration for SYNC DRAM
;==================================================
SYNC_DRAM_CONFIGURATION
LDR r0, =0x3FF0000
LDR r1, =0x83FFFF90 ; SetValue = 0x83FFFF91
STR r1, [r0] ; Cache,WB disable
; Start_addr = 0x3FF00000
;ROM and RAM Configuration(Multiple Load and Store)
LDR r0, =SystemInitDataSDRAM
LDMIA r0, {r1-r12}
LDR r0, =0x3FF0000 + 0x3010 ; ROMCntr Offset : 0x3010
STMIA r0, {r1-r12}
;=============================
; Exception Vector Table Setup
;=============================
EXCEPTION_VECTOR_TABLE_SETUP
LDR r0, =HandleReset ; Exception Vector Table Memory Loc.
LDR r1, =ExceptionHandlerTable ; Exception Handler Assign
MOV r2, #8 ; Number of Exception is 8
ExceptLoop
LDR r3, [r1], #4
STR r3, [r0], #4
SUBS r2, r2, #1 ; Down Count
BNE ExceptLoop
;=====================================
; Initialise memory required by C code
;=====================================
IMPORT |Image$$RO$$Limit| ; End of ROM code (=start of ROM data)
IMPORT |Image$$RW$$Base| ; Base of RAM to initialise
IMPORT |Image$$ZI$$Base| ; Base and limit of area
IMPORT |Image$$ZI$$Limit| ; to zero initialise
LDR r0, =|Image$$RO$$Limit| ; Get pointer to ROM data
LDR r1, =|Image$$RW$$Base| ; and RAM copy
LDR r3, =|Image$$ZI$$Base| ; Zero init base => top of initialised data
CMP r0, r1 ; Check that they are different
BEQ %1
0 CMP r1, r3 ; Copy init data
LDRCC r2, [r0], #4
STRCC r2, [r1], #4
BCC %0
1 LDR r1, =|Image$$ZI$$Limit| ; Top of zero init segment
MOV r2, #0
2 CMP r3, r1 ; Zero init
STRCC r2, [r3], #4
BCC %2
;====================================================
; Now change to user mode and set up user mode stack.
;====================================================
MRS r0, cpsr
BIC r0, r0, #LOCKOUT | MODE_MASK
ORR r1, r0, #USR_MODE
MSR cpsr_cf, r0
LDR sp, =USR_STACK
;===========================
; Now we enter the C Program
;===========================
BL Main
;===========================================
; Exception Vector Function Definition
; Consist of function Call from C-Program.
;===========================================
SystemUndefinedHandler
IMPORT ISR_UndefHandler
STMFD sp!, {r0-r12}
B ISR_UndefHandler
LDMFD sp!, {r0-r12, pc}^
SystemSwiHandler
STMFD sp!, {r0-r12,lr}
LDR r0, [lr, #-4]
BIC r0, r0, #0xff000000
CMP r0, #0xff
BEQ MakeSVC
LDMFD sp!, {r0-r12, pc}^
MakeSVC
MRS r1, spsr
BIC r1, r1, #MODE_MASK
ORR r2, r1, #SUP_MODE
MSR spsr_cf, r2
LDMFD sp!, {r0-r12, pc}^
SystemPrefetchHandler
IMPORT ISR_PrefetchHandler
STMFD sp!, {r0-r12, lr}
B ISR_PrefetchHandler
LDMFD sp!, {r0-r12, lr}
;ADD sp, sp, #4
SUBS pc, lr, #4
SystemAbortHandler
IMPORT ISR_AbortHandler
STMFD sp!, {r0-r12, lr}
B ISR_AbortHandler
LDMFD sp!, {r0-r12, lr}
;ADD sp, sp, #4
SUBS pc, lr, #8
SystemReserv
SUBS pc, lr, #4
SystemIrqHandler
IMPORT ISR_IrqHandler
STMFD sp!, {r0-r12, lr}
BL ISR_IrqHandler
LDMFD sp!, {r0-r12, lr}
SUBS pc, lr, #4
SystemFiqHandler
IMPORT ISR_FiqHandler
STMFD sp!, {r0-r7, lr}
BL ISR_FiqHandler
LDMFD sp!, {r0-r7, lr}
SUBS pc, lr, #4
AREA ROMDATA, DATA, READONLY
;======================================================
; SDRAM System Initialize Data (KS32C50100 only)
;======================================================
SystemInitDataSDRAM
DCD rEXTDBWTH
DCD rROMCON0 ; 0M ~ 4M-1
DCD rROMCON1
DCD rROMCON2
DCD rROMCON3
DCD rROMCON4
DCD rROMCON5
DCD rSDRAMCON0 ; 4M ~ 20M
DCD rSDRAMCON1
DCD rSDRAMCON2
DCD rSDRAMCON3
DCD rSREFEXTCON
;===========================================
; Exception Handler Vector Table Entry Point
;===========================================
ExceptionHandlerTable
DCD UserCodeArea
DCD SystemUndefinedHandler
DCD SystemSwiHandler
DCD SystemPrefetchHandler
DCD SystemAbortHandler
DCD SystemReserv
DCD SystemIrqHandler
DCD SystemFiqHandler
END
答 1: hehe我的到现在还没完全正常的使用所有程序呢?
{
InterruptHandlers[vector] = handler;
}
我将三星snds100开发板上的程序(其中包含串口、HDLC、中断等)移植到我的S3C4510B板子上,目前在板子上用仿真器仿真,程序跑起来正常(含串口、HDLC、中断等),但我不知道如何把此程序装载到我的板子上让其掉电不丢失,我使用的init.s程序如下,哪位大侠伸伸手、帮帮
忙,谢谢了。都折腾7天了没出来,我都快急疯了。
使用此init.s程序,不能正常启动。
SYNC_DRAM_CONFIGURATION
LDR r0, =0x3FF0000
LDR r1, =0x83FFFF90 ; SetValue = 0x83FFFF91
STR r1, [r0] ; Cache,WB disable
; Start_addr = 0x3FF00000
;ROM and RAM Configuration(Multiple Load and Store)
LDR r0, =SystemInitDataSDRAM
LDMIA r0, {r1-r12}
LDR r0, =0x3FF0000 + 0x3010 ; ROMCntr Offset : 0x3010
STMIA r0, {r1-r12}
还有我不明白的是此程序上电只做了一次映像,没做重映像,不知为何?
我用Twentyone(xuzhouhe@hotmail.com)大侠告诉的方法写一启动代码也不好用。
init.s文件为
;====================================================
;//SRAM的基地址(=0x3FE0000),共8k空间
;====================================================
SystemStackAdr EQU 0x3FE0000
USR_STACK_SIZE EQU 1024
UDF_STACK_SIZE EQU 512
ABT_STACK_SIZE EQU 512
IRQ_STACK_SIZE EQU 2048
FIQ_STACK_SIZE EQU 2048
SUP_STACK_SIZE EQU 2048
USR_STACK EQU SystemStackAdr + USR_STACK_SIZE
UDF_STACK EQU USR_STACK + UDF_STACK_SIZE
ABT_STACK EQU UDF_STACK + ABT_STACK_SIZE
IRQ_STACK EQU ABT_STACK + IRQ_STACK_SIZE
FIQ_STACK EQU IRQ_STACK + FIQ_STACK_SIZE
SUP_STACK EQU FIQ_STACK + SUP_STACK_SIZE
AREA Init, CODE, READONLY
CODE32
GET memory.s
GET snds.s
ENTRY
B Reset_Handler
B Undefined_Handler
B SWI_Handler
B Prefetch_Handler
B Abort_Handler
NOP ; Reserved vector
B IRQ_Handler
B FIQ_Handler
;==========================================================
; The Default Exception Handler Vector Entry Pointer Setup
;==========================================================
FIQ_Handler
SUB sp, sp, #4
STMFD sp!, {r0}
LDR r0, =HandleFiq
LDR r0, [r0]
STR r0, [sp, #4]
LDMFD sp!, {r0, pc}
IRQ_Handler
SUB sp, sp, #4
STMFD sp!, {r0}
LDR r0, =HandleIrq
LDR r0, [r0]
STR r0, [sp, #4]
LDMFD sp!, {r0, pc}
Prefetch_Handler
SUB sp, sp, #4
STMFD sp!, {r0}
LDR r0, =HandlePrefetch
LDR r0, [r0]
STR r0, [sp, #4]
LDMFD sp!, {r0, pc}
Abort_Handler
SUB sp, sp, #4
STMFD sp!, {r0}
LDR r0, =HandleAbort
LDR r0, [r0]
STR r0, [sp, #4]
LDMFD sp!, {r0, pc}
Undefined_Handler
SUB sp, sp, #4
STMFD sp!, {r0}
LDR r0, =HandleUndef
LDR r0, [r0]
STR r0, [sp, #4]
LDMFD sp!, {r0, pc}
SWI_Handler
SUB sp, sp, #4
STMFD sp!, {r0}
LDR r0, =HandleSwi
LDR r0, [r0]
STR r0, [sp, #4]
LDMFD sp!, {r0, pc}
AREA Main, CODE, READONLY
;==========================================================
; The Reset Entry Point
;==========================================================
EXPORT Reset_Handler
Reset_Handler ;/* Reset Entry Point */
LDR r1, =IntMask
LDR r0, =0xFFFFFFFF
STR r0, [r1]
;=====================================
; Initialise STACK
;=====================================
INITIALIZE_STACK
MRS r0, cpsr
BIC r0, r0, #LOCKOUT | MODE_MASK
ORR r2, r0, #USR_MODE
ORR r1, r0, #LOCKOUT | FIQ_MODE
MSR cpsr_cf, r1
MSR spsr_cf, r2
LDR sp, =FIQ_STACK
ORR r1, r0, #LOCKOUT | IRQ_MODE
MSR cpsr_cf, r1
MSR spsr_cf, r2
LDR sp, =IRQ_STACK
ORR r1, r0, #LOCKOUT | ABT_MODE
MSR cpsr_cf, r1
MSR spsr_cf, r2
LDR sp, =ABT_STACK
ORR r1, r0, #LOCKOUT | UDF_MODE
MSR cpsr_cf, r1
MSR spsr_cf, r2
LDR sp, =UDF_STACK
ORR r1, r0, #LOCKOUT | SUP_MODE
MSR cpsr_cf, r1
MSR spsr_cf, r2
LDR sp, =SUP_STACK ; Change CPSR to SVC mode
;=====================================
; LED Display
;=====================================
LDR r1, =IOPMODE
LDR r0, =0xFF
STR r0, [r1]
LDR r1, =IOPDATA
LDR r0, =0x55
STR r0, [r1]
;==================================================
; Special Register Configuration for SYNC DRAM
;==================================================
SYNC_DRAM_CONFIGURATION
LDR r0, =0x3FF0000
LDR r1, =0x83FFFF90 ; SetValue = 0x83FFFF91
STR r1, [r0] ; Cache,WB disable
; Start_addr = 0x3FF00000
;ROM and RAM Configuration(Multiple Load and Store)
LDR r0, =SystemInitDataSDRAM
LDMIA r0, {r1-r12}
LDR r0, =0x3FF0000 + 0x3010 ; ROMCntr Offset : 0x3010
STMIA r0, {r1-r12}
;=============================
; Exception Vector Table Setup
;=============================
EXCEPTION_VECTOR_TABLE_SETUP
LDR r0, =HandleReset ; Exception Vector Table Memory Loc.
LDR r1, =ExceptionHandlerTable ; Exception Handler Assign
MOV r2, #8 ; Number of Exception is 8
ExceptLoop
LDR r3, [r1], #4
STR r3, [r0], #4
SUBS r2, r2, #1 ; Down Count
BNE ExceptLoop
;=====================================
; Initialise memory required by C code
;=====================================
IMPORT |Image$$RO$$Limit| ; End of ROM code (=start of ROM data)
IMPORT |Image$$RW$$Base| ; Base of RAM to initialise
IMPORT |Image$$ZI$$Base| ; Base and limit of area
IMPORT |Image$$ZI$$Limit| ; to zero initialise
LDR r0, =|Image$$RO$$Limit| ; Get pointer to ROM data
LDR r1, =|Image$$RW$$Base| ; and RAM copy
LDR r3, =|Image$$ZI$$Base| ; Zero init base => top of initialised data
CMP r0, r1 ; Check that they are different
BEQ %1
0 CMP r1, r3 ; Copy init data
LDRCC r2, [r0], #4
STRCC r2, [r1], #4
BCC %0
1 LDR r1, =|Image$$ZI$$Limit| ; Top of zero init segment
MOV r2, #0
2 CMP r3, r1 ; Zero init
STRCC r2, [r3], #4
BCC %2
;====================================================
; Now change to user mode and set up user mode stack.
;====================================================
MRS r0, cpsr
BIC r0, r0, #LOCKOUT | MODE_MASK
ORR r1, r0, #USR_MODE
MSR cpsr_cf, r0
LDR sp, =USR_STACK
;===========================
; Now we enter the C Program
;===========================
BL Main
;===========================================
; Exception Vector Function Definition
; Consist of function Call from C-Program.
;===========================================
SystemUndefinedHandler
IMPORT ISR_UndefHandler
STMFD sp!, {r0-r12}
B ISR_UndefHandler
LDMFD sp!, {r0-r12, pc}^
SystemSwiHandler
STMFD sp!, {r0-r12,lr}
LDR r0, [lr, #-4]
BIC r0, r0, #0xff000000
CMP r0, #0xff
BEQ MakeSVC
LDMFD sp!, {r0-r12, pc}^
MakeSVC
MRS r1, spsr
BIC r1, r1, #MODE_MASK
ORR r2, r1, #SUP_MODE
MSR spsr_cf, r2
LDMFD sp!, {r0-r12, pc}^
SystemPrefetchHandler
IMPORT ISR_PrefetchHandler
STMFD sp!, {r0-r12, lr}
B ISR_PrefetchHandler
LDMFD sp!, {r0-r12, lr}
;ADD sp, sp, #4
SUBS pc, lr, #4
SystemAbortHandler
IMPORT ISR_AbortHandler
STMFD sp!, {r0-r12, lr}
B ISR_AbortHandler
LDMFD sp!, {r0-r12, lr}
;ADD sp, sp, #4
SUBS pc, lr, #8
SystemReserv
SUBS pc, lr, #4
SystemIrqHandler
IMPORT ISR_IrqHandler
STMFD sp!, {r0-r12, lr}
BL ISR_IrqHandler
LDMFD sp!, {r0-r12, lr}
SUBS pc, lr, #4
SystemFiqHandler
IMPORT ISR_FiqHandler
STMFD sp!, {r0-r7, lr}
BL ISR_FiqHandler
LDMFD sp!, {r0-r7, lr}
SUBS pc, lr, #4
AREA ROMDATA, DATA, READONLY
;======================================================
; SDRAM System Initialize Data (KS32C50100 only)
;======================================================
SystemInitDataSDRAM
DCD rEXTDBWTH
DCD rROMCON0 ; 0M ~ 4M-1
DCD rROMCON1
DCD rROMCON2
DCD rROMCON3
DCD rROMCON4
DCD rROMCON5
DCD rSDRAMCON0 ; 4M ~ 20M
DCD rSDRAMCON1
DCD rSDRAMCON2
DCD rSDRAMCON3
DCD rSREFEXTCON
;===========================================
; Exception Handler Vector Table Entry Point
;===========================================
ExceptionHandlerTable
DCD UserCodeArea
DCD SystemUndefinedHandler
DCD SystemSwiHandler
DCD SystemPrefetchHandler
DCD SystemAbortHandler
DCD SystemReserv
DCD SystemIrqHandler
DCD SystemFiqHandler
END
答 1: hehe我的到现在还没完全正常的使用所有程序呢?
共2条
1/1 1 跳转至页
回复
有奖活动 | |
---|---|
【有奖活动】分享技术经验,兑换京东卡 | |
话不多说,快进群! | |
请大声喊出:我要开发板! | |
【有奖活动】EEPW网站征稿正在进行时,欢迎踊跃投稿啦 | |
奖!发布技术笔记,技术评测贴换取您心仪的礼品 | |
打赏了!打赏了!打赏了! |