Porting C# application onto GRV native linux

I have a c# application that is running on an embedded PC which uses the .NET SDK (the dll) from Opto22 to gather data from I/O processors such as the SNAP-PAC-EB2. This application then interfaces to a larger system.

I would like to port a portion of this application to run natively on a GRV-EPIC-PR1. This would allow me to get rid of the embedded PC. There is a lot of code written in C# that I do not want to rewrite. I was thinking possibly to use mono to run it on Linux.

Has anyone done anything like this or have a better idea?



Unfortunately .NET applications are heavily Windows-based and so they often have issues running on Linux systems. While there are some workarounds like mono, they have a lot overhead when it comes to both resources like RAM and CPU as well as strict software prerequisites that have stopped me from using mono in the past.
Depending on how much experience you have getting software like this running it still might be worth a try, but there’s no go-to way of running C# / .NET applications at this stage.

It is basically a very simple console app. I will explore on a Linux dev system I have and see if it plays. If not I have other options such as porting to C++ and compiling with gcc. I assume one can use the Shell access on the GRV-PR1 to copy over a cross compiled program, or does the PR1 have sufficient resources to run gcc natively? (I have one on order to explore it better when it arrives)

Have you done any further consideration of this running the code you need in PAC Control instead of a custom .net program?

1 Like

@JerryD GGC version 5.2.0 is preinstalled on groov EPIC and compiles on-board very well in my experience. If you can port to C++ that would certainly be an option worth exploring.

Yes and in fact I have implemented several charts which perform most of the needed tasks as a demonstration and performance test. Timing is critical and there is little to no user interface to be concerned with. The existing application is written in C# running over Windows and the lead developers are very c# savvy.

As soon as the groov hardware arrives I will be exploring both c# and Pac Control.

Interesting thought, though the team wants to standardize on C#

Regarding this idea of using C++, is there an OptoMMP library on the groov accessible via C++ or does one access the OptoMMP interface via the local port 2000 (IEEE 1394)?

There is an OptoMMP C++ library (PAC-DEV-OPTOMMP-CPLUS), where OptoMMP uses port 2001 on groov EPIC.
Also, if you are going to work with that library I highly recommend checking out the OptoMMP Protocol Guide (form 1465), it has a ton of very useful information!

Has anyone tried running the .net core Linux ARM64 ARM32 runtime on EPIC?

Edit: ARM32… getting ahead of myself…

I am using the .NET OptoMMP now quite successfully and this is running on a Windows machine. C++ is a real possibility. I also started exploring Node RED here on the EPIC-PR1 that just arrived. This is also interesting. Where are the Opto22 Nodes I see in the video. I assume these would allow one to get data from I/O modules?

Click on the menu in the top right corner.
Then on Manage Palette.
Then on the Install Tab.
Type in Opto for the search term.

1 Like

If I have no internet access directly, is there a place where one can put the files and have them show up?

Not really. You need to copy the .node-red directory from an EPIC that has had the nodes installed.
We have an ‘image’ of such a an EPIC if you are game.
You need to have SSH installed and be comfortable working in shell which I suspect you are…

1 Like

Yes and use Linux all the time except at work. LOL

Sent you a PM. Check your forum inbox.

I tested a .NET core 3.1 console application compiled to ARM32 on EPIC. The app opened port 2001 and wrote a test string to the scratchpad and read it back. Worked just fine.

The binary was a bit large at ~31MB with the .NET core compiled in, but has the benefit of not needing any dependencies being installed - including the framework itself.

Additional info: When installing the .NET core runtime and building the application as framework dependent, the executable size dropped to 117KB. The size of the runtime itself is 74MB. Memory usage when the application is running is about 21MB either way.
The OptoMMP code I used to read and write to the scratchpad is my own library I wrote several years ago before Opto had a managed code SDK. My library was targeting .NET Framework 4.5, I changed this to .NET Core 3.1 and built - no source code changes were needed.

If your developers are set on sticking with C#, this looks like a viable path to me. Maybe Opto could build their managed SDK targeting .NET core for you.


Good information Philip. How exactly did you install and compile this on the ARM32 EPIC? I ask because of my limited connectivity with the EPIC-PR1 to the outside world. However, if you installed using apt-get or some process similar, I will see what I can arrange here.

As I side note, I am able to import the original application into monodevelop on another Linux box by starting with an empty ‘solution’ and ‘adding’ individual files.

Thanks for feedback

I compiled a binary on my PC and transferred it to the EPIC.
I believe these are the minimum steps to get this working. I did other things too in my experimenting so if it doesn’t work, let me know.

I installed Visual Studio 2019 (required for core 3.1) which has .net core 3.1 sdk with it.
I setup the project in VS to target .NET Core 3.1.
I created a new Publish profile - set to Folder.
I then edited the Publish profile, set the Deployment Mode to “Self-contained”. This ensures all the dependencies are published to your deployment folder so you don’t need to install the sdk or runtime on the EPIC at all.
I set the Target Runtime to linux-arm
I changed the File Publish Options to produce a single file which will compile in all the dependencies into a single binary.
I ran the publish, and then scp’d the resulting file to the EPIC. I then chmod +x the binary and then executed it.

I think the above approach is easiest, but you can also install the core runtime on the epic if you wish by using wget of the runtime direct from microsoft (https://download.visualstudio.microsoft.com/download/pr/60d21925-7f8f-4004-9afe-aebd041d2d4a/0db2946738642d7f88f71f7800522e8c/dotnet-runtime-3.1.0-linux-arm.tar.gz) and extract it to a folder. You will have to set a dot net root environment variable. See https://docs.microsoft.com/en-us/dotnet/core/install/runtime?pivots=os-linux


This is great Philip. I think I can make this play.