S12X flash memory copy

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

S12X flash memory copy

Jump to solution
1,912 Views
michaelsarafidi
Contributor II

Hi there,

 

We are using mc9s12dg256 for our device and we are trying to migrate to mc9s12xdt256.

We have to copy manually flash area 0x4000 to 0x7FFF in order our software to run.

Thus, we coppied 0x4000 to 0x7FFF flash area from our old uC using command line "Save 0x4000 .. 0xFFFF dump.hex" and tried to write it to the new uC using command line "SREC dump.hex".

Although, the command seems to be executed no data where writen to that memory area.

The command was executed after the uc was programmed (during a breakpoint stop).

In debugging memory mapping we have set "access kind R/W" and checked "refresh memory when halting" for the specific area.

 

Any ideas?

 

Thanks in advance.

Labels (1)
0 Kudos
1 Solution
1,199 Views
kef
Specialist I

There should be discussion somewhere about EEPROM(FLASH) save/restore as an alternative to AEFSKIPERASING.

SREC command allows to flash S19 file, but one need to use flash arm/disarm commands. I'm using it to save/restore part of C32 flash:

In preload.cmd:

save ????..???? eedata.s19

In postload.cmd:

        flash

        flash arm

        srec eedata.s19

        flash disarm

        reset

It works.

View solution in original post

0 Kudos
3 Replies
1,199 Views
RadekS
NXP Employee
NXP Employee

I think that this is just misunderstanding.

Command SREC doesn’t support write into flash (yes, this information missing in CW help). You need programming algorithm for write into flash.

In fact commands SAVE and SREC are very simple tools.

Commands SAVE and SREC you can simply use for RAM and registers (with restrictions).

For SAVE command you can use also paged address. Example: SAVE 0x308000..0x30BFFF DUMP.SX

In that case you cannot copy data from more pages at one turn because after address 0x30BFFF is physically 0x318000 address and not 0x30C000 address. This tool is simply not enough intelligent.

In that case dump.sx file will contain S2 record format automatically. For copy whole flash at one turn you can use global address (only in case S12X). Example : SAVE 0x780000’G..0x7FFFFF’G DUMP.SX

For convert result file you can use SRecCvt tool: https://www.freescale.com/webapp/sps/download/license.jsp?colCode=SRECCVTSW

If you prefer paged address or you have MCU without GPAGE (for example S12D) and you want store whole content of flash into one file, only way is using local addressing and export every page step by step.

SAVE 0x308000..0x30BFFF dump.txt ;A

SAVE 0x318000..0x31BFFF dump.txt ;A

SAVE 0x3F8000..0x3FBFFF dump.txt ;A

By parameter “;A” we will attempt new content to exiting file. This way you will have one file with whole Flash content.

If you want program flash, please go to debugger-menu-HC12MultilinkCyclonePro (or your BDM interface)-Load-select srecord file and press Open…

Note: There should be checked option “Automatically erase and program into Flash and EEPROM”

Second option: debugger-menu-HC12MultilinkCyclonePro (or your BDM interface)-Flash-mark PFlash-Erase-Load- select srecord file and press Open…

BTW: I think that you cannot simply hex file from S12D and paste this code into S12XD. There is lot of differences (for example: number of interrupt vectors, peripherals …). When you take c-code, paste this into new S12XD project and compile, there is better chance for working solution.

I would like recommend our application note AN2615 HCS12 and S12X Family Compatibility:

http://cache.freescale.com/files/microcontrollers/doc/app_note/AN2615.pdf?fsrch=1&sr=1


0 Kudos
1,200 Views
kef
Specialist I

There should be discussion somewhere about EEPROM(FLASH) save/restore as an alternative to AEFSKIPERASING.

SREC command allows to flash S19 file, but one need to use flash arm/disarm commands. I'm using it to save/restore part of C32 flash:

In preload.cmd:

save ????..???? eedata.s19

In postload.cmd:

        flash

        flash arm

        srec eedata.s19

        flash disarm

        reset

It works.

0 Kudos
1,199 Views
michaelsarafidi
Contributor II

Hi Radek,

we are using this whole area as const and we are programming it from an external application.

Since we have not yet completed the migration we are unable to program it from that application and the software is unable to continue.

i have tried to load the exported file to the memory but it erased all the other pages even though i have disabled the erase.

Hi Edward,

that worked fine!!!

Thank you both...

0 Kudos