Project Description

The aim of the project is to add GCC compiler support to .NET Micro Framework codebase for the STM32F4 family of ARM Cortex-based microcontrollers. The project files consist of the original .NET Micro Framework source files and the extension of the code made by Oberon microsystems, which originally did not allow compiling via GCC out of the box. This source code has been modified in order to accomplish the GCC support.

The project builds up on the following code:

Supported compilers

The project can be compiled by ARM GCC cross-compiler from the following binary distribution maintained by ARM employees https://launchpad.net/gcc-arm-embedded/.

The compilation process was tested under:
  • gcc-arm-none-eabi-4_7-2013q1-20130313-win32 (GCC 4.7.3) released in March 2013
  • gcc-arm-none-eabi-4_8-2014q2-20140609-win32 (GCC 4.8.4) released in June 2014

Other GCC versions coming from the same distribution or even from other distributions might work, however it is not guaranteed. Watch out for differences in the build configuration used for each particular GCC distribution (see gcc -v). In case the compiler's or linker's command-line need to be tweaked, take a look into tools\Targets\Microsoft.Spot.System.gcc.targets configuration file.

Supported boards

  • STM32 F4Discovery - http://www.st.com/web/catalog/tools/FM116/SC959/SS1532/PF252419 (Low-cost evaluation board created by ST Microelectronics; see directory Solutions\Discovery4)
  • custom development board with STM32F4 and Xilinx Spartan-6 FPGA ("FPGAkit") - more info in the thesis text linked below
  • support for other STM32F4-based platforms can be added - use F4Discovery solution as a base for your own port

.NET MF build process

Novices in the field of .NET MF compilation and porting might want to skim through this introductory guide first http://www.ghielectronics.com/downloads/FEZ/Beginners%20Guide%20to%20Porting%20NETMF.pdf.
  1. Install the above-mentioned ARM GCC compiler
  2. Install MS Visual Studio C# 2010 Express and MS Visual Studio C+ 2010 Express
  3. Install .NET Micro Framework SDK 4.2 - https://netmf.codeplex.com/)
  4. Install .NET Micro Framework 4.2 Porting Kit (preferrably choose a destination directory wihtout spaces or special characters in the path, e.g. c:\MicroFrameworkPKv42) - https://netmf.codeplex.com/
  5. Obtain a copy of the .NET MF Extension for STM32F4 created by Oberon Microsystems (https://netmf4stm32.codeplex.com/) and integrate it into .NET MF Porting kit sources. New files and folders will be created and some of the old source files will be overwritten by their updated and extended versions.
    • Note: If you expect to make custom modifications to the .NET MF Porting kit (PK) sources, I strongly recommend putting the .NET MF PK directory under version control (svn/git/...). That way you can easily track your own modifications, revert changes if needed or share patches with others.
  6. Obtain a current version of this project's source codes and integrate it into the .NET MF Porting Kit sources in a similar fashion (i.e. copy the updated source code over the porting kit directory - some of the original files will get again overwritten by the updated ones).
  7. Open a command-line window (cmd) and set environmental variables needed by the MSBuild compilation system. Use the setenv_gcc.cmd script, e.g.: setenv_gcc.cmd 4.7.3 c:\path\to\gcc\install
  8. Change the working directory to the desired solution directory and launch the compilation process by this command: msbuild.exe /t:build /p:memory=flash;flavor=release;device_type=cortex-m4
  9. Load the binary framework image to the target hardware product. The tinybooter.bin image is supposed to be written to the device using standard means like JTAG or ST-LINK adapters. The CLR images ER_CONFIG and ER_FLASH should be loaded to the device using the MFDeploy application (part of the .NET MF SDK package).
  10. If you decide to perform custom modifications to the framework, it is useful to redirect the compilation log to a text file instead of stdout due its length so that a detailed inspection of errors/warnings is possible.

Author

The published modifications of .NET MF to support for STM32F4 & GCC were performed by Jan Matyas as a by-product of his diploma thesis at Faculty of Information Technology, Brno University of Technology (thesis text in Czech: http://www.fit.vutbr.cz/study/DP/DP.php?id=15625).

In case of any questions, I can be reached at info at janmatyas dot net.



Last edited Jul 12, 2014 at 8:53 PM by jmatyas, version 22