dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
15.22k stars 4.72k forks source link

Arm6 Raspberry PI Zero - PI 1 #7764

Closed olegsavelos closed 2 years ago

olegsavelos commented 7 years ago

Is there any effort in place to bring support for the ARM6 platform? I think the PI Zero is perfect platform for lots of different IOT projects and it would be quite a shame if there is no support for it.

miloush commented 4 years ago

https://blogs.windows.com/windowsdeveloper/2020/05/26/build-your-iot-devices-with-windows-for-iot-a-comprehensive-platform-for-every-device-developer/

We are excited to share that going forward, there is one OS release for Windows for IoT, Windows 10 IoT Enterprise that can address these needs.

I might be interpreting this wrong but it makes me worry there will be no more IoT Core for RPi unless it's ARM64.

ivanjx commented 4 years ago

@miloush I dont think that this issue has anything with Windows IoT. The topic here is adding dotnet support to armv6 processor so we can run dotnet on Raspberry Pi Zero.

miloush commented 4 years ago

@realivanjx indeed my bad

mguinness commented 4 years ago

From reading above it seems ARM6 support is unlikely due to work needed for thumb instruction set. Anyone else have experience running dotnet core on other low cost hardware like Orange Pi Zero?

eduncan911 commented 4 years ago

The PR #657 to add ARMv6 was closed...

Came here because of a .NET Core project we need running on a RPi Zeros at the school as we have about 25x RPi Zeros purchased for this project. We don't have, nor are we going to buy 25 new RPi 3s because .NET Core doesn't support ARMv6.

Guess I'll re-write the project in Golang...

thesoftwarejedi commented 4 years ago

@eduncan911 Try going the mono route. Here's some details.

michaldobrodenka commented 4 years ago

Net6 should support multiple cpu architectures via mono runtime. maybe.

michaldobrodenka commented 4 years ago

I'm running more than thousand ARMv6 cpu devices via mono. 3 years ago we introduced ARMv7 hardware, still on mono, but now we are refactoring and migrating to Net core/ net standard, so only small executable will be different and libraries are reused between mono and net core.

BryanCrotaz commented 4 years ago

Same here. I run the scoreboards at Lord’s cricket ground from pi 1 and Pi B+ using Mono. The newer kit runs off Pi 3 using Net Core. Same source files, with a core object that does the work. In the framework and core apps it just creates the service object and loads the app config into it.

Bryan Crotaz Silver CurvE

michaldobrodenka commented 4 years ago

Unfortunately mono is full of bugs. Bugs no one will ever probably fix. Most of them network related. For example on some networks when dns is available but normal traffic has a problem - https/ssl streams has a memory leak which could eat whole memory. Or mono could not communicate on some network without playing with MTU size. But python or NET Core doesn't have problems communicating.

Surprisingly, mono is sometimes faster than net core, at least on ARMv7. Not always, but I expected that net core would win performance race by a huge margin.

mguinness commented 4 years ago

I find it hard to believe that Mono is full of bugs, but it could depend upon application. Blazor WASM is implemented in Mono and if there were network related issues that would be a major problem.

Mono: from Xamarin to WebAssembly, Blazor, and .NET 5

danmoseley commented 4 years ago

cc @marek-safar

michaldobrodenka commented 4 years ago

I run mono on several thousand machines and many network configurations. These bugs does not occur on every machine and network configuration. They have the same linux image.

MTU size problem - 0.3% of installations - on these network is 100% reproducible. I have completely no idea why. But ssh works on these networks and the fact that I have to change mtu size was discovered only by accident.

SSL Stream memory leak - 2% of installations. It was very hard to reproduce, in the end we succeed to reproduce it with 4G router with consumed data, so only dns is working, other request doesn't work. But we couldn't simulate it with tcp error simulator on normal lan network. We use 4G router and specific SIM card to simulate that leak. Usually happens on installation with 4G or other wireless networks. It seems that if in case of establishing TCP & HTTPS connection TCP handshake doesn't complete, it creates a leak.

From time to time we encounter a bug, sometimes it's fixed in short time, sometimes we workaround them and once I've fixed it in mono and pull request was accepted (also related to network) :) But to be fair, this week I found (and reported) a bug in NET5 RC1. To me mono is excellent piece of software (I work with it for 9 years) but has some glitches in network code.

mguinness commented 4 years ago

Fair enough, but to characterize Mono as full of bugs is a little unfair. The 4G router/SIM card combo certainly seems like an edge case, I'd encourage you to create an issue on Mono repo and provide as much info as possible. Even if it doesn't get resolved at least others with the same issue can discover the bug. Thanks for your previous contributions to the Mono/NET5 repos.

michaldobrodenka commented 4 years ago

Ok, sorry, it's unfair.

But we just lost several hundreds man hours finding why some installations have these problems. Mono is especially usable for short lived apps - like mobile. We have some installations where we have more than a year uptime, but sometimes it's problematic.

Graveen commented 4 years ago

@michaldobrodenka btw your testimonial is very interesting !

Dargazo commented 3 years ago

Will ARMv6 support be included in .NET 6.0 ?

Richard Lander mentioned something about it in the comments of .NET 5 Preview 4 announcement https://devblogs.microsoft.com/dotnet/announcing-net-5-preview-4-and-our-journey-to-one-net/#comment-5958

richlander commented 3 years ago

My thinking with that is that we'd use Mono for Armv6 as part of .NET 5.0. We most all the Mono/Xamarin related projects to 6.0. I'm hoping that we can fund a Mono Armv6 build in 6.0.

JackQChen commented 3 years ago

Adding my vote for armv6 support! +1

danmoseley commented 3 years ago

@phooey did you intend to post to this issue?

marinasundstrom commented 3 years ago

We need this to run on the new Raspberry Pi Pico microntroller.

https://github.com/dotnet/runtime/discussions/47270

ivanjx commented 3 years ago

@robertsundstrom Raspberry Pi Pico does not run linux

marinasundstrom commented 3 years ago

@realivanjx Yeah, right. I was thinking of native compilation for that hardware. Wrong thread.

santoro-mariano commented 3 years ago

@robertsundstrom you could use NanoFramework

Dargazo commented 3 years ago

@richlander Just to clarify you comment on the release of .NET 6 Preview 1, is it the case that Armv6 support will not be included in .NET 6, or that -specifically- Mono's implementation of Armv6 will not be included?

ao57772 commented 3 years ago

Dreaming about this almost every night

Albonycal commented 3 years ago

Any updates? ARMv6 support?

michaldobrodenka commented 3 years ago

@richlander ARMv6 support is more than only R Pi 1/Zero/Compute module - it's also about embedded world with iMX devices etc.

Phyyl commented 3 years ago

this would be such a game changer for IOT and raspberry pi zero

Albonycal commented 3 years ago

^^

DocBrown101 commented 3 years ago

I've resigned myself to the fact that it's not coming.

My workaround is to target .NET 4.7.2 and compile IL code and then run it with MONO on Arm6.

Phyyl commented 3 years ago

problem is, mono has been lagging behind in terms of language version support and it's really disappointing to give up records, switch expressions, pattern matching, async streams, ranges, null-coalescing assignment, and so on... as well as all the performance improvements. Not to mention using mono isn't always the smoothest ride...

DocBrown101 commented 3 years ago

I completely agree with this statement!

michaldobrodenka commented 3 years ago

I've resigned myself to the fact that it's not coming.

My workaround is to target .NET 4.7.2 and compile IL code and then run it with MONO on Arm6.

I have mono running on thousands IoT devices (ARMv6) and for a new project I wouldn't choose it again. First problem is that it almost abandoned project, has many bugs, mainly in network code, especially everything with SSL/HTTPS in long run, but not limited to SSL - and they will be probably fixed only if you fix them. Second problem is that you are stuck with C# 7.3 (8 with hack) and Nestadard2.0 (2.1 with hack). In future more and more libraries will be unusable because they will target NET6/7/8 TFM. And also poor debugging/diagnostics compared to dotnet

I still hope, that MS will keep up to its promise and using mono VM will make dotnet multiplatform. So I'm hoping that after release of .NET6 will target more platforms.

Second option if you have to use ARMv6 (eg some embedded HW) is not to use c#. Use Rust (or Java, C++ or js...)

Using mono on ARMv6 is feasible only for proof of concept, demo.

ao57772 commented 3 years ago

My workaround is to target .NET 4.7.2 then you have to use older versions of nuget packages and it means extra hours for me to maintain the code compile for 4.7.2 and net5.0 at the same time... if possible at all. Digging for packages still compatible with 4.7.2 is sometimes like time travel, bringing me 8 years back. Ok .. I had more hair then but that is the only plus point of it, I guess.

DocBrown101 commented 3 years ago

Just look at what Richard Lander has written on .NET 6 Preview 1: https://devblogs.microsoft.com/dotnet/announcing-net-6-preview-1/#comment-8452

marinasundstrom commented 3 years ago

I'd rather see and updated RPi Zero, since they have declared that 32-bit is soon to be dead, and 64-bit is the way forward.

BryanCrotaz commented 3 years ago

There are approximately 20 million Pi 1,2 and Zero boards already out there

michaldobrodenka commented 3 years ago

Raspberry pi compute module along with other ARMv6 boards are still in use in embedded segment

DigitalArtifex commented 3 years ago

+1 on armv6 support.

If JIT is the issue, then it's not an issue as far as I remember. .NET MicroFramework supported JIT and was ported to just about any popular micro in 2014, including armv6.

I know it's not nearly as extensive as the Core JIT, and it would take work, but it's certainly not impossible. Also highly beneficial to IoT

marianblazicek commented 3 years ago

+1

Misiu commented 3 years ago

What about Pi Zero 2 W (https://www.raspberrypi.com/news/new-raspberry-pi-zero-2-w-2/)? It has the same connectors, so it should work as a replacement for Pi Zero (1).

ismaelhamed commented 3 years ago

@Misiu AFAIK, the Cortex-A53 is an ARMv8 chip

mguinness commented 3 years ago

Yep, it's ARM64 as detailed in review of Raspberry Pi Zero 2 W and it has the same form factor as Pi Zero 1 which is great news for .NET Core developers.

BlackDawnX commented 2 years ago

+1

michaldobrodenka commented 2 years ago

How hard is it to use dotnet with monoVM for ARMv6? Are there some steps to follow how to wire it together?

marekdovjak commented 2 years ago

@janvorli @jkotas Now, when NET6 support using monoVM runtime, it should be easier. MonoVM for 32bit linux-arm could be compiled for ARMv6 - which should be fordward compatible with ARMv7. And so if anyone wanted to use NET6 on ARMv6, just use self contained app with -p:UseMonoRuntime=true

DocBrown101 commented 2 years ago

@marekdovjak Have you already tested this and does it work?

marekdovjak commented 2 years ago

I've tested only my app using -p:UseMonoRuntime=true, but it doesnt work (Seg fault). MonoVM is probably compiled for ARMv7

steveisok commented 2 years ago

@directhex Please take a look at what it would take to provide an ARMv6 mono runtime.