Why calling kernelInit two times. - VxWorks

This is a discussion on Why calling kernelInit two times. - VxWorks ; Hi all, When I was studying boot sequence I found the below abnormality. There is kernel init call kernelInit ((FUNCPTR) usrRoot, ROOT_STACK_SIZE, \ (char *) MEM_POOL_START_ADRS, sysMemTop (), ISR_STACK_SIZE, INT_LOCK_LEVEL); in usrKernelInit() function in usrkernel.c . which is called from ...

Thread: Why calling kernelInit two times.

1. Why calling kernelInit two times.

Hi all,

When I was studying boot sequence I found the below abnormality.

There is kernel init call

kernelInit ((FUNCPTR) usrRoot, ROOT_STACK_SIZE, \
sysMemTop (), ISR_STACK_SIZE, INT_LOCK_LEVEL); in
usrKernelInit() function in usrkernel.c .

which is called from usrInit() function. but after calling
usrKernelInit(), we again calling kernelInit() from usrInit(). in
bootconfig.c

I wonder why we are calling kernelInit two time..?

Any one know the reason?

I am using vxworks 6.4 ..

Regards,
Nabendu

2. Re: Why calling kernelInit two times.

On Jul 17, 9:09 am, Nabendu wrote:
> Hi all,
>
> When I was studying boot sequence I found the below abnormality.
>
> There is kernel init call
>
> kernelInit ((FUNCPTR) usrRoot, ROOT_STACK_SIZE, \
> sysMemTop (), ISR_STACK_SIZE, INT_LOCK_LEVEL); in
> usrKernelInit() function in usrkernel.c .
>
> which is called from usrInit() function. but after calling
> usrKernelInit(), we again calling kernelInit() from usrInit(). in
> bootconfig.c
>
> I wonder why we are calling kernelInit two time..?
>
> Any one know the reason?
>
> I am using vxworks 6.4 ..
>

Hhhmm, if you had found a third module with a call to kernelInit(),
would you have assumed it was being called 3 times? ;-)
Seriously, it is not being called twice.

HTH,
GV

3. Re: Why calling kernelInit two times.

On Jul 17, 7:25 pm, gvarndell wrote:
> On Jul 17, 9:09 am, Nabendu wrote:
>
>
>
> > Hi all,

>
> > When I was studying boot sequence I found the below abnormality.

>
> > There is kernel init call

>
> > kernelInit ((FUNCPTR) usrRoot, ROOT_STACK_SIZE, \
> > sysMemTop (), ISR_STACK_SIZE, INT_LOCK_LEVEL); in
> > usrKernelInit() function in usrkernel.c .

>
> > which is called from usrInit() function. but after calling
> > usrKernelInit(), we again calling kernelInit() from usrInit(). in
> > bootconfig.c

>
> > I wonder why we are calling kernelInit two time..?

>
> > Any one know the reason?

>
> > I am using vxworks 6.4 ..

>
> Hhhmm, if you had found a third module with a call to kernelInit(),
> would you have assumed it was being called 3 times? ;-)
> Seriously, it is not being called twice.
>
> HTH,
> GV

Logically I understand it should not be called more than once.

GV,Had you ever gone through the code of usrInit() in target\config\all
\bootconfig.c or usrConfig.c
and usrKernelInit() code in target\config\comps\src\usrKernel.c ?

(FYI - bootconfig.c or usrConfig.c are copied and modified to BSP

Regards,
Nabendu

4. Re: Why calling kernelInit two times.

On Jul 17, 11:24 am, Nabendu wrote:
> On Jul 17, 7:25 pm, gvarndell wrote:
>
>
>
> > On Jul 17, 9:09 am, Nabendu wrote:

>
> > > Hi all,

>
> > > When I was studying boot sequence I found the below abnormality.

>
> > > There is kernel init call

>
> > > kernelInit ((FUNCPTR) usrRoot, ROOT_STACK_SIZE, \
> > > (char *) MEM_POOL_START_ADRS,
> > > sysMemTop (), ISR_STACK_SIZE, INT_LOCK_LEVEL); in
> > > usrKernelInit() function in usrkernel.c .

>
> > > which is called from usrInit() function. but after calling
> > > usrKernelInit(), we again calling kernelInit() from usrInit(). in
> > > bootconfig.c

>
> > > I wonder why we are calling kernelInit two time..?

>
> > > Any one know the reason?

>
> > > I am using vxworks 6.4 ..

>
> > Hhhmm, if you had found a third module with a call to kernelInit(),
> > would you have assumed it was being called 3 times? ;-)
> > Seriously, it is not being called twice.

>
> > HTH,
> > GV

>
> Logically I understand it should not be called more than once.
>
> GV,Had you ever gone through the code of usrInit() in target\config\all
> \bootconfig.c or usrConfig.c
> and usrKernelInit() code in target\config\comps\src\usrKernel.c ?

No, never.

>
> (FYI - bootconfig.c or usrConfig.c are copied and modified to BSP

Actually, you're right -- kernelInit() is called twice.
Once when the bootrom image executes.
And then again when the ram image is executed.
And, if you reset the target, it's executed 4 times. ;-)

HTH
GV

5. Re: Why calling kernelInit two times.

On Jul 18, 12:06 am, gvarndell wrote:
> On Jul 17, 11:24 am, Nabendu wrote:
>
>
>
> > On Jul 17, 7:25 pm, gvarndell wrote:

>
> > > On Jul 17, 9:09 am, Nabendu wrote:

>
> > > > Hi all,

>
> > > > When I was studying boot sequence I found the below abnormality.

>
> > > > There is kernel init call

>
> > > > kernelInit ((FUNCPTR) usrRoot, ROOT_STACK_SIZE, \
> > > > (char *) MEM_POOL_START_ADRS,
> > > > sysMemTop (), ISR_STACK_SIZE, INT_LOCK_LEVEL); in
> > > > usrKernelInit() function in usrkernel.c .

>
> > > > which is called from usrInit() function. but after calling
> > > > usrKernelInit(), we again calling kernelInit() from usrInit(). in
> > > > bootconfig.c

>
> > > > I wonder why we are calling kernelInit two time..?

>
> > > > Any one know the reason?

>
> > > > I am using vxworks 6.4 ..

>
> > > Hhhmm, if you had found a third module with a call to kernelInit(),
> > > would you have assumed it was being called 3 times? ;-)
> > > Seriously, it is not being called twice.

>
> > > HTH,
> > > GV

>
> > Logically I understand it should not be called more than once.

>
> > GV,Had you ever gone through the code of usrInit() in target\config\all
> > \bootconfig.c or usrConfig.c
> > and usrKernelInit() code in target\config\comps\src\usrKernel.c ?

>
> No, never.
>
>
>
> > (FYI - bootconfig.c or usrConfig.c are copied and modified to BSP
> > directory any change required in bootloader commads or other things)

>
> Actually, you're right -- kernelInit() is called twice.
> Once when the bootrom image executes.
> And then again when the ram image is executed.
> And, if you reset the target, it's executed 4 times. ;-)
>
> HTH
> GV

haha really funny, ya, 6 times if i reset 2 times ,,ie n*2 +2 if i
reset n times...????

usrConfig.c is used for vxworks image and bootconfig.c for bootloder/
botrom.some functions are defined as same/almost same in them(usr .

so before giving any command from boot prompt of bootloader
(bootcmdloop) kernelinit called 2 times,
after giving boot command (e.g. @) image is loaded to ram and run
it ,there kernelinit run 2 times

So total no of kernelInit is 4.

Correct me if I'm wrong.

Regards,
Nabendu

6. Re: Why calling kernelInit two times.

On Jul 18, 12:48 am, Nabendu wrote:
> On Jul 18, 12:06 am, gvarndell wrote:
>
>
>
> > On Jul 17, 11:24 am, Nabendu wrote:

>
> > > On Jul 17, 7:25 pm, gvarndell wrote:

>
> > > > On Jul 17, 9:09 am, Nabendu wrote:

>
> > > > > Hi all,

>
> > > > > When I was studying boot sequence I found the below abnormality.

>
> > > > > There is kernel init call

>
> > > > > kernelInit ((FUNCPTR) usrRoot, ROOT_STACK_SIZE, \
> > > > > (char *) MEM_POOL_START_ADRS,
> > > > > sysMemTop (), ISR_STACK_SIZE, INT_LOCK_LEVEL); in
> > > > > usrKernelInit() function in usrkernel.c .

>
> > > > > which is called from usrInit() function. but after calling
> > > > > usrKernelInit(), we again calling kernelInit() from usrInit(). in
> > > > > bootconfig.c

>
> > > > > I wonder why we are calling kernelInit two time..?

>
> > > > > Any one know the reason?

>
> > > > > I am using vxworks 6.4 ..

>
> > > > Hhhmm, if you had found a third module with a call to kernelInit(),
> > > > would you have assumed it was being called 3 times? ;-)
> > > > Seriously, it is not being called twice.

>
> > > > HTH,
> > > > GV

>
> > > Logically I understand it should not be called more than once.

>
> > > GV,Had you ever gone through the code of usrInit() in target\config\all
> > > \bootconfig.c or usrConfig.c
> > > and usrKernelInit() code in target\config\comps\src\usrKernel.c ?

>
> > No, never.

>
> > > (FYI - bootconfig.c or usrConfig.c are copied and modified to BSP
> > > directory any change required in bootloader commads or other things)

>
> > Actually, you're right -- kernelInit() is called twice.
> > Once when the bootrom image executes.
> > And then again when the ram image is executed.
> > And, if you reset the target, it's executed 4 times. ;-)

>
> > HTH
> > GV

>
> haha really funny, ya, 6 times if i reset 2 times ,,ie n*2 +2 if i
> reset n times...????
>
> usrConfig.c is used for vxworks image and bootconfig.c for bootloder/
> botrom.some functions are defined as same/almost same in them(usr .
>
> so before giving any command from boot prompt of bootloader
> (bootcmdloop) kernelinit called 2 times,
> after giving boot command (e.g. @) image is loaded to ram and run
> it ,there kernelinit run 2 times
>
> So total no of kernelInit is 4.
>
> Correct me if I'm wrong.
>

If I really took off on you, someone (someone who otherwise would
never bother) would think me an obnoxious bore and feel really sorry
for you and come to your rescue.
I think I'll just let you think about it for a while.

GV