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