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

This thread has come about because a number of community members (myself included) are having problems working out how to build the firmware. We would like to improve the documentation to make it easier for those who follow.

Is it possible for you to give a little more detail on how you have built the firmware in order that we can improve the documentation?

Regards,
Mark

1 Like

After my attempts to compile the firmware I had to reinstall the Netduino sdk in order to deploy my application again. Before understanding that I also reinstalled other things. And since I had deleted the buildoutput directory I needed to build the firmware again in order to give you the path. Problem is that now it doesnā€™t compile. It takes more than a minute longer and I get much fewer warnings but 34 errors. First one is this:

C:\Netduino_SDK-master\Netduino_2_and_3_NETMF\CLR\Tools\StubWinHal\stdafx.h(20): fatal error C1083: Cannot open include  file: 'wininet.h': No such file or directory [C:\Netduino_SDK-master\Netduino_2_and_3_NETMF\CLR\Tools\StubWinHal\dotnetmf.proj]C:\Netduino_SDK-master\Netduino_2_and_3_NETMF\tools\targets\Microsoft.SPOT.System.x86.Targets(162,5): error : Build failed: StubWinHal.cpp [C:\Netduino_SDK-master\Netduino_2_and_3_NETMF\CLR\Tools\StubWinHal\dotnetmf.proj]

So almost back to square oneā€¦ wininet.hā€¦ seems to have to do with windowsā€¦ anyone?

You can build the Netduino2 firmware with the following.

call cd C:\SVN\IngenuityMicro\NETMF\Firmware\NETMF4_3
call setenv_mdk 5.05
call C:\SVN\IngenuityMicro\NETMF\Firmware\NETMF4_3\Solutions\Netduino2
call msbuild /flp:ErrorsOnly;LogFile=errors.log /v:m:

The other projects are not in a buildable state due to Networking funnies.

why donā€™t you use the ā€œNetduino_SDK-masterā€?

I have copied the files from ā€œNetduino_SDK-masterā€ into my local NETMF structure.

why? is it necessary?

Probably not, i just like to keep things in one place.

I think i resolved that one (wininet.h) by installing windows kit 8

Yes I reinstalled the windows sdk found in VS 2013 and now it compiled again!
path to ER_FLASH for my board:
Netduino_SDK-master\Netduino_2_and_3_NETMF\BuildOutput\THUMB2\MDK5.10\le\FLASH\release\Netduino3Ethernet\bin\tinyclr.hex\

Tinybooter.hex:
\Netduino_SDK-master\Netduino_2_and_3_NETMF\BuildOutput\THUMB2\MDK5.10\le\FLASH\release\Netduino3Ethernet\bin\

Still getting the same error when trying to run my own code:

 ERROR!!!!  Firmware version does not match managed code version!!!! * Invalid native checksum: Netduino.IP.Interop 0x00000000!=0xD8265967 *

Ok Bryan, or anyone else out there in the wilderness, we need your attention. The Netduino_SDK-master found on WildernessLabs GitHub is not the master. If this is going to be an open source project you need to give us the correct source. Today I managed to compile and deploy the firmware for the N3 Ethernet board. When I looked in device info I found that there was two gobus assemblies. One was version 1.0.0.0 and it wanted NETMF 4.2 meaning I could not run anything on the device. So I looked at ā€¦\Netduino3Ethernet\TinyCLR\TinyCLR.proj and I was surprised to find this:
<Import Project="$(SPOCLIENT)\Solutions\Netduino3Ethernet\DeviceCode\GoBus\GoBus.featureproj" /> <Import Project="$(SPOCLIENT)\Solutions\Netduino2\DeviceCode\GoBus\GoBus.featureproj" />

I removed the last entry, recompiled, and got a device that I could run my code on. But how did it get there?

There is also the issue with the checksum of Netduino.IP.Interop. I had to set it manually to 0 in Netduino_IP_Interop.cpp. Maybe it will be solved with the master source.

I do not want to sound negative. Though it took some hours I feel happy. I finally got it running.

Wow I just tried to compile the Netduino 2 firmware and got 755 errors.

Congratulations great job!

1 Like

755! That must be the current record!

Yep,

I found this may be a good start.

Congratulations on getting this compiled and deployed.

Is there any chance you could give a list of steps in order that others can reproduce this?

Regards,
Mark

@Niclas_B, @David_Weaver; weā€™re building out a clean box to try and repro the issues youā€™re having.

There are a lot of moving parts in the build. It took us over a month of hacking to get it to work right. Weā€™ve tried to simplify, but we may have missed some steps in the documentation.

Stay tuned.

I used VS2012 express (need to edit setenv_base) and Keil ARM MDK 5.24 prof/eval on Windows 10. I could not use MFDeploy to deploy Tinybooter as described at wildernesslabs.co (some error writing boot sector or somethingā€¦). Instead I used the Netduino Deploy for mac (which occasionally froze at around 30% but most of the time worked).

Building the firmware was a lot of trial and error so, to give you anything better than I already have written in this thread, I need to set this up on a clean computer to narrow down the steps that was necessary. My time is limited so letā€™s see what Bryan comes up with first. Iā€™ll instead do some interop coding. If I have any problems, or find out anything useful, Iā€™ll start a new topic.

My first test of making an interop assembly went smoothly. I followed this guide:https://ziggurat29.wordpress.com/category/projects/building-and-interop-assembly-for-the-netduino-plus-2/

Hi all,

Weā€™ve been trying to reproduce your build errors but have been unsuccessful so far. Can you please give us some more information on your build environment (VS version, exact build type, verbose msbuild output, etc would be super helpful!)

Just so we can all be on the same page we installed a brand new build environment with the following configuration:

  1. Install Win10 Pro (1703)
    • Install Guest Add-Ons
    • Full Windows update
  2. Install VS2012
    • Install all updates
  3. Install Git (64-bit)
  4. Install Keil MDK 5.10
  5. Check out https://github.com/WildernessLabs/Netduino_SDK to c:\work
  6. Start a VS 2013 Developer Command Prompt
  7. cd c:\work\Netduino_SDK\Netduino_2_and_3_NETMF
  8. setenv_mdk_510.bat
  9. msbuild Solutions\Netduino3Ethernet\dotnetmf.proj /t:rebuild /p:flavor=release

The build succeeded successfully. Please note with the following patch you should be able to also use VS2013 or VS2015:

The ā€œInvalid native checksumā€ error indicates that youā€™ve rebuilt one of the interop assemblies without checking the ā€˜generate native stubsā€™ checkbox and updating the stubs with the hash.

Hi Netduino_Development. Good to hear from you!

You never run setenv_vs?
Did you run anything on a N3 Ethernet board using the build? Like your Blinky example?

Hi Niclas,

  1. Correct do not run setenv_vs.
  2. Iā€™m on a flight currently and cannot test with this specific build, but this is how we build all the firmwares. The duplicate GoBus feature include you found is indeed an oversight, but harmless. Those GoBus binaries are actually identical and the build will only link in one.

Thanks for the input and testing. I have been busy working on a project, among other things. I am hoping to have time and do a clean install this weekend to test the methods here and update the original posting.

Regards,
IdleGoose