Hi,
Is it somehow possible to generate a break point in code and than wait for the debugger (jtag) to connect to target and start debugging at that point?
Kind Regards
Daniel Moberg
Wait for debugger
Re: Wait for debugger
Hi Daniel, first you can use cpu_hal_is_debugger_attached function to check whether OpenOCD has connected to the chip. If not connected, print some message, delay, repeat the check.
Once OpenOCD is connected, cpu_hal_is_debugger_attached returns 'true'.
Then call cpu_hal_set_breakpoint function to set a breakpoint at the point where you would like the program to stop.
Something along these lines:
Once OpenOCD is connected, cpu_hal_is_debugger_attached returns 'true'.
Then call cpu_hal_set_breakpoint function to set a breakpoint at the point where you would like the program to stop.
Something along these lines:
Code: Select all
while(!cpu_hal_is_debugger_attached()) {
printf("waiting for debugger\n");
usleep(1000000);
}
cpu_hal_set_breakpoint(0, &next);
next: // label used to get the address of the next line of code
some_other_func();
Who is online
Users browsing this forum: No registered users and 112 guests