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

Starting execution from an address, AppEntry() function

Hi,

My boot code is booted from the SPI flash and it copies the application code to the 0x80000000 address, where the SDRAM starts.

The NAND and NOR bootloader codes written by KEIL has an AppEntry function which is below:

#define EXT_SDRAM   0x80000000
typedef void (*fnc) (void);
const fnc AppEntry = (fnc)EXT_SDRAM;

int main()
{
-
-
AppEntry();
}

I use this function in my code to start execution from 0x80000000 address. However, it does not work! The program counter does not jump to my location, instead, it continues executing in its own function.

I also tried to stop at a breakpoint and change the value of the PC by hand. But, it had the same affect, no jump occured.

The same code works in NOR bootloader, so maybe I have something in the project options to fix?

Besides, in the NOR bootloader, the mode is "supervisor mode". I also switched to this mode in my code, but I still have the same result.

Can someone please help me out of this issue?

Thanks

  • Maybe your jump is optimized away by the compiler? Have a look at the assembly code.

  • Hi,

    When my boot code loads the application to SDRAM and changes the value of the program counter to the start address of the SDRAM, the mcu is RESET!
    It goes to the "Reset_Handler" and starts the program from main.

    I use the same method in the NOR Bootloader provided by Keil, then there is no problem, PC jumps to the application code and everything is fine.

    I made the start up code of my software the same with the one in the NOR Bootloader project. But I still have a reset while changing PC to the SDRAM address.

    There is no problem when I change the value of the PC to somewhere other than the SDRAM.

    This has been an important problem and my time is exceeding day by day. I'll be very glad to hear from you.

    ps: All the optimization are closed.

    Thanks for your helps.

  • Assuming you are (still) using the LPC3250 ...

    Have you configured the startup code of your bootloader to initialise the SDRAM?

  • I believe the SDRAM is initialized, because, the application code is correctly transfered from the SPI flash to SDRAM.

    Reset occurs when the PC value is changed to the SDRAM.

    Besides, I am using the evaluation version of uVision. Does it make such an effect?

    ps: Yes, I still am using LPC3250.

    Thanks for your helps.