How to get the machine code file from a target board with an un-protected or un-secured Flash MCU?

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

How to get the machine code file from a target board with an un-protected or un-secured Flash MCU?

Jump to solution
1,098 Views
kunxu
Contributor II

Hello, I have a target board with a MC9S12XEP100 chip. The flash of the MCU chip is un-protected and un-secured. I want to get the machine code file or assembly file (*.abs, or *.s19). What should I do?

PS: I have succesfully connected the target board using the BDM (P&E USB Multilink Inerface) via the software - hiwave.exe, and see the contents of the Flash memory, as well as the Assemble codes  in the Windows of "Memory" and "Assemble" of the hiwave.exe software, respectively. But I don't know how to save them as a *.abs file or a *.s19 file.  The copy command cannot be used in the Windows "Memory" or "Assemble" of the hiwave.exe software

Labels (1)
1 Solution
620 Views
iggi
NXP Employee
NXP Employee

The code programmed into memory of a chip is an optimized binary code but not originally written assembly. The chip never records your original assembly code. So it is not possible to get your original assembly code from chip. 

We can use the SAVE command to save a specified block of memory to a specified file in Freescale S-record format. Then we can reload the memory block later using the load S-record (SREC) command. The SAVE command is used in debugger command window.

E.g. 
in>SAVE 0x1000..0x2000 DUMP.S19 ;A


This way we can read binary opcode from flash to .s19 file. It appends the memory range 0x1000..0x2000 to the DUMP.S19 file.

We can use decoder.exe tool to decode .s19 and see the code in assembly-pseudo, but it is not real assembly format. This attribute depends on .s19 and .lib itself but not decode tool

View solution in original post

2 Replies
621 Views
iggi
NXP Employee
NXP Employee

The code programmed into memory of a chip is an optimized binary code but not originally written assembly. The chip never records your original assembly code. So it is not possible to get your original assembly code from chip. 

We can use the SAVE command to save a specified block of memory to a specified file in Freescale S-record format. Then we can reload the memory block later using the load S-record (SREC) command. The SAVE command is used in debugger command window.

E.g. 
in>SAVE 0x1000..0x2000 DUMP.S19 ;A


This way we can read binary opcode from flash to .s19 file. It appends the memory range 0x1000..0x2000 to the DUMP.S19 file.

We can use decoder.exe tool to decode .s19 and see the code in assembly-pseudo, but it is not real assembly format. This attribute depends on .s19 and .lib itself but not decode tool

620 Views
kunxu
Contributor II

Thank you for the nice reply. I can have a good sleep tonight. Thank you

0 Kudos