Skip to main content
Visitor II
December 5, 2013
Question

Cosmic _checksum16() problems

  • December 5, 2013
  • 4 replies
  • 1316 views
Posted on December 05, 2013 at 10:28

Hi folks

Couple of questions about the

_checksum16()

function. I've kind of got it working, but:

  • I have to put in an ''

    extern int _checksum16(void);

    '' declaration of my own - I can't for the life of me find a header file which declares this
  • It appears that it fails if there's a breakpoint set, presumably because setting a breakpoint modifies the code memory that's being checksummed. Is that expected, and does anyone have a tip for a reasonably safe workaround?
Best regards

Jonathan
    This topic has been closed for replies.

    4 replies

    Visitor II
    December 5, 2013
    Posted on December 05, 2013 at 11:12

    Hello,

    CRC implementation is simple, write your own function and the problem is solved;)

    Visitor II
    December 5, 2013
    Posted on December 05, 2013 at 12:03

    Hi,

    the header is correct and the problem you mentioned, that only happens with debug instruments that modify the memory in order to set a bkpt (of course!), is known.

    As for solutions, nothing magic: either skip the checksum while debugging or use a more powerful debugger/emulator.

    Regards.

    jroAuthor
    Visitor II
    December 5, 2013
    Posted on December 05, 2013 at 15:49

    @Argail

    Yes, I know CRC is easy to implement, but computing the correct value for the binary image before that image is linked, and then getting the value into program Flash is distinctly non-trivial!

    @luca

    Thanks for your prompt response.

    Which header is correct? I cannot find a .h file supplied with the compiler which declares _checksum16()...

    Given that ''simple'' debuggers cause a problem, and are probably the most commonly used, it would probably be a good idea to document it in the manual. I spent at least a couple of hours figuring out what was going on, having been used recently to ARM systems which have (a limited number of) hardware breakpoints, and thus don't suffer from this.

    Best regards

    Jonathan

    Visitor II
    December 6, 2013
    Posted on December 06, 2013 at 08:18

    Oh sorry, I didn't understand what you wanted to do