"... and no one shall work for money, and no one shall work for fame; But each for the joy of the working, and each, in his separate star, shall draw the thing as he sees it, for the god of things as they are"

-Kipling

 

C# Remote Compilation and Debugging on the Raspberry Pi 2

Summary

The ultimate goal of this project is to get Mono/C# installed and operational on the Raspberry Pi 2 and also to implement a tool chain which permits remote editing, compiling and debugging. The companion RPICSIO project implements a library which enables a C# program to read, write and accept interrupts from the GPIO Pins and other peripherals such as the SPI, I2C, PWM and UART ports.

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 Raspberry Pi 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.

Background

The Raspberry Pi 2 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 900MHz, with HDMI, USB, Ethernet and installed Linux it is pretty cheap and powerful.

The Raspberry Pi 2

One of the big features of the Raspberry Pi, 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 operate on I2C or SPI busses and that there are also serial ports and pulse width modulator peripherals is just icing on the cake.

Note: The information below is current as of January 2017 and was written for the Raspberry Pi 2, Model B. The Raspberry Pi is very much in active development and there is, of course, also a Raspberry Pi 3 and Raspberry Pi 0. Things will doubtless change and, in the future, the information below may well become inaccurate as the the Raspberry Pi and its onboard software are updated.

Installing Mono and C# on the Raspberry Pi 2

Installing MonoDevelop and Configuring a Remote Compilation Tool Chain on the Raspberry Pi 2

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 Raspberry Pi 2. Especially useful is the Raspberry Pi Forums and the people there are very knowledgeable and helpful.