AnsweredAssumed Answered

Problem with execute-from-SRAM on MKL25Z128 (FRDM-KL25Z) in AN2295-base bootloader

Question asked by Wolfgang Wegner on Sep 27, 2013

Hi,

 

I am trying to get something like the AN2295 bootloader running on a KL25Z128.

 

I took some original version from Freescale (sorry, as there are so many versions floating around it is difficult to tell which one it actually is) that claimed to work with CW10.3 and Kinetis L, but had to modify it quite heavily to get it to compile and at least partially run with CW10.3 and the Freedom board.

 

My modifications:

- use PLL-based clock

- no trimming or calibration; fixed baud rate only (commented out calibration in hc08sprog, too)

 

There are two strange things now:

1) hc08sprog always complains

"WARNING! The protocol version [0x08] (Kinetis) does not match the one associated with the device with following SDID [0x000].

Protocol version for given SDID should be [0x02] (S08).

Continuing with reported protocol version anyway.

 

Something is screwed up, please report!"

although the bytes sent from KL25Z should be ok. well, don't care for now...

2) flashing works when I execute the code from flash, but when I try to relocate the flashing routines, the debugger halts at the default exception handler immediately when the in-ram function is called.

I tried the relocation from AN2295 code as well as the one outlined in AN4695_1 for gcc-based compiler in Codewarrior. The relocation address of 0x20000000 is correct (I can see the correct code there in the debugger and the PC also seems correct), but still the exception occurs.

- Is there an easy way to see which exception occurred?

- what might be the cause? Is there some general preparation needed to execute code from SRAM?

 

Any help is appreciated!

I attached my project in case it can give some details I forgot to mention here.

 

Best regards,
Wolfgang

Original Attachment has been moved to: bootloader3.zip

Outcomes