<?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>8-bit MicrocontrollersのトピックRe: LC60: CRC Control of Program Content</title>
    <link>https://community.nxp.com/t5/8-bit-Microcontrollers/LC60-CRC-Control-of-Program-Content/m-p/202982#M16765</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hello BP,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;All of the error checking schemes will detect a single bit error within the data block.&amp;nbsp; However, if more than one bit error is probable, the effectiveness of some of the methods&amp;nbsp;will be&amp;nbsp;significantly reduced.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;The following would be more properly called "checksum" methods, rather than CRC:&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;CRC_ADD_BYTE, CRC_ADD_WORD, CRC_ADD_LONG&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;CRC_XOR_BYTE, CRC_XOR_WORD, CRC_XOR_LONG&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;These are particularly prone to non-detection of multiple bit errors, compared with the true CRC methods that utilize a "polynomial" for the error checking.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;However, for each of the true&amp;nbsp;CRC methods CRC_8, CRC_16, CRC_CCITT and CRC_32, the detection of multiple bit errors is good, but will start to deteriorate, when the data&amp;nbsp;block size exceeds certain limits -&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;8-bit CRC:&amp;nbsp;&amp;nbsp; 32 bytes&lt;/DIV&gt;&lt;DIV&gt;16-bit CRC: 8192 bytes&lt;/DIV&gt;&lt;DIV&gt;32-bit CRC:&amp;nbsp;More than 500Mb&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;You will therefore need to use a method that suits the size of the data block you are checking.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Regards,&lt;/DIV&gt;&lt;DIV&gt;Mac&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 16 Mar 2008 00:46:34 GMT</pubDate>
    <dc:creator>bigmac</dc:creator>
    <dc:date>2008-03-16T00:46:34Z</dc:date>
    <item>
      <title>LC60: CRC Control of Program Content</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/LC60-CRC-Control-of-Program-Content/m-p/202971#M16754</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;Hi to all,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;We are living corrupted program memory problem in mass production.&lt;/DIV&gt;&lt;DIV&gt;I want to add CRC algorithm to verify program content in run-time.&lt;/DIV&gt;&lt;DIV&gt;Two methods are&amp;nbsp;suggested in the CW6.1 Help for that:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; * PRM file controlled checksum computation&lt;BR /&gt;&amp;nbsp;&amp;nbsp; * Automatic linker controlled checksum computation&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I choosed Automatic Linker Controlled checksum computation for my project and added &amp;lt;start08.h&amp;gt; and&amp;nbsp;&amp;lt;checksum.h&amp;gt; to my project.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV class="msg_source_code"&gt;&lt;DIV class="text_smallest"&gt;Code:&lt;/DIV&gt;&lt;PRE&gt;#include &amp;lt;hidef.h&amp;gt;#include &amp;lt;start08.h&amp;gt;#include &amp;lt;checksum.h&amp;gt;#include "derivative.h"_CHECKSUM_STARTUP_ENTRY......void main(void){&amp;nbsp; __RESET_WATCHDOG();&amp;nbsp; while(__CHECKSUM_IS_OK != 1) __RESET_WATCHDOG();&amp;nbsp; ...&amp;nbsp; ... }&lt;/PRE&gt;&lt;/DIV&gt;&lt;BR /&gt;But it gives error "C1085: checkSum is not a member"&lt;/DIV&gt;&lt;DIV&gt;I looked to _startupData and it doesn't really have member such as checkSum.&lt;/DIV&gt;&lt;DIV&gt;What am I doing wrong?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thanks,&lt;/DIV&gt;&lt;DIV&gt;BP.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Mar 2008 20:40:45 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/LC60-CRC-Control-of-Program-Content/m-p/202971#M16754</guid>
      <dc:creator>BasePointer</dc:creator>
      <dc:date>2008-03-14T20:40:45Z</dc:date>
    </item>
    <item>
      <title>Re: LC60: CRC Control of Program Content</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/LC60-CRC-Control-of-Program-Content/m-p/202972#M16755</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;The standard start08.h does not support that checksum feature, it does need a small extension from checksum.h. The checksum header contains a macro to provide the added fields, by placing those into a local copy of start08.h it should just work :smileyhappy:.&lt;BR /&gt;There have been 3 checksum samples with previous versions, but they did not ship with the recent versions.&lt;BR /&gt;Anyway, out of my memory, the following should do it:&lt;BR /&gt;- copy start08.h into your local project (in order not to change other projects)&lt;BR /&gt;- include checksum.h in start08.h&lt;BR /&gt;- search for the macro defining the checkSum field in checksum.h and add it in the struct in start08.h where the compiler expects the checkSum field.&lt;BR /&gt;&lt;BR /&gt;There is no need to recompile the ANSI lib, you may have to add checksum.c to your project though.&lt;BR /&gt;&lt;BR /&gt;Daniel&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Mar 2008 21:18:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/LC60-CRC-Control-of-Program-Content/m-p/202972#M16755</guid>
      <dc:creator>CompilerGuru</dc:creator>
      <dc:date>2008-03-14T21:18:26Z</dc:date>
    </item>
    <item>
      <title>Re: LC60: CRC Control of Program Content</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/LC60-CRC-Control-of-Program-Content/m-p/202973#M16756</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;Just rereading the OP.&lt;BR /&gt;&lt;PRE&gt;_&lt;B&gt;CHECKSUM&lt;/B&gt;_STARTUP_ENTRY has to be added in (a copy of) start08.h, not in main.c.

&lt;/PRE&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Mar 2008 21:22:29 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/LC60-CRC-Control-of-Program-Content/m-p/202973#M16756</guid>
      <dc:creator>CompilerGuru</dc:creator>
      <dc:date>2008-03-14T21:22:29Z</dc:date>
    </item>
    <item>
      <title>Re: LC60: CRC Control of Program Content</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/LC60-CRC-Control-of-Program-Content/m-p/202974#M16757</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Dear Daniel,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;1. I copied checksum.h, checksum.c and Start08.h to my project source location.&lt;/DIV&gt;&lt;DIV&gt;2. In Local Start08.h file, I added #include "checksum.h" immediatel after #include &amp;lt;hidef.h&amp;gt;.&lt;/DIV&gt;&lt;DIV&gt;3. In Local Start08.h file, I added _CHECKSUM_STARTUP_ENTRY to the end of both struct _tagStartup definition.&lt;/DIV&gt;&lt;DIV&gt;4. I added local checksum.c file to my project to build.&lt;/DIV&gt;&lt;DIV&gt;5. In my mail.c file, I added&amp;nbsp;#include "checksum.h", #include "Start08.h" lines.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;The project is now linked successfully with a warning:&lt;/DIV&gt;&lt;DIV&gt;"&lt;A target="_blank"&gt;L1827: Symbol _startupData has different size in&amp;nbsp;Start08.c.o (10 bytes) and&amp;nbsp;main.c.o (13 bytes)&lt;/A&gt;"&lt;/DIV&gt;&lt;DIV&gt;Is this problem? I also want to use at least 16bit CRC. How can I define this?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV class="msg_source_code"&gt;&lt;DIV class="text_smallest"&gt;Code:&lt;/DIV&gt;&lt;PRE&gt;#include &amp;lt;hidef.h&amp;gt; /* for EnableInterrupts macro */#include &amp;lt;string.h&amp;gt;#include "checksum.h"#include "Start08.h"#include "derivative.h"&lt;/PRE&gt;&lt;/DIV&gt;&lt;BR /&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thanks,&lt;/DIV&gt;&lt;DIV&gt;BP.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Mar 2008 22:09:18 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/LC60-CRC-Control-of-Program-Content/m-p/202974#M16757</guid>
      <dc:creator>BasePointer</dc:creator>
      <dc:date>2008-03-14T22:09:18Z</dc:date>
    </item>
    <item>
      <title>Re: LC60: CRC Control of Program Content</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/LC60-CRC-Control-of-Program-Content/m-p/202975#M16758</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hi,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;These two flags in Start08.c cause the warning.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="msg_source_code"&gt;&lt;DIV class="text_smallest"&gt;Code:&lt;/DIV&gt;&lt;PRE&gt;#define __NO_FLAGS_OFFSET   /* we do not need the flags field in the startup data descriptor */#define __NO_MAIN_OFFSET    /* we do not need the main field in the startup data descriptor */#include "Start08.h"&lt;/PRE&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;BR /&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I don't know the meaning of them. Included start08.h in main.c doesn't define these two flags (__NO_FLAGS_OFFSET and __NO_MAIN_OFFSET) and so size of _startupData in main.c and _startupData in start08.c be different.&lt;BR /&gt;&lt;/DIV&gt;&lt;DIV&gt;Should I remove these flags in start08.c? Or Should I add these flags to also main.c before including start08.h?&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Regards,&lt;/DIV&gt;&lt;DIV&gt;BP.&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Mar 2008 22:37:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/LC60-CRC-Control-of-Program-Content/m-p/202975#M16758</guid>
      <dc:creator>BasePointer</dc:creator>
      <dc:date>2008-03-14T22:37:44Z</dc:date>
    </item>
    <item>
      <title>Re: LC60: CRC Control of Program Content</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/LC60-CRC-Control-of-Program-Content/m-p/202976#M16759</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Hi,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I solved the problem above by moving flag definitions to Start08.h.&lt;/DIV&gt;&lt;DIV&gt;I have an other problem:&lt;/DIV&gt;&lt;DIV&gt;When I debug the code below&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; _Checksum_Check(_startupData.checkSum, _startupData.nofCheckSums)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I saw that _startupData.nofCheckSums equals to 6 for my project. It iterates _Checksum_CheckAreaCRC16(check-&amp;gt;start, check-&amp;gt;len...) function six times.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;0: start-&amp;gt;0x1870, len-&amp;gt;57056 (decimal)&lt;/DIV&gt;&lt;DIV&gt;1: start-&amp;gt;0xFEB0, len-&amp;gt;210 (decimal)&lt;/DIV&gt;&lt;DIV&gt;2: start-&amp;gt;0xFFBD, len-&amp;gt;1 (decimal)&lt;/DIV&gt;&lt;DIV&gt;3: start-&amp;gt;0xFFBF, len-&amp;gt;1 (decimal)&lt;/DIV&gt;&lt;DIV&gt;4: start-&amp;gt;&lt;STRONG&gt;0xFFD2&lt;/STRONG&gt;, len-&amp;gt;46 (decimal)&lt;/DIV&gt;&lt;DIV&gt;5: start-&amp;gt;&lt;STRONG&gt;0xFFD2&lt;/STRONG&gt;, len-&amp;gt;44 (decimal) [again]&lt;BR /&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV class="msg_source_code"&gt;&lt;DIV class="text_smallest"&gt;Code:&lt;/DIV&gt;&lt;PRE&gt;SEGMENTS /* Here all RAM/ROM areas of the device are listed. Used in PLACEMENT below. */        Z_RAM                    =  READ_WRITE   0x0060 TO 0x00FF;  // 160 byte    RAM                      =  READ_WRITE   0x0100 TO 0x085F;  // 1888 byte    NO_INIT_RAM_SEG          =  NO_INIT      0x0860 TO 0x0C5F;  // 1024 byte    MY_STK                   =  NO_INIT      0x0C60 TO 0x105F;  // 1024 byte    NV_SAVE_SEG              =  &lt;STRONG&gt;READ_ONLY&lt;/STRONG&gt;    0x1060 TO 0x13FF FILL 0x8D;  // reserve 928 (512) byte for NV    ROM1                     =  &lt;STRONG&gt;READ_ONLY&lt;/STRONG&gt;    0x1400 TO 0x17FF FILL 0x8D;    ROM                      =  &lt;STRONG&gt;READ_ONLY&lt;/STRONG&gt;    0x1870 TO 0xFEAF FILL 0x8D;    FLASH_ROUTINE_SEG        =  &lt;STRONG&gt;READ_ONLY&lt;/STRONG&gt;    0xFEB0 TO 0xFFAF FILL 0x8D;    ROM2                     =  &lt;STRONG&gt;READ_ONLY&lt;/STRONG&gt;    0xFFC0 TO 0xFFD1 FILL 0x8D;    INTVECT                  =  &lt;STRONG&gt;READ_ONLY&lt;/STRONG&gt;    0xFFD2 TO 0xFFFF FILL 0x8D;// Reserved for Int. Vectors*/ENDPLACEMENT /* Here all predefined and user segments are placed into the SEGMENTS defined above. */    _DATA_ZEROPAGE, MY_ZEROPAGE         INTO  Z_RAM;    DEFAULT_RAM                         INTO  RAM;    NO_INIT_RAM                         INTO  NO_INIT_RAM_SEG;    SSTACK                              INTO  MY_STK;    NV_SAVE_AREA                        INTO  NV_SAVE_SEG;    FLASH_ROUTINE_AREA                  INTO  FLASH_ROUTINE_SEG;    _PRESTART, STARTUP, DEFAULT_ROM,     ROM_VAR, STRINGS, COPY, .checksum   INTO  ROM, ROM1; /* ROM1,ROM2 In case you want to use ROM1,ROM2                                                            as well, be sure the option -OnB=b                                                             is passed to the compiler. */END&lt;/PRE&gt;&lt;/DIV&gt;&lt;BR /&gt;&amp;nbsp;I don't understant what the 2., 3., 4. and 5. iterations are. Especially, 4. and 5. seem as a problem.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Here is related section from map file:&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV class="msg_source_code"&gt;&lt;DIV class="text_smallest"&gt;Code:&lt;/DIV&gt;&lt;PRE&gt;*********************************************************************************************SECTION-ALLOCATION SECTIONSection Name                    Size  Type     From       To       Segment---------------------------------------------------------------------------------------------FLASH_ROUTINE_AREA               210     R     0xFEB0     0xFF81   FLASH_ROUTINE_SEG.init                            132     R     0x1870     0x18F3   ROM.startData                        18     R     0x18F4     0x1905   ROM.text                          54720     R     0x1906     0xEEC5   ROM.rodata                         1221     R     0xEEC6     0xF38A   ROM.rodata1                         930     R     0xF38B     0xF72C   ROM.copy                             35     R     0xF72D     0xF74F   ROM.checksum                         36     R     0xF750     0xF773   ROM.abs_section_ffbd                  1     R     0xFFBD     0xFFBD   .absSeg128.abs_section_ffbf                  1     R     0xFFBF     0xFFBF   .absSeg129.abs_section_ffd6                  2     R     0xFFD6     0xFFD7   .absSeg130.abs_section_ffd8                  2     R     0xFFD8     0xFFD9   .absSeg131.abs_section_ffda                  2     R     0xFFDA     0xFFDB   .absSeg132.abs_section_ffdc                  2     R     0xFFDC     0xFFDD   .absSeg133.abs_section_ffe8                  2     R     0xFFE8     0xFFE9   .absSeg134.abs_section_ffe6                  2     R     0xFFE6     0xFFE7   .absSeg135.abs_section_ffec                  2     R     0xFFEC     0xFFED   .absSeg136.abs_section_ffee                  2     R     0xFFEE     0xFFEF   .absSeg137.abs_section_fff2                  2     R     0xFFF2     0xFFF3   .absSeg138.abs_section_fff4                  2     R     0xFFF4     0xFFF5   .absSeg139.abs_section_fff8                  2     R     0xFFF8     0xFFF9   .absSeg140.abs_section_fffa                  2     R     0xFFFA     0xFFFB   .absSeg141.abs_section_fffc                  2     R     0xFFFC     0xFFFD   .absSeg142.abs_section_ffd2                  2     R     0xFFD2     0xFFD3   .absSeg143.abs_section_fff6                  2     R     0xFFF6     0xFFF7   .absSeg144.abs_section_ffd4                  2     R     0xFFD4     0xFFD5   .absSeg145.abs_section_fff0                  2     R     0xFFF0     0xFFF1   .absSeg146.abs_section_ffea                  2     R     0xFFEA     0xFFEB   .absSeg147.abs_section_ffe2                  2     R     0xFFE2     0xFFE3   .absSeg148.abs_section_ffe0                  2     R     0xFFE0     0xFFE1   .absSeg149.abs_section_ffe4                  2     R     0xFFE4     0xFFE5   .absSeg150.abs_section_ffde                  2     R     0xFFDE     0xFFDF   .absSeg151INTVECT_vect                      46     R     0xFFD2     0xFFFF   INTVECTNV_SAVE_SEG_152                  928     R     0x1060     0x13FF   NV_SAVE_SEGROM1_153                        1024     R     0x1400     0x17FF   ROM1ROM_154                         1852     R     0xF774     0xFEAF   ROMFLASH_ROUTINE_SEG_155             46     R     0xFF82     0xFFAF   FLASH_ROUTINE_SEGSummary of section sizes per section type:READ_ONLY (R):        EF3C (dec:    61244)&lt;/PRE&gt;&lt;/DIV&gt;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 15 Mar 2008 01:26:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/LC60-CRC-Control-of-Program-Content/m-p/202976#M16759</guid>
      <dc:creator>BasePointer</dc:creator>
      <dc:date>2008-03-15T01:26:56Z</dc:date>
    </item>
    <item>
      <title>Re: LC60: CRC Control of Program Content</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/LC60-CRC-Control-of-Program-Content/m-p/202977#M16760</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Are you getting any warnings from the linker? Check that none are disabled in the linker preference panel.&lt;BR /&gt;It looks to me as if the area used by the INTVECT segment, is used concurrently by some absolutely allocated vectors too.&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;DIV class="msg_source_code"&gt;&lt;DIV class="text_smallest"&gt;Code:&lt;/DIV&gt;&lt;PRE&gt;INTVECT_vect                      46     R     0xFFD2     0xFFFF   INTVECT.abs_section_ffd2                  2     R     0xFFD2     0xFFD3   .absSeg143&lt;/PRE&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/DIV&gt;Daniel&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 15 Mar 2008 08:01:59 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/LC60-CRC-Control-of-Program-Content/m-p/202977#M16760</guid>
      <dc:creator>CompilerGuru</dc:creator>
      <dc:date>2008-03-15T08:01:59Z</dc:date>
    </item>
    <item>
      <title>Re: LC60: CRC Control of Program Content</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/LC60-CRC-Control-of-Program-Content/m-p/202978#M16761</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Hi Daniel,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I removed INTVEC segment from the prm file. Now it iterates five times:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;0. start: 0x1870, len: 57056 -&amp;gt; ROM segment&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;1. start: 0xFEB0, len:&amp;nbsp;210 -&amp;gt;&amp;nbsp;FLASH_ROUTINE_SEG segment&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;2. start: 0xFFBD, len:&amp;nbsp;1 -&amp;gt; NVPROT&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;3. start: 0xFFBF, len:&amp;nbsp;1 -&amp;gt; NVOPT&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;4. start: 0xFFD2, len:&amp;nbsp;46 -&amp;gt; Absolutely allocated&amp;nbsp;interrupt vectors&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Empty program memory but filled with 0x8D by linker via the PRM file isn't included for CRC calculation. This is not so much problem for me.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV class="msg_source_code"&gt;Code:&lt;PRE&gt;/* Block Protection Disabled */const unsigned char NVPROT_INIT @0x0000FFBD = 0b11111111;/* NVOPT: KEYEN=0,FNORED=1,??=1,??=1,??=1,??=1,SEC01=0,SEC00=1 *//* Backdoor Key disabled, no vector redirection, MCU is unsecure */const unsigned char NVOPT_INIT @0x0000FFBF = 0b01000010; // CyclonePro makes it secure after programming!&lt;/PRE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;For the NVOPT, I leave that&amp;nbsp;MCU is in unsecure mode. But CyclonePro make it secure after programming. Because, if I make it secure in the code, CyclonePro can't program it. So the CRC of the content would be different. Is it possible to&amp;nbsp;mark linker not to include NVOPT register for CRC calculation? Or any other method?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thanks,&lt;/DIV&gt;&lt;DIV&gt;BP.&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 15 Mar 2008 19:04:04 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/LC60-CRC-Control-of-Program-Content/m-p/202978#M16761</guid>
      <dc:creator>BasePointer</dc:creator>
      <dc:date>2008-03-15T19:04:04Z</dc:date>
    </item>
    <item>
      <title>Re: LC60: CRC Control of Program Content</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/LC60-CRC-Control-of-Program-Content/m-p/202979#M16762</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;Hi Daniel,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I also removed&amp;nbsp;NVPROT and NVOPT&amp;nbsp;definition in my code. CRC routine doesn't scan these registers and it iterates three times.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;0. start: 0x1870, len: 57056 -&amp;gt; ROM segment&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;1. start: 0xFEB0, len:&amp;nbsp;210 -&amp;gt;&amp;nbsp;FLASH_ROUTINE_SEG segment&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;3. start: 0xFFD2, len:&amp;nbsp;46 -&amp;gt; Absolutely allocated&amp;nbsp;interrupt vectors&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Cyclone Pro configures these registers after programming.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Benchmark for CRC Routines: (ENABLE_PRECOMPUTE uses table)&lt;/DIV&gt;&lt;DIV&gt;CRC_8 -&amp;gt; 294msec&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;CRC_16 -&amp;gt; 700msec&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;CRC_CCITT -&amp;gt; 1.2sec&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;CRC_32 -&amp;gt; 4.94sec&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;CRC_ADD_BYTE -&amp;gt; 392msec&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;CRC_ADD_WORD -&amp;gt; &lt;STRONG&gt;280msec&lt;/STRONG&gt; ****&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;CRC_ADD_LONG -&amp;gt; 4.95sec&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;CRC_XOR_BYTE -&amp;gt; 393msec&lt;/DIV&gt;&lt;DIV&gt;CRC_XOR_WORD -&amp;gt; &lt;STRONG&gt;278msec&lt;/STRONG&gt; ****&lt;/DIV&gt;&lt;DIV&gt;CRC_XOR_LONG -&amp;gt; 4.93sec&lt;/DIV&gt;&lt;DIV&gt;------------------------------------------------&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;There are some notes for ADD_WORD/LONG and XOR_WORD/LONG&lt;/DIV&gt;&lt;DIV&gt;"For WORD: &lt;EM&gt;/* careful: this one only works when all the addresses/sizes are&amp;nbsp; a multiple of 2 */&lt;/EM&gt;"&lt;/DIV&gt;&lt;DIV&gt;"For LONG: &lt;EM&gt;/* careful: this one only works when all the addresses/sizes are&amp;nbsp; a multiple of 4 */&lt;/EM&gt;"&lt;/DIV&gt;&lt;DIV&gt;How can I be sure if addresses/sizes are really a multiple of 2 or 4?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;I will choose one of CRC_ADD_WORD or CRC_XOR_WORD method due to execution time.&lt;/DIV&gt;&lt;DIV&gt;Which method do you thing safer?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thanks,&lt;/DIV&gt;&lt;DIV&gt;BP.&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 15 Mar 2008 21:36:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/LC60-CRC-Control-of-Program-Content/m-p/202979#M16762</guid>
      <dc:creator>BasePointer</dc:creator>
      <dc:date>2008-03-15T21:36:53Z</dc:date>
    </item>
    <item>
      <title>Re: LC60: CRC Control of Program Content</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/LC60-CRC-Control-of-Program-Content/m-p/202980#M16763</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;CRC32 is the most safe, by quite a wide margin.&lt;BR /&gt;&lt;BR /&gt;CRC_CCITT is safe, and probably the best comprise between time and results.. This is a carefully designed algorithm that minimizes the chances of hashing collisions.&amp;nbsp; This means the chances that it gets the same CRC for incorrect date is minimized. It is very well researched.&lt;BR /&gt;&lt;BR /&gt;If that is too slow, my next choice would be CRC16.&lt;BR /&gt;&lt;BR /&gt;I would use CRC_8 before any of the other faster ones. At least is a CRC computation, and has known characteristics.&lt;BR /&gt;&lt;BR /&gt;Personally, unless the time is a killer, I would not waste my time with the others.&lt;BR /&gt;There is much data available, so check it out for yourself.&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 15 Mar 2008 23:12:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/LC60-CRC-Control-of-Program-Content/m-p/202980#M16763</guid>
      <dc:creator>JimDon</dc:creator>
      <dc:date>2008-03-15T23:12:50Z</dc:date>
    </item>
    <item>
      <title>Re: LC60: CRC Control of Program Content</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/LC60-CRC-Control-of-Program-Content/m-p/202981#M16764</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Just for a check I did some timings for CCITT16&lt;BR /&gt;Using an 8 Mhz bus clock (16 Mhz CPU Clock) on a QG8 I got about 16.5 ms/K.&lt;BR /&gt;(not running in the debugger).&lt;BR /&gt;Don't know how much you are checking or your clock speed, but things should scale linearly.&lt;BR /&gt;&lt;BR /&gt;I also discovered if you don't set _CHECKSUM_CRC_8 to 0, it will include that one as well by default, so you might check into that. It will end up doing both&lt;BR /&gt;&lt;BR /&gt;You also do not need to copy checksum.c or h to you project directory, you can just add them from the src directory. The advantage to that is if they ever get bug fixes, you will get the fixes - the disadvantage is you may not care for the bug fixes.&lt;BR /&gt;&lt;BR /&gt;If you choose the leave them there in the src folder, you will need to add this to cimplier command line args dialog:&lt;BR /&gt;-D_CHECKSUM_CRC_CCITT=1 -D_CHECKSUM_CRC_8=0&lt;BR /&gt;Also if you do things like this either way, you will not have change #define s in your code.&lt;BR /&gt;&lt;BR /&gt;As you mentioned, it will only include generated code - not filled areas even though it seems you told it to.&lt;BR /&gt;If these are important to verify flash integrity, you could just loop on a compare for those areas, but if you use them later the code would have to be adjusted.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 16 Mar 2008 00:39:00 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/LC60-CRC-Control-of-Program-Content/m-p/202981#M16764</guid>
      <dc:creator>JimDon</dc:creator>
      <dc:date>2008-03-16T00:39:00Z</dc:date>
    </item>
    <item>
      <title>Re: LC60: CRC Control of Program Content</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/LC60-CRC-Control-of-Program-Content/m-p/202982#M16765</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hello BP,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;All of the error checking schemes will detect a single bit error within the data block.&amp;nbsp; However, if more than one bit error is probable, the effectiveness of some of the methods&amp;nbsp;will be&amp;nbsp;significantly reduced.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;The following would be more properly called "checksum" methods, rather than CRC:&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;CRC_ADD_BYTE, CRC_ADD_WORD, CRC_ADD_LONG&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;CRC_XOR_BYTE, CRC_XOR_WORD, CRC_XOR_LONG&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;These are particularly prone to non-detection of multiple bit errors, compared with the true CRC methods that utilize a "polynomial" for the error checking.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;However, for each of the true&amp;nbsp;CRC methods CRC_8, CRC_16, CRC_CCITT and CRC_32, the detection of multiple bit errors is good, but will start to deteriorate, when the data&amp;nbsp;block size exceeds certain limits -&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;8-bit CRC:&amp;nbsp;&amp;nbsp; 32 bytes&lt;/DIV&gt;&lt;DIV&gt;16-bit CRC: 8192 bytes&lt;/DIV&gt;&lt;DIV&gt;32-bit CRC:&amp;nbsp;More than 500Mb&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;You will therefore need to use a method that suits the size of the data block you are checking.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Regards,&lt;/DIV&gt;&lt;DIV&gt;Mac&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 16 Mar 2008 00:46:34 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/LC60-CRC-Control-of-Program-Content/m-p/202982#M16765</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2008-03-16T00:46:34Z</dc:date>
    </item>
    <item>
      <title>Re: LC60: CRC Control of Program Content</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/LC60-CRC-Control-of-Program-Content/m-p/202983#M16766</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Hi Jim, Mac,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;My bus frequency is about 6Mhz and the program size is around 60K. CCITT takes time about 1.2sec for my application. So Jim's estimation is approximately equal to my result. I choosed CHECKSUM_ADD_WORD method due to short execution time. But there is a limitation for it: &lt;STRONG&gt;/* careful: this one only works when all the addresses/sizes are&amp;nbsp; a multiple of 2 */&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;&lt;/STRONG&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;The algorithm is really not working when the size are not a multiple of 2. Everytime I don't want to check address/size&amp;nbsp;if they really are a multiple of 2.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Can I control this at linking stage automatically?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I know safest method is CRC32 or more bits.. But if you&amp;nbsp;had to use a method between CHECKSUM_ADD_WORD and CHECKSUM_XOR_WORD, which of them would you choose?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;10x,&lt;/DIV&gt;&lt;DIV&gt;BP.&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;Message Edited by BasePointer on &lt;SPAN class="date_text"&gt;2008-03-17&lt;/SPAN&gt; &lt;SPAN class="time_text"&gt;05:00 PM&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Mar 2008 21:49:07 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/LC60-CRC-Control-of-Program-Content/m-p/202983#M16766</guid>
      <dc:creator>BasePointer</dc:creator>
      <dc:date>2008-03-17T21:49:07Z</dc:date>
    </item>
  </channel>
</rss>

