How to download an application, started by a bootloader?

Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to download an application, started by a bootloader?

Contributor II

I have an MPC5643L bootloader + application combination.

Bootloader is flashed at 0x00000000 (16kB)
Application (a second level bootloader) is flashed at 0x00008000 (80kB)

I set the entry point of the application to 0x0000005C.
This is inside the bootloader, not the application.

I first program the bootloader, then I program the application (not erasing the first 16 kB)
When programming the application, the bootloader symbols are loaded.

The bootloader sets up the low level stuff like registers, MMU etc.

When I flash the application, it does not halt, and if I stop I am in an exception handler (IVOR6trap).
If I apply reset at this stage, the bootloader starts as expected.

I try to make the debugger stop by setting combinations of entrypoints/breakpoints in the debugger,
but the debugger reports.
"Error stopping a <address>
Reason: Target request failed: Failed to set breakpoint".

If I set the entry point inside the application, I do not get such errors.

The Debugger is set to use Hardware Breakpoints

I can in some cases see that the debugger sets the PC to 0x00000000.
This is bad, since that contains the tag (0x005A0000) for the ROM bootloader
showing this is a bootable flash sector.
If I single step that address, I immediately get IVOR6trap.

I have found one workaround, and that is to set the entry point in the application
to a valid function inside the application.
This simply jumps to the entry point of the bootloader.

            .extern __boot_address ; 0x0000005C
             b __boot_address

This is really a roundabout way of "solving" the problem.

Is it impossible to put an entry point for the debugger outside the application?
   (This seems to be to be a bug)

What is the proper way to make a proper startup when debugging the application?

0 Kudos
0 Replies