Raspberry Pi Debugging with Visual Studio

preview_player
Показать описание
Dave shows you how to single-step C++ code live in the Visual Studio debugger as it runs remotely on a Pi running Raspbian Linux.

Don’t forget to check out my book on Autism and read the “Burgers with Bill Gates” sample chapter!

----

IMPORTANT STEP THAT'S NOT SHOWN IN THE VIDEO: CONNECTION MANAGER in Visual Studio
- To connect to the Pi, you must set up the Connection to it in Connection Manager as follows:
- In the Debug-Options menu, under Cross Platform, open the Connection Manager. Add an SSH connection to your Pi using it’s hostname and your credentials, and it will verify that the connection works for you.
- Here’s some additional info on the connection manager if needed:

ON THE PI:
sudo apt update
sudo apt upgrade
sudo apt-get install openssh-server g++ gdb gdbserver wiringpi install make ninja-build rsync zip
sudo groupadd gpio
sudo usermod -a -G gpio YOURUSERNAME
sudo grep gpio /etc/group
sudo chmod g+rw /dev/gpiomem

--- If you need a source copy of WiringPi:
Using WSL and your favorite Linux distribution:
cd WiringOP
chmod +x ./build
sudo ./build

--- More helpful info
I found this page quite helpful and recommend it:
Рекомендации по теме
Комментарии
Автор

Definitely a vid on remote ESP32 w/ vscode!

Emerald
Автор

1:40 I had an excellent sleep last night, thanks!

JeffGeerling
Автор

Joke's on you Dave, most bosses haven't coded in decades ;)

psyjax
Автор

One of the most useful tips when working with a pi: In Raspberry Pi Imager press CTRL+SHIFT+X to bring up the advanced options. Lets you setup SSH, Wi-Fi, mDNS name, and you can save these settings so every pi from now on has these settings by default when flashed with Raspberry Pi Imager.

Swesen
Автор

Hi Dave, amazing video! Really good to see you more relaxed on the camera. Just finished you book by the way, it was really informative and answered many questions !

gbrls_yt
Автор

Hello Dave! Post more tips and tricks on debugging, that is significant amount of effort when coding and looking for non obvious problems.
I like this video very much!

Also, you made huge progress and now you are natural friendly youtube fraggles. Its pleasure to watch you!

sczygiel
Автор

You're an excellent teacher. You repeat things that are really important, but you don't repeat them too much.

technowey
Автор

Dave I can't believe you just made this video. I bought a Freenove Ultimate Starter Kit for my Pi 3B+, and just the other day I completed the very first project, the one where you flash the LED on and off. For years I've wanted to learn more about how electronics works (outside of school), and this finally gives me the chance. Tip: Make sure your jumper wires are connected tight into the breadboard. The one I had leading back to ground was loose, so I had to wiggle it. Then it started working. :-D

erichkohl
Автор

I used wiringPi way back in 2014 for some undergrad projects in my ECE program. Nice to see a much more refined workflow using Visual Studio and ssh to do things wirelessly!

dwillingham
Автор

Thanks, Dave. Haven't used VS for work in almost 15 years as I'm in a 100% Linux shop. I'll add this to the list of things I want to play with bin 😁

vincei
Автор

I would absolutely love a video about debugging an ESP32 in the same way.

Potts
Автор

Thank you, Dave. Still working with the LED's, myself. This was a good C++ breakdown for me. Awesome!

christopherleadholm
Автор

Thanks so much! I tried to get Wiringpi working last year, but had trouble. Looking forward to getting back into it

jameshorner
Автор

Wasn't expecting to be transported back to my childhood. Thanks for reminding me of the Friendly Giant.

MikeNewmania
Автор

Wow, a Friendly Giant reference at the end. Someone’s showing their Canuckishness.

PS Hello from Jasper avenue in “Siberia”

lucasthompson
Автор

The first thing I noticed when I started working up a new project for a pi was that my VS community installation, which I may have pushed all the buttons on during installation, has a c++ raspberry pi project already in place ["Raspberry Pi Project", "A blinking LED app using WiringPi for Raspberry Pi."]. This sets things up quite nicely, including sorting out wiringPi. The little getting started bit also gives some nice instructions for setting up the remote.

RadicalEdwardStudios
Автор

Great video! I've recently started doing remote debugging of STM32 with ST-Link, and there's truly no better way to dig deep into those tricky bugs than direct debugging. Before getting the ST-Link I was just printing things out to the serial console, just about the slowest and most tedious way to track down issues.

ScottLahteine
Автор

Great video, always nice learning new things. Had a pi when I was younger, would be cool to buy one and play around with it

nevin
Автор

I do this kind of debugging daily. I do this on game consoles. Attaching and launching on another pc. It's great!

RockuHD
Автор

Absolutely interested in a similar setup for the ESP32! We have a work project that uses one of those, and we just use the vanilla ESP-IDF with VS Code to edit and printf debugging :)

mranthonymills