How to read firmware using S12U, Codewarrior 5 and Multilink?

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

How to read firmware using S12U, Codewarrior 5 and Multilink?

6,802 Views
hectorgomez
Contributor II

Hello.

 

I am quite new using Freescale microcontrollers, Codewarrior IDE 5 and the USB Multilink programer.

But I am not new in this world of programing microcontrollers.

 

I need to know how to retrieve a .hex (if apply to freesacale MCUs) from a S12U microcontroller using Codewarrior and the USB Multilink programmer.

There is not too much documentation in this point.

 

Best regards.

Labels (1)
12 Replies

3,396 Views
carlosglez
Contributor I

Zhang, 

    There's no error message. The problem is that I'm not really sure if the micro code was attached to the debugger. I don't have the source code, so i don't know if the debugger is actually seeing the code that is on the chip memory. 

    In other words, How can I see in the debugger memory window what is on chip's memory if I dont have the source code?

    Really appreciate your help! Thanks. 

0 Kudos
Reply

3,396 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi Carlos.

In order to investigate the problem efficiently and correctly, I hope you can provide me more information to avoid any misunderstanding.

Could you make a video of your problem? please make sure:

1. you connect the board with "attach"

2. connect the board with hardware interface(eg, Multilink interface)

3. when launch debugger, browse memory window, is there any data in valid flash address, if yes, it means debugger attaches board correctly.

Best Regards.

Jennie Zhang

0 Kudos
Reply

3,396 Views
carlosglez
Contributor I

Hi Zhang,

   I'm now a this point: Already attach to the board and see data on the memory. 

pastedImage_1.png

  Export the memory data from address 0x0 to 0xFFFFFF (Not sure what space of memory I should export but that's the biggest length it lets me).

pastedImage_2.png

After that, i got the following file:

pastedImage_3.png

BUT! My trouble now is that when I dowload this file to a different board it doesn't work as the original board. I connected the new board and select my just exported file with the Flash File to Target option: 

pastedImage_4.png

The board programed just dont do anything.

BestRegards.

CarlosG

0 Kudos
Reply

3,396 Views
carlosglez
Contributor I

Radek Thanks for your soon answer!

    I alredy configure debug as attach. I'm now using Cyclone beacuse with Multilink I cant connect with the board. 

pastedImage_6.png

  And I wirte the following command on the Debugger Shell:

pastedImage_7.png

But I got neither a confirmation nor where the file was saved. I look for the file on my project folder and on the debugger folder and there's nothing.

Got any idea?

Thanks :smileyhappy:

0 Kudos
Reply

3,396 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi Carlos.

you can extract memory data via debugger export button:

pastedImage_1.png

then save range of data in a file.

BTW, this thread is almost 4 years ago. If you have question, I highly suggest you create a new thread for it. Thanks.


Have a great day,
Jennie Zhang

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply

3,396 Views
carlosglez
Contributor I

Hi Zhang,how 

    Thanks for your answer! My trouble is connecting  my board with the debugger. Dont know how to extract the code of the micro and see its memory, Can you help with that? 

   Thanks!

0 Kudos
Reply

3,396 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

What error did you have?

can you upload the error screenshot?

0 Kudos
Reply

3,396 Views
carlosglez
Contributor I

I have the same question but working on a MC56F8! I want read the firmware from that board and copy to another board. Im using CW 10.6 and a Multilink. But i look for mi hiwave.exe on my download folder and theres not even the prog folder.

0 Kudos
Reply

3,396 Views
RadekS
NXP Employee
NXP Employee

Hello Carlos,

Unfortunately, I don’t have experience with MC56F8, but there is significant difference between CW for HCS12(X) 5.1 (Classic IDE) and CW for MCU 10.6 (Eclipse IDE).

The CW for MCU is based on Eclipse IDE and debugger is no longer separate program (hiwave.exe) like on Classic IDE.

Also, the command line commands may be different.

 

I would like to recommend create a new “dummy” project for your MCU derivative.

After that press small triangle at debug button and select Debug Configuration.

Debug Configuration1.png 

Here select Attach instead of Download.

Debug Configuration2.png

 That should manage, that debugger will try to connect MCU without MCU reset and code loading.

When connection will successful, you may open Debugger Shell

Debug Configuration3.png 

After that you may use mem, fl::dump or save commands for reading flash content (no experience on my side with that).

More details about these commands you will find in document:

"c:\Freescale\CW MCU v10.6.4\MCU\Help\PDF\CodeWarrior Common Features Guide.pdf"

I hope it helps you.

Best Regards

Radek

3,396 Views
hectorgomez
Contributor II

I mean.

How to extract the whole memory inside the S12U microcontroller into the PC and then copy into another one?

Best regards.

0 Kudos
Reply

3,396 Views
RadekS
NXP Employee
NXP Employee

At first: You can read flash data only in case when MCU is not secured.


I suppose that you mean S12UF32 device.


For reading Flash content you can use directly CW debugger (Hi-wave). Connect to MCU and use command SAVE. In Help you can find example SAVE 0x1000..0x2000 DUMP.SX This command saves memory range into file dump.sx in S1 record format.

Example of procedure:

1. Connect USB Multilink and power to MCU

2. Start debugger (HiWave). Example path: "c:\Program Files\Freescale\CWS12v5.1\Prog\hiwave.exe"

3. In menu-Select Derivative choose your MCU, for example MC9S12UF32

4. Optionally you have to set also USB Multilink in Connection Manager window (menu-Communication)

5. MCU should be now connected and you can read “Target Ready” in Command window

6. Enter command “SAVE 0x8000..0xFFFF DUMP.s19” into Command window and press Enter

7. Now you should wait some time (depends on MCU clock and BDM speed) for downloading data from flash

8. File DUMP.s19 you can find in the same directory as debugger. ). Example path: "c:\Program Files\Freescale\CWS12v5.1\Prog\DUMP.txt"


0 Kudos
Reply

3,396 Views
hectorgomez
Contributor II

Hello

Thanks a lot for your kind answer.

I have some issues to get the target connected. I am using de BDM port connector, using just four pins for the USB-ML-UNIVERSAL and the MC9S12UF32 microcontroller in my target board, this is Pin1 BGND, Pin2 GND, Pin4 RESET and Pin6 TVCC.

But before I have 3 basic questions.

1. How to know if the MC9S12UF32 is protected?

2. Which is the right memory range, 0x0..0x8000, 0x0..0xFFFF, 0x0..0xFFF8, 0x8000..0xFFF8?

3. The right command to load a S19 bin file into a blank microcontroller is the SREC command?

I run the hiwave.exe and follow your steps. But at step at step. I attach some image describing my process.

I successfully start the target and the debugger, but rarely I see de "Target Ready" message. Instead of that I always receive this message in the command window.

Could not find appropriate io_delay_cnt.

I eliminate this message calculating the io_delay_cnt using the equation: IO_DELAY_CNT = (120000000 / Fbus) – 1. The target board have a 12MHz cristal so the final number is 9.

I load this number into the Connection Manager in the BDM Communication Speed section "Use IO_DELAY_CNT = 9 (Decimal). Then I click connect.

Then I receive in the command window the following messages:

IO register loaded fir MC9S12UF32 C:\Freescale\CWS12v5.1\Prog\REG\MCU03E2.REG

P&E Interface detected - Flash Version 6.13

P&E Interface detected - Flash Version 6.13

Startup command file does not exist.

RUNNING

The write the command

in>SAVE 0x8000..0xFFFF DUMP.s19

                 ˘

Error: CPU is running.

Then I hit F6 or click in Halt button, the command windows says STOPPING, but I write the SAVE command again and says the same thing Error: CPU is runnung. Seems to be the microcontroller is not halting.

Some test give a S19 binary file output but I am not sure it have the right information. Solving the NON HALT issue and I asume can be retrieve the right S19 from the microcontroller.

Any suggestions?

My best regards.

0 Kudos
Reply