Netduino home hardware projects downloads community

Jump to content

The Netduino forums have been replaced by new forums at This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.

Brian Jepson

Member Since 23 Jul 2010
Offline Last Active Jan 12 2019 10:29 PM

#9452 Setting up a Mono Toolchain for Netduino on Mac OS X

Posted by Brian Jepson on 13 February 2011 - 10:02 PM

Miguel de Icaza and Marek Safar of Mono got in touch with us to let us know that they've incorporated a bunch of improvements to Mono that will let it work with Netduino. Unfortunately, these changes will not be included in the upcoming 2.10 version of Mono. The good news is that it's not too hard to compile Mono yourself, especially if you are familiar with the Mac OS X Terminal.

Here's what you need to install as prerequisites:

Now you're ready to get started. Open a Terminal window (Terminal is in /Application/Utilities). Next:

  • Follow Mono's instructions to check out the latest version of the Mono source.
  • Compile Mono by following these steps (type these commands at the Terminal):

  • Change directory to the Mono source directory:
    cd mono
  • Configure the Mono source code (change /usr/local to wherever you want to install Mono but do not choose /usr):
    ./ --prefix=/usr/local --with-glib=embedded --enable-nls=no
  • Compile Mono:
  • Install Mono (this uses the sudo command to run the command as the super user; you will need to be logged in as an administrative user and you will need to type your password when prompted):
    sudo make install
You now have two versions of Mono installed: one in /usr/bin (the version you installed during the prerequisite phase, and the version you just compiled). To use the Mono compiler that supports Netduino, invoke it as /usr/local/bin/mcs (change /usr/local to the prefix you used in step 2 from the last list of steps).

To try compiling a program, use the attached Makefile. This Makefile expects the following:

  • mscorlib.dll, Microsoft.SPOT.TinyCore.dll, Microsoft.SPOT.Native.dll, and MetaDataProcessor.exe must be in the same directory as the Makefile. Those three DLLs and MetaDataProcessor.exe were included with the zipfile you downloaded when you installed MetaDataProcessor in the prerequisites section of this post.
  • Your program must be named Program.cs, and your AssemblyInfo.cs file needs to be in the Properties/ subdirectory. You can find example programs in the Mono bootloader for Netduino (and sample apps) post, which also includes information on deploying the assemblies to the Netduino.
  • If you want to compile anything other than those sample programs, you will probably need to edit the Makefile.

Attached Files

#7782 MetaDataProcessor.exe WINE notes

Posted by Brian Jepson on 16 January 2011 - 11:44 PM

Here are some preliminary notes on running MetaDataProcessor.exe on WINE. This will let Linux and Mac users run the version of MetaDataProcessor.exe that comes with the .NET Micro Framework. Eventually we'll want to port MetaDataProcessor to portable C, but this will work in the meantime.

This takes the compiled assembly from the C# compiler (Linux instructions; Mac instructions), minimizes it to fit on the CPU, and gives you a PE file that can load dynamically or bundle into a hex file for MFDeploy. It is not a complete solution for compiling or deploying to Netduino on Mac and Linux, but is one of a few steps in that direction.

  • Install Wine
  • Configure wine by running winecfg at the command line.
  • Download the winetricks utility (
  • Use winetricks to install the following libraries/packages: vcrun2010, vcrun2008, dotnet30
  • Copy the "le" versions of mscorlib.dll and Microsoft.SPOT.Native.dll into your working directory (where you plan to invoke MetaDataProcessor.exe from).

For your convenience, I have attached a zip file containing these DLLs (as well as some that are needed by the Mono compiler, including a couple of Netduino-specific DLLs) and MetaDataProcessor.exe from NETMF, which is an open source project distributed under the Apache 2.0 license.

Now you can run MetaDataProcessor.exe like this (all on one line):

wine MetaDataProcessor.exe -loadHints mscorlib mscorlib.dll -parse ASM.dll -minimize -endian le -compile

If MetaDataProcessor.exe is somewhere else, change Tools/ to point to its location. Also, replace ASM.dll with the DLL you want to process and with the name of the desired PE output file.

Attached Files

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.