This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Boot ROM Question of NXP LPC17xx

Note: This was originally posted on 9th June 2011 at http://forums.arm.com

Hi,

I am about to use LPC17xx to do some work. But I don't quite understand
it's boot ROM remapping.  According to ARMv7 architecture manual, the
first vector entry (address 0x00 to 0x03) should be value of SP and the
second entry (address 0x04 to 0x07) should be reset entry (the starting
point of the user program). On the other hand, the LPC17xx manual said
that at boot time, a portion of the 8K boot ROM is temporarily remapped
to address 0x00000000.  So I was wondering, what are the values in the
first 16 bytes in boot ROM? And, how a user program is finally get
executed? Where is my stack top?

Thanks in advance if you can give me some clues.

-
narke
  • Note: This was originally posted on 9th June 2011 at http://forums.arm.com

    Dear Joseph,

    Many thanks for you clear explanation!  I then have two more question raised from your answers.

    1. If so, why we need the boot ROM?  What it did for us?  In the LPC17xx manual, it said, the boot ROM contains flash services. But as I understand, the flash driver is usually implemented as a part of our user firmware.  How to use these service and should we use it?

    2.  You said "... and then execute the program in the flash memory if the flash memory has been programmed (this might also depends on other boot settings)".   What you mean by 'bot settings', I did not see we have any setting to effect boot behavior.  Had I missed something in the manual?


    Thank you again!
    narke

    The first 16 bytes in the boot ROM will contain the vector table for the boot ROM, with the reset vector pointing to the starting address of boot ROM program.  During executing of the boot loader program, it will turn off the remap function at some stage, so that the user program in the flash will appear at the beginning of the memory map, and then execute the program in the flash memory if the flash memory has been programmed (this might also depends on other boot settings).

    Before switching to run the program in flash, the boot loader can read the vector table on the flash memory, and adjust the main stack pointer value accordingly. Then it can read the reset vector in the vector table and branch to this address. In this way, the initial main stack pointer value and starting program address will match the values you placed in the starting of the flash memory.

    This memory remap function is implemented in the bus system of the NXP LPC17xx. It is not inside the processor core, so you cannot find this information from ARM documentation.

    regards,
    Joseph
  • Note: This was originally posted on 10th June 2011 at http://forums.arm.com


    Hi Narke,

    Regarding (1):
    The flash memory in LPC17xx can be programmed using serial communication with
    some flash programming firmware (in the boot loader) running.
    See chapter 32 of User manual (http://www.nxp.com/d...ual/UM10360.pdf)
    An example method of using this flash programming mechanism is flash magic (http://www.flashmagictool.com/).

    The boot loader also check if the flash is programmed before running the program in flash.
    This is done by detecting a checksum. (See 32.3.1.1 of the LPC17xx User manual)

    Regarding (2):
    Yes, please see "32.4 Boot process flowchart" in the user manual, and section 32.3:
    "The flash boot loader code is executed every time the part is powered on or reset. The
    loader can execute the ISP command handler or the user application code. A LOW level
    after reset at pin P2.10 is considered an external hardware request to start the ISP
    command handler."

    So when you design your circuit, make sure P2.10 is not low when it startup.
    (Best to put a jumper or DIP switch so you can control it for debug purpose.)

    regards,
    Joseph




    Many thanks for you kind help!   It's get more and more clear to me.  I should now invest more time on study the manual.  Hope I can still get you help in future.    Have a nice day!

    Best Regards,
    narke
  • Note: This was originally posted on 9th June 2011 at http://forums.arm.com

    The first 16 bytes in the boot ROM will contain the vector table for the boot ROM, with the reset vector pointing to the starting address of boot ROM program.  During executing of the boot loader program, it will turn off the remap function at some stage, so that the user program in the flash will appear at the beginning of the memory map, and then execute the program in the flash memory if the flash memory has been programmed (this might also depends on other boot settings).

    Before switching to run the program in flash, the boot loader can read the vector table on the flash memory, and adjust the main stack pointer value accordingly. Then it can read the reset vector in the vector table and branch to this address. In this way, the initial main stack pointer value and starting program address will match the values you placed in the starting of the flash memory.

    This memory remap function is implemented in the bus system of the NXP LPC17xx. It is not inside the processor core, so you cannot find this information from ARM documentation.

    regards,
    Joseph
  • Note: This was originally posted on 9th June 2011 at http://forums.arm.com

    Hi Narke,

    Regarding (1):
    The flash memory in LPC17xx can be programmed using serial communication with
    some flash programming firmware (in the boot loader) running.
    See chapter 32 of User manual (http://www.nxp.com/documents/user_manual/UM10360.pdf)
    An example method of using this flash programming mechanism is flash magic (http://www.flashmagictool.com/).

    The boot loader also check if the flash is programmed before running the program in flash.
    This is done by detecting a checksum. (See 32.3.1.1 of the LPC17xx User manual)

    Regarding (2):
    Yes, please see "32.4 Boot process flowchart" in the user manual, and section 32.3:
    "The flash boot loader code is executed every time the part is powered on or reset. The
    loader can execute the ISP command handler or the user application code. A LOW level
    after reset at pin P2.10 is considered an external hardware request to start the ISP
    command handler."

    So when you design your circuit, make sure P2.10 is not low when it startup.
    (Best to put a jumper or DIP switch so you can control it for debug purpose.)

    regards,
    Joseph