AnsweredAssumed Answered

Jumping to program from custom bootloader

Question asked by Wood.Robert on Jun 22, 2012
Latest reply on Jun 25, 2014 by LaserElettronicaSRL
I have nearly got a custom bootloader working which downloads code using RS485 and is encrypted using xtea. I have done the following:

1. Recompiled the original program with the start address as 0x8003000 defined in the linker file.
2. Encrypted the hex file
3. Downloaded the encrypted hex file, decrypted it and programmed the flash.

Now, it looks to me, when I run the debugger the code is correctly programmed into flash from 0x8003000. If I run up a second copy of Crossworks on my laptop with the target program that is recompiled to start at 0x8003000 and run this with the simulator, the code seems to be exactly the same as running the JTAG debugger and looking at what I have programmed with my bootloader.

So, once all the code is downloaded I call this routine:

void JumpToNormalApplication(void)

    volatile unsigned long JumpAddress;

    SCB_VTOR = (unsigned long)0x8003000;
    JumpAddress = *(volatile unsigned long*) (0x8003000 + 4);
    Jump_To_Application = (pFunction) JumpAddress;

If I single step through this, it does seem to jump to the right part of code and I can see it executing exactly the same assembler steps that are in thumb_crt0.s. However, it doesn't actually run the target program. I obviously can't really see what is happening in the debugger other than assembler steps so it's difficult to see what is going wrong.

Does anyone have any ideas or tips as to what step(s) I am missing out please?

Many thanks.