Flash memory with range not defined

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

Flash memory with range not defined

Jump to solution
1,286 Views
maurom
Contributor II

Hi,

im ready to Flash my S12 microcontroller through bdm interface and Hiwave.exe. I have saved flash memory in range 0x0e08000 to 0x0e7bfff, but inside it there is some block not defined.

I succeed to save range with (;A) append option in save command, but in the S19 file created there is some hole addresses, same of not defined block.

I need to change some bit in the range 0x0e08000 to 0x0e7bfff of saved S19 file and then write changes.

If i try to flash this "holed" S19 file into microcontroller there is possibilitie some go wrong and i loss original memory?

 

Thanks a lot for any replies

Bye

M.

Labels (1)
1 Solution
998 Views
RadekS
NXP Employee
NXP Employee

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!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

4 Replies
998 Views
maurom
Contributor II

Thnaks a lot Radek.. all changes was wirited successfully!

Best Regards, superb support

0 Kudos
998 Views
maurom
Contributor II

Thanks a lot Radek for replie, you have explained very well, and yes my MCU is a S12XET256.

Another question,in the Flash utility i can load a Banked or Linear file?

For info in the follow much details of memory flash from Flashing utility:

Pflash 0x0004000 - 0x00007FFF    Programmed

Pflash 0x000C000 - 0x000FFFF     Programmed

Pflash 0x0E08000 - 0x0E7BFFF     Programmed

Pflash 0x0F88000 - 0x0FFBFFF     Programmed

Dflash 0x0000800 - 0x01F0BFF      Blank

Best regards,

Mauro

0 Kudos
998 Views
RadekS
NXP Employee
NXP Employee

Hi Mauro,

From software perspective:

The CW debugger (hiwave.exe) works only with s19 files which have addresses in banked (logical addresses) format. On another side, the tools from P&E like Prog12Z programmer or CyclonePro debugger in standalone mode works only with s19 files which have addresses in linear (global addresses) format.

Note: there is also P&E “log2phy” utility which may convert s19 file from banked to linear format. However, the opposite conversion (from linear to banked format) is not supported.

 

From hardware perspective:

The S12 core understood only banked (logical) addresses. The S12X core may understood also linear (global) addresses in connection with global instructions (these instructions typically starts with G, e.g. LDD x GLDD instructions).

The S12XE flash module commands require addresses in linear (global) address format.

 

I hope it helps you.

Have a great day,
Radek

0 Kudos
999 Views
RadekS
NXP Employee
NXP Employee

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!
-----------------------------------------------------------------------------------------------------------------------