.NET Micro Framework V4.2 QFE2最新版其實在8月14就已經發布了,不過最近由於相對較忙,所以現在才抽時間研究一下新版本,和V4.2 QFE1從代碼角度來看,新版本有如下改變(http://netmf.codeplex.com/SourceControl/changeset/23973)。
*Micro Booter 代碼優化調整
*浮點運算相關代碼進行了調整
*CLR_RT_HeapXXXX等相關函數,增加了 CLR_UINT32 blockSize 這個參數
*64位長整轉字符串的bug已經解決
*增加了DA接口(模擬量輸出)
*引入了g_fDoNotUninitializeDebuggerPort全局變量,調試口卸載要進行判斷
if(!g_fDoNotUninitializeDebuggerPort)
{
DebuggerPort_Uninitialize( m_port );
}
*損耗平衡代碼
\MicroFrameworkPK_v4_2_QFE2\DeviceCode\Drivers\BlockStorage\WearLeveling\BS_WearLeveling_Driver.cpp
損耗平衡相關代碼進行了大幅度的修改,以前我測試過程中發現,這段代碼實現的有問題,希望這次改進,能解決以前的遺留問題。
*文件系統代碼
\MicroFrameworkPK_v4_2_QFE2\DeviceCode\Drivers\FS\FAT\FAT_FileHandle.cpp
\MicroFrameworkPK_v4_2_QFE2\DeviceCode\Drivers\FS\FAT\FAT_SectorCache.cpp
如果不啟用損耗平衡功能,文件系統在寫比較大的文件的時候,就會出現問題,看此次修改的代碼,數據緩存做了一定的處理,等我移植好相關代碼,測試一下,看看是否還存在類似問題。
另外 定義了一個 FAT_FS__DO_NOT_UPDATE_FILE_ACCESS_TIME 宏,因為文件系統中,如果文件一修改,就更改修改時間,代價還是蠻高的,如果不是特別在意文件的修改時間,又對文件系統操作的性能有要求,應該在配置文件中,定義這個宏。
*WinUSB
由於引入了WinUSB,所以在USB配置文件里,徹底去掉了Sideshow(以前vista系統控制面板中有該功能,Win7中給去掉了)的支持。
\MicroFrameworkPK_v4_2_QFE2\Framework\Debugger\WinUsb
\MicroFrameworkPK_v4_2_QFE2\tools\bin\Test\WinUsbInvoke.dll
WinUSB驅動
\MicroFrameworkPK_v4_2_QFE2\USB_Drivers\WinUSB\DriverPackage\win7
*bool HAL_CONTINUATION::IsLinked()
異步處理,增加了這個函數
*LWIP協議棧
\MicroFrameworkPK_v4_2_QFE2\DeviceCode\pal\COM\sockets_lwip\sockets_lwip.cpp
部分代碼也進行了調整
* SSD1289顯示驅動
\MicroFrameworkPK_v4_2_QFE2\DeviceCode\Drivers\Display\SSD1289
顯示增加了一芯片SSD1289的支持
*Touch
增加了一個 TouchScreen.cs 文件
*TestMFProfiler(上一個版本也有)
有一個比較有用的測試工具\MicroFrameworkPK_v4_2_QFE2\tools\bin\TestMFProfiler.exe
可以充分評測當前的運行的程序的各種參數。
不過這次升級也引入了一些問題
1\MicroFrameworkPK_v4_2_QFE2\CLR\Core\HeapPersistence\Heap_Persistence_stub.cpp
很奇怪,這個文件里面的代碼應該是空的,不知道為啥全填寫了具體的實現代碼
2\MicroFrameworkPK_v4_2_QFE2\CLR\Libraries\SPOT_Hardware\SPOT_Serial\spot_hardware_serial_native_System_IO_Ports_SerialPort.cpp
該文件中 增加了一個 break,不太理解,因為添加了之后,意味着串口必須一次讀夠要獲取的數據了。
while(fRes && count > 0) { int read = ::USART_Read( port, (char*)ptr, count ); if(read == 0) { stack.m_evalStack[ 1 ].NumericByRef().s4 = totRead; TINYCLR_CHECK_HRESULT(g_CLR_RT_ExecutionEngine.WaitEvents( stack.m_owningThread, *timeoutTicks, CLR_RT_ExecutionEngine::c_Event_SerialPort, fRes )); } else if(read < 0) { TINYCLR_SET_AND_LEAVE(CLR_E_INVALID_PARAMETER); } else { ptr += read; totRead += read; count -= read; break; <-- 新增加的 } }
新版本下載:http://netmf.codeplex.com/releases/view/91594
官方更新說明:
The additions for this release include adding support for the WinUSB driver in replacement of the current USB driver that had been associated with some deployment problems. Analog Output has also been added based on a contribution from Oberon Microsystems – part of the Mountaineer group that makes .NET Gadgeteer mainboards. Finally, support for installing the latest versions of GCC (4.6.1) has been added.
There have also been a number of performance improvements and minor bug fixes which include:
- File system
- Improved FS performance and some minor bug fixes
- Added continuation to flush the FS cache at a configurable time
- Wear Leveling
- Reworked the Driver to fix some issues around bad block replacement
- improved diagnostics for wear leveling
- MicroBooter
- Changes to support unaligned ZI/RW sections
- RW/RO sections are no longer required to be contiguous
- Fixed SREC processor to support multiple BS devices and non-contiguous memory streams
- Read buffer is now only 512K instead of a block size
- Touch Screen
- Improved the Gesture Driver
- Fixed some minor issues with the touch driver
- moved the touch event structures, enums, and delegates assembly (Microsoft.SPOT.Native)
- Others
- Thumb-2 assembly code updated and global lock implemented
- SerialPort.DiscardBuffer fixed (flushes the correct buffer)
- SerialPort.Read no longer blocking if data is available.
- Faster loadign of large heaps
- Support weak references with stubbed EWR
- Better support of emulated floating point bounds checking
- Better hex number formatting
- AppDomain.GetAssembly implemented
- Fixed issues with the stream reader (no longer waits forever to refill the buffer)
- Better handling of the case where RTIP is not installed as PK add-on but used in the solution