.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 includeadding support for the WinUSB driver in replacement of thecurrent USB driver that had been associated with some deployment problems. AnalogOutput has also been added based on a contribution from OberonMicrosystems – part of the Mountaineer group that makes .NET Gadgeteermainboards. Finally, support for installing the latest versions of GCC (4.6.1)has been added.
There have also been a number ofperformance 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