Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>.NET FastIoTNew to Visual Studio Code? Get it now.

.NET FastIoT

Preview

DevDotNetORG

|
986 installs
| (2) | Free
Configuring Remote Debugging of a .NET application for embedded Linux devices
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

License GitHub last commit Installs Downloads Rating

.NET FastIoT VS Code Extension

.NET FastIoT Extension in Visual Studio Code Marketplace.

README in English | README на русском языке | DevDotNet.ORG (Russian) - latest news | Habr.com (Russian) - Easy development of IoT applications in C # for Raspberry Pi and other SBCs, on Linux.

This extension allows you configures an ARMv7 or ARMv8 Linux embedded device to run .NET applications, and configures *.csproj projects for remote debugging via an ssh-tunnel. This has been tested on Windows (64 bits).

Devices supported: Raspberry Pi, Banana Pi, Orange Pi, Radxa, Tinkerboard, Odroid, Khadas VIM, NanoPi, Pine.

.NET FastIoT Extension UI

.NET FastIoT title

.NET FastIoT title

Features

  1. Easy installation .NET SDK, .NET Runtimes, .NET Debugger (vsdbg), Libgpiod, Docker for Linux;
  2. Setting up .NET projects for remote debugging, adding environment variables (Method Environment.GetEnvironmentVariable);
  3. Device Tree overlays management. Required to turn on/off devices such as I2C, SPI, PWM, etc. Available remote download of files * .DTS and enable/disable "layers". See Working with GPIO. Part 2. Device Tree overlays (RU). Only the Armbian distribution is supported. To support other distributions, the adapter must be implemented using the IDtoAdapter.ts interface. Armbian implementation example - IoTDTOArmbianAdapter.ts;
  4. GPIO pin control (not fully implemented yet). Detecting available Gpiochip ~~and lines. Applying 0/1 to the contact, reading the state of the contact. Generation of C# code for the selected contact for transferring to the project one-to-one.~~

System requirements

  • OS version . Windows 7-10 (x64). Linux version coming later;
  • Visual Studio Code. version not lower than 1.70.3;
  • .NET. Compiling a C# project requires .NET SDK depending on which version of your project you are using (the extension itself is not required to work);

Additional extensions required for developing .NET applications:

  • C# for Visual Studio Code (powered by OmniSharp) — support for C# development ;
  • NuGet Package Manager — adding Nuget packages (later the Nuget package manager will be built into the extension);
  • DeviceTree (optional) — Syntax highlighting for DeviceTree (Device Tree, .dts) files in VSCode. For example, it will be required if it becomes necessary to adapt the SPI LCD ILI9341 (RU) for your SBC.

Third-party applications:

  • cwRsync. The package uses the rsync and ssh utilities. Included in the extension and copied to the default folder C:\RemoteCode\cwrsync\ (location changes in settings). Optionally, you can replace the package by downloading it from the official website at the link. The PuTTY terminal is not used.

Third-party bash scripts to install packages/libraries:

  • .NET SDK, .NET Runtimes, .NET Debugger (vsdbg), Libgpiod, Docker, are downloaded from the official sites of the package developers, excluding the Libgpiod library. The script for installing this library is downloaded from the GitHub resource — devdotnetorg/docker-libgpiod. Next, the uploaded script downloads the source code of the library from the official Libgpiod repository and compiles the library.

System requirements for the device

  • Processor. ARMv7 or ARMv8;
  • OS version. Linux distribution based on at least Ubuntu 18.04 (Bionic Beaver), or at least Debian 10.11 (Buster);

Getting started

Step 1 — Preparing the device

The single board computer must be running a Debian distribution or Ubuntu, Linux. For remote access, you need to install an ssh server and configure certain settings. As a terminal for remote access, you can use MobaXterm (much more convenient compared to the PuTTY terminal). If the sudo is not installed, then install this package as root using the commands:

apt-get update
apt-get install -y sudo

To install an ssh-server and configure access, run the following commands on a single board computer:

sudo apt-get update
sudo apt-get install -y openssh-server mc
sudo systemctl reload ssh
sudo mcedit /etc/ssh/sshd_config

In the editor that opens, set the following parameters. If these parameters are missing, then just insert the line (usually the AuthenticationMethods is missing):

PermitRootLogin yes
PasswordAuthentication yes
ChallengeResponseAuthentication yes
AuthenticationMethods publickey keyboard-interactive password
PubkeyAcceptedAlgorithms=+ssh-rsa

Then save the changes F2 and exit the editor F10.

Restart the ssh-server to apply the new settings:

sudo systemctl reload ssh
sudo systemctl status ssh

The last command displays the current status of the service.

Video instruction for setting up an ssh server for connecting an extension:

.NET FastIoT. Step 1. Configuring SSH access

Step 2 — Adding a device

At the first connection, a pair of access keys is created, private and public. The private key is copied to the C:\RemoteCode\keys\ folder (the location is changed in the settings). This key is used to configure the device and start remote debugging.

The important point is choosing an account to create on the device. The first option is the debugvscode account (the name can be changed in the settings), the second option is root:

Selecting an account to create on the device VSCode dotnet FastIoT

Selecting the debugvscode option creates a permissions configuration file 20-gpio-fastiot.rules to devices using the udev subsystem. A group named iotis created, and permissions for devices such as: gpiochip, I2C, SPI, PWM, etc. Then the user debugvscode is added to this group. Due to the fact that testing was performed only on Armbian, it is possible that not all permissions have been added. Therefore, if you have problems with access rights to devices, then choose — root.

Adding a new device (YouTube):

VSCode dotnet FastIoT

Step 3 — Installing packages

To run a .NET IoT application and perform remote debugging, you need to install:

  • Runtime - .NET Runtime.
  • Remote debugger - .NET Debugger (vsdbg).
  • GPIO line control library - Libgpiod (optional).

Installing the Libgpiod library is possible from the repository and source code. If the repository contains an old version of the library, then install the library from source.

Step 4 — Launch configuration

Now you need to open the project or create it. Project example dotnet-iot-fastiot-test.

To create a remote debugging configuration on the device, you must click on the Add Configuration button:

VSCode dotnet FastIoT

Select project:

VSCode dotnet FastIoT

Select a device for remote debugging:

VSCode dotnet FastIoT

The application launch configuration has been created.

VSCode dotnet FastIoT

Now you need to go to Run and Debug:

VSCode dotnet FastIoT

Select configuration to run:

VSCode dotnet FastIoT

Run the project on debugging menu Run > Start Debugging.

VSCode dotnet FastIoT

Test projects

The *.csproj test projects are located in the folder samples. The first base project for testing remote debugging is dotnet-iot-fastiot-test. Other projects are located in the devdotnetorg/dotnet-iot-samples repository.

Extension settings

To change the extension settings, open the menu item File > Preferences > Settings. Then go to the User tab and select Extensions.

VSCode dotnet FastIoT

Settings:

  • Conf › Resource: Insert Empty Last Line - device data is stored in the fastiot.device.all.JSON node in JSON format, it is not recommended to change it manually. Due to incorrect changes, the device list may not load.
  • Fastiot › Device › Account: Groups - Linux user group on a remote device (eg Raspberry Pi) to which the account (debugvscode) will be added to control the device. This group must have Administrator rights.
  • Fastiot › Device › Account: Username - account name created on the remote device. Used to control the device and perform remote debugging. Default value: debugvscode.
  • Fastiot › Device › All: JSON - device settings in JSON format, it is not recommended to change them manually. Due to incorrect changes, the device list may not load.
  • Fastiot › Device: Pathfoldercwrsync - folder with cwRsync program. Default value: C:\RemoteCode\cwrsync.
  • Fastiot › Device: Pathfolderkeys - folder for storing access keys to devices (eg Raspberry Pi).
  • Fastiot › Launch: Templatetitle - template for forming the name of the debugging profile. The values of the variables can be viewed at the link. Default value: Launch on %DEVICE_LABEL% (%NAME_PROJECT%, %BOARD_NAME%, %USER_DEBUG%).

Videos (YouTube):

  1. Step 1. Configuring SSH access
  2. Step 2. Adding a device
  3. Step 3. Installing packages
  4. Step 4. Creating a .NET console application and remote debugging
  5. Step 5. Using GPIO. Blink

Known Issues

See ISSUES.md and Issues.

Feedback

Send your comments by email fastiot@devdotnet.org. And check in Issues.

License

This software is licensed under the terms of the LGPL-3.0 license.

See LICENSE for more details.

Changelog

See CHANGELOG.md.

Schedule

See SCHEDULE.md.

Testing

Testing performed on single board computers:

  • Cubieboard
  • Cubietruck
  • Banana Pi BPI-M64
  • Contact us
  • Jobs
  • Privacy
  • Terms of use
  • Trademarks
© 2023 Microsoft