Dotnet core and ubuntu arm32 development experience

Dotnet core and ubuntu arm32 development experience

  1. Select a development board that supports ubuntu and is compatible with wiringPI

  2. Installing .Net core On Linux ARM32/64

    Installing .NET Core on Linux ARM64

    The following intructions can be used to install .NET Core on Linux ARM64.

    Pro tip: Check out .NET Core Docker files to determine the exact instructions for installing .NET Core builds, for example .NET Core 3.1 ARM32 SDK Dockerfile .

    Installing .NET Core Globally

    The following instructions install the latest .NET Core globally. It isn't required to do that, but it provides the best experience.

     curl -SL -o dotnet.tar.gz  https://dotnetcli.blob.core.windows.net/dotnet/Sdk/master/dotnet-sdk-latest-linux-arm64.tar.gz sudo mkdir -p /usr/share/dotnet sudo tar -zxf dotnet.tar.gz -C /usr/share/dotnet sudo ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet

    Dependencies

    .NET Core has the following dependencies, on Ubuntu (other distros will vary):

    • libc6
    • libgcc1
    • libgssapi-krb5-2
    • libicu60
    • liblttng-ust0
    • libssl1.0.0
    • libstdc++6
    • zlib1g
  3. Programming

     internal const string WiringOP = "libwiringPi.so"; [DllImport(WiringOP, EntryPoint = "wiringPiSetup",  SetLastError = true)] public static extern int WiringPiSetup(); [DllImport(WiringOP, EntryPoint = "pinModeAlt",  SetLastError = true)] public static extern void PinModeAlt([MarshalAs(UnmanagedType.I4)] Pin pin,  [MarshalAs(UnmanagedType.I4)]IOMode mode); [DllImport(WiringOP, EntryPoint = "pinMode",  SetLastError = true)] public static extern void PinMode([MarshalAs(UnmanagedType.I4)] Pin pin,  [MarshalAs(UnmanagedType.I4)]IOMode mode); [DllImport(WiringOP, EntryPoint = "pullUpDnControl",  SetLastError = true)] public static extern void PullUpDnControl([MarshalAs(UnmanagedType.I4)] Pin pin,  [MarshalAs(UnmanagedType.I4)]Pud pud); [DllImport(WiringOP, EntryPoint = "digitalRead",  SetLastError = true)] [return: MarshalAs(UnmanagedType.I4)] public static extern Level DigitalRead([MarshalAs(UnmanagedType.I4)] Pin pin); [DllImport(WiringOP, EntryPoint = "digitalWrite",  SetLastError = true)] public static extern void DigitalWrite([MarshalAs(UnmanagedType.I4)] Pin pin,  [MarshalAs(UnmanagedType.I4)] Level level);
  4. Desktop environment configuration

    • Close the desktop environment
     systemctl set-default multi-user.target
    • Turn on the desktop environment
     systemctl set-default graphical.target
  5. Ubuntu 16.04 Configure Auto Start Service

    • Create Service Profile
     vim /etc/systemd/system/test.service [Unit] Description=test service. [Service] Type=simple #ExecStartPre=-cd /root/Published ExecStart=/usr/bin/dotnet /root/Published/test.dll #Working directory WorkingDirectory=/root/Published/ ExecReload=/bin/kill -SIGHUP $MAINPID ExecStop=/bin/kill -SIGINT $MIANPID StandardOutput=file:/root/Published/log.log StandardError=file:/root/Published/err.log [Install] WantedBy=multi-user.target
    • Give permissions to the service profile
     chmod 644 /etc/systemd/system/test.service
    • Configure Startup
     systemctl enable test.service
    • Turn off startup
     systemctl disable test.service

    After the service is modified, use systemctl daemon reload to load the modification

  6. View the service running log

    • View through log redirection configured by service
    • adopt journalctl -u test.servcie see
    • If StandardOutput is not set, you can start and redirect through sh ExecStart=/bin/sh 'exec /bin/dotnet /root/Published/test.dll >> /root/Published/test.log 2>&1'
posted @ 2020-11-13 12:07   illegal keyword   Reading( three hundred and eighty-four Comments( zero edit   Collection   report