Main Site Documentation

Can't build .NET MF for STM32F1


#1

Hi guys.

I have board based on STM32F1RET6 (the same MCU is in STM32Stamp solution from PK4.3 and the same MCU in Beat’s .NET Quadrocopter - https://www.ghielectronics.com/community/forum/topic?id=12602 )

So, I decided it’s a good idea to start from building STM32Stamp solution from .NET MF Porting Kit 4.3 (RTM QFE1).
But unfortunately it doesn’t build. I’m stuck with some strange errors.

I’ve added %VS120COMNTOOLS% to setenv_base.cmd to support MSVS2013 and added Keil 5.10 paths to \tools\Targets\Microsoft.Spot.system.mdk.targets file:

“$(MDK_TOOL_PATH)\armcc\bin\armcc.exe”
"$(MDK_TOOL_PATH)\armcc\bin\armcc.exe"
"$(MDK_TOOL_PATH)\armcc\bin\armasm.exe"

"$(MDK_TOOL_PATH)\armcc\bin\armlink.exe" "$(MDK_TOOL_PATH)\armcc\bin\armar.exe" "$(MDK_TOOL_PATH)\armcc\bin\fromelf.exe"

To build I run:

cd /D f:\MicroFrameworkPK_v4_3
setenv_vs.cmd 12
setenv_mdk.cmd 5.10 f:\Keil_v5\ARM
cd f:\MicroFrameworkPK_v4_3\Solutions\STM32Stamp
msbuild /t:rebuild /p:flavor=release;memory=flash >msbuild.log

But build fails:

f:\MicroFrameworkPK_v4_3\tools\targets\Microsoft.SPOT.System.MDK.targets(276,4): error MSB3073: The command ““f:\Keil_v5\ARM\armcc\bin\armcc.exe” --cpp --diag_suppress 2874,111,161,550,C3011 --diag_suppress 66,161,230,1293 --split_sections -DMDK_V3_1 -DARM_V3_1 -If:\MicroFrameworkPK_v4_3\DeviceCode -If:\MicroFrameworkPK_v4_3\DeviceCode\pal\rtip -If:\MicroFrameworkPK_v4_3\DeviceCode\pal\rtip\rtpcore -If:\MicroFrameworkPK_v4_3\devicecode\pal\rtip\tinyclr --feedback f:\MicroFrameworkPK_v4_3\tools\make\Feedback\STM32Stamp_MDK5.10.feedback -DTINYCLR_ENABLE_SOURCELEVELDEBUGGING -DCOMPILE_THUMB2 -DVERSION_MAJOR=4 -DVERSION_MINOR=3 -DVERSION_BUILD=1 -DVERSION_REVISION=0 -DOEMSYSTEMINFOSTRING=”“Copyright Oberon microsystems, Inc.”" -DPLATFORM_ARM_STM32Stamp -DTARGETLOCATION_FLASH -DLITTLE_ENDIAN -DPLATFORM_EMULATED_FLOATINGPOINT=1 -DPLATFORM_NO_CLR_TRACE=1 -DTINYCLR_NO_APPDOMAINS=1 -DTINYCLR_NO_IL_INLINE=1 --thumb --apcs=interwork --fpu none --cpu Cortex-M3 --littleend --no_debug --dwarf2 --no_debug_macros -O2 --inline -Otime --no_autoinline -DNDEBUG -If:\Keil_v5\ARM\RV31\INC -If:\MicroFrameworkPK_v4_3\CLR\Libraries\CorLib -If:\MicroFrameworkPK_v4_3\DeviceCode\include -If:\MicroFrameworkPK_v4_3\DeviceCode\Cores\arm -If:\MicroFrameworkPK_v4_3\Support\Include -If:\MicroFrameworkPK_v4_3\crypto\inc -If:\MicroFrameworkPK_v4_3\CLR\Include -If:\MicroFrameworkPK_v4_3\CLR\Libraries\CorLib -If:\MicroFrameworkPK_v4_3\CLR\Libraries\SPOT -If:\MicroFrameworkPK_v4_3\CLR\Libraries\SPOT_Hardware -If:\MicroFrameworkPK_v4_3\CLR\Libraries\SPOT_Graphics -If:\MicroFrameworkPK_v4_3\CLR\Libraries\SPOT_Net -If:\MicroFrameworkPK_v4_3\CLR\Libraries\SPOT_Net_Security -If:\MicroFrameworkPK_v4_3\Solutions\STM32Stamp -If:\MicroFrameworkPK_v4_3\devicecode\Targets\Native\STM32 -If:\MicroFrameworkPK_v4_3\DeviceCode\Cores\arm -If:\MicroFrameworkPK_v4_3\DeviceCode\Cores\arm\Include -If:\MicroFrameworkPK_v4_3\DeviceCode -If:\MicroFrameworkPK_v4_3\DeviceCode\Include -If:\MicroFrameworkPK_v4_3\DeviceCode\Targets\Native\STM32\STM32Stamp -If:\MicroFrameworkPK_v4_3\Support\Include -If:\MicroFrameworkPK_v4_3\DeviceCode\include -If:\MicroFrameworkPK_v4_3\CLR\include -If:\MicroFrameworkPK_v4_3\Crypto\inc -If:\MicroFrameworkPK_v4_3\CLR\libraries\corlib -If:\MicroFrameworkPK_v4_3\BuildOutput\THUMB2\MDK5.10\le\ANY_MEDIA\release\lib -o f:\MicroFrameworkPK_v4_3\BuildOutput\THUMB2\MDK5.10\le\ANY_MEDIA\release\obj\CLR\Libraries\CorLib\CorLib_fastcompile.obj -c f:\MicroFrameworkPK_v4_3\CLR\Libraries\CorLib\CorLib_fastcompile.cpp " exited with code 1. [f:\MicroFrameworkPK_v4_3\CLR\Libraries\CorLib\dotnetmf.proj]

This command throws 43 warnings and 6 errors like those:

“f:\MicroFrameworkPK_v4_3\CLR\Libraries\CorLib\corlib_native_System_BitConverter.cpp”, line 99: Error: #1151: floating-point variable definition with initialiser is not permitted with --fpu=none
float input = stack.Arg0().NumericByRefConst().r4;

“f:\MicroFrameworkPK_v4_3\CLR\Libraries\CorLib\corlib_native_System_BitConverter.cpp”, line 199: Error: #1265: converting to and from floating-point type is not permitted with --fpu=none
stack.SetResult_R8(*p);

What am I missing?


#2

I’m not sure about -fpu=none for stm32f1… Need to check
I’ve not yet worked on native 4.3, but next week I will spend time on it for stm32f4. I will report to you. I still use keil 4.74 for netmf firmware


#3

I see that F4 is widely supported by .NETMF community, but F1 feels really abandoned. Looks like it was abandoned right after Oberon ported it.

I tried compile with Keil 4.x and getting same error. So I believe it’s not about MDK version.

Maybe I’m missing something obvious?
Maybe I’m trying with outdated or too fresh codebase?

Should I get PK4.2 (non-QFE, QFE1, QFE2)?
Should I use pure PK from http://netmf.codeplex.com/ or need to apply patches from http://ghiopensource.codeplex.com or http://netmf4stm32.codeplex.com/?


#4

cd C:\MicroFrameworkPK_v4_3
setenv_MDK.cmd 4.71 (Actually 5.1)
C:\MicroFrameworkPK_v4_3\Solutions\STM32Stamp
msbuild /t:build /p:flavor=release;memory=flash

Builds fine for me with no errors.


#5

@ Justin - wow, but how? Is that unmodified pure PK 4.3 QFE1 from http://netmf.codeplex.com/ ?

At least this should fail:

Because paths changed from [b]\ARM\bin40[/b] to \ARM\ARMCC\bin

Could you tell me what else did you modify to get this working?


#6

Unmodified code from PK

Modified Targets file from Oberon that takes care of things like paths…

“$(MDK_TOOL_PATH)\armcc\bin\armcc.exe”

@ andre.m - i just know the right people :smiley:


#7

Seems the solution doesnt include TinyBooter…


#8

Ok, copying everything to C:\ drive…
What is your Visual Studio version (msbuild /version)?


#9

Did you clear output folder (MicroFrameworkPK_v4_3\BuildOutput) before building?


#10

Yes, delete the build output folder

Microsoft Visual Studio Ultimate 2013
Version 12.0.30110.00 Update 1
Microsoft .NET Framework
Version 4.5.51641


#11

Ok, now I’m really lost :frowning:
Maybe you just think that you have unmodified PK version?

Could you rename your MicroFrameworkPK_v4_3 folder to something like MicroFrameworkPK_v4_3_backup, reinstall PK (https://netmf.codeplex.com/downloads/get/790686) and then repeat my modifications and build steps and tell me if it works too?


#12

Fresh 4.3 QFE1 + updating the MDK targets throws a single error…
So yes i have other changes (mainly F4 chnages) that enable me to build it.
I dont have time to find it at the moment but if you are still lost later on i will dig deeper.


#13

Are those changes your project-specific?
Or comes from GHI http://ghiopensource.codeplex.com or Oberon http://netmf4stm32.codeplex.com/ ?

Could you send me a diff (easiest I can think - commit unmodified PK to git, then copy over your backup folder, this will show all diff)?

Yes, I’m lost. I’m new to this and I need something working to start learning about platform specific things and modify it.


#14

It’s actually neither.
i will need to talk to Oberon about it.


#15

I’m a tiny step closer to succeed.

I’ve downloaded latest netduino 2 firmware v4.3.1 source http://cdn.netduino.com/downloads/forums/netduinofirmware_source_4.3.1.0.zip.

They have fixed CLR/Libraries/CorLib/corlib_native_System_BitConverter.cpp file (Checking if TINYCLR_EMULATED_FLOATINGPOINT is defined and use CLR_INT64 type instead of double). Build doesn’t stop there, but now it stops at BuildScatterfile step.

Any ideas?

Here is the new output:

BuildScatterfile:
  ...
Processing file: c:\MicroFrameworkPK_v4_3\Solutions\STM32Stamp\TinyCLR\scatterfile_tinyclr_MDK.xml
BuildAXF:
  "C:\Keil_v5\ARM\armcc\bin\armar.exe"  --create -c -r c:\MicroFrameworkPK_v4_3\BuildOutput\THUMB2\MDK5.1\le\FLASH\release\STM32Stamp\lib\tmp_tinyclr.lib Core.lib Hardware.lib IOPort.lib RPC_stub.lib CorLib.lib SPOT.lib SPOT_Hardware.lib CLRStartup.lib CRC.lib WireProtocol.lib Graphics_stub.lib Debugger.lib Debugger_full.lib Diagnostics.lib HeapPersistence.lib SPOT_Messaging_stub.lib Messaging.lib I2C.lib InterruptHandler.lib SPOT_Serialization.lib Serialization.lib SPOT_Hardware_SerialPort.lib SPOT_Hardware_PWM.lib SPOT_Hardware_Usb.lib
  "C:\Keil_v5\ARM\armcc\bin\armlink.exe"  --keep *(.init_array) --no_keep_init_arrays --feedback c:\MicroFrameworkPK_v4_3\BuildOutput\THUMB2\MDK5.1\le\FLASH\release\STM32Stamp\bin\tinyclr_STM32Stamp_FLASH_release_MDK5.1.feedback  --debug --remove --unmangled --info sizes,totals,veneers,unused,libraries --map  --xref --symbols --callgraph --userlibpath c:\MicroFrameworkPK_v4_3\BuildOutput\THUMB2\MDK5.1\le\FLASH\release\STM32Stamp\lib --userlibpath c:\MicroFrameworkPK_v4_3\BuildOutput\THUMB2\MDK5.1\le\ANY_MEDIA\release\lib --libpath C:\Keil_v5\ARM\RV31\LIB  --entry EntryPoint  --symdefs c:\MicroFrameworkPK_v4_3\BuildOutput\THUMB2\MDK5.1\le\FLASH\release\STM32Stamp\bin\tinyclr.symdefs --list c:\MicroFrameworkPK_v4_3\BuildOutput\THUMB2\MDK5.1\le\FLASH\release\STM32Stamp\bin\tinyclr.map --output c:\MicroFrameworkPK_v4_3\BuildOutput\THUMB2\MDK5.1\le\FLASH\release\STM32Stamp\bin\tinyclr.axf --scatter c:\MicroFrameworkPK_v4_3\BuildOutput\THUMB2\MDK5.1\le\FLASH\release\STM32Stamp\bin\tinyclr_scatterfile.txt c:\MicroFrameworkPK_v4_3\BuildOutput\THUMB2\MDK5.1\le\FLASH\release\STM32Stamp\obj\Solutions\STM32Stamp\TinyCLR\tinyclr_dat.obj c:\MicroFrameworkPK_v4_3\BuildOutput\THUMB2\MDK5.1\le\FLASH\release\STM32Stamp\obj\Solutions\STM32Stamp\TinyCLR\allocator.obj c:\MicroFrameworkPK_v4_3\BuildOutput\THUMB2\MDK5.1\le\FLASH\release\STM32Stamp\obj\Solutions\STM32Stamp\TinyCLR\tinyclr.obj c:\MicroFrameworkPK_v4_3\BuildOutput\THUMB2\MDK5.1\le\FLASH\release\STM32Stamp\lib\InteropAssembliesTable.lib LargeBuffer_hal_stubs.lib virtualkey_hal_stubs.lib Crypto_stub.lib GlobalLock_hal_Cortex.lib TinyHal_Cortex.lib cpu_prestackinit_stubs.lib STM32_bootstrap.lib batterycharger_hal_stubs.lib batterymeasurement_hal_stubs.lib STM32_GPIO.lib STM32_Power.lib STM32_time.lib cpu_watchdog_stubs.lib system_initialization_hal.lib Watchdog_pal_stubs.lib asyncproccall_pal.lib blockstorage_pal.lib Buttons_pal.lib config_pal.lib heap_pal.lib piezo_pal_stubs.lib SimpleHeap_stubs.lib SimpleHeap_config_stubs.lib tinycrt_pal.lib fs_pal_stubs.lib Ink_pal_stubs.lib Gesture_pal_stubs.lib palevent_pal.lib Time_pal.lib FS_Config_stubs.lib TimeService_pal_stubs.lib backlight_hal_stubs.lib lcd_hal_stubs.lib cpu_cache_stubs.lib cpu_LCD_stubs.lib STM32_Flash.lib STM32_blconfig_STM32Stamp.lib BlockStorage_AddDevices_STM32Stamp.lib IO_Init_STM32Stamp.lib STM32_SPI.lib STM32_I2C.lib STM32_USART.lib STM32_USB.lib STM32_IntC.lib STM32_PWM.lib STM32_Analog.lib STM32_DA.lib COM_pal.lib DebuggerPort_SSL_config_stubs.lib events_pal.lib sockets_pal_stubs.lib usart_pal.lib usb_pal.lib i2c_pal.lib usb_pal_config_stub.lib MFUpdate_PAL_stub.lib ssl_pal_stubs.lib c:\MicroFrameworkPK_v4_3\BuildOutput\THUMB2\MDK5.1\le\FLASH\release\STM32Stamp\lib\tmp_tinyclr.lib
  "c:\MicroFrameworkPK_v4_3\BuildOutput\THUMB2\MDK5.1\le\FLASH\release\STM32Stamp\bin\tinyclr_scatterfile.txt", line 13 (column 5): Warning: L6312W: Empty Execution region description for region ER_RAM_RO
EXEC : warning : L6310W: Unable to find ARM libraries. [c:\MicroFrameworkPK_v4_3\Solutions\STM32Stamp\TinyCLR\TinyCLR.proj]
EXEC : warning : L6320W: Ignoring --keep command. Cannot find argument '__cpp_initialize__aeabi_'. [c:\MicroFrameworkPK_v4_3\Solutions\STM32Stamp\TinyCLR\TinyCLR.proj]
EXEC : error : L6218E: Undefined symbol __use_no_semihosting_swi (referred from allocator.obj). [c:\MicroFrameworkPK_v4_3\Solutions\STM32Stamp\TinyCLR\TinyCLR.proj]
EXEC : error : L6218E: Undefined symbol __aeabi_memclr (referred from tinyhal.obj). [c:\MicroFrameworkPK_v4_3\Solutions\STM32Stamp\TinyCLR\TinyCLR.proj]
EXEC : error : L6218E: Undefined symbol __aeabi_memcpy (referred from tinyhal.obj). [c:\MicroFrameworkPK_v4_3\Solutions\STM32Stamp\TinyCLR\TinyCLR.proj]
EXEC : error : L6218E: Undefined symbol __aeabi_memset (referred from tinyhal.obj). [c:\MicroFrameworkPK_v4_3\Solutions\STM32Stamp\TinyCLR\TinyCLR.proj]
EXEC : error : L6218E: Undefined symbol _vsnprintf (referred from tinycrt.obj). [c:\MicroFrameworkPK_v4_3\Solutions\STM32Stamp\TinyCLR\TinyCLR.proj]
EXEC : error : L6218E: Undefined symbol strcpy (referred from tinycrt.obj). [c:\MicroFrameworkPK_v4_3\Solutions\STM32Stamp\TinyCLR\TinyCLR.proj]
EXEC : error : L6218E: Undefined symbol strncmp (referred from tinycrt.obj). [c:\MicroFrameworkPK_v4_3\Solutions\STM32Stamp\TinyCLR\TinyCLR.proj]
EXEC : error : L6218E: Undefined symbol strncpy (referred from tinycrt.obj). [c:\MicroFrameworkPK_v4_3\Solutions\STM32Stamp\TinyCLR\TinyCLR.proj]
EXEC : error : L6218E: Undefined symbol __aeabi_memclr4 (referred from Debugger.obj). [c:\MicroFrameworkPK_v4_3\Solutions\STM32Stamp\TinyCLR\TinyCLR.proj]
EXEC : error : L6218E: Undefined symbol __aeabi_memcpy4 (referred from Debugger.obj). [c:\MicroFrameworkPK_v4_3\Solutions\STM32Stamp\TinyCLR\TinyCLR.proj]
EXEC : error : L6218E: Undefined symbol strcmp (referred from ConfigHelper.obj). [c:\MicroFrameworkPK_v4_3\Solutions\STM32Stamp\TinyCLR\TinyCLR.proj]
EXEC : error : L6218E: Undefined symbol __aeabi_lasr (referred from core_fastcompile.obj). [c:\MicroFrameworkPK_v4_3\Solutions\STM32Stamp\TinyCLR\TinyCLR.proj]
EXEC : error : L6218E: Undefined symbol __aeabi_ldivmod (referred from core_fastcompile.obj). [c:\MicroFrameworkPK_v4_3\Solutions\STM32Stamp\TinyCLR\TinyCLR.proj]
EXEC : error : L6218E: Undefined symbol __aeabi_llsl (referred from core_fastcompile.obj). [c:\MicroFrameworkPK_v4_3\Solutions\STM32Stamp\TinyCLR\TinyCLR.proj]
EXEC : error : L6218E: Undefined symbol __aeabi_llsr (referred from core_fastcompile.obj). [c:\MicroFrameworkPK_v4_3\Solutions\STM32Stamp\TinyCLR\TinyCLR.proj]
EXEC : error : L6218E: Undefined symbol __aeabi_memmove (referred from core_fastcompile.obj). [c:\MicroFrameworkPK_v4_3\Solutions\STM32Stamp\TinyCLR\TinyCLR.proj]
EXEC : error : L6218E: Undefined symbol __aeabi_memmove4 (referred from core_fastcompile.obj). [c:\MicroFrameworkPK_v4_3\Solutions\STM32Stamp\TinyCLR\TinyCLR.proj]
EXEC : error : L6218E: Undefined symbol __aeabi_uldivmod (referred from core_fastcompile.obj). [c:\MicroFrameworkPK_v4_3\Solutions\STM32Stamp\TinyCLR\TinyCLR.proj]
EXEC : error : L6218E: Undefined symbol bsearch (referred from core_fastcompile.obj). [c:\MicroFrameworkPK_v4_3\Solutions\STM32Stamp\TinyCLR\TinyCLR.proj]
EXEC : error : L6218E: Undefined symbol memcmp (referred from core_fastcompile.obj). [c:\MicroFrameworkPK_v4_3\Solutions\STM32Stamp\TinyCLR\TinyCLR.proj]
EXEC : error : L6218E: Undefined symbol strchr (referred from Diagnostics_fastcompile.obj). [c:\MicroFrameworkPK_v4_3\Solutions\STM32Stamp\TinyCLR\TinyCLR.proj]
EXEC : error : L6218E: Undefined symbol __cpp_initialize__aeabi_ (referred from anon$$obj.o). [c:\MicroFrameworkPK_v4_3\Solutions\STM32Stamp\TinyCLR\TinyCLR.proj]
  Not enough information to produce a SYMDEFs file.
  Not enough information to produce a FEEDBACK file.
  Not enough information to list image symbols.
  Finished: 3 information, 3 warning and 22 error messages.

#16

I’ve missed another MDK path in tools\Targets\Microsoft.Spot.system.mdk.targets file. Finally I’ve managed to build something (didn’t flash to board yet) :dance:

@ Justin - Could you test that this solution works on your side too?

  1. Get clean PK 4.3 QFE1
  2. Overwrite with this:
    https://dl.dropboxusercontent.com/u/17131034/PK_v4.3.1.MSVS_v12.MDK_v5.1.zip
  3. Build:
cd /D c:\MicroFrameworkPK_v4_3
setenv_vs.cmd 12
setenv_mdk.cmd 5.1 C:\Keil_v5\ARM
cd c:\MicroFrameworkPK_v4_3\Solutions\STM32Stamp
msbuild /t:rebuild /p:flavor=release;memory=flash

#17

Your solution…


#18

Thanks guys, this will save me lot of time!!!


#19

You are welcome. But I’m not sure if compiled code really run. I tried to flash it with ST-Link (tinyclr.bin\ER_FLASH to 0x08000000 and tinyclr.bin\ER_CONFIG to 0x08040000), but board doesn’t show any life signs, it just hangs and doesn’t respond even on JTAG. Have to do several power cycles before able to connect again.
I need to try reconfigure firmware to another USART and see if anything there.
Or maybe try to deploy program at 0x08042000 (Oberon pdf say so).

Btw, Netduino v.4.3.1 overlay have a lot of other changes/fixes too. I think it’s currently most frequently updated port.


#20

@ Savvkin - the most upto date ports by a country mile are the Oberon ones.
All of the other vendors STM ports are based off Oberon’s.