How to verify flash with elf file?

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

How to verify flash with elf file?

Jump to solution
2,490 Views
aaronlee
Contributor V

Hi,

I have many version of elf file. How to verify those code with MCU?

And, how to security MCU flash (unable to read)?

Best Regards,

Aaron

1 Solution
1,531 Views
RadekS
NXP Employee
NXP Employee

Hi Aaron,

If I understood correctly, you want to process how to load elf file into MCU without original project.

Correct?

 

The simplest way will be creating new project for target MCU derivative.

 

After that, please open “Target Task” window by menu-Window-Show view-Other-Debug-Target Tasks

 

Now, you may create new Target Task

Flash Programmer1.png 

Please enter name and select configuration (The configuration was created with our new project). As Task type, select Flash Programmer for S12Z.

Flash Programmer2.png 

Please add Flash Device – separately for Flash and EEPROM (if necessary)

Flash Programmer3.png 

Add Action – Erase/Blank check

I would like to recommend erase whole block. If you program also EEPROM, erase also EEPROM block

Flash Programmer4.png 

Add Action – Program/Verify

Select your elf file and check Restrict to Addresses in this Range if you program Flash and EEPROM separately

Flash Programmer5.png 

You may add also verify commands or enable/disable commends by check buttons on left side.

Flash Programmer6.png 

The Task may be run by special Run Task button.

Flash Programmer7.png 

Optionally you may configure Project Debug Configuration, uncheck Perform Standard Download and add your Task into the list. In this case, the you may start debug session the same was as for standard Project.

Debug Configuration-Execute Task.png

 

Note: The CW10 have also Flash programmer button (blue lightning, Alt+B,F) in Commander window, which will run wizard for configure new Target Task.

The FSEC byte at address 0xFFFE0F should be programmed for secure an MCU. The last two bits SEC[1:0] should differ from 0b10 for enable security feature (recommended is 0b01).

Since S12Z flash contains ECC feature, the additional securing is not trivial task – we have to read last Flash sector, erase them, modify SEC[1:0] bits and program whole sector back.

Some more details about Security feature:

https://community.nxp.com/docs/DOC-93803

 

If FSEC configuration is not part of original elf file data, the managing security will be probably quite annoying.

In such case, I would like to recommend working with S-record files (contains only NVM data in readable format) and manually edit these files (See attached tool).

The S-record files may be generated by linker directly during building or converted from elf file by burner.exe tool.

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

2 Replies
1,532 Views
RadekS
NXP Employee
NXP Employee

Hi Aaron,

If I understood correctly, you want to process how to load elf file into MCU without original project.

Correct?

 

The simplest way will be creating new project for target MCU derivative.

 

After that, please open “Target Task” window by menu-Window-Show view-Other-Debug-Target Tasks

 

Now, you may create new Target Task

Flash Programmer1.png 

Please enter name and select configuration (The configuration was created with our new project). As Task type, select Flash Programmer for S12Z.

Flash Programmer2.png 

Please add Flash Device – separately for Flash and EEPROM (if necessary)

Flash Programmer3.png 

Add Action – Erase/Blank check

I would like to recommend erase whole block. If you program also EEPROM, erase also EEPROM block

Flash Programmer4.png 

Add Action – Program/Verify

Select your elf file and check Restrict to Addresses in this Range if you program Flash and EEPROM separately

Flash Programmer5.png 

You may add also verify commands or enable/disable commends by check buttons on left side.

Flash Programmer6.png 

The Task may be run by special Run Task button.

Flash Programmer7.png 

Optionally you may configure Project Debug Configuration, uncheck Perform Standard Download and add your Task into the list. In this case, the you may start debug session the same was as for standard Project.

Debug Configuration-Execute Task.png

 

Note: The CW10 have also Flash programmer button (blue lightning, Alt+B,F) in Commander window, which will run wizard for configure new Target Task.

The FSEC byte at address 0xFFFE0F should be programmed for secure an MCU. The last two bits SEC[1:0] should differ from 0b10 for enable security feature (recommended is 0b01).

Since S12Z flash contains ECC feature, the additional securing is not trivial task – we have to read last Flash sector, erase them, modify SEC[1:0] bits and program whole sector back.

Some more details about Security feature:

https://community.nxp.com/docs/DOC-93803

 

If FSEC configuration is not part of original elf file data, the managing security will be probably quite annoying.

In such case, I would like to recommend working with S-record files (contains only NVM data in readable format) and manually edit these files (See attached tool).

The S-record files may be generated by linker directly during building or converted from elf file by burner.exe tool.

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

1,531 Views
aaronlee
Contributor V

Hi Radek,

It's helpful. Thank you very much.

Best Regards,

Aaron

0 Kudos