podonoghue / usbdm-eclipse-makefiles-build

Current USBDM builds
GNU General Public License v2.0
15 stars 15 forks source link

MemoryDump did not work with paged flash on HCS12X #13

Closed EgorKin closed 2 years ago

EgorKin commented 4 years ago

Hi Peter, I try use MemoryDump for dump MC9S12XS128 proc. PPAGE register address for it is 0x15 vs 0x30 for HCS12 without X. Thank you for customize PPAGE address setting. But I have no luck with it.

I set PPAGE address = 15 and: 1) Almost all time MemoryDump wont dump with error: "Expected BDM command ASK missing" if I set Start & End dump address for more than 0x1000 size. Log and screenshot attached. 2) Rarely it dump few chunks for 0x1000 length each and stop with same error "Expected BDM command ASK missing". Log and screenshot attached too. 3) If I dump only 0x1000 bytes from paged flash (like 0xFF8000-0xFF8FFF) MemoryDump did not show any errors but dump is **PARTIALLY** incorrect. First bytes correct but after 0xFF810A in my dump some bytes is not same as in linear dump and some bytes is 0xFF vs normal values in linear dump. FF8000-FF8FFF.s19 dump attached. 4) Linear memory successful dump at anytime. Dump 0x0000-0xFFFF attached. 5) I try dump few registers including PPAGE reg and notice that PPAGE offset 0x15 sometimes misterios changed to 0xF9 or 0x00 values even if I do "15,FF" init string and dump nonpaged flash like "0x4000 - 0x4200" + "0x0 - 0x20" regs offsets. If I dump only "0x0 - 0x20" regs offsets after Init "15,FF" PPAGE value always correct = 0xFF. Noticed that if PPAGE value changed than GPAGE value changed too. Dont know why it happens.

I also try set PPAGE via init text box with "15,FF" (PPAGE = 0xFF (last page)) but no luck too.

My point is dump memory as linear at 0xC000-0xFFFF and next try dump paged memory from page FF. Based on datasheet mc9s12XEP100 second nonpaged flash block (0xC000-0xFFFF) and FF flash memory page are same, first non paged block 0x4000-0x7FFF should be same with FD flash memory page. If both dumps is same then paged flash dump is correct.

But even partially dumped flash memory chunks from 1) or 2) does not same as linear dump. Linear dump 100% correct.

I try use CodeWarrior for dump all flash memory. But processor RUNNING again after HALT or RESET on CodeWarrior 5.2 and I can`t execute SAVE commands. But I can look at Memory window and it show absolutely correct bytes - FF8000-FFBFFF have same bytes as my linear dump from MemoryDump at C000-FFFF.

CW5 2_and_lineardump_compare PrintScreen 2019-12-04 20-05-49 PrintScreen 2019-12-04 20-07-04 PrintScreen 2019-12-04 20-18-07 MemoryDump.log usbdm.log usbdm-ppage15-ff8000-ff8fff-success.log linear0000-ffff.zip ff8000-ff8fff.zip

EgorKin commented 4 years ago

Just for you know. I'm workaround my problem with dump hcs12x - comment width variable checking code (!=0 || !=1 || !=2 || !=4) and set width = 0x31. It allow use global addressing at start and end fields. And successful dump whole memory from 0x0 to 0x7fffff with flat option checked. That do you think about add checkbox "use global addressing" for current Flat option makes bdmInterface->readMemory(width|0x30, size, start, data);?