Open cogito666 opened 4 weeks ago
I don't think I have used swo_read_stimulus()
; the example application is for use with swo_read()
.
I don't think I have used
swo_read_stimulus()
; the example application is for use withswo_read()
.
Oh, thanks for letting me know. The previous code from document.. Maybe it's out dated. https://pylink.readthedocs.io/en/latest/swd.html
Anyway as you mentioned, I tested with the script in Example. Below is the log in my IDE (PyCharm)
Serial Wire Viewer Press Ctrl-C to Exit Reading data from port 0:
Is this log indicates that my CPU is locked? or has it something to do with the APP-PROTECT?
`
The SWD example is for cases where you are using SWD in your target to write data when a debugger is attached. Your firmware must be using SWD debug, and implementing write()
to trigger a vector catch. There's an example here in the semihosting
section on Memfault's blog of doing that: https://interrupt.memfault.com/blog/printf-on-embedded#semihosting
// Based on the implementation here:
// https://github.com/bminor/newlib/blob/1a0908203606527b6ac0ed438669b5bcd247a5f9/newlib/libc/sys/arm/syscalls.c#L314-L338
// And here:
// https://github.com/bminor/newlib/blob/69f4c4029183fb26d2fcae00790881620c1978a3/newlib/libc/sys/arm/swi.h#L74-L89
int _write(int file, uint8_t *ptr, int len) {
int data[3] = {file, (int) ptr, len};
__asm__("mov r0, %0 \n mov r1, %1 \n bkpt #0xAB"
: : "r" (5), "r" (&data) : "r0", "r1", "memory");
return len;
}
The SWV is used for Serial Wire Output (SWO), and similarly, you must implement a _write()
in your firmware that outputs data to SWO. You also need to assign a GPIO for use with SWO. They have an example section on that as well: https://interrupt.memfault.com/blog/printf-on-embedded#serial-wire-output-swo
I am using upper script for nRF52DK.
When I run the script, num_bytes is not zero. But the swo_read_stimulus() returns empty list. What's wrong? Am I missing something?
I am using nrf52832 target CPU and it's programmed using Zephyr RTOS.