Skip to main content
greg_t
Associate III
August 3, 2010
Question

Checksum (EWARMv5)

  • August 3, 2010
  • 11 replies
  • 2120 views
Posted on August 03, 2010 at 16:22

Checksum (EWARMv5)

    This topic has been closed for replies.

    11 replies

    smart2
    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 14:00

    Take a look at IAR application note.

    http://supp.iar.com/Support/?note=91733

    swhite2
    Associate II
    May 17, 2011
    Posted on May 17, 2011 at 14:00

    EWARM 5.xx doen not, to my knowledge, support calculating  a CRC the way the STM32 peripheral does. I've heard that this is coming but then so is Christmas.

    IAR does supply the source code for ielftool so you could make the modifications yourself. I chose to write my own program that works on .bin files instead.

    I've developed a header structure that includes CRC's (header + code) but its a commercial product so I can't share it. That said its not hard to come up with such a header. However if you want the header at the start of your image it'll conflict with the ARM exception vectors. Those (except for reset, initial SP) can be moved however.

    Andrew Neil
    Super User
    May 17, 2011
    Posted on May 17, 2011 at 14:00

    ''... checksum (CRC) ...''

     

    Please don't write like that: it suggests that ''Checksum'' and ''CRC'' are equivalent or interchangeable terms  - they are not!

     

    Checksums and CRCs are entirely different things.

    A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
    swhite2
    Associate II
    May 17, 2011
    Posted on May 17, 2011 at 14:00

    Nice application note except that it won't help. ielftool calculates checksums on a byte-by-byte basis. The STM32 CRC peripheral does so on a 32-bit word basis. You'll never get IAR's checksum to match ST's even if you set all the other parameters (polynomial, bit-order, initial value etc) correctly.

    You may want to review this thread.

    https://my.st.com/public/STe2ecommunities/mcu/Lists/ARM%20CortexM3%20STM32/CRC%20calculation%20in%20software

    swhite2
    Associate II
    May 17, 2011
    Posted on May 17, 2011 at 14:00

    Perhaps you'd like to share the exact setup in the ''Checksum'' tab of IAR. I take it the resulting value matched that generated by the STM32 CRC generator over the same memory range.

    greg_t
    greg_tAuthor
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 14:00

    I've used the IAR explanation and it worked 

    http://supp.iar.com/Support/?Note=11927

    greg_t
    greg_tAuthor
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 14:00

    neil.andrew, I am sorry if you got offended   = )

    sros
    Associate
    May 17, 2011
    Posted on May 17, 2011 at 14:00

    You can find a description on how to ''calculate CRC32 as in STM32 hardware'' at IAR's ''Technical Note 64424''

    http://supp.iar.com/Support/?note=64424&from=search+result

    greg_t
    greg_tAuthor
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 14:00

    No

    I've used CRC16

    andre239955_st
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 14:00

    With version 6.10 it works with the tool settings for checksum calculation.

    Check Fill unused memory, use 0xFF

    Generate checksum 4 bytes, Alignment 4, CRC32

    Complement: As is

    Bit order: MSB first

    Check the ''Reverse byte order within word'' flag.

    Initial value: 0xFFFFFFFF, uncheck ''Use as input''

    And of course, do not forget to set the start and end addresses.

    Have fun,

    Dreeke