<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>CodeWarrior for MCUのトピックRe: Checksum calculations revisited...</title>
    <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Checksum-calculations-revisited/m-p/171460#M5306</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi...&lt;/P&gt;&lt;P&gt;I forgot to check the linker version, sorry...&lt;/P&gt;&lt;P&gt;I too prefer to use the single area syntax; I was thrashing around looking for a&lt;/P&gt;&lt;P&gt;solution.&lt;/P&gt;&lt;P&gt;Flash is correct, in that the CRC works well up to $D70F (DF09, actually).&lt;/P&gt;&lt;P&gt;I hadn't thought of using the 'add' method instead of 'crc-16' to narrow the list&lt;/P&gt;&lt;P&gt;of possibilities; I'll try that, and maybe 'xor-16' as well. That should provide some&lt;/P&gt;&lt;P&gt;clues.&lt;/P&gt;&lt;P&gt;Ty for the suggestion; shall update on my results.&lt;/P&gt;&lt;P&gt;Seb&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 22 Dec 2010 20:16:06 GMT</pubDate>
    <dc:creator>sebbyBaby</dc:creator>
    <dc:date>2010-12-22T20:16:06Z</dc:date>
    <item>
      <title>Checksum calculations revisited...</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Checksum-calculations-revisited/m-p/171457#M5303</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Am using an mc9s12xdt256, with CodeWarrior IDE 5.9.0&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have created&amp;nbsp;'bootstrap' code that resides in $E000 to $FFFF, and am placing application&lt;/P&gt;&lt;P&gt;code in $4004 to $D70F, and a secondary interrupt vector table in $D710 - $D7FF.&amp;nbsp; The&lt;/P&gt;&lt;P&gt;bootstrap checks the CRC of the application area, and compares it with a PRM-calculated&lt;/P&gt;&lt;P&gt;checksum at $4000, and only jumps to the app if it is correct.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The PRM file segment definitions look like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/* non-banked FLASH */&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ROM_APP_CRC&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = READ_ONLY&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x4000 TO&amp;nbsp;&amp;nbsp; 0x4001;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ROM_APP_ENTRY = READ_ONLY&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x4002 TO&amp;nbsp;&amp;nbsp; 0x4003;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ROM_4000&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = READ_ONLY&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x4004 TO&amp;nbsp;&amp;nbsp; 0xD70F&amp;nbsp; FILL 0x3F;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ROM_VEC_TAB&amp;nbsp;&amp;nbsp; = READ_ONLY&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0xD710 TO&amp;nbsp;&amp;nbsp; 0xD7FF&amp;nbsp; FILL 0x3F;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;a)&amp;nbsp;If I use a single checksum entry calculation, from $4004 to $D70F, everything&lt;/P&gt;&lt;P&gt;works fine, and I jump to the app....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;b) if I use a single checksum entry calculation anywhere beyond $D70F, it fails.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;c) I tried using a two-entry checksum calculation in the PRM file, but - irrespective&lt;/P&gt;&lt;P&gt;of the endpoint of the 2nd stages calculation - it always fails.&lt;/P&gt;&lt;P&gt;Have attached a sample of one of my efforts.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CHECKSUM&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CHECKSUM_ENTRY&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; METHOD_CRC16 INIT 0xFFFF POLY 0x1021&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OF READ_ONLY 0x4004 TO 0xD70F&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OF READ_ONLY 0xD710 TO 0xD7F9&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; INTO READ_ONLY 0x4000 SIZE 2&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; UNDEFINED 0x3F&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; END&lt;BR /&gt;END&lt;/P&gt;&lt;P&gt;It seems as if the automatically calculated checksum loses its&lt;/P&gt;&lt;P&gt;continuity&amp;nbsp;at the segment change from ROM_4000 to ROM_VEC_TAB.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is this an accurate asdsessment, and is there possible a workaround&lt;/P&gt;&lt;P&gt;for it?&lt;/P&gt;&lt;P&gt;I'd be very grateful for any assistance in this matter.&lt;/P&gt;&lt;P&gt;Seb&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Dec 2010 03:15:17 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Checksum-calculations-revisited/m-p/171457#M5303</guid>
      <dc:creator>sebbyBaby</dc:creator>
      <dc:date>2010-12-22T03:15:17Z</dc:date>
    </item>
    <item>
      <title>Re: Checksum calculations revisited...</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Checksum-calculations-revisited/m-p/171458#M5304</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;First, the given version 5.9 is the version of the ide (the build system and editor). The most recent HC12 product version is 5.1 (I think). Are you using a recent version.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then as the 2 segments are contiguous a single area should be fine. I never used the 2 areas syntax, I actually do not see the benefit of that compared with 2 separate checksums for distinct 2 areas. Either way, that's not your issue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Did you verify that the content of the flash is indeed correct?&lt;/P&gt;&lt;P&gt;In order to narrow down the reason of the failure I would suggest to use a simpler checksum method (say add) and to narrow down the area which fails as much as possible, preferably to just a byte (or word for a 16 bit checksum). Then I would hope it gets obvious why it is failing...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Dec 2010 06:29:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Checksum-calculations-revisited/m-p/171458#M5304</guid>
      <dc:creator>CompilerGuru</dc:creator>
      <dc:date>2010-12-22T06:29:26Z</dc:date>
    </item>
    <item>
      <title>Re: Checksum calculations revisited...</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Checksum-calculations-revisited/m-p/171459#M5305</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Seb,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; UNDEFINED &lt;FONT color="#ff0000"&gt;0x3F&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When there's&amp;nbsp;some gap between sections, some undefined addresses, CRC calculator uses UNDEFINED setttng to "fill" missing addresses. I wonder why did you change this to 0x3F? Erased flash state is all ones, or 0xFF for erased byte. Of course CRC should fail on unused locations, since they are 0xFF and CRC calculator assumed 9x3F. Change it back to 0xFF or remove optional UNDEFINED line.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Dec 2010 14:00:45 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Checksum-calculations-revisited/m-p/171459#M5305</guid>
      <dc:creator>kef</dc:creator>
      <dc:date>2010-12-22T14:00:45Z</dc:date>
    </item>
    <item>
      <title>Re: Checksum calculations revisited...</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Checksum-calculations-revisited/m-p/171460#M5306</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi...&lt;/P&gt;&lt;P&gt;I forgot to check the linker version, sorry...&lt;/P&gt;&lt;P&gt;I too prefer to use the single area syntax; I was thrashing around looking for a&lt;/P&gt;&lt;P&gt;solution.&lt;/P&gt;&lt;P&gt;Flash is correct, in that the CRC works well up to $D70F (DF09, actually).&lt;/P&gt;&lt;P&gt;I hadn't thought of using the 'add' method instead of 'crc-16' to narrow the list&lt;/P&gt;&lt;P&gt;of possibilities; I'll try that, and maybe 'xor-16' as well. That should provide some&lt;/P&gt;&lt;P&gt;clues.&lt;/P&gt;&lt;P&gt;Ty for the suggestion; shall update on my results.&lt;/P&gt;&lt;P&gt;Seb&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Dec 2010 20:16:06 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Checksum-calculations-revisited/m-p/171460#M5306</guid>
      <dc:creator>sebbyBaby</dc:creator>
      <dc:date>2010-12-22T20:16:06Z</dc:date>
    </item>
    <item>
      <title>Re: Checksum calculations revisited...</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Checksum-calculations-revisited/m-p/171461#M5307</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi...&lt;/P&gt;&lt;P&gt;I use 0x3F for undefined areas as it is the opcode for a software interrupt&lt;/P&gt;&lt;P&gt;instruction, which I use to force a reset (processor has definitely gone astray&lt;/P&gt;&lt;P&gt;if it is trying to execute code in an undefined area). I also use it as the filler&lt;/P&gt;&lt;P&gt;byte for the segments.&lt;/P&gt;&lt;P&gt;It does work, in that the CRC is correct up to a point (up to $D709).&lt;/P&gt;&lt;P&gt;Ty for the suggestion, though... there's a couple of things that I can try out to&lt;/P&gt;&lt;P&gt;see what is actually happening, and shall post the results of my investigation.&lt;/P&gt;&lt;P&gt;Is going to be something very subtle, I think..&amp;nbsp; e.g. I found out that the PRM CRC&lt;/P&gt;&lt;P&gt;calculation does not work with an odd number of bytes (gives an error message!).&lt;/P&gt;&lt;P&gt;It's going to be something in the way that the calculation is performed.&lt;/P&gt;&lt;P&gt;Seb&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Dec 2010 20:26:01 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Checksum-calculations-revisited/m-p/171461#M5307</guid>
      <dc:creator>sebbyBaby</dc:creator>
      <dc:date>2010-12-22T20:26:01Z</dc:date>
    </item>
    <item>
      <title>Re: Checksum calculations revisited...</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Checksum-calculations-revisited/m-p/171462#M5308</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry for noise, I didn't notice FILL 0x3F.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Dec 2010 21:19:57 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Checksum-calculations-revisited/m-p/171462#M5308</guid>
      <dc:creator>kef</dc:creator>
      <dc:date>2010-12-22T21:19:57Z</dc:date>
    </item>
    <item>
      <title>Re: Checksum calculations revisited...</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Checksum-calculations-revisited/m-p/171463#M5309</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;- Did you verify that the flash content is correct other than looking at the checksum result? HIWAVE's load command can for example do a verify.&lt;/P&gt;&lt;P&gt;- The checksum fails as soon as it includes&amp;nbsp;DF0A? What is at&amp;nbsp;DF0A?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;Does a 1 byte add checksum at&amp;nbsp;DF0A fail?&lt;/P&gt;&lt;P&gt;- Which version of the tools are you using?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;In the release notes of the linker 5.0.36 (in MCU10):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;gt; - &amp;nbsp;MTWX27784: Fix for an issue where linker calculates incorrect checksum with option -COCC&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Dec 2010 02:40:05 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Checksum-calculations-revisited/m-p/171463#M5309</guid>
      <dc:creator>CompilerGuru</dc:creator>
      <dc:date>2010-12-23T02:40:05Z</dc:date>
    </item>
    <item>
      <title>Re: Checksum calculations revisited...</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Checksum-calculations-revisited/m-p/171464#M5310</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi...&lt;/P&gt;&lt;P&gt;Sorry top be so late replying, but I felt the need to have a&lt;/P&gt;&lt;P&gt;break over Xmas.&lt;/P&gt;&lt;P&gt;I eventually settled on&amp;nbsp;a single entry solution, and got the&lt;/P&gt;&lt;P&gt;thing going...&lt;/P&gt;&lt;P&gt;Your suggestion of using the command line option for the&lt;/P&gt;&lt;P&gt;fix seems to be exactly what I needed; I checked the release&lt;/P&gt;&lt;P&gt;notes, and it seems spot-on.&amp;nbsp; Have put that on my to-do list&lt;/P&gt;&lt;P&gt;for tidying the software.&lt;/P&gt;&lt;P&gt;Thanks for your help, and hope that you (and the others) &amp;nbsp;have&lt;/P&gt;&lt;P&gt;a happy new year,&lt;/P&gt;&lt;P&gt;Seb&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Jan 2011 22:15:30 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Checksum-calculations-revisited/m-p/171464#M5310</guid>
      <dc:creator>sebbyBaby</dc:creator>
      <dc:date>2011-01-05T22:15:30Z</dc:date>
    </item>
  </channel>
</rss>

