Remote debugging

Post Reply
jon volk
Posts: 572
Joined: Wed Apr 10, 2019 7:47 pm
Location: Connecticut
Been thanked: 2 times

Remote debugging

Post by jon volk »

I had a situation with the BMS/CCS controller that I’m working on where it would crash after a day or two without any consistency. Despite my best efforts, I couldn’t find a working solution to connect with an st-link that didn’t involve resetting the mcu and thus losing the fault state.

Solution was a raspberry pi zero w running openocd and gdb. This way I was able to let it happily run until failure and then connect to the pi via WiFi/ssh. Worked really well and was able to find the root cause from the comfort of my couch rather than the 20F garage.

Basically just need to set up the pi as a headless Linux machine and enable ssh. Install/configure openocd and everything runs from a command line as it would from a full desktop or laptop.
You’ll also want ‘screen’ so you can keep your terminal sessions running and reconnect later without disrupting anything. The obviously allows for remote flashing as well if iterating over some changes.

Anyway, found it would kick out a CAN error from two different RTOS tasks from stepping on each other. Finally got that resolved.

I’ll definitely be utilizing this more often.
99CE0E30-7830-4F59-A522-CB96554B4005.jpeg
Formerly 92 E30 BMW Cabrio with Tesla power
Post Reply