102 Views
December 16, 17
スライド概要
https://centerclr.connpass.com/event/71414/
SeeedKKの中の人。Microsoft MVP for Internet of Things。
TinyCLR OSのポーティング Takashi Matsuoka
Takashi Matsuoka 2017~ MVP for Windows Development Joined the Seeed K.K. Developing the Wio LTE for Arduino
Raspberry Pi PIC Arduino AVR Mbed C / C++ / JavaScript / Python
C# ???
.NET Micro Framework Interpreter
https://youtu.be/yMGntUwPT1I
Visual Studio Extension (.vsix) Visual Studio 2017 NuGet Libraries (.nupkg) USB FEZ
FEZ • • • • Flash: 0x08000000 GHI Bootloader 0x08004000 Config 0x08008400 TinyCLR Firmware 0x08040000 .NET Application 0x08080000 STM32F401RET6 Cortex-M4 w FPU Flash 512KB RAM 96KB
• ファームウェア書き込み方法が煩雑 • UARTによるVisual Studio接続 NUCLEO-F401REへポーティングに挑戦! FEZ • • • • STM32F401RET6 Cortex-M4 84MHz Flash 512KB RAM 96KB NUCLEO-F401RE • • • • STM32F401RET6 Cortex-M4 84MHz Flash 512KB RAM 96KB
NUCLEO-F401RE FEZ Flash: 0x08000000 0x08004000 0x08008400 Flash: GHI Bootloader <- dfu-util 0x08000000 drive Config TinyCLR Firmware <- XMODEM 0x08040000 0x08040000 .NET Application 0x08080000 TinyCLR Firmware <- Mbed .NET Application 0x08080000
ST-LINK/V2-1 debugger/programmer with USB re-enumeration capability. Three different interfaces supported on USB: mass storage, virtual COM port and debug port • • • Debug port Virtual Com port Mass storage USB • • • Debug port Virtual Com port Mass storage USB ST-LINK/V2-1 SWD UART NUCLEO-F401RE SWD UART NUCLEO-F401RE
http://docs.ghielectronics.com/tinyclr/porting/intro.html • • • • • Install the GCC. (6-2017-q2-update) Clone the TinyCLR-Ports repo. (https://github.com/ghi-electronics/TinyCLR-Ports) Copy and unzip the Arm CMSIS pack. Copy and unzip the TinyCLR OS Core. Run the build.bat. Build time: 00:10.57
BuildConfiguration.txt FEZ コンフィグ領域削除 NUCLEO-F401RE
Scatterfile.gcc.ldf FEZ コンフィグ領域削除 NUCLEO-F401RE 割当アドレス変更
Device.h FEZ コンフィグ領域削除 NUCLEO-F401RE デバッグインターフェース変更
ぜんぜん動かんorz
FEZ NUCLEO-F401RE クリスタルが無い!
Device.h FEZ NUCLEO-F401RE STM32F407G-DISC1 外部クリスタルから内蔵クリスタルに変更
デバッガーと繋がらない
Visual Studio 2017 Visual Studio Extension (.vsix) COM STLink Virtual COM Port USB STLink UART(PA2/PA3) STM32F401 FTDI Virtual COM Port USB
Visual Studio 2017 Parityを明示的に設定していない Visual Studio Extension (.vsix) COM STLink Virtual COM Port USB STLink UART(PA2/PA3) STM32F401
https://forums.ghielectronics.com/t/uart-debugport-via-stlink-virtual-com-port/20568
DEMO
NEXT PORTING Wio LTE JP Version • • • • • NUCLEO-F401RE • STM32F401RET6 • Cortex-M4 84MHz • Flash 512KB • RAM 96KB STM32F405RG Cortex-M4 168MHz Flash 1MB RAM 192KB with LTE module mbedRO359B • • • • • K24F Cortex-M4 120MHz Flash 1MB RAM 256KB with Wi-Fi module
STM32F401RET6 (NUCLEO-F401RE) STM32F405RG (Wio LTE)
STM32F401RET6 (NUCLEO-F401RE) K24F (mbedRO359B)
LED制御はC/C++で実装 → C#からC/C++の呼び出し(Interop)
Native Interops in TinyCLR C# class Generate stubs GCC C function ptr Native Bin RLI region C function Binary Resource Flash: TinyCLR Firmware RAM: RW Data Heap .NET Application Native Bin Native Bin Stack RLP
Native APIs in TinyCLR Flash: TinyCLR Firmware RAM: RW Data Heap Native Interops .NET Application Native Bin Native Bin Stack Flash: TinyCLR Firmware Native APIs Custom Code RAM: RW Data Heap .NET Application Custom Library Stack RLP
Visual Studio 2017 Version 15.5, Visual Studio for Mac Released
まとめ
• NETMFの縮小版 • Visual Studio 2017対応 • 3つのファイルでポーティング(STM32F4) • ポーティングのデバッグ大変 • C/C++を呼び出し可能 • VS2017 15.5は運用回避