MC9S08DZ128 Bootloader

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

MC9S08DZ128 Bootloader

Jump to solution
2,871 Views
photoman
Contributor I

Hi, I have application code already written for this processor, but I am having a hard time implimenting the bootloader.from AN2295.

 

My understanding of the flow is this: open hc08sprg-s08dz128.mcp in Codewarrior, build, and program to target using BDM.  Run hp08sprg.exe, and load user .s19 file to target.  Done

 

I can do all that sucessfully.  However, I cannot seem to run the user code (properly) on the target (no indication of it doing anything).  I cannot communicate serially with HyperTerminal (my normal way to communicate), and there are none of the usual LEDs flashing that I set up in software).  In addition, before programming the target with the user binary, it tells me that the source is bigger than the memory at address 0x3C00 (the start of the EEPROM area).  Obviously I don't want to program to the EEPROM area (my user code actually uses the EEPROM as NVROM).

 

Basically, the bootloader program doesn't seem to be putting the user file in the correct flash location, and I don't see why from looking at the prm or inc files.  Any pointers on how to proceed would be much appreciated.

Labels (1)
0 Kudos
Reply
1 Solution
2,064 Views
ok2ucx
Contributor IV

Guys,

it would be rather more efficient posting the hotfix publicly, here it comes:

http://pavel.lajsner.sweb.cz/tmp/hc08sprg-dz128-alpha-4.exe.zip

(this is just temporary download, it will soon be part of standard AN2295SW suite).

This is what we've debugged with Scott. The major flaw I did was the "illegal instruction". In previous versions of bootloader (that were running on CPU cores version V3 or below), I used a single-byte unused opcode. In newer cores this 'unused' has changed to RTC (return from call). The 'bad' code today runs away after executing RTC instead of causing reset.

The fix is to implement either some unused two-byte opcode or STOP instruction (which is implemented in alpha-4 code above). Though the STOP instruction is configured to be treated as illegal via SOPT1.

Hope this helps, let us know if you're successful with this latest code.

Regards, Pavel Lajšner

View solution in original post

0 Kudos
Reply
10 Replies
2,065 Views
ok2ucx
Contributor IV

Guys,

it would be rather more efficient posting the hotfix publicly, here it comes:

http://pavel.lajsner.sweb.cz/tmp/hc08sprg-dz128-alpha-4.exe.zip

(this is just temporary download, it will soon be part of standard AN2295SW suite).

This is what we've debugged with Scott. The major flaw I did was the "illegal instruction". In previous versions of bootloader (that were running on CPU cores version V3 or below), I used a single-byte unused opcode. In newer cores this 'unused' has changed to RTC (return from call). The 'bad' code today runs away after executing RTC instead of causing reset.

The fix is to implement either some unused two-byte opcode or STOP instruction (which is implemented in alpha-4 code above). Though the STOP instruction is configured to be treated as illegal via SOPT1.

Hope this helps, let us know if you're successful with this latest code.

Regards, Pavel Lajšner

0 Kudos
Reply
2,064 Views
Ralph_
Contributor I

Hallo Pavel,

in my former answer I've told you that everything is fine with the bootloader, but now after trying different modes/functions and playing with the SW I recognized that it seems, that  there is a problem connecting to the bootloader:

a) if only the bootloader is programmed everything works for the first time

b) if an application is already programmed to the target, the Master (PC) SW has a problem to calibrate the target. Only in a very few cases (after several power off/on tries) the calibration works and a programming of the target is possible.

Uncommenting the "lazy COM port"-option in the bootloader has no effect, using normal speed instead of HISPEED, as well.

May be I did something wrong, so hopefully you have some hints for me, what I have to mind concerning the calibration process?


Thanks a lot.


Best regards

Ralph

0 Kudos
Reply
2,064 Views
Ralph_
Contributor I

Correction: Problem caused by connected PE Micro USB Programming adapter


Hallo Pavel,


the problem I described in my last answer was caused by the PE Micro USB Programming adapter, which was always  connected to the target hardware. It seems that the MCU reset behavior is different if the programming adapter is still connected to the hardware. Without the programming adapter the programming process worked for a several times with the first attempt.

Thanks and best regards

Ralph

0 Kudos
Reply
2,064 Views
Ralph_
Contributor I

Hallo Pavel,

it works, really great, thanks a lot :smileyhappy: !!!

With the new sources my application started immediately after programming the hardware, perfect. I've tried also erasing and then programming again, works also fine. So for me every thing seems to be Ok, and I'll start implementing the bootloader to our application. 

Thanks a lot for the very quick reaction to that case - should have role character for the support service of other companies!

Best Regards

Ralph

0 Kudos
Reply
2,064 Views
ok2ucx
Contributor IV

Hi,

unfortunately the DZ128 bootloader has not been thoroughly tested in the real application. It has been ported from the most similar version, awaiting the feedback from the field. Here it is, not too much positive :smileyplain:

Let me follow up with you - there are couple of steps that we can do to debug this. The simplest would be to readout the

entire memory after bootloading has taken place - you can that in debugger by issuing the following commands in the command window:

save 0x004000..0x00FFFF page00.s19

save 0x028000..0x02BFFF page02.s19

save 0x048000..0x04BFFF page04.s19

save 0x068000..0x06BFFF page06.s19

save 0x078000..0x07BFFF page07.s19

save 0x003C00..0x003FFF pageE0.s19

save 0x013C00..0x013FFF pageE1.s19

(you can even save those into some text file and issue that file using Execute while right-clicking into the Command window)


And after providing the original user S19 - we can compare where are the differences.

I can see the one issue now - the EEPROM memory ranges are not included in the bootloader's memory maps. That's why you're getting the warning (about 0x3C00 range). However this is minor issue = warning only. The functionality is in there, it all should work. Still something to be fixed.

If you've placed some code into 0x3C00 area, obviously you'd like this code to be programmed.

Let's follow up over PM.

Pavel

an2295 bootloader develeper

0 Kudos
Reply
2,064 Views
Ralph_
Contributor I

Hallo Pavel,

sorry to answer or lets say to ask you according the same problem then Scott Miller does:

We used the DZ60 (incl.serial bootloader, based on your freescales bootloader code) and we ported now our application to the DZ128, every thing is working fine so far.

And of course we keept the best ;-) for the end, means we are now trying to implement the serial bootloader for the DZ128.

I've used your PC code and your MCU code to program the DZ128 with our application S19 file, the connection and programming, even the compare works perfect and no error is prompted, but the application won't start!

I've reviewed the memory areas a several times and guess there shouldn't be any conflict.

Do have any hints, tips, further examples or documents according the programming of a DZ128 device via the serial bootloader?

Many thanks for your support!

Ralph

0 Kudos
Reply
2,064 Views
ok2ucx
Contributor IV

Hallo Ralph,

thanks to Scott together we've finally debugged DZ128 version (I personally haven't touched any DZ128 hardware thus alpha version only). Yes, there were some glitches :smileyconfused:

The corrected DZ128 version will be updated on the web soon anyway (AN2295 will be updated for Kinetis L-series in couple of days). If you'd need this code sooner, I may provide it to you via email (just drop me your email address via private message).

Regards,

Pavel

0 Kudos
Reply
2,064 Views
photoman
Contributor I

Hi Pavel –

Where are the license terms located for the AN2295 applications? 

I am having trouble finding where the text of the license terms (see below) originated from.  I don’t see it in the AN2295sw.zip file, or on the web page where you download the file.  Can you please direct me to where the license text is?  There doesn’t appear to be an installer for this program either, which is usually where the license text appears.  Can you please help?

0 Kudos
Reply
2,064 Views
Ralph_
Contributor I

Hallo Pavel,

thank you very much for your quick reply, yes it would be very courteous, if you could send me the code via E-Mail!

I hope I know how I can send you my email address via a private message. If I'm not successful I'll let know it right here.

Once again many thanks to you!

Best regards

Ralph

0 Kudos
Reply
2,064 Views
Ralph_
Contributor I

Sorry Pavel,

direct messaging is only possible to linked persons, don't know how to deal that so I tried to link you with the "add friend" function, but I don't know whether this is the correct way? If not please let me know how to handle that. Thanks.

Best regards

Ralph

0 Kudos
Reply