Tuesday, 15 July 2008

How To enable Monte Carlo Profiler on a CE 5 to CE 6 Port

For the Monte Carlo Profiler, you need to implement a Timer Interrupt Handler.
To start/stop the Monte Carlo Profiler, the Kernel calls OEMProfileTimerEnable() and OEMProfileTimerDisable(). You can find the implementation of these Functions as well as the ISR for the PXA27x platform in CE 6 under

WinCE600 calls the OEMXxx functions in a different way than WinCE500. This might be the cause of a problem when porting the profiler from WinCE500 to WinCE600.

On CE5 everything was built into one module: nk.exe. In CE6 this has been changed. The Kernel is split up into the Kernel code (Kernel.dll) and the OEM code (OAL.exe). The Kernel uses the structure OEMGlobal to get the addresses of the OEMXxx functions in OAL.exe. See the definition of the OEMGlobal structure in
PUBLIC\COMMON\OAK\INC\oemglobal.h. By default, the function addresses of the non optional components will be saved automatically. But optional components like OEMProfileTimerEnable() are not included in the OEMGlobal structure, so the Kernel can't call this function.

The OEMGlobal structure is accessed via the global variable g_pOemGlobal. To set the addresses for your OEMProfileTimerXx() functions set the members of OEMGlobal in your OEMInit() Function as follows:

g_pOemGlobal->pfnProfileTimerEnable = OEMProfileTimerEnable;
g_pOemGlobal->pfnProfileTimerDisable = OEMProfileTimerDisable;

No comments: