Pierre Bouffard

QE128 serial bootloader and Flash write in RAM ?

Discussion created by Pierre Bouffard on Feb 25, 2010
Latest reply on Mar 9, 2010 by Francois

Hello all,

 

I am using the MC9S08QE128 and I am writing a boot loader to copy application code in the lower flash locations. Looking at the serial bootloader in AN2295, I see that the erase and write flash subroutines are copied in RAM and then executed from there.  In my boot loader, I try to run the write command without copying the code in RAM, in other words I run it from the boot loader ROM directly since the boot loader must not overwrite itself by design. When I step trace the code with the BDM the write command works everytime but when I let it run full speed (F5 in the TrueTime debugger) the CPU goes wild (I assume it resets) and the debugger gets lost. More precisely I get ILLEGAL_BP and Triggers A & C occurred errors in an unpredictable way.

 

My question:

Do I absolutely have to copy and run the flash command routines from RAM ? Can you help me otherwise ?

 

Some sample C code would be terrific.

 

Thanks,

Pierre

Outcomes