Hi Mauro,
could you please specify your MCU?
I suppose for now that you use S12XE256.
The S12(X) MCUs use 64kB memory map with flash memory window at 0x8000~0xBFFF.
Since this is memory window and command SAVE is not enough intelligent, you cannot use 0x0e08000 to 0x0e7bfff range as linear address space (after the first page read, the command SAVE tries read from 0x0e0C000… instead jump to next page at 0x0e18000).
So, the only way how to read data from two and more flash pages at S12 MCU is through SAVE command with (;A) appendix.
At S12X MCUs you may use global addresses. The local address 0x0e08000 refers to 0x780000 global address and 0x0E7BFFF refers to 0x79FFFF global address.
Attached is S12XE memory map in excel file.
So, you may use for example command: SAVE 0x780000’G..0x79FFFF’G DUMP.SX
In that case, the dump.sx file will contain S2 record format automatically.
For convert result file from linear to banked addresses, you can use SRecCvt tool: https://www.nxp.com/webapp/sps/download/license.jsp?colCode=SRECCVTSW
Attached is SRec calculator.
You may simply copy a line from your s19 file into green Input – Recalculate Checksum field, modify data bytes in the same field and load modified S record with recalculated checksum from output field.
When you need update some data in flash, you have to read at least whole aligned sector, erase this sector and write modified data. However the CW debugger typical do not offer a tool for erasing specific flash sector. In most of the cases, you will have to erase whole block (it do not need to fit with hardware flash block) of flash. So, I would like to recommend save whole flash content prior such operations.
For catastrophic scenario (when MCU will be accidentally secured), it might be useful to save also D-Flash/EEPROM content (depends on flash partitioning).
The specific case is last flash sector with configuration bytes at 0xFF00~0xFF0F - like Security byte. For more details, please look at document here:
https://community.nxp.com/docs/DOC-93803
I hope it helps you.
Have a great day,
Radek
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------