Installing Mono and C# on the Beaglebone Black
Summary
Updated Nov. 2018
The ultimate goal of this project is to get Mono/C# installed and operational on the Beaglebone Black and also to implement a tool chain which permits
remote editing, compiling and debugging. The BBBCSIO project implements a library which enables
a C# program to read, write and accept interrupts from the GPIO Pins and other OCP peripherals such as the SPI port.
The effort spent implementing a remote compilation toolchain might seem a bit odd if you are new to the microcontroller world. If so, you probably
do not realize the utility of a nice functional remote toolchain - especially the debugging. I am sure that once you have it configured
you will find it is much, much, more pleasant to work in a nice Interactive Development Environment (IDE) with
syntax highlighting, bookmarks, context sensitive help and all of the other conveniences of a modern programming environment. Once you are able
to press a button to compile and transport the code to the Beaglebone Black and also be able to remotely step through it in a debugger you will probably never
willingly go back to a text based editing solution.
This sequence of pages will show you how to write code on your PC in Visual Studio and have it remotely execute and debug on the BBB. The section at the bottom
of the page discusses how to set up a similar procedure using MonoDevelop on a Ubuntu Linux box.
Background
The Beaglebone Black is an extremely powerful and inexpensive microcontroller board which incorporates
more or less every item of functionality you might wish to have in a microprocessor solution. I won't go into to all of the details - you can look them up for
yourself - however at 1Ghz, with HDMI, USB, Ethernet and installed Linux it is pretty cheap and powerful.
The Beaglebone Black
One of the big features of the Beaglebone Black, as far as I am concerned, is that it has a large number of pins that can be configured as input or
output GPIOs. This makes it possible to control or monitor a large number of interesting things. The fact that some of the pins can use PWM or A/D
sampling and that there are also two 200 Mhz co-processors imbedded in the 1 Ghz core (the PRUs) is just icing on the cake. If you are interested,
this page discusses why this, and other projects, were developed for the Beaglebone Black.
The Beaglebone Black is very much in active development and things
will doubtless change. In the future, the information below may well become inaccurate or irrelevant as the the Beaglebone Black and its onboard software are
updated. Note: The information below is current as of November 2018 and is a update of the previous information on this page
which was provided in May 2015.
Installing Mono and C# on the Beaglebone Black
-
- This page describes my hardware setup of my Beaglebone Black. It includes a discussion of
why you need to get a USB keyboard and monitor working before you do anything else. A procedure for hooking up a cheap, non-HDMI, VGA monitor to the the
Beaglebone Black HDMI port is also detailed.
-
- I could never get Mono to install or compile on the soft float Linux Debian 3.8 armel O/S (ie the Linux version with which the Beaglebone Black ships by default) so I needed to install an armhf package.
It is my belief that Mono will only install on a "hard float" armhf kernel.
-
- A discussion of how the networking and connections are setup on my system - including how to set a static IP address and configure nameservers etc.
-
- Once you have an armhf kernel installed, the installation of Mono is simple. However, there is a 'gotcha' in regards to installing a 3.8 kernel or a 3.14 kernel.
The link contains details.
Visual Studio 2017 Remote Debugging
Remote Compilation and Debugging on the Beaglebone Black Using Visual Studio
-
- Mapping a directory on a remote Development PC into the Beaglebone Black ensures that any executable code created remotely is instantly and automatically
available to run on the Beaglebone Black without any user interaction. A pleasant working environment with remote compilation and execution is achieved
by creating an executable on the Development PC using a nice IDE and having CIFS automatically move that file over to a mapped directory on the Beaglebone Black where it can be run.
-
- Things have moved on since the previous version of this page and it is now quite straight forward to setup remote compilation and debugging on a BeagleBone
Black from within a Visual Studio 2017 instance which is running on a remote PC. The procedure is simple if you use the free MonoRemoteDebugger tool and this
page provides information on the installation and use of that tool.
MonoDevelop on Linux Remote Debugging
Installing MonoDevelop and Configuring a Remote Compilation Tool Chain on the Beaglebone Black
-
- Mono Develop is a pretty good IDE - not as good as Visual Studio IMHO - but still pretty darn good. However,
when this group of pages were written (May 2015) I could not get a remote compiling or debugging
toolchain working with Visual Studio (this has since changed - see above) and so I decided to use the open source MonoDevelop software running on Ubuntu 14.1.4 Linux as the remote development platform.
-
- Mapping a directory on a remote Development PC into the Beaglebone Black ensures that any executable code created remotely is instantly and automatically
available to run on the Beaglebone Black without any user interaction. A pleasant working environment with remote compilation and execution is achieved
by creating an executable on the Development PC using a nice IDE and having NFS automatically move that file over to a mapped directory on the Beaglebone Black where it can be run.
-
- The MonoDevelop IDE contains a "soft debugger" which is designed to provide full debugging capabilities on remote .NET executables. This page describes how to set things up so you can remotely debug C# executables running in Mono on the Beaglebone Black from a remote Linux PC using the
MonoDevelop IDE.
Notes on the Beaglebone Black
-
- The Linux Device Tree can appear to be very complex and hard to understand. This technical note attempts to provide an explanation of how the Device Tree works and
how to compile and de-compile it.
License
The contents of this web page are provided "as is" without any warranty of any kind and without any claim to accuracy. Please be aware that the information provided
may be out-of-date, incomplete, erroneous or simply unsuitable for your purposes. Any use you make of the information is entirely at your
discretion and any consequences of that use are entirely your responsibility.
All source code is provided under the terms of the MIT License.
Acknowledgements
Various internet resources were used to help understand the workings of the Beaglebone Black. Especially useful is the
Beaglebone Black Community Forums and the people there are very knowledgeable and helpful. Thanks forum members!.