vscode (Visual Studio Code) for Remote C/C++ Development and Deployment (Fedora Linux) 23 May 2020
In this post I have listed all the programs and commands I used to develop C/C++ programs, compile them using arm-linux-gnueabihf-gcc/g++
and then deploy them on my BeagleBone. Debugging is not discussed in this post, If I find a way to perform that I will share it with you guys.
Developmement
1. Install the required software
- Download and install the Visual Studio Code on Linux. Now, install the Remote - SSH Extention by pressing
ctrl+shift+x
OR by choosing Extentions from Side Bar and searching for the extention. - Install fedy on your fedora machine. Under development tools you’ll find option for
arm-linux-gnueabihf-toolchain
hit install for that. If you are using diffrent distro find and install the same. - Install development tools on your Fedora by running
sudo dnf groupinstall "Development Tools"
. This will install tools like make, gcc, etc. If you have all the development tools already installed separately you can skip this. - Install other missing tools if prompted…
2. Compiling your C/C++ code
- Open up your source directory in vscode.
- Create a new C/C++ “Hello World” program.
- Open up a new terminal using
ctrl + `
. - Now compile your program for BeagleBone using either,
arm-linux-gnueabihf-g++ HelloWorld.cpp
arm-linux-gnueabihf-gcc HelloWorld.c
.
3. Using vscode Remote - SSH
- Click on
Remote Explorer
Button on vscode Side Bar. - Click on
+
button to Add New connection. - Enter
ssh debian@192.168.7.2 -A
- choose ssh configuration, Both
/home/yourname/.ssh/config
and/etc/ssh/ssh_config
worked just fine for me. - Enter password for you BeagleBone, default is
temppwd
. - By Using the Explorer from the Side Bar you can open BeagleBone folders and files.
- For using Termainl press
ctrl + `
.
Deployment
Deployment is very easy, you just have to drag the executable binary you just created by comiling your source and drop it into your desired directory on BeagleBone. Now you you have to make it executable on your BeagleBone by running chmod +x a.out
(replace a.out
with your binary name).