Hmm. I wonder if you main loop should not just have the inverse condition.
You are stopping the loop once the checksum is correct....
It should be like this
while (__CHECKSUM_IS_OK) {
work();
}
BadThingsAreHappening();
This of course raises the question why your checksum computation does always fail...
Does it work if you are just checking the non banked code?
I think there is some preprocessor define you can use to get the checking working for banked code too (not 100% sure).
Anyway, you should have the code to see how the computation is done at runtime and which areas are tested, and which not.
Do you get any link time warnings?
Check the
CodeWarrior\(CodeWarrior_Examples)\HC12\Checksums
samples
Daniel