question about warm boot ,cold boot and Position Indepentdent Code - VxWorks

This is a discussion on question about warm boot ,cold boot and Position Indepentdent Code - VxWorks ; Hi, all I am confused the programming method in file rominit.s. I think we can replace lines between 11 and 29 with a single instruction "bl start" or just remove lines between 11 and 29 But it does not work ...

+ Reply to Thread
Results 1 to 5 of 5

Thread: question about warm boot ,cold boot and Position Indepentdent Code

  1. question about warm boot ,cold boot and Position Indepentdent Code

    Hi, all
    I am confused the programming method in file rominit.s.
    I think we can replace lines between 11 and 29 with a single
    instruction "bl start" or just remove lines between 11 and 29
    But it does not work .why?

    Question1: why it can use "bl cold" and "bl start" in line 3
    and 4 to jump,
    But can not use instruction "bl start" to replace the so-called
    Position Indepentdent Code between line11 and line 29?
    Question2: if we just remove lines between 11 and line 29, it will
    avoids jump and call instruction And it will execute sequentially,
    but it also does not work, why?

    Thanks a lot for you reply

    1 _romInit:
    2 romInit:
    3 bl cold
    4 bl start /* warm start ,called from systoMonitor*/
    5 .ascii "Copyright 1999-2000 Goldencom Networks, Inc."
    6 .align 4
    7 cold:
    8 /* clear out r0 */
    9 xor r0, r0, r0
    10 li r3, BOOT_COLD
    11 /* r4 = start() */
    12 lis r4, HIADJ(start)
    13 addi r4, r4, LO(start)
    14
    15 /* r5 = romInit() */
    16 lis r5, HIADJ(romInit)
    17 addi r5, r5, LO(romInit)
    18
    19 /* r6 = ROM_TEXT_ADRS */
    20 lis r6, HIADJ(ROM_TEXT_ADRS)
    21 addi r6, r6, LO(ROM_TEXT_ADRS)
    22
    23 sub r4, r4, r5
    24 add r4, r4, r6
    25
    26 /* goto (start-romInit+ROM_TEXT_ADRS) */
    27 mtspr LR, r4
    28 blr
    29
    30 start:
    31
    32 /* clear out r0 */
    33 xor r0, r0, r0
    34
    35 /* set the MSR & SRR1 to a known state */
    36 lis r4, 0x0000
    37 addi r4, r4, 0x1002


  2. Re: question about warm boot ,cold boot and Position Indepentdent Code

    PowePC generally boots from address 0xFFF00100.

    Boot code is generally linked for RAM_HIGH_ADRS e.g. something like
    0x1E000000.

    The maths is changing a link address of romInit() like 0x1E00xxxx to a real
    boot ROM address 0xFFF0xxxx and putting the result in the link register LR.

    On a cold start, there is nothing in RAM yet.

    Once the code is copied from ROM to RAM_HIGH_ADRS the linker supplied
    addresses will be correct.

    --


    Regards,


    Graham Baxter
    Freelance Software Engineer (VxWorks, Linux and pSOS BSPs)
    Graham Baxter (Software) Limited
    http://www.gbsw.co.uk
    fromnewsgrp@NOSPAMgbsw.co.uk


    "lucas.isaac" wrote in message
    news:1155304285.321918.302180@h48g2000cwc.googlegr oups.com...
    > Hi, all
    > I am confused the programming method in file rominit.s.
    > I think we can replace lines between 11 and 29 with a single
    > instruction "bl start" or just remove lines between 11 and 29
    > But it does not work .why?
    >
    > Question1: why it can use "bl cold" and "bl start" in line 3
    > and 4 to jump,
    > But can not use instruction "bl start" to replace the so-called
    > Position Indepentdent Code between line11 and line 29?
    > Question2: if we just remove lines between 11 and line 29, it will
    > avoids jump and call instruction And it will execute sequentially,
    > but it also does not work, why?
    >
    > Thanks a lot for you reply
    >
    > 1 _romInit:
    > 2 romInit:
    > 3 bl cold
    > 4 bl start /* warm start ,called from systoMonitor*/
    > 5 .ascii "Copyright 1999-2000 Goldencom Networks, Inc."
    > 6 .align 4
    > 7 cold:
    > 8 /* clear out r0 */
    > 9 xor r0, r0, r0
    > 10 li r3, BOOT_COLD
    > 11 /* r4 = start() */
    > 12 lis r4, HIADJ(start)
    > 13 addi r4, r4, LO(start)
    > 14
    > 15 /* r5 = romInit() */
    > 16 lis r5, HIADJ(romInit)
    > 17 addi r5, r5, LO(romInit)
    > 18
    > 19 /* r6 = ROM_TEXT_ADRS */
    > 20 lis r6, HIADJ(ROM_TEXT_ADRS)
    > 21 addi r6, r6, LO(ROM_TEXT_ADRS)
    > 22
    > 23 sub r4, r4, r5
    > 24 add r4, r4, r6
    > 25
    > 26 /* goto (start-romInit+ROM_TEXT_ADRS) */
    > 27 mtspr LR, r4
    > 28 blr
    > 29
    > 30 start:
    > 31
    > 32 /* clear out r0 */
    > 33 xor r0, r0, r0
    > 34
    > 35 /* set the MSR & SRR1 to a known state */
    > 36 lis r4, 0x0000
    > 37 addi r4, r4, 0x1002
    >




  3. Re: question about warm boot ,cold boot and Position Indepentdent Code

    Graham:
    i am appreciateing you reply,

    but you did not answer the question 1 and question 2.

    you answer fit for the situation when jump to Romstart() in tail of
    file rominit.s.
    when call Romstart() there must be a function call ( meaning without
    this function call
    we can not jump to Romstart(),for it can not execute sequentially to
    reach Romstart() ),so it use the method you just pointed out.
    but this does not apply to Question 1,because it can execute
    sequentially to reach the symbol "Start"


    Graham Baxter wrote:
    > PowePC generally boots from address 0xFFF00100.
    >
    > Boot code is generally linked for RAM_HIGH_ADRS e.g. something like
    > 0x1E000000.
    >
    > The maths is changing a link address of romInit() like 0x1E00xxxx to a real
    > boot ROM address 0xFFF0xxxx and putting the result in the link register LR.
    >
    > On a cold start, there is nothing in RAM yet.
    >
    > Once the code is copied from ROM to RAM_HIGH_ADRS the linker supplied
    > addresses will be correct.
    >
    > --
    >
    >
    > Regards,
    >
    >
    > Graham Baxter
    > Freelance Software Engineer (VxWorks, Linux and pSOS BSPs)
    > Graham Baxter (Software) Limited
    > http://www.gbsw.co.uk
    > fromnewsgrp@NOSPAMgbsw.co.uk
    >



  4. Re: question about warm boot ,cold boot and Position Indepentdent Code

    For your questions, it depends how you define the definition
    of PIC.

    Regards,

    lucas.isaac wrote:
    > Graham:
    > i am appreciateing you reply,
    >
    > but you did not answer the question 1 and question 2.
    >
    > you answer fit for the situation when jump to Romstart() in tail of
    > file rominit.s.
    > when call Romstart() there must be a function call ( meaning without
    > this function call
    > we can not jump to Romstart(),for it can not execute sequentially to
    > reach Romstart() ),so it use the method you just pointed out.
    > but this does not apply to Question 1,because it can execute
    > sequentially to reach the symbol "Start"
    >
    >
    > Graham Baxter wrote:
    > > PowePC generally boots from address 0xFFF00100.
    > >
    > > Boot code is generally linked for RAM_HIGH_ADRS e.g. something like
    > > 0x1E000000.
    > >
    > > The maths is changing a link address of romInit() like 0x1E00xxxx to a real
    > > boot ROM address 0xFFF0xxxx and putting the result in the link register LR.
    > >
    > > On a cold start, there is nothing in RAM yet.
    > >
    > > Once the code is copied from ROM to RAM_HIGH_ADRS the linker supplied
    > > addresses will be correct.
    > >
    > > --
    > >
    > >
    > > Regards,
    > >
    > >
    > > Graham Baxter
    > > Freelance Software Engineer (VxWorks, Linux and pSOS BSPs)
    > > Graham Baxter (Software) Limited
    > > http://www.gbsw.co.uk
    > > fromnewsgrp@NOSPAMgbsw.co.uk
    > >



  5. Re: question about warm boot ,cold boot and Position Indepentdent Code

    Tony:
    Thanks very much for your reply
    can you help me understand the Question 1 and Question 2 ,
    they are confusing me till now.
    Best Regards

    tony wrote:
    > For your questions, it depends how you define the definition
    > of PIC.
    >
    > Regards,
    >
    > lucas.isaac wrote:
    > > Graham:
    > > i am appreciateing you reply,
    > >
    > > but you did not answer the question 1 and question 2.
    > >
    > > you answer fit for the situation when jump to Romstart() in tail of
    > > file rominit.s.
    > > when call Romstart() there must be a function call ( meaning without
    > > this function call
    > > we can not jump to Romstart(),for it can not execute sequentially to
    > > reach Romstart() ),so it use the method you just pointed out.
    > > but this does not apply to Question 1,because it can execute
    > > sequentially to reach the symbol "Start"
    > >
    > >
    > > Graham Baxter wrote:
    > > > PowePC generally boots from address 0xFFF00100.
    > > >
    > > > Boot code is generally linked for RAM_HIGH_ADRS e.g. something like
    > > > 0x1E000000.
    > > >
    > > > The maths is changing a link address of romInit() like 0x1E00xxxx to a real
    > > > boot ROM address 0xFFF0xxxx and putting the result in the link register LR.
    > > >
    > > > On a cold start, there is nothing in RAM yet.
    > > >
    > > > Once the code is copied from ROM to RAM_HIGH_ADRS the linker supplied
    > > > addresses will be correct.
    > > >
    > > > --
    > > >
    > > >
    > > > Regards,
    > > >
    > > >
    > > > Graham Baxter
    > > > Freelance Software Engineer (VxWorks, Linux and pSOS BSPs)
    > > > Graham Baxter (Software) Limited
    > > > http://www.gbsw.co.uk
    > > > fromnewsgrp@NOSPAMgbsw.co.uk
    > > >



+ Reply to Thread