bast22
Posts: 1
Joined: Wed Mar 06, 2013 9:57 pm

XSP4 (Mono) on RPI

Wed Mar 06, 2013 10:01 pm

Hi All.

I see several topics posted regarding Mono and RPI. However, I haven't found one that matches my exact issue.

I installed mono-complete via the repositories (armhf version) and mono itself seems to work ok (can compile and run basic 'hello world' programs). However, I can't seem to get xsp2 or xsp4 to function correctly?

Is this a known issue regarding the hard vs soft float? Is there another work-around?

Many thanks if anyone can point me in the right direction!

PiPaul
Posts: 4
Joined: Sat Mar 09, 2013 5:53 pm

Re: XSP4 (Mono) on RPI

Sat Mar 09, 2013 5:59 pm

I have tried xsp2 yesterday without a problem on a softfloat wheezy. On hardfloat I ran into problems
with almost everything I tried except the most simple hello world code. So if you are using a hardfloat OS, grab a softfloat version.

JoeStrout
Posts: 43
Joined: Sun Oct 09, 2011 12:11 pm
Contact: Website

Re: XSP4 (Mono) on RPI

Sun Mar 10, 2013 6:47 pm

I'm still trying to wrap my head around this hard/soft float issue. I've seen it mentioned several times, but haven't really dug into it.

Can you give me a simple test to see whether my distro suffers from the problem?

Are there any good references for this issue?

Thanks,
- Joe

OtherCrashOverride
Posts: 582
Joined: Sat Feb 02, 2013 3:25 am

Re: XSP4 (Mono) on RPI

Sun Mar 10, 2013 7:57 pm

Console.WriteLine(DateTime.Now.ToString());

If you see a garbage date/time, you have the hard-float issue.

The hard vs. soft float issue is the ABI (application binary interface) calling convention for the platform as defined by ARM. Hardfloat means that floating point parameters may be passed between functions using floating point registers. Softfloat means that floating point parameters may only be passed using integer registers. As a side note, it is perfectly legitimate to use floating point hardware instructions with a soft-float ABI.

The reason this is an issue for mono is due to the JIT (just-in-time) compiling of code that mono does internally. Mono on ARM uses a soft-float ABI when it JITs and must be patched to correctly pass floating point parameters on hard-float platforms.

OtherCrashOverride
Posts: 582
Joined: Sat Feb 02, 2013 3:25 am

Re: XSP4 (Mono) on RPI

Sun Mar 10, 2013 8:15 pm

To shed a little light on things: There is a hard-float patch to mono that was done by Sony for armv7. This patch requires a patch to work on armv6 on Raspberry Pi. Since Xamarin is not the author of the patch, they do not include it in mono because, although mono is GPL/LGPL, they require copywrite assignment so they can re-license mono commercially. To further complicate things, the hard-float patch is against mono 2.10 while mono 3.x is now current.

JoeStrout
Posts: 43
Joined: Sun Oct 09, 2011 12:11 pm
Contact: Website

Re: XSP4 (Mono) on RPI

Sun Mar 10, 2013 9:06 pm

Thanks for the insight, that helps me understand what's going on.

The bug report has a link to the patch, but the link is dead. Do you know where the patch can be found, and how it would be applied?

("mono --version" shows 2.10.11 for me, so I guess a 2.x patch would be OK.)

Thanks again,
- Joe

PiPaul
Posts: 4
Joined: Sat Mar 09, 2013 5:53 pm

Re: XSP4 (Mono) on RPI

Sun Mar 10, 2013 9:14 pm

The link works fine for me. It links to some code on github

JoeStrout
Posts: 43
Joined: Sun Oct 09, 2011 12:11 pm
Contact: Website

Re: XSP4 (Mono) on RPI

Sun Mar 10, 2013 10:04 pm

Huh -- now it works for me too. Earlier today it gave me a 404 Not Found. Odd...

Oh well, I'll start in on a wiki page about the hard/soft float ABI thing.

User avatar
xranby
Posts: 539
Joined: Sat Mar 03, 2012 10:02 pm
Contact: Website

Re: XSP4 (Mono) on RPI

Mon Mar 11, 2013 6:05 pm

OtherCrashOverride wrote:To shed a little light on things: There is a hard-float patch to mono that was done by Sony for armv7. This patch requires a patch to work on armv6 on Raspberry Pi. Since Xamarin is not the author of the patch, they do not include it in mono because, although mono is GPL/LGPL, they require copywrite assignment so they can re-license mono commercially. To further complicate things, the hard-float patch is against mono 2.10 while mono 3.x is now current.
In this case, if the patch can't get merge upstream, then it may be best to start by creating a distribution patch. This means that Debian & Rasbian can host the patch. This is common practise by distributions to make the packaged software as good as possible by maintaining distribution specific patches when needed.

I would suggest to download the current debian source for mono and include the patch in order to make a proof of concept .deb package.

If interest is large enough the community may create a, patch maintaining, project for mono outside Xamarin that may ease inclusion of the patch for all Raspberry Pi Linux distributions, similar to the current java situation where the IcedTea project maintains armhf and JIT patches on top of OpenJDK that for political reasons cant be merged with Oracles OpenJDK codebase upstream. This is the best way to community manage the code in the long run.
Xerxes Rånby @xranby I once had two, then I gave one away. Now both are in use every day!
twitter.com/xranby

Return to “Other programming languages”