Complete Communications Engineering

The .NET SDK from Microsoft can be used for this.  The SDK is available for download for a few different platforms, including ARM and x64.  When building for embedded systems, usually cross-compiling will be used.  In this case, the x64 version can be installed on a 64-bit Linux build system, and that can be used to cross-compile binaries for ARM.  This saves space on the ARM device as only the .NET Runtime is required on the ARM device to run the binaries.

The .NET SDK can be used on the command line by running the dotnet executable which is in the root folder of the SDK.  Building a C# application can be done using the build sub-command from the dotnet executable.  The build process is mostly automated.  Only a project file and source code files are required.  The following is a minimal project file:

Project.csproj

<Project Sdk=“Microsoft.NET.Sdk”>

 

<PropertyGroup>

    <OutputType>Exe</OutputType>

    <TargetFramework>net5.0</TargetFramework>

    <SelfContained>false</SelfContained>

</PropertyGroup>

 

</Project>

The file should have the ‘.csproj’ extension, and the contents are XML.  The properties say that an executable will be built, the target .NET version is specified, and the executable will require the .NET runtime to be installed on the target system.  The following is a minimal C# program that can be used for testing:

App.cs

using System;

 

namespace my_cs_namespace {

 

    class MyCSApp

    {

        static void Main()

        {

            Console.Write(“Hello from C#!\n”);

        }

    }

};

With these two files in place, the dotnet build command can be run on the build machine with the runtime option to specify the target platform:

> dotnet build –runtime linux-arm

This will generate an executable and some other files, and place them in a sub-folder.  Those files can be copied onto the embedded device and should run as the following commands demonstrate:

> ls

Project                         Project.pdb

Project.deps.json               Project.runtimeconfig.dev.json

Project.dll                     Project.runtimeconfig.json

> ./Project

Hello from C#!

>