Marus / cortex-debug

Visual Studio Code extension for enhancing debug capabilities for Cortex-M Microcontrollers
MIT License
1.02k stars 241 forks source link

Zephyr RTOS debugging using pyOCD #900

Open tyalie opened 1 year ago

tyalie commented 1 year ago

Is your feature request related to a problem? Please describe. I am using pyOCD to program and debug Zephyr on our chips. I would love to be able to use the integrated RTOS view in this combination. I've already tried using rtos in the launch.json but got the error that pyOCD is not supported.

Describe the solution you'd like PyOCD seems to have a concept what an RTOS is and already bundles a Zephyr driver in their support packages. It would be lovely to be able to use rtos for this server type.

Describe alternatives you've considered It isn't easy for mr to switch to alternatives like OpenOCD or JLink. I'm using a custom chip / flash combination which requires its own flasher and I've so far configured it for pyOCD but not for OpenOCD.

haneefdm commented 1 year ago

We don't explicitly support any RTOS. That is the gdb-servers responsibility. All we do with the rtos setting in launch.json is to pass the info along to the gdb-server on its command line if it needs such an option. Not sure pyOCD added such an option.

Here is what we do though. If the gdb-server (pyOCD) reports threads to gdb, we simply report the same. We are ALWAYS in RTOS mode and expecting one any time ... even in the middle of the program execution. And, we don't care which RTOS it is. They are all the same to us.

Do you know how to specify an RTOS when you start pyOCD? If so, you can do the same using serverArgs but do let us know so we can automate it.

tyalie commented 1 year ago

Just to note: I haven't been able to test this out as I'm right now not with debugable hardware in my reach.

But it seems to me, that one can explicitly give PyOCD an RTOS to look out for. See rtos.name in the docs. But I'll test this functionality / PyOCDs RTOS support before making broad statements.

haneefdm commented 1 year ago

I saw that but I can't tell if that is a command line option or if it some of a script you have to do. If it script based, then you can do that yourself already. Same with command line option but research and let me know.