Skip to content

Latest commit

 

History

History
134 lines (75 loc) · 6.56 KB

File metadata and controls

134 lines (75 loc) · 6.56 KB

Getting started

Step 1 — Preparing the device

The single board computer must be running a Debian or Ubuntu, Linux distribution. For remote access, you need to install the OpenSSH server and set certain settings. You can use MobaXterm as a remote access terminal. All subsequent steps are performed on a single-board computer.

  1. If the sudo package is not installed, then install this package as the root user using the commands:
apt-get update
apt-get install -y sudo
  1. To install the OpenSSH server and configure access, run the following commands:
sudo apt-get update
sudo apt-get install -y openssh-server mc
sudo mcedit /etc/ssh/sshd_config
  1. In the opened editor, set the following parameters:
PermitRootLogin yes
PasswordAuthentication yes

The remaining necessary parameters will be added automatically when you first connect to the device using the extension.

  1. Then save the changes F2 and exit the editor F10.

  2. Restart the OpenSSH server to apply the new settings:

sudo systemctl reload ssh
sudo systemctl status ssh

The last command displays the current status of the service.

Step 2 - Adding a Device

Add device

VSCode dotnet FastIoT

All settings, including private keys, templates, are by default located in the user profile folder along the path %userprofile%\fastiot (the location can be changed in the settings). When you connect to the device for the first time, a pair of keys is created: private and public. The private key is copied to the %userprofile%\fastiot\settings\keys folder and used to configure the device and start remote debugging, the public key is stored on the remote device itself.

The important point is to select an account to create on the device that will be used for device management and remote debugging. 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 configuration file for device access rights 20-gpio-fastiot.rules using the udev. A group named iot is created and the user debugvscode is added to it. The iot group is then given permissions to gpiochip, led, and pwm. Further, to access other hardware interfaces, the user debugvscode is added to the appropriate groups with access such as: video, i2c, spi, spidev, kmem, tty, dialout, input, audio, to access I2C, SPI, etc. d.

Due to the fact that testing was performed only on Armbian, not all permissions may have been added. Therefore, if there are problems with access rights to gpiochip, PWM, etc., then choose - ** root **.

Step 3 - Install Packages

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

  • Runtime - .NET Runtime;
  • Remote debugger - .NET Debugger (vsdbg).

Minimum set of packages to run .NET applications

VSCode dotnet FastIoT

Step 4 - Create a Project

  1. Now you need to create a project. To create a project, click on the Create project button:

VSCode dotnet FastIoT

  1. Select a device for remote debugging:

VSCode dotnet FastIoT

  1. Select a template for the project:

VSCode dotnet FastIoT

  1. Set the name of the project:

VSCode dotnet FastIoT

  1. Specify the folder for saving the project:

VSCode dotnet FastIoT

  1. Select version of .NET framework:

VSCode dotnet FastIoT

  1. Available Launch to launch remote debugging:

VSCode dotnet FastIoT

  1. Now go to Run and Debug:

VSCode dotnet FastIoT

  1. Select the Launch configuration to launch:

VSCode dotnet FastIoT

  1. Run the project for debugging menu Run > Start Debugging:

VSCode dotnet FastIoT

  1. An example of displaying messages during remote debugging:

VSCode dotnet FastIoT

Sample projects with added configuration Launch (/.vscode/launch.json) and Tasks (/.vscode/tasks.json) are located in the samples folder.

The template.fastiot.yaml file will be placed in the project folder. This file is required to determine the template ID when adding Launch. If it is removed, then there will be no exact definition of the template from which the project was formed. From the template.fastiot.yaml file, only the template identifier string id: dotnet-console is taken.

Rebuild Launch

Launch (/.vscode/launch.json) and Tasks (/.vscode/tasks.json) configurations contain absolute paths to binary files that are loaded on the device, for example /cygdrive/d/Anton/Projects/Tests /DotnetConsoleAppRuntimeInfo/bin/Debug/net5.0/linux-arm/. In this regard, if you change the path to the Applicationdatafolder folder in the settings or rename/move the project folder, then the paths become non-existent. In this case, you need to rebuild (Rebuild) Launch. Select the required Launch and then call the context menu, click on the Rebuild menu item.

Invoking the Rebuild command

.NET FastIoT Launch Rebuild"

Launch Options

Some Launch options can be changed from the LAUCHS window. The following options are changed: