[U-Boot-Users] Re: Questions about startup code for S3C44B0 CPU-core

Andrea Scian andrea.scian at dave-tech.it
Mon Jan 19 19:43:38 CET 2004


Hi Alex,


>Hi Andrea,
>
>in s3c44b0x's app03-test.pdf, the stacks in boot code are initialized like 
>this:
>
>     ;****************************************************
>     ;* Initialize stacks *
>     ;****************************************************
>     ldr sp, =SVCStack ;Why?
>     bl InitStacks
>     ......
>     ;****************************************************
>     ;* Initialize stacks    *
>     ;****************************************************
>InitStacks
>         ;Don't use DRAM,such as stmfd,ldmfd......
>         ;SVCstack is initialized before
>         ;Under toolkit ver 2.50, 'msr cpsr,r1' can be used instead of 
> 'msr cpsr_cxsf,r1'
>     mrs     r0,cpsr
>     bic     r0,r0,#MODEMASK
>     orr     r1,r0,#UNDEFMODE|NOINT
>     msr     cpsr_cxsf,r1   ;UndefMode
>     ldr     sp,=UndefStack
>
>     orr     r1,r0,#ABORTMODE|NOINT
>     msr     cpsr_cxsf,r1       ;AbortMode
>     ldr     sp,=AbortStack
>
>     orr     r1,r0,#IRQMODE|NOINT
>     msr     cpsr_cxsf,r1       ;IRQMode
>     ldr     sp,=IRQStack
>
>     orr     r1,r0,#FIQMODE|NOINT
>     msr     cpsr_cxsf,r1       ;FIQMode
>     ldr     sp,=FIQStack
>
>     orr     r1,r0,#SVCMODE|NOINT
>     msr     cpsr_cxsf,r1       ;SVCMode
>     ldr     sp,=SVCStack
>......

Thanks you very much for the piece of code, I have find the original 
Samsung document and now I can understand what you are talking about! 
(well.. it has been a long time since I have read that doc! :-)

>But in U-boot there isn't any code like this.

In u-boot there is no need of that code because the only thing u-boot does 
when there is an exception is to reset the board (ARM architecture does not 
need stack because it uses banked register on exception, so only user code 
needs it? am I wrong?).
BTW I think the reset code is not right because it just jump to the reset 
vector, which may not be what you want to reset the board (I think the 
better way is to call cpu_reset() or something like that and use the 
watchdog, don't you think so?)


>BTW, we have run a uclinux in our 44b0x system, but there isn't any code 
>for initializing stacks in uclinux.
>What should the cpu do if any of the exceptions happen?
>
>So I think the code like this are not very reliable. Is my comprehension 
>right? Or if we should initialize these stacks before call start_kernel() 
>in uclinux?

Don't really know how the ARM Linux kernel works regarding interrupt and 
exception stack... are you really sure that it does not initialize stack?
Now I don't allocate stack for interrupt but interrupts works pretty well :-)
Anyway I'll have a close look at the source code as soon as I can...

BTW did you found some ARMLinux docs where it says that ARMLinux bootloader 
have to set up stack before calling the kernel? (I'll have another look at 
them too as soon as I can...)

Best Regards,
Andrea


>Best Regards,
>
>Alex Zu
>----- Original Message -----
>From: "Andrea Scian" <andrea.scian at dave-tech.it>
>To: "Alex Zu" <Seu_huizu at tom.com>
>Cc: <u-boot-users at lists.sourceforge.net>
>Sent: Friday, January 14, 2005 7:13 PM
>Subject: Re: Questions about startup code for S3C44B0 CPU-core
>
>
> >
> > Hi Alex,
> >
> >
> >>Hi Andrea,
> >>  thank you for your explanation but the stacks of EXCEPTION MODEs
> >> which  we discussed about
> >>is still not very clear.  U-boot here does not use interrupts,so there is
> >>no need for such
> >>initialization for interrupts,but we can"t insure that there is no core
> >>exception.In case of
> >>these exception,the system may go wrong. So I think that we should
> >>initialize the stacks for
> >>those exceptions.
> >
> > BTW, even if not used into the bootloader, interrupt vector are 
> initialized
> > by u-boot (take a look at cpu/s3c44b0/start.S)
> >
> >
> >>And there is no initialization in linux, either.What should linux do in
> >>case of these
> >>exceptions. So there is the initialization in other common start codes of
> >>s3c44b0x.
> >
> > Something is still not clear to me... could you please tell me where I can
> > find some example of such code (or where this initialization is explained
> > into the ARM or Samsung manual)? Thanks.
> >
> > Best Regards,
> >
> > Andrea Scian
> >
> >





More information about the U-Boot mailing list