S12ZVL

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

S12ZVL

1,188 Views
thankaphahee
Contributor I

I am using S12ZVL microcontroller and using Freescale AN4723 bootloader to flash. I have an intermittent issue with Flashing. I am using cosmic compiler and Zap Debugger. The cosmic generated S19 file is not in the address order, not every is 37 byte long. Wnen I flash this cosmic generated S19 file, the application does not run.

I tried the following:

1. I downloaded the same S19 file using ZAP debugger and then Uploaded Form 0xFF8000 to 0xFFE3FF (My bootloader starts at 0xFFE400). Then I flashed this uploaded S19 file using AN4723 bootlader. It works fine

The uploaded S19 file is in the Address order and every single line is 37 bytes long.

2. I downloaded the cosmic generated S19 file using AN4723 booloader (the application did not run). Then I used ZAP debugger to upload Form 0xFF8000 to 0xFFE3FF. Then I used AN4723 bootloader to flash this uploaded S19 file again. Now the application works fine

I do not understand Why the application fails to run when I just flash the cosmic generated S19 (not in address order and some lines are not 37 byte long). I verified the flashing using ZAP debugger verification, verification was successful.

Can someone explain me where the problems occurs?

Thanks.

Thanka

0 Kudos
Reply
1 Reply

910 Views
RadekS
NXP Employee
NXP Employee

Hi Thanka,

Unfortunately, you didn’t attach your S-record file.

Per your description, the problem is in data order in generated S-record file.

I can imagine two potential issues:

  1. Your S-record file may contain two records for the same flash phrase (An aligned group of four 16-bit words within the P-Flash memory). Since the cumulative write into the same phrase is not allowed (even not possible due to ECC) and bootloader does not expect that situation (missing code for reading/modify/program of the whole sector), the programmed data may be incorrect.
  2. The bootloader code expects that reset vector at 0xFFFFF8 will be the last S-record from S-record file. The bootloader jumps to application code after receiving reset vector. So, if generated S-record file contains reset vector somewhere in middle, the application will be loaded only partially.

 

So, you have several easy…tough options how to fix it. For example:

  1. you may configure Cosmic compiler for generating expected S-record file format. Unfortunately, I don’t have any experience with the Cosmic compiler and their settings.
  2. you may modify bootloader code/loading software for accepting S-record files generated by the Cosmic compiler for avoiding upper mentioned potential issues. This present rather tough way because reprogramming 1kB sector needs additional resources and because the source code of loading software is not public available.
  3. You may convert generated S-record file into a specific format with subsequent data order. In general, you need a tool which will load from an original S-record file into “virtual” memory and read it subsequently back into new S-record file. This is an exact procedure, what you already make through your MCU. Unfortunately, I am not aware of any specific SW tool for S12Z, but You may use older SRecCvt tool for S12(X) with some limitation.

http://www.nxp.com/webapp/sps/download/license.jsp?colCode=SRECCVTSW

The  SRecCvt tool is much older than the S12Z core, therefore user GUI cannot be used in our case. However, we still can use SRecCvt tool directly through the command line. For example:

c:\Tools\SRecCvt_v1.0.31\SRecCvt-GUI\sreccvt -hc12 -m 100000 FFFFFF 32 -o "D:\Workspace\MY_PROJECT\FLASH\Output.S19" " D:\Workspace\MY_PROJECT\FLASH\Input.S19"

Please update your paths…

This command converts the Input.S19 file into Output.S19 file. The S-records will contain exactly 32bytes and the S-records will be placed in subsequent order.

 

The nice thing is that you may use this command directly as post build step (I am not sure whether Cosmic compiler has such option) and convert generated  S-record file automatically.

 

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

0 Kudos
Reply