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

Problem with own bootloader / its application startup

Hi all

I am having problems with application startup. My USB based bootloader needs to start the "real" application if no USB is present. So I got two separate programs in flash residing on different locations. Bootloader starting at 0 (with flash vectors) and the application at say 0x4000, using relocated rambased vectors.

Both applications work fine, if started from within the debugger (PC set to either 0 or 0x4000, then command "go").

USB Bootloder is in Thumb mode, but I issue the BX R0 with R0 set to 4000h from supervisor mode. The application starts, but then ends up in an exception shortly. Any ideas what might be wrong? Does the CPU need some more setup? Or causes the duplicate clock stuff in the startup code some problems?

Funny thing is I checked NXP's app note 10711, which is about an USB bootloader too and they start the application simply that way:

void execute_user_code(void)
{ void (*user_code_entry)(void); user_code_entry = (void (*)(void))USER_FLASH_START; user_code_entry();
}

The bootloader is in Thumb and User mode I guess. Can that generally be a workiing solution? I tried it that way at first, but failed too.

Many thanks in advance
U.B.

Parents
  • Thanks Tamir, but ..

    if you read the OP , I stated there that the applications works well, if started directly, thus the remapping should be OK and yes, supervisor mode is set

    So the only thing left is that IRQS are left turned on. Will try that and turn them off

    btw, does the Keil startup code really work for remapping? I can neither see how the original vector set is being copied to RAM and how the first 64 bytes are being held free from normal program usage only by setting REMAP etc.

Reply
  • Thanks Tamir, but ..

    if you read the OP , I stated there that the applications works well, if started directly, thus the remapping should be OK and yes, supervisor mode is set

    So the only thing left is that IRQS are left turned on. Will try that and turn them off

    btw, does the Keil startup code really work for remapping? I can neither see how the original vector set is being copied to RAM and how the first 64 bytes are being held free from normal program usage only by setting REMAP etc.

Children