In my world I don't use exit() at all, but sometimes a nasty error could happen inside a library func
which calls exit(). In the comp.c this function is implemented as this:
void _exit(int status)
{
// disable all interrupts, run infinite loop
__asm("cpsid i");
while(1);
}
What would be much nicer is if the sw could just enter the debugger. Do I have to patch the source, or is there a
non intrusive way of do this?
已解决! 转到解答。
Hello,
I have checked the source code file and it is located in KSDK_1.1.0\rtos\mqx\mqx\source\psp\cortex_m\compiler\gcc_arm\comp.c, i.e. this program module is a part of MQX. It is a static source code file and you can modify it.
This issue is related to MQX software solution. I will move it.
Best Regards,
Marek Neuzil
Hello,
I have checked the source code file and it is located in KSDK_1.1.0\rtos\mqx\mqx\source\psp\cortex_m\compiler\gcc_arm\comp.c, i.e. this program module is a part of MQX. It is a static source code file and you can modify it.
This issue is related to MQX software solution. I will move it.
Best Regards,
Marek Neuzil
In some example code, I've seen this coded with a '0' instead of a '4'. ARM documentation says:
"The BKPT
instruction causes the processor to enter Debug state. Debug tools can use this to investigate system state when the instruction at a particular address is reached.
In both ARM state and Thumb state,
is ignored by the ARM hardware. However, a debugger can use it to store additional information about the breakpoint." [ARM Information Center]imm
So I'm curious if there is any particular reason for using '4'?
I'm also curious about what happens if a bkpt instruction is executed when there is no debugger connected. I assume this acts similar to either a NOP or a HALT but haven't found a description of this yet.
Thanks,
James
Thanks. Just FYI, '0' seems to work too. Guess you COULD look at this value to take some action in the debugger.
Too bad about the behavior--guess that means can't leave bkpt instructions sprinkled in the code!!