One, attempt

A few days ago, I saw ”
Asp.Net finally runs on Loongson servers: Jexus successfully completed the adaptation of domestic series CPUs

” pushed by the public of Zhang Team . I think of the last week when I worked with my friends on Loongson.NET Core. Write about .NET Core under Loongson.

Jexus Web Server can run on Loongson servers, but what about ASP.NET? What about .NET Core? What version of Mono is installed? Jexus author’s article expression is a bit fuzzy ~

Last week I spent a lot of time trying to deploy .NET projects with my friends on Godson. A friend company won the bid for a government project. After developing a project made by .NET Core, it was discovered that the server to be deployed was Loongson, and .NET Core could not run on it.

What server have Mono 4.x, you can create a simple Proparm.cs, compile a program that uses mono xx.exerun, but put the project out to compile ~ want to compile and install Mono 6.x does not work, some intermediate process error.

.NET Core naturally don’t have to think about it, it can’t be compiled at all. Through Google query data, you need to rewrite the C ++ part (port) to compile CoreCLR under Loongson.

The official CoreCLR source library, you can see some scripts and compilation toolchain.

RISV-C is a reduced instruction set, MIPS refers to a RISC-V-based CPU architecture, and Godson servers use the MIPS architecture.

Eventually, .NET software could not be deployed, and a friend company switched to Java development. . .

In the past, in order to run .NET Core under Armel’s CPU, I spent a lot of time manually compiling .NET Core, but it still failed. I wrote a detailed article on the compilation process at the address ”
Troubleshooting: Building Armel Versions of .NET Core Tutorials and Resources


Second, several disadvantages of .NET Core under embedded

In July 18, Zhang team came to our school to organize a .NET exchange meeting in the Greater Bay Area. Since then, they have started studying .NET. In March of 19th, they dared to turn around for the internship.

Using .NET Core development for half a year, in embedded development, I personally concluded that there are several problems / suggestions in the embedded field of .NET Core.

1. CPUs from previous years are not supported

.NET Core does not work on Raspberry Pi Zero (Arm v6);

Cannot run on Huawei Hisilicon A9 chip (Armel Armv7);

Although these two chips are chips that were released a few years ago, .NET Core is a big fan of IoT, but it is not compatible with older CPUs. At present, many old devices will still be mainstream in the future.

Microsoft official also said:

Note: .NET Core 2.1 is supported on Raspberry Pi 2+. It isn’t supported on the Pi Zero or other devices that use an ARMv6 chip. .NET Core requires ARMv7 or ARMv8 chips, like the ARM Cortex-A53.

Arm’s support is still not wide enough.

2. Fewer hardware devices tested

The official test of embedded devices is mainly on the Raspberry Pi 2/3, and there are many development boards that have not been tested ~

3. Supports less compatible system versions

.NET Core supports many Linux systems, but the support for these systems is based on the latest version of the system. For example, .NET Core 3.0 on Ubuntu supports 16.x, 18.x, 14.x, and 17.x Abandoned ruthlessly.

.NET Core 3.0 supports the following systems:

4, the volume is still too large

For embedded development, .NET Core is still too large, and .NET Core 3.0 cannot be saved. . . Even if there is only one line Hello World, it should be above 70MB +.

5, relying on libraries is more troublesome

ICU, libssl, gcc and other dependent libraries often have inconsistent versions or error messages are reported when these libraries are not installed. Stone Brother once lost his hair due to these problems.

Third, the progress and information of .NET Core Godson transplant

According to bigwigs of the transplant, when No. 9 November, has achieved a running .NET Core Godson in the above Hello Worldexample,

The code base was upgraded to 3.0. Hello World and serveral tests in coreclr can run on MIPS64 now. 

This is a port of CoreCLR, and there are still many issues waiting for God to solve.

For discussion of porting .NET Core on MIPS, you can go to Issue

However, Microsoft currently has no official migration plan, and it can only be done by the community.

Microsoft currently has no plans or work in progress to support MIPS. Of course, we would be willing to accept external contributions towards that goal as appropriate. Note that it is, certainly, a significant amount of work to port .NET Core to a new platform.

There is another great god

This project will focus on translating .NET IL for non-supported .NET targets. Portibility is a huge focus.

  • .NET Standard compatibility
  • Native C performance
  • C89: modern, legacy and embedded platforms (x86, MIPS, SPARK, RISC-V, PPC, AVR, etc)
  • CC65: 6502 platforms (Atari, C64, NES, Apple II, etc) [CS2X may be better suited]]
  • SDCC: Many targets (ColecoVision, etc) [CS2X may be better suited]
  • Assembly: CP1610 (Intellivision) [CS2X may be better suited]]
  • Retarget: Custom assembly targets via plugin system (FPGA CPU, 16bit bytes, etc)
  • Custom Standard lib(s) for various targets.
  • Documentation

Orignal link: