0

I am trying to run a simple "Hello, World" C# app on my Raspberry Pi Zero. It works fine on my Raspberry Pi B+, but I get an "illegal instruction" error on the Zero. In both cases, I am compiling the program using Visual Studio on a Windows PC, copying the exe to the Pi, and then running it on the Pi with "sudo mono hello.exe". I should also note that I built the SD image for the Zero on the B+ (to avoid having to find weird adapters for video, USB, ...)

I get that the Zero has an ARMv6 architecture and the B+ an ARMv7 architecture, and am assuming that is the root of my problem.

Some questions come to mind:

  1. Is it true that mono and the mono libraries target only ARMv7 and that an ARMv6 version is not available?

  2. Would compiling the code for the Zero on the Zero make any difference?

  3. Is it feasible to even consider trying to compile/port mono to work on an ARMv6 myself?

  4. Or is there any other way to get a C#/.Net application to run on a Zero?

Thanks in advance for your thoughts.

1

I get that the Zero has an ARMv6 architecture and the B+ an ARMv7

No. The B+ (aka "model 1 B+": https://www.raspberrypi.org/products/raspberry-pi-1-model-b-plus/) and Zero both have ARMv6 single core processors.

I'll guess that what you are acually referring to is a 3B+, which has a multicore ARMv8 processor. Anyway, that being the case, yes, this difference in architecture is the issue.

Is it true that mono and the mono libraries target only ARMv7 and that an ARMv6 version is not available?

I'm not a mono user, but this is very unlikely since Raspbian is actually compiled as ARMv6 in order to make it compatible with all models. So if there was no ARMv6 there would be no mono in Raspbian.

Also, if you look at the oldest questions here tagged they date back to 2012, years before the ARMv7 models came into being.

Mono is open source, so compiling it for various platforms is just a matter of getting it to work (as opposed to getting the corporation which owns it to produce a version).

Would compiling the code for the Zero on the Zero make any difference?

If you can, then almost certainly,yes. Try a small test to confirm that.

  • Actually, what I really have is a Raspberry Pi 3 Model B, and not a "+" anything. Still ARMv8, apparently. Thanks for the quick response; I'll give compilation on the Zero a try. – BoCoKeith Oct 12 '18 at 22:07
  • I can't even run the compiler "mcs" on the Zero. "Illegal instruction". :-( – BoCoKeith Oct 13 '18 at 1:45
  • I started from scratch and built a new Raspian SD card for the Zero then reinstalled mono-complete, etc., Mono is now working fine. Sounding like operator error. Thanks again for the info, @goldilocks. – BoCoKeith Oct 14 '18 at 2:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.