Building .NET Micro Framework v4.4 (vNext) SDK and Porting Kit with SMT32F4 support using Visual Studio 2013

Hey guys.

I wanted to play with fresh .NET Micro Framework 4.4 (vNext) but compiling it wasn’t quite straightforward task. So I decided to make this quick guide to share the knowledge.

The SDK/Vsix/PK and MCBSTM32F400 solution builds without errors, but I don’t have MCBSTM32F400 board and don’t know if it is actually run on real hardware.

Testing, updates and suggestions are very welcome.

[title]Building .NET Micro Framework v4.4 (vNext) SDK and Porting Kit with SMT32F4 support using Visual Studio 2013[/title]
Tested with ChangeSet 43297 from Feb 4 12:57 AM

[title]Test SDK/Vsix building[/title]

1. Download zipped sources from [url=][/url]

2. Create netmf folder in the root folder (eg. c:) and extract those entries into it:


3. Download Visual Studio 2012/2013 SDK assemblies (see Downloads) and extract v11 and v12 folders to c:\netmf\tools\x86\MicrosoftSDKs\VsSDK folder

4. Download PK4.3 Crypto libs and extract them to c:\netmf\client_vNext\crypto\lib folder

5. Copy c:\netmf\client_vNext\BuildEnv.props to the root folder (c:\BuildEnv.props)

6. Create c:\builds folder in the root folder (eg. c:)

7. Go to client_vNext folder and start building SDK (replace DEV43297 with actual ChangeSet number):
Open new command prompt

cd /D c:\netmf\client_vNext
build_sdk.cmd 0 c:\builds client_vNext “(DEV43297)”[/quote]

8. After build is finished, check sdkpre.log, sdk.log and vsixpkg.log logs in [b]c:\netmf\client_vNext[/b] - they should end with “0 Error(s)”

[title]Including SMT32F4/MCBSTM32F400 into Porting Kit[/title]

9. If you use different Keil version (eg. 5.13) add new section to c:\netmf\client_vNext\tools\Targets\Microsoft.Spot.system.mdk.targets right after “MDK5.05” section:


"$(MDK_TOOL_PATH)\ARMCC\bin\armlink.exe" "$(MDK_TOOL_PATH)\ARMCC\bin\armar.exe" "$(MDK_TOOL_PATH)\ARMCC\bin\fromelf.exe" $(MdkCrtLibLinkSwitch) $(SWTC)libpath $(MDK_TOOL_PATH)\ARMCC\LIB[/quote]

10. Fix lib and include paths for Keil 5.xx in file c:\netmf\client_vNext\setenv_base.cmd replace


IF “%MDK_EXT%”==“5” (
) ELSE (

11. Copy CMSIS files from Keil_v5:

c:\Keil_v5\ARM\Pack\ARM\CMSIS\4.2.0\CMSIS\Include to c:\netmf\client_vNext\DeviceCode\Cores\arm\CMSIS\Include
c:\Keil_v5\ARM\Pack\ARM\CMSIS\4.2.0\CMSIS\Driver\Include to c:\netmf\client_vNext\DeviceCode\Cores\arm\CMSIS\Driver\Include
c:\Keil_v5\ARM\Pack\ARM\CMSIS\4.2.0\CMSIS_RTX\INC to c:\netmf\client_vNext\DeviceCode\Cores\arm\CMSIS_RTX\INC
c:\Keil_v5\ARM\Pack\ARM\CMSIS\4.2.0\CMSIS_RTX\SRC to c:\netmf\client_vNext\DeviceCode\Cores\arm\CMSIS_RTX\SRC[/quote]

12. In file c:\netmf\client_vNext\DeviceCode\Targets\OS\CMSIS_RTOS\DeviceCode\lwip_1_4_1_os\arch\sys_arch.cpp
change line #include to #include “mutex”

13. In file c:\netmf\client_vNext\tools\scripts\port\SourceCopyList.txt add lines:

+, %SPOCLIENT%\DeviceCode\Cores\arm\CMSIS.…
+, %SPOCLIENT%\DeviceCode\Cores\arm\CMSIS_RTX.…
+, %SPOCLIENT%\DeviceCode\Targets\OS\CMSIS_RTOS.…
+, %SPOCLIENT%\DeviceCode\Targets\Native\STM32F4.…
+, %SPOCLIENT%\Solutions\MCBSTM32F400.…[/quote]

[title]Building final clean SDK/Vsix/PortingKit[/title]

14. Delete contents of c:\builds folder and c:\netmf\client_vNext*.log files

15. In file c:\netmf\client_vNext\build_sdk_and_port.cmd:

replace line call setenv_vs.cmd 11 with call setenv_vs.cmd 12
remove all /p:SignBuild=true
replace all %VSSDK110Install% with %VSSDK120Install%[/quote]

16. Go to client_vNext folder and start building SDK (replace DEV43297 with actual ChangeSet number):
Open new command prompt

cd /D c:\netmf\client_vNext
build_sdk_and_port.cmd 0 c:\builds client_vNext “(DEV43297)”[/quote]

17. After build is completed, check logs for errors.
Ignore errors in PK-NET-ARM/PK-NET-THUMB/PK-NET-THUMB2/PK-NET-SH2 steps (req. RVDS3.1/HEW9.2 compiler?)


18. Install SDK/Vsix/PortingKit:

19. Build MCBSTM32F400 sample solution
Open new command prompt (required!)

cd /D c:\MicroFrameworkPK_v4_4
setenv_vs.cmd 12
setenv_mdk.cmd 5.13 c:\Keil_v5\ARM
cd c:\MicroFrameworkPK_v4_4\Solutions\MCBSTM32F400
msbuild /t:rebuild /p:flavor=release;memory=flash >msbuild.log[/quote]

20. After build is finished check c:\MicroFrameworkPK_v4_4\Solutions\MCBSTM32F400\msbuild.log for errors
Output files (Tinybooter.hex and tinyclr.hex) should be in c:\MicroFrameworkPK_v4_4\BuildOutput\THUMB2FP\MDK5.13\le\FLASH\release\MCBSTM32F400\bin folder

21. Open Visual Studio and create new .NET Micro Framework app and rebuild it
File → New → Project → Templates → Visual C# → Micro Framework → Console Application → OK
Build → Rebuild Solution



Is there any info of what was fixed in 4.4 compared to 4.3?

I was secretly hoping to see bitshift operators working in VB environment, but they are still not working :’(

Very nice.

One thing missing is to download and install “Legacy Crypto Pack” into client\crypto\lib - otherwise the crypto function stubs are linked and certain operations do not work (signing and I think something in metadataprocessor or mfdeploy). They are not used very often, probably not at all, but just in case…

1 Like

It’s not release version, it’s just current development snapshot. So it’s likely new bugs introduced, than fixed. It could even be totally broken :think:

I think you are right!
Libs inside Porting Kit 4.3 (RTM QFE1) – Legacy Crypto Pack are modified in 2012 and included into pack in 2014. So I think they are not changing between netmf releases and should work for netmf v4.4.

Added crypto lib step and uploaded fresh build.
Didn’t include firmware for MCBSTM32F400, because seems like STM32F4 support in vNext is broken.

@ iamin - I have not seen any change-log so far. What I noticed, is that debug-messages are not printed anymore in release-mode.

@ Savvkin - Oh… this guys are moving to CMSIS for STM32, but some part of the native code is not yet (correctly) integrated …

@ All - anyone used and managed to get it working NOT using the keil arm toolchain ?

@ PiWi - Good question. I am interested in that one, too.

Does anyone know which edition is minimal needed, I reckon the lite edition won’t do ?

MDK-Lite has 32KB code size limitation. Not enough even for TinyBooter.

So which edition do you recommend ?

@ PiWi - The version which your wife will shoot you for buying cause it costs many thousands of Euros :smiley:

@ BillGates - Well, she not in the house, yet :whistle:

1 Like

Now that 4.4 is on GitHub, how should these instructions change?

If one uses a Keil Toolchain, it is mentioned in the wiki - > getting started -> how to build the firmware binaries, the darn thing is I ain’t got no Keil and hearing the price for it, I probably never will own one either … so what is the alternative, I ask ye governer ???

GCC for the larger chips.
Mucho Dolores for the smaller chips.

@ PiWi, according to the description, cheapest (~3800 USD) MDK-ARM Cortex-M Edition (part#: MDK-ARM-CM) should be enough to build .NET MF.

@ eddie_garmon, didn’t test github version yet. But I think not much is changed. Maybe skip the PK building part.