My post in “An error occurred…”: Applied Debugging Rules gives some hints about how to isolate and solve some debugging problems. But here is a case where the tips did not help: I had this dialog with “Failed to resume target process” for my HCS08 project again:
The issue is: there is no useful information at all, and I’m up for guessing? Yes, there is a problem, but what kind of problem? Enabling the log for the console view did not help :-(.
Hmm, “Failed to resume target process” tells me something about the debugger not getting control over the target. I *think* the debugger started the flash programming. So he had control first, but then lost it during flash programming? Background: The debugger downloads a small program to the target which executes and performs the programming. Somehow that program on the target completely failed without returning a proper error code.
So I tried to download it with the HI-WAVE debugger from the non-eclipse based CodeWarrior, and voilà, it gives me this:
Code loading overlap detected in range 0x0000FFBD..0x0000FFBD
Ah! That debugger gives me the important hint! I love the eclipse based CodeWarrior debugger, but here it is shamefully failing.
The old HI-WAVE debugger gave me the hint: I have overlapping flash ranges. What is the problem? Checking the map file, indeed I have a memory cell assigned twice in flash:
MODULE: -- ProcessorExpert_c.obj -- - VARIABLES: NVPROT_INIT FFBD 1 1 0 .abs_section_ffbd MODULE: -- Cpu_c.obj -- - VARIABLES: NVPROT_INIT FFBD 1 1 0 .abs_section_ffbd
And the reason is that I have the flash protection register set up twice in my code:
static const uint8_t NVPROT_INIT @0x0000FFBDU = 0xFFU;
So the problem is: the flash programming algorithm fails dealing with overlapping memory ranges, and the debugger fails to check for it or for returning a useful error message.
So I think the linker should catch this? Well, indeed he would warn me about this, but that message is disabled in my project:
Changing them to a warning (using ‘w’ (warning) instead of ‘d’ (disable) in the option)
Ok, that would have warned me. Fixing my code, the double allocation is fixed, and everything works now again. Good.
As a result, I have that linker messages now changed in my S08 projects. That way I get appropriate warnings. Still, I expect the debugger to report me a useful error message for such a failure. “Problem Occurred” in that case does not help. This issue has been submitted to Freescale, so hopefully things get improved over time.
Happy Problem Solving 🙂