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

LPC1754, uVision4, Boot Rom - RAM change

I use LPC1754, and Keil uVision4.
I have a small code that use noinit memory , at the end of the first region of RAM
From 0x10003F00 to 0x10003FFF. - 256 bytes.
I zeroed this region, and make reset.
I found that after every reset, memory addresses between 0x10003FC8-0x10003FE0 are always changed form the mcu, with this bytes
CD,AB,56,34,CD,AB,56,34,78,56,34,12,00,00,00,00,CD,AB,56,34,FF,FF,FF,FF
All other bytes remain zeroed , as they are expected because they are in noinit section.

Does anybody knows, what are these bytes.
Does anybody knows, what kind of instructions are executed right after reset,
and what memory region they use for their job.

I suppose it is boot-rom code, that is executed before main, and even before start-up assembler code. ( __main ).

Another thing is what is the size of RAM that this hidden code uses.
What is the possible size of RAM at the end of the first region, that can be used for noinit memory.

10x

  • Have you spent some quality time with the user manual for the processor?

    At least, there is info for RAM usage for IAP and for ISP. Not sure if there is full info for the actual boot loader code.

    ISP has stack located at RAM top -32. And it grows downard - max 256 bytes.
    ISP/IAP flash programming commands uses the top 32 bytes.
    IAP needs max 128 bytes from the stack you configured.

  • Thank you , Per Westermark, for this VERY USEFUL post.
    Finally I found something written about this problem.

    But now there is some more questions appeared.
    If I have two regions of RAM activated ( 16K + 16K ),
    what is considered for TOP of RAM,
    may be always top of the first region is TOP of RAM.

    Why the ISP or IAP module are activated. I have no ISP programmer connected,
    or have to program the flash memory after reset using IAP. I have only ULINK2 connected.
    Could ULINK2 cause ISP or IAP to use their stack, or just this BOOT PROCESS FLOWCHART
    does this every time after reset.

    Why Linker does not protect this regions, or issue a warning, if user use them.
    For example , if user program have variables located on the top of RAM, and issue some IAP commands, they can change this RAM variables?

    So the conclusion is, RAM addresses between
    0x1000 0118 to 0x1000 01FF can be changed after reset from ISP commands.
    0x1000 3ee0 to 0x1000 3fe0 can be changed after reset or during runtime from ISP command handler stack.
    0x1000 3fe0 to 0x1000 3fff can be changed after reset or during runtimefrom Flash programming

  • Doesn't matter if you use IAP or ISP.

    The chip still always starts the boot loader to check the pin to know if ISP is needed. And to check interrupt vector table to see if there seems to be a valid program or chip is empty.

    So you always get stack usage there.

    Linker have no reason to warn - most of this stack space doesn't collide with your own program because your program is started after the boot loader. It's only when you specifically ask for IAP that you need to consider the stack requirements for the IAP code that you explicitly call.

    But (!) the important thing is that if you need zero-initialized memory, you should consider using other side of the RAM instead. The linker just can't know what memory the chip internal firmware will touch. And your startup code will run way after the memory have been touched.