title: IAR linker CRC32 calculation doesn't match with the one calculated in C (and in other webs)
body: <p>The point is that I need to calculate a 32 bit CRC using the IAR in order to auto store this value into a known memory address but the result given by IAR and the one I calculate using a C function (checked using some online calculators) don't match. 
  In the next paragraphs I will try to go step by step following all the process I followed.</p>
  
  <p>I configured the IAR linker as it is recommended ( I think so at least ) in the following link:
  <a href="https://www.iar.com/support/tech-notes/general/checksum-calculation-with-ielftool-after-linking-with-ilink/" rel="nofollow noreferrer">IAR documentation CRC links</a>
  The fact is that I have configured it as in the Calculate CRC32 as in STM32 hardware (v.5.50 and later) example (the first part of this, because I have IAR 6.5).
  As I see there I tried to clone the configuration shown in the screenshot:
  <a href="https://www.iar.com/contentassets/d8bbf6cb53c44ac39f10798d3c086d67/64424-projectoptionslinkerchecksum_6_40.png" rel="nofollow noreferrer">CONFIGURATION PICTURE</a></p>
  
  <p>And this is the configuration I use in my C CRC file:</p>
  
  <pre><code>/* PARAMETERS EXPLANATION
     * 'order' [1..32] is the CRC polynom order, counted without the leading
     * '1' bit.
     * 'polynom' is the CRC polynom without leading '1' bit.
     * 'direct' [0,1] specifies the kind of algorithm: 1=direct, no augmented
     * zero bits.
     * 'crcinit' is the initial CRC value belonging to that algorithm.
     * 'crcxor' is the final XOR value.
     * 'refin' [0,1] specifies if a data byte is reflected before processing
     * (UART) or not.
     * 'refout' [0,1] specifies if the CRC will be reflected before XOR.
     */
  
    /* Init parameters for CRC 32 algorithm */
    crcParams.order    = 32;
    crcParams.polynom  = 0x4C11DB7;
    crcParams.direct   = true;
    crcParams.crcinit  = 0xffffffff;
    crcParams.crcxor   = 0xffffffff;
    crcParams.refin    = false;
    crcParams.refout   = false;
  </code></pre>
  
  <p>I had a doubt about if the crcxor should be 0xFFFFFFFF or 0x00000000, but I tried with both without getting the expected result.</p>
  
  <p>In order to check that the C function was working I have used the following websites:</p>
  
  <p><a href="http://www.sunshine2k.de/coding/javascript/crc/crc_js.html" rel="nofollow noreferrer">FIRST CRC32 CALCULATOR</a></p>
  
  <p><a href="http://www.zorc.breitbandkatze.de/crc.html" rel="nofollow noreferrer">SECOND CRC32 CALCULATOR</a></p>
  
  <p>The C code I use to calculate the CRC is based in the one explained here:
  <a href="http://www.zorc.breitbandkatze.de/crctester.c" rel="nofollow noreferrer">CRC C code</a></p>
  
  <p>This is an example of the configuration used in one of the websites:
  <a href="https://i.stack.imgur.com/lVmwA.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lVmwA.jpg" alt="CRC CONFIGURATION BASED ON THE STM32 EXAMPLE"></a></p>
  
  <p>Any help will be really appreciated.</p>
  
  <p>Thanks in advance.</p>
  
  <p>Best regrads.</p>
  
  <p>Iván</p>