Description:
If the CRC check is being run on program memory itself where ‘main()’ resides and the ‘Software breakpoint’ is asserted at any location inside the code, then the CRC check will fail.
Reason:
Setting a software breakpoint in the code that is being CRC-checked may cause a problem because the emulator would have replaced that instruction with a EMUHALT instruction, which has a different opcode than the original instruction. So if the breakpoint is anywhere in the area of code that the CRC is being checked on, then there could be a problem.
This swapping of EMUHALT and the replacement of original instruction happens behind the scenes of the emulator so a memory dump will not reflect this replacement and will show the actual op-codes as expected.
Work-around:
To deal with this you can make use of the Hardware breakpoints as it uses the processor’s watchpoint unit to monitor instruction/data buses to provide breakpoint functionality.