aeyes wrote on Thursday, August 07, 2008:
Hi Richard ,
Thanks a lot .
I will paste the stsrtup file for your reference . The first problem is that the interrupts are not gettign disabled somehow when the code enters the main . It could be a simulator problem , I have posted a mail at the skyeye forum too regarding this .
Also I have edited only the prvsetuptimer function of the code to accomodate the S3C4510b timer . I have given an arbitrary delay for the timer which is a long one . The timer setup is fine as I have checked running the timer on the simulator . Also I put a endless for loop at the end of the code on prvtimer setup to check if the timer is running , and the timer runs.
Also S3C4510b hass a non vectored interrupt structure so I have dedicated the IRQ interrupt request for the timer interrupt, so at the IRQ ISR I have given a branch to the tick ISR routine directly . I have removed the naked attribute and handling the return from interrupt at the assembly level itself .
I am using the Yagarto GNU compiler. I am setting upma stack for the Supervisor and IRQ modes in the startup . I have borrowed the stsrtup routing from somewhere and made the necessary changes.
I am creatijgn2 tasks and trying to run them , the code starts running as I have put various check points in the RTOS source which sends characters out through the UART to indicate a particular section of the code has been reaches, but I am unable to trace it to where it finally hangs.
Also since I am new to embedded development on the whole , I have issues in running GDB and getting a stack dump , but I am working on it .
Pasting the startup code below for you to have a look . Please note that just before the branch to the main routine I have moved to the supervisor mode and disabled the interrupts , but still the interrupts did not get disabled.
Thank you .
/*************************************************************************/
/* crt.S */
/* S3C4510 */
/*************************************************************************/
@ .include "S3C4510.mac"
.EQU LOCKOUT, 0xC0
.EQU MODE_MASK, 0x1F
.EQU UDF_MODE, 0x1B
.EQU ABT_MODE, 0x17
.EQU SUP_MODE, 0x13
@ SVC
.EQU IRQ_MODE, 0x12
@ IRQ
.EQU FIQ_MODE, 0x11
@ FIQ
.EQU USR_MODE, 0x10
@ USR
.equ I_BIT, 0x80
/* when I bit is set, IRQ is disabled */
.equ F_BIT, 0x40
/* when F bit is set, FIQ is disabled */
.set
MODE_SVC, 0x13 /* Supervisor Mode */
ENTRY:
B Reset_Handler
B SystemUndefinedHandler
B SystemSwiHandler
B SystemPrefetchHandler
B SystemAbortHandler
B SystemReserv
B SystemIrqHandler
B SystemFiqHandler
.global Reset_Handler
Reset_Handler:
LDR r0, =0x3FF0000
LDR r1, =0xe7ffff90
STR r1, [r0]
LDR r0, =0x3ff3008
LDR r1, =0x6000000
@ Trying to configure EXTACON0 with tACC1 = 5 cycles
STR r1, [r0]
.ifdef
ROM
LDR r0, =SystemInitDataSDRAM
LDMIA r0, {r1-r12}
LDR r0, =0x3FF0000 + 0x3010
STMIA r0, {r1-r12}
.endif
.extern Image_RO_Limit
.extern Image_RW_Base
.extern Image_ZI_Base
.extern Image_ZI_Limit
LDR r0, =Image_RO_Limit
LDR r1, =Image_RW_Base
LDR r3, =Image_ZI_Base
CMP r0, r1
BEQ LOOP1
LOOP0:
CMP r1, r3
LDRCC r2, [r0], #4
STRCC r2, [r1], #4
BCC LOOP0
LOOP1:
LDR r1, =Image_ZI_Limit
MOV r2, #0
LOOP2:
CMP r3, r1
STRCC r2, [r3], #4
BCC LOOP2
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
MRS r0, cpsr
BIC r0, r0, #LOCKOUT | MODE_MASK
ORR r1, r0, #USR_MODE
MSR cpsr_cf, r0
LDR sp, =USR_STACK
msr CPSR_c, #MODE_SVC|I_BIT|F_BIT # this is where I have tried to disable the IRQ and FIQ ISR but it has no effect …
.extern main
BL main
SystemUndefinedHandler:
B SystemUndefinedHandler
SystemSwiHandler:
B SystemSwiHandler
MakeSVC:
B MakeSVC
SystemPrefetchHandler:
B SystemPrefetchHandler
SystemAbortHandler:
B SystemAbortHandler
SystemReserv:
B SystemReserv
SystemIrqHandler:
.extern ISR_IrqHandler
STMFD sp!, {r0-r12, lr}
BL ISR_IrqHandler
LDMFD sp!, {r0-r12, lr}
SUBS pc, lr, #4
SystemFiqHandler:
.extern ISR_FiqHandler
STMFD sp!, {r0-r7, lr}
BL ISR_FiqHandler
LDMFD sp!, {r0-r7, lr}
SUBS pc, lr, #4
SystemInitDataSDRAM:
.long 0x0a7fff0f @;EXTDBWTH
#.long 0x01000060 @;ROMCON0
.long 0x02000060 @;ROMCON0
#.long 0x13044060 @;ROMCON1
.long 0x22080060 @;ROMCON1
.long 0x00000060 @;ROMCON2
.long 0x00000060 @;ROMCON3
.long 0x00000060 @;ROMCON4
.long 0x00000060 @;ROMCON5
.long 0x11004380 @;DRAMCON0
#.long 0x20040380 @;DRAMCON0
.long 0x00000000 @;DRAMCON1
.long 0x00000000 @;DRAMCON2
.long 0x00000000 @;DRAMCON3
.long 0xce278360 @;REFEXTCON
# .long 0x00003E02 @ EXTDBWTH
# .long 0x02000060 @ ROMCOON0 0~0x200000
# .long 0x40010040
# .long 0x00000060
# .long 0x00000060
# .long 0x00000060
# .long 0x00000060
# .long 0x14010301
# .long 0x00000000
# .long 0x00000000
# .long 0x00000000
# .long 0x9C298360
.data
.SPACE 1024
USR_STACK:
.SPACE 512
UDF_STACK:
.SPACE 512
ABT_STACK:
.SPACE 512
IRQ_STACK:
.SPACE 512
FIQ_STACK:
.SPACE 512
SUP_STACK: