How to edit, compile and deploy custom firmware for your Netduino

My intentions are to provide a single post, potentially sticky, on how to setup the related tool-chain in order to modify Netduino firmware and API’s so that others in the community can make custom changes to suit their project.

Personal Driving Force: To extend the framework (possibly even upgrade to 4.4), add other helper functions along with the experience.

Potential Outcome: Having the Netduino community come together and show others in the maker community how adaptable .NetMF and, particularly, Netduino is as an embedded solution.

I found some rather outdated material covered in the old forums (the one they all linked too is a dead link) and thought it was time to update and expand upon for Wilderness Labs.

If you have been successful in any of these areas, could you please reply so that I may add it to this?

-IdleGoose

Netduino Source(s)
.NET MicroFramework 4.3 SDK
Visual Studio 2015 Community (Be sure to select C# and C++ during install)

In trying to follow the steps on the page here , I encountered errors promptly.

In the directory “…\Netduino_SDK-master\Netduino_2_and_3_NETMF”
msbuild dotnetmf.proj /t:rebuild /p:flavor=release

Working them out one by one. will post my findings when completed.

Update: I cannot figure out how to get past this error. Any ideas?

Project "D:\Netduino_SDK-master\Netduino_2_and_3_NETMF\Solutions\Windows2\TinyCLR\TinyCLR.proj" (8) is building "D:\Netduino_SDK-master\Netduino_2_and_3_NETMF\Framework\Subset_of_CorLib\SpotCorLib.csproj" (171) on node 1 (Build target(s)).
StartBuild:
  Building...D:\Netduino_SDK-master\Netduino_2_and_3_NETMF\Framework\Subset_of_CorLib\SpotCorLib.csproj;

...

Using shared compilation with compiler from directory: C:\Program Files (x86)\MSBuild\14.0\bin
        
**CSC : error CS8021**: No value for RuntimeMetadataVersion found. No assembly containing System.Object was found nor was a value for RuntimeMetadataVersion specified through options. [D:\Netduino_SDK-master\Netduino_2_and_3_NETMF\Framework\Subset_of_CorLib\SpotCorLib.csproj]

Done Building Project "D:\Netduino_SDK-master\Netduino_2_and_3_NETMF\Framework\Subset_of_CorLib\SpotCorLib.csproj" (Build target(s)) -- FAILED.

Do you have the NETMF SDK installed? It looks like it’s trying to find it and can’t.

Hi. Yes I also found that the compile procedure found on WildernessLabs GitHub is not working. Do you use GCC or ARM MDK? With some luck I managed to compile it using MDK 5.24 without errors but with some 200+ warnings. It did deploy to my Netduino 3 Ethernet board but when I try to run my application in Visual Studio I get this error:

Found debugger!
Create TS.
 Loading start at 8059b8c, end 80882b8
Assembly: mscorlib (4.3.1.0)
Assembly: Microsoft.SPOT.Native (4.3.1.0)
Assembly: Microsoft.SPOT.Hardware (4.3.1.0)
Assembly: Microsoft.SPOT.Net (4.3.1.0)
Assembly: Microsoft.SPOT.Net.Security (4.3.1.0)
Assembly: System (4.3.1.0)
Assembly: System.Net.Security (4.3.1.0)
Assembly: Microsoft.SPOT.Hardware.SerialPort (4.3.1.0)
Assembly: Microsoft.SPOT.IO (4.3.1.0)
Assembly: System.IO (4.3.1.0)
Assembly: Microsoft.SPOT.Hardware.PWM (4.3.1.0)
Assembly: Microsoft.SPOT.Hardware.Usb (4.3.1.0)
Assembly: Microsoft.SPOT.Net (4.3.1.0)
Assembly: System (4.3.1.0)
Assembly: Netduino.IP (1.0.1.0)
Assembly: Netduino.IP.Interop (1.0.0.0)
***********************************************************************
*                                                                     *
* ERROR!!!!  Firmware version does not match managed code version!!!! *
*                                                                     *
*                                                                     *
* Invalid native checksum: Netduino.IP.Interop 0x00000000!=0xD8265967 *
*                                                                     *
***********************************************************************
Error: 96000000

Using MFDeploy I can see that the only things that is different from what I had before when it worked is the SolutionReleaseInfo.solutionVersion that has changed from 4.3.2.2 to 4.3.2.3 and the text “by Secret Labs LLC” has changed to “by Wilderness Labs LLC”(Why is the latest compiled firmware Secret lab?). Also some assemblies are missing but that must be because I can’t deploy my application. I have only been working NETMF and Netduino for a couple of weeks so I regard myself as a beginner. So before I tell you how I managed to compile it, and confuse everybody, maybe Bryan or someone could give us the correct procedure. I can give som ideas about what I think is wrong and whats missing though. The requirements is lacking a version of Visual Studio, otherwise you do not have msbuild. You need to run some Setenv commands. The building output is not in $(FlavorDirectory)\BuildOutput. Is 200+ warnings normal?

@bryancostanich
Yes, I have the Netduino SDK installed and the ARM Keil 5.10 (as suggested by the post), in fact I download an older Window Kit (8.0), and VS (2010) in addition to VS (2015) to get past another group of errors. Reinstalled everything from scratch. Did this on my “junk tower” as not to disrupt my main rig.

@Niclas_B I Imagine bryan, and his team?, are working on updating the source files to reflect the name changes and other modifications… Hopefully a 4.4 version… for a new Mini? A maker can dream.

@IdleGoose - Compiling NETMF 4.4 for Netduino is a fairly trivial task if you can compile 4.3

I have been running NETMF 4.4 since it’s release with great results on custom STM based boards.

I cannot compile 4.3 is the problem. I’m not sure if I am missing something in the tool-chain or something more obscure.
I am hoping that by creating this post I can provide a step by step instruction set to compile and deploy from a scratch system to at least N3 and, perhaps on my own site, other platforms / devices for reference to other makers and hobbyists.

Very nifty board you have there @Justin_Wilson I would need more pins though. But that would be great for some of my smaller projects. Is there a place where I can purchase some online?

@IdleGoose - until i get around to getting online ordering running again i am just taking orders by email.
How many pins do you need?

@Justin_Wilson
Just an estimate, but at least 30 off the top of my head. but if multiple 12 pin models would do the same thing. Still smaller than the current form factor (netduino/arduino sized), not only that but having multiple “cores” might be nice… even if they can only communicate through serial.

Here’s a few more pins…

1 Like

You are running msbuild in the wrong directory. You should be in your board directory under solutions. Also I think you need to run at least setenv_vs and setenv_mdk_510 found in that directory before building.

After running both setenv_vs and setenv_mdk_510

D:\Netduino_SDK-master\Netduino_2_and_3_NETMF\Solutions\Netduino3>msbuild dotnetmf.proj /t:rebuild /p:flavor=release
Microsoft (R) Build Engine version 14.0.25420.1
Copyright (C) Microsoft Corporation. All rights reserved.

Build started 9/13/2017 2:07:53 PM.
Project "D:\Netduino_SDK-master\Netduino_2_and_3_NETMF\Solutions\Netduino3\dotnetmf.proj" on node 1 (rebuild target(s))
.
D:\Netduino_SDK-master\Netduino_3_NETMF\tools\targets\Microsoft.SPOT.System.Targets(194,5): error : Must specify BUILD_
ROOT [D:\Netduino_SDK-master\Netduino_2_and_3_NETMF\Solutions\Netduino3\dotnetmf.proj]
Done Building Project "D:\Netduino_SDK-master\Netduino_2_and_3_NETMF\Solutions\Netduino3\dotnetmf.proj" (rebuild target
(s)) -- FAILED.


Build FAILED.

I also tried init.cmd as this contained

IF "%COVERAGEBUILDID%" == "" (
	set BUILD_ROOT=%BUILD_ROOT_BASE%\public
) ELSE (
	set BUILD_ROOT=%BUILD_ROOT%\Coverage
)

what does setenv_vs reply?

Just this depending on which argument I throw it

Compiler VS11 or VS 14
setting source depot RVDS vars

I modified setenv_base with (I did it before I added the 14. (I installed 11, and reinstalled all frameworks previously to see if it was a 14 issue, nope, same thing) I am running my command line or msbuild as Administrator.)

IF NOT "%VS140COMNTOOLS%" == "" (
		CALL "%VS140COMNTOOLS%vsvars32.bat"
	) ELSE (

and

IF "%COMPILER_TOOL_VERSION_NUM%"=="14" (
  IF "" == "%VS140COMNTOOLS%" GOTO BAD_VS_ARG
  CALL "%VS140COMNTOOLS%vsvars32.bat"
  GOTO :EOF
)

inside of init this line gets called and continues

set BUILD_ROOT=%BUILD_ROOT_BASE%\public

I’ve finally managed to get a clean build and in case it’s any use here’s what I did:

Firstly, the machine has had VS2015 and VS2017 installed in the past. Both of these have been removed and VS2013 Express is the only VS environment currently installed. The machine is used purely for Netdiuno devleopment.

System is running Windows 10.

Pre-reqs

  • Downloaded the Microframework 4.3 porting kit from Codeplex.
  • Install the complete porting kit in c:\MicroFrameworkPK_v4_3
  • Downloaded GCC 6.3.1 from Arm web site.
  • Installed this into c:\gcc6stm32

Test 4.3 Compilation

  • Changed to MicroFrameworkPF_v4_3 directory
  • Execute setenv_vs
  • Output from above indicated VS11 found
  • Execute setenv_gcc 6.3.1 c:\gcc6stm32
  • Execute msbuild dotNetMF.proj /t:rebuild /p:flavor=release

15 minutes later everything had built with a number of warnings and no errors.

So at this point I was confident that the vanilla porting kit installation looked OK.

Build Netduino SDK

  • Started with a new cmd prompt to start fresh regarding the environment variables.
  • Copied the Netduino SDK into the porting kit directory
  • Change directory to c:\MicroFrameworkPK_v4_3\Netduino_3_NETMF
  • Execute setenv_vs
  • Output from above indicated VS11 found
  • Execute setenv_gcc 6.3.1 c:\gcc6stm32
  • Execute msbuild dotNetMF.proj /t:rebuild /p:flavor=release

15 minutes later, 76 warnings, 0 errors.

Now to figure out where stuff is :grin:

Regards,
Mark

Edit: Minor correction to a directory location.

I was able to build finally with MDK… not sure what I changed to make it work this time… will have to start over from beginning to make sure I can recreate it. However, I am not finding firmware from the build, I can only find the ones included in the SDK-Master(dated from when I first started this adventure). I assumed MDK (Keil) was involved in assembling those.

Good news! I found them deep down in BuildOutput. just search for ER_FLASH. You’ll find two files with that name. take the one in the hex folder and add .hex (or s19). Tinybooter.hex was in a different folder.

I could not find them. I tried using Everything Search and all that came up was the old precompiled ones. Could you post the path you found yours in, I may have to navigate there manually.

No ER_FLASH with the gcc build. Looking at the directory contents I’m not sure that the gcc build is actually building the device specific stuff.

Might have to look at the trial of the Keil environment.

Regards,
Mark

You have to build from the directory of the board you want to build for as explained on WildernessLabs Github.