If you plan to start some development around Windows Phone 7 devices, I would suggest you to read this free ebook recently published :
Programming Windows Phone 7 by Charles Petzold (available here)
- Nicolas
Tuesday, November 16, 2010
Windows Phone 7 Programming Free Ebook
Posted by Nicolas BESSON [MVP] 0 comments
Labels: Microsoft, Windows Phone
Wednesday, November 3, 2010
Driver wrapper for C#
From .NET Compact Framework, there is no API allowing access to the driver interfaces, as the main reason of the framework existance is to be able to run on whatever hardware an application without having to recompile it, this by the usage of the CLR (Common Language Runtime).
But developper working on embedded systems usually have to access those drivers that are specific to the platform. So in that case they need an access to the native APIs.
Identify the needs
Before getting access to the driver from C# you have to identify the APIs that have to be mapped from native to managed environment. Accessing a driver from native code is performed using the following APIs :
- CreateFile : in order to open a driver instance
- CloseHandle : to close the opened instance
- ReadFile : read data from the stream
- WriteFile : write data into the stream
- Seek : move data pointer in the stream
- DeviceIoControl : to perform driver specific actions with the usage of the CTL_CODE macro for commands IDs
Map the native API
In order to map the native API into C#, the usage of the interop services is required.
Note : you can find native API mapping from pinvoke.net (http://www.pinvoke.net/) website.
Create a driver class
We have to define the Driver class that will handle all the wrapping actions for us.
using System;
using System.Runtime.InteropServices;
namespace Adeneo_Embedded
{
public class Driver
{
}
}
Map the mandatory native functions
- CreateFile function
// This function creates, opens, or truncates a file, communications
// resource, disk device, or console. It returns a handle that can be
// used to access the object. It can also open and return a handle to
// a directory.
[DllImport ("coredll.dll")]
private static extern int CreateFile(
string lpFileName,
int dwDesiredAccess,
int dwShareMode,
int lpSecurityAttributes,
int dwCreationDisposition,
int dwFlagsAndAttributes,
int hTemplateFile);
- CloseHandle function
// This function closes an open object handle
[DllImport ("coredll.dll")]
private static extern int CloseHandle(int hObject);
- ReadFile function
// This function reads data from a file, starting at the position indicated
// by the file pointer. After the read operation has been completed, the
// file pointer is adjusted by the number of bytes actually read.
[DllImport ("coredll.dll")]
private static extern int ReadFile(
int hFile,
byte[] lpBuffer,
int nNumberOfBytesToRead,
ref int lpNumberOfBytesRead,
ref OVERLAPPED lpOverlapped);
- WriteFile function
// This function writes data to a file. WriteFile starts writing data to
// the file at the position indicated by the file pointer. After the write
// operation has been completed, the file pointer is adjusted by the number
// of bytes actually written.
[DllImport ("coredll.dll")]
private static extern int WriteFile(
int hFile,
byte[] lpBuffer,
int nNumberOfBytesToWrite,
ref int lpNumberOfBytesWritten,
ref OVERLAPPED lpOverlapped);
- DeviceIoControl function
// This function sends an IOCTL directly to a specified device driver,
// causing the corresponding device to perform the specified operation.
[DllImport ("coredll.dll")]
private static extern int DeviceIoControl(
int hFile,
uint dwIoControlCode,
byte[] lpInBuffer,
uint nInBufferSize,
byte[] lpOutBuffer,
uint nOutBufferSize,
ref uint lpBytesReturned,
ref OVERLAPPED lpOverlapped);
Redefine the CTL_CODE macro
When driver developper is implementing the driver IoControls and when the application developper want to execute this command, then both should refer to the same identifier. To get a unique identifier for a driver command, the CTL_CODE macro is used.
//
// Macro definition for defining IOCTL and FSCTL function control codes. Note
// that function codes 0-2047 are reserved for Microsoft Corporation, and
// 2048-4095 are reserved for customers.
//
public uint CTL_CODE(uint DeviceType, uint Function, uint Method, uint Access )
{
}
Redefine the constant values
CreateFile, DeviceIoControl, and CTL_CODE code is using constant that also have to be redefined in our driver class.
#region "constants"
private const int GENERIC_READ = unchecked((int)0x80000000);
private const int GENERIC_WRITE = 0x40000000;
private const int OPEN_EXISTING = 3;
private const int INVALID_HANDLE_VALUE = -1;
#region "CTL_CODE"
#region "Method"
//
// Define the method codes for how buffers are passed for I/O and FS controls
//
public const uint METHOD_BUFFERED = 0;
public const uint METHOD_IN_DIRECT = 1;
public const uint METHOD_OUT_DIRECT = 2;
public const uint METHOD_NEITHER = 3;
#endregion // "Method"
#region "Access"
//
// Define the access check value for any access
//
//
// The FILE_READ_ACCESS and FILE_WRITE_ACCESS constants are also defined in
// ntioapi.h as FILE_READ_DATA and FILE_WRITE_DATA. The values for these
// constants *MUST* always be in sync.
//
public const uint FILE_ANY_ACCESS = 0;
public const uint FILE_READ_ACCESS = ( 0x0001 ); // file & pipe
public const uint FILE_WRITE_ACCESS = ( 0x0002 ); // file & pipe
#endregion // "Access"
#region "DeviceType"
// begin_ntddk begin_nthal begin_ntifs
//
// Define the various device type values. Note that values used by Microsoft
// Corporation are in the range 0-32767, and 32768-65535 are reserved for use
// by customers.
//
public const uint FILE_DEVICE_BEEP = 0x00000001;
public const uint FILE_DEVICE_CD_ROM = 0x00000002;
public const uint FILE_DEVICE_CD_ROM_FILE_SYSTEM = 0x00000003;
public const uint FILE_DEVICE_CONTROLLER = 0x00000004;
public const uint FILE_DEVICE_DATALINK = 0x00000005;
public const uint FILE_DEVICE_DFS = 0x00000006;
public const uint FILE_DEVICE_DISK = 0x00000007;
public const uint FILE_DEVICE_DISK_FILE_SYSTEM = 0x00000008;
public const uint FILE_DEVICE_FILE_SYSTEM = 0x00000009;
public const uint FILE_DEVICE_INPORT_PORT = 0x0000000a;
public const uint FILE_DEVICE_KEYBOARD = 0x0000000b;
public const uint FILE_DEVICE_MAILSLOT = 0x0000000c;
public const uint FILE_DEVICE_MIDI_IN = 0x0000000d;
public const uint FILE_DEVICE_MIDI_OUT = 0x0000000e;
public const uint FILE_DEVICE_MOUSE = 0x0000000f;
public const uint FILE_DEVICE_MULTI_UNC_PROVIDER = 0x00000010;
public const uint FILE_DEVICE_NAMED_PIPE = 0x00000011;
public const uint FILE_DEVICE_NETWORK = 0x00000012;
public const uint FILE_DEVICE_NETWORK_BROWSER = 0x00000013;
public const uint FILE_DEVICE_NETWORK_FILE_SYSTEM = 0x00000014;
public const uint FILE_DEVICE_NULL = 0x00000015;
public const uint FILE_DEVICE_PARALLEL_PORT = 0x00000016;
public const uint FILE_DEVICE_PHYSICAL_NETCARD = 0x00000017;
public const uint FILE_DEVICE_PRINTER = 0x00000018;
public const uint FILE_DEVICE_SCANNER = 0x00000019;
public const uint FILE_DEVICE_SERIAL_MOUSE_PORT = 0x0000001a;
public const uint FILE_DEVICE_SERIAL_PORT = 0x0000001b;
public const uint FILE_DEVICE_SCREEN = 0x0000001c;
public const uint FILE_DEVICE_SOUND = 0x0000001d;
public const uint FILE_DEVICE_STREAMS = 0x0000001e;
public const uint FILE_DEVICE_TAPE = 0x0000001f;
public const uint FILE_DEVICE_TAPE_FILE_SYSTEM = 0x00000020;
public const uint FILE_DEVICE_TRANSPORT = 0x00000021;
public const uint FILE_DEVICE_UNKNOWN = 0x00000022;
public const uint FILE_DEVICE_VIDEO = 0x00000023;
public const uint FILE_DEVICE_VIRTUAL_DISK = 0x00000024;
public const uint FILE_DEVICE_WAVE_IN = 0x00000025;
public const uint FILE_DEVICE_WAVE_OUT = 0x00000026;
public const uint FILE_DEVICE_8042_PORT = 0x00000027;
public const uint FILE_DEVICE_NETWORK_REDIRECTOR = 0x00000028;
public const uint FILE_DEVICE_PARTITION = 0x00000029;
public const uint FILE_DEVICE_STORE = 0x00000030;
#endregion // "DeviceType"
#endregion // "CTL_CODE"
#endregion // "constants"
Filling the empty egg
A bit of additional work is required to accomplish our task, the driver class goal is to map the driver access within C#, but also an abstraction class to deeply simplify the access to the driver and then offer a servicing class for your application.
#region "private members"
private int mintHandle = INVALID_HANDLE_VALUE; // driver handle
#endregion // "private members"
#region "Constructor-Destrcutor"
public Driver()
{
}
~ Driver ()
{
if (mintHandle != INVALID_HANDLE_VALUE)
Close ();
}
#endregion // Constructor-Destrcutor
#region "Open"
public bool Open(String strDriverName)
{
if (mintHandle != INVALID_HANDLE_VALUE)
{
Close ();
}
mintHandle = CreateFile(strDriverName, GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, 0, 0);
return mintHandle != INVALID_HANDLE_VALUE;
}
#endregion // open the driver
#region "Close"
public bool Close()
{
bool bResult = false;
int iValue;
if (mintHandle != INVALID_HANDLE_VALUE)
{
iValue = CloseHandle (mintHandle);
if (iValue != 0)
{
bResult = true;
mintHandle = INVALID_HANDLE_VALUE;
}
}
return bResult;
}
#endregion // close the driver
#region "Read"
public bool Read(byte []buffer, ref int lpBytesToRead)
{
bool bResult = false;
int lpNumberOfBytesRead = 0;
int intResult = 0;
OVERLAPPED lpOverlapped = new OVERLAPPED();
if (mintHandle != INVALID_HANDLE_VALUE)
{
intResult = ReadFile(mintHandle, buffer, lpBytesToRead, ref lpNumberOfBytesRead, ref lpOverlapped);
if (intResult == 0)
{
throw new Exception("Error reading driver");
}
else
{
lpBytesToRead = lpNumberOfBytesRead;
bResult = true;
}
}
return bResult;
}
#endregion // read data from the driver
#region "Write"
public bool Write(byte []buffer, ref int lpBytesToWrite)
{
bool bResult = false;
int lpNumberOfBytesWrite = 0;
int intResult = 0;
OVERLAPPED lpOverlapped = new OVERLAPPED();
if (mintHandle != INVALID_HANDLE_VALUE)
{
intResult = WriteFile(mintHandle, buffer, lpBytesToWrite, ref lpNumberOfBytesWrite, ref lpOverlapped);
if (intResult == 0)
{
throw new Exception("Error writing driver");
}
else
{
lpBytesToWrite = lpNumberOfBytesWrite;
bResult = true;
}
}
return bResult;
}
#endregion // read data from the driver
#region "IOControl"
public bool IOControl(uint IoControlCode, byte []bufferIn, uint bufferSizeIn, byte []bufferOut, ref uint lpBufferSizeOut)
{
bool bResult = false;
uint lpNumberOfBytesReturned = 0;
int intResult = 0;
OVERLAPPED lpOverlapped = new OVERLAPPED();
if (mintHandle != INVALID_HANDLE_VALUE)
{
intResult = DeviceIoControl(mintHandle, IoControlCode, bufferIn, bufferSizeIn, bufferOut, lpBufferSizeOut, ref lpNumberOfBytesReturned, ref lpOverlapped);
if (intResult == 0)
{
throw new Exception("Error IOcontrol driver");
}
else
{
lpBufferSizeOut = lpNumberOfBytesReturned;
bResult = true;
}
}
return bResult;
}
#endregion // read data from the driver
This is it, now we have a class that really simplify the access to the drivers.
Driver myI2CDriver = new Driver();
myI2CDriver.Open("I2C1:");
…
myI2CDriver.Close();
- Nicolas
Posted by Nicolas BESSON [MVP] 2 comments
Labels: .Net Compact FrameWork
Tuesday, November 2, 2010
WEC 7 : Build Solution performing a Buid & Sysgen
As this action is not required, it is useful to avoid the execution of a such action. This can be done by modifying the blddemo.bat file located in $(_WINCEROOT)\PUBLIC\COMMON\OAK\MISC and adding in the first lines :
If "%1"=="" goto :EOF
- Nicolas
Posted by Nicolas BESSON [MVP] 0 comments
Labels: General, Windows CE 7.0
Automaticaly Add files to an SDK - refreshed
When building an SDK using Platform Builder 6.0 (and previous), you may need to include your own files. Those files are the list of IOcontrols of drivers you implemented, or header files required to link to a new library that you want to provide in your SDK. In that case you have to include those files to your SDKs.
The first one is a manual inclusion of those files using the configuration wizard of the SDK. That’s mean that every time you generates the SDK you have to take care of those files.
The second solution is to automated this mechanism by copying those files to a specific folder that will be used automatically by the wizard during the generation of the SDK.
Identification of the sdk folder
The SDK tool uses the content of the cesysgen folder (located in your OSDesign folder), and the sdk folder located in the same folder as the cesysgen and OAK folder.$(_PROJECTROOT)\sdk or $(_PROJECTSDKROOT)
The SDK tool adds the content of the sdk\Inc and sdk\Lib folder to the SDK msi file. So you must store the files you need to provide with the SDK in those sub folders. Doing it manually is never the solution, so by asking the Windows embedded CE build environment to do it, it is more reliable. This could be done during the build of those libraries or drivers.
Add an automated task
Using the sources files you can add dependencies and enable automated task for the build engine. You could also use the postlink macro, but this is not the purpose of this article.
In the sources file add the following lines :
#------------------------------------------------------------------------------
# SDK files
#------------------------------------------------------------------------------
# Enable copy to the SDK directory
WINCETARGETFILES=$(WINCETARGETFILES) CopyFilesToSDK
# Hearder files
SDK_H_FILES=gpio_iocontrol.h driverheadertoshare.h
#Lib files
SDK_LIB_FILES=
Any target files that you specify using WINCETARGETFILES are added to the list of dependencies that must be satisfied to generate a successful build. Also by listing the files you need for your SDK in the SDK_ FILES variable, you will generate a list actions that will be solved later in the makefile.inc.
Add an automated copy instructions
In association to the SOURCES file you must provide a makefile.inc (located in the same folder), this file is proceeded after your sources files during the build. In this file you must satisfy the dependency list, so it must contain information about the CopyFilesToSDK.
Makefile.inc content will be the following :
#
# DO NOT EDIT THIS FILE!!! Edit .\sources. if you want to include new files
# in the SDK.
#
CopyFilesToSDK:
if not EXIST $(_PROJECTSDKROOT)\Inc mkdir $(_PROJECTSDKROOT)\Inc
FOR %%f IN ($(SDK_H_FILES)) DO xcopy /I /D /Q %%f $(_PROJECTSDKROOT)\Inc > nul
if not EXIST $(_PROJECTSDKROOT)\Lib mkdir $(_PROJECTSDKROOT)\Lib\$(_CPUINDPATH)
FOR %%f IN ($(SDK_LIB_FILES)) DO xcopy /I /D /Q $(_RELEASELIBDIR)\%%f $(_PROJECTSDKROOT)\Lib\$(_CPUINDPATH)\ > nul
The copy will be done in batch script language and executed by the build engine.
After the build of the driver or the library, you may find all your required files in the $(_PROJECTSDKROOT) folder.
In this article I described only one list of files to be proceeded, but it make sense to have two lists, one for the header files and the sdk\Inc folder and another one for the sdk\Lib folder for the libraries.
- Nicolas
Posted by Nicolas BESSON [MVP] 0 comments
Labels: Device Drivers, SDK, Windows CE 5.0, Windows CE 6.0, Windows CE 7.0
Wednesday, October 20, 2010
How fun is Windows Embedded Standard 7
The last release of Microsoft Windows Embedded Standard, is based on Windows 7 operating system, and devices will come to the market in the next days. So Microsoft is demonstrating the capabilities of this Operating System in an Home Entertainment context.
- Nicolas
Posted by Nicolas BESSON [MVP] 0 comments
Labels: Microsoft, Video, Windows Embedded Standard
Tuesday, October 19, 2010
Awesome video of Windows Embedded Compact 7 running on TI OMAP based platform
Texas Instruments and Adeneo Embedded present during the last Computex event a PTI platform based on an OMAP 3530 processor running the next version of Microsoft Embedded operating system called Windows Embedded Compact 7.0 (WEC 7).
- Nicolas
Posted by Nicolas BESSON [MVP] 0 comments
Labels: Video, WEC 7, Windows CE 7.0
Wednesday, October 13, 2010
2nd place : Phone Seven Competition
Adeneo Embedded and GoProd participated to the French Windows Phone 7 competition with WinMote application. With WinMote, you start all your medias on your PC from your Windows Phone 7. With this application, we get the 2nd place of the competition !
Check the video
- Nicolas
Posted by Nicolas BESSON [MVP] 0 comments
Labels: Windows Phone
Monday, October 11, 2010
Develop a driver easily...
CEDriverWiz is a Windows Embedded CE wizard that works within the Visual Studio IDE, helps simplify the tasks needed to setup the initial subproject workspace to develop stream interface device driver for Windows CE 6.0.
Check out all the details about this nice project on CodePlex.
- Nicolas
Posted by Nicolas BESSON [MVP] 0 comments
Labels: Device Drivers, Windows CE 6.0
Sunday, October 3, 2010
Windows Embedded Standard 7 Compatible Applications
Most applications that run on Windows 7, Windows Vista, and Windows XP will run on Windows Embedded Standard 7. Through the use of templates, we now make it easy to ensure that all of your application development projects will run on Windows Embedded Standard 7. These templates allow an application developer to indicate which components should be included in the build in order to support their application on embedded systems.
Microsoft is providing for the most used applications, templates that you can use to integrate those apps in your runtime image. Check out the list here.
- Nicolas
Posted by Nicolas BESSON [MVP] 0 comments
Labels: Microsoft, Windows Embedded Standard
Wednesday, September 22, 2010
Windows Phone 7 App Contest
For the launch of Windows Phone 7, the French Microsoft entity organize a contest for the killer app.
Check out on Developper.net facebook page, the registered application and vote for your favorite one (before Friday evening).
http://www.facebook.com/Developpeurs.net
One of my favorite is : WinMote 7 application
www.facebook.com/video/video.php?v=474533036010
- Nicolas
Posted by Nicolas BESSON [MVP] 0 comments
Labels: Microsoft, Windows Mobile, Windows Phone
Thursday, July 22, 2010
Windows Embedded Developer Update
On June 28, 2010 Windows Embedded Developer Update for Windows Embedded Standard 7 users was made available for download. Windows Embedded Developer Update gives developers an easy method to discover, download and install updates, providing them with full control of their development environment and the confidence to know they've got the latest update.
- To download Windows Embedded Developer Update please visit the Windows Embedded Download Center
- For a video overview on Windows Embedded Developer Update visit The Windows Embedded News Center
- For more information on how to use Windows Embedded Developer Update visit MSDN
- Nicolas
Posted by Nicolas BESSON [MVP] 0 comments
Labels: Microsoft, Press Release, Windows Embedded Standard
Friday, July 16, 2010
Make Image and the "Out of buffer space" error
An error that you could face on is the "Out of buffer space" error occuring during the Windows CE makeimage step.
.....It just happens to me this morning, while buiding a RunTime image for a project, and even looking into the log and error files, no specific details should explain the reason why.
CeNlsCmp: JamoSort Compose: 1120
CeNlsCmp: Default Lang Except uppercase: 52
CeNlsCmp: Default Lang Except lowercase: 32
CeNlsCmp: 0 Lang Except tables: 0
Total data: 96714
CeNlsCmp: Done. Success parsing locale file
makeimg: FATAL ERROR: Out of buffer space.
makeimg: FATAL ERROR: Out of buffer space.
BLDDEMO: EVM_3530 build complete.
.....
By looking more in details I found that the path to my reldir folder was longer than the previous projects I work on. So I moved my OSDesign to a different folder with a shorter path length. And it fix this issue.
So the make image process is waiting for a path that could not exceed a path length. In this case reduce this path length by renaming with shorter names the folder containing your OSDesign (if this one isn't located inside _WINCEROOT\OSDesigns folder)
- Nicolas
Posted by Nicolas BESSON [MVP] 1 comments
Labels: General, Windows CE 5.0, Windows CE 6.0
Thursday, June 24, 2010
Windows Embedded Handheld revealed
Microsoft just officially launch the operating system dedicated for enterprise and rugged devices. In the middle between Windows CE and Windows Phone, this new operating system offers to OEM a standardized platform to build their devices. The first company to provide such device is Motorola with its ES400.
Check out Steve Ballmer interview : http://www.microsoft.com/windowsembedded/en-us/products/handheld/overview.mspx
- Nicolas
Posted by Nicolas BESSON [MVP] 0 comments
Labels: Windows Embedded Handheld
Monday, April 26, 2010
PipeTerm for Windows Embedded CE 6.0
PipeTerm is a Windows Embedded CE 6.0 PowerToy that can be used to display serial port (debug) output from a booting/running CE 6.0 operating system image being hosted in Virtual PC 2007.
Check it here.
- Nicolas
Posted by Nicolas BESSON [MVP] 0 comments
Labels: Tricks, Windows CE 6.0
Thursday, April 22, 2010
Windows Embedded CE 6.0 R3 Silverlight demo on a Freescale reference design
Check out this video of Silverlight for Windows Embedded demos done by Adeneo-Embedded and running on a Freescale tablet reference design.
- Nicolas
Posted by Nicolas BESSON [MVP] 0 comments
Labels: Silverlight, Windows CE 6.0
Wednesday, April 14, 2010
Webcast : Silverlight for Windows Embedded CE (French)
Missed the Techdays 2010 or would like to review the really interesting conference about Silverlight for Windows Embedded, you can check this out here.
- Nicolas
Posted by Nicolas BESSON [MVP] 0 comments
Labels: Silverlight, Webcast, Windows CE 6.0
Friday, April 9, 2010
Create and Manage Telnet users
Windows Embedded CE is provided with a Telnet server, that you can use on your target to access it from the network. This Telnet service can work in two different modes :
- without authentication : anybody connecting to the Telnet have access to the target
- with authentication enable : only trusted user with password have access to the target
Enable Telnet Server :
In your OSDesign, select the Telnet Server component located in :
Core OS -> CEBASE -> Communication Services and Networking -> Servers -> Telnet Server
Disable authentication :
Simply add the following lines to your project.reg to disable service authentication. All users then will have access to the service as no credential will be requested.
[HKEY_LOCAL_MACHINE\COMM\TELNETD]
"IsEnabled"=dword:1
"UseAuthentication"=dword:0
Enable authentication :
When enabling authentication, you have to add in addition to the Telnet server support, the NTLM component located in :
Core OS -> CEBASE -> Security -> Authentication Services (SSPI) -> NTLM
And you also have to add in registry the list of users that will have access to the service. Users can be classified by groups of users (check MSDN for details).
[HKEY_LOCAL_MACHINE\COMM\TELNETD]
"IsEnabled"=dword:1
"UseAuthentication"=dword:1
"UserList"="Bob"
In the sample above, we are adding user named Bob, and only this user will have access to the telnet service.
Set and Change user password :
By default there is no default password for the different users defined on the system, and the password is ciphered and stored in the registry. This password cannot be set at Runtime image build time, and is usually set on first system boot. The sample code below set the password for user Bob.
#include "ntlmssp.h"
#define DEFAULT_USER L"Bob"
#define DEFAULT_NEW_PASS L"password"
...
BOOL bRet = NTLMSetUserInfo(DEFAULT_USER, DEFAULT_NEW_PASS);
if (bRet == FALSE)
RETAILMSG(1, (L"Failed to set user info"));
else
RETAILMSG(1, (L"User info updated"));
...
- Nicolas
Posted by Nicolas BESSON [MVP] 7 comments
Labels: Windows CE 4.2, Windows CE 5.0, Windows CE 6.0
Wednesday, April 7, 2010
Microsoft Certification Contest in France
The How To of the Microsoft Certifications is here.
- Nicolas
Posted by Nicolas BESSON [MVP] 0 comments
Labels: Press Release
Tuesday, April 6, 2010
Enable RamDisk, and Mass Storage under Windows CE [Updates]
A Ram Disk is a storage disk located in RAM of your device, meaning its content isn't persistent between system boot. The RamDisk usually used for storing temporary content like software updates source binaries.
Reserve Memory space on target :
The Ram disk will be located at a customizable memory address and size on the device, and will be mounted on your root file system as any other file system. In order to reserve the physical memory area, you have to modify the config.bib file of your BSP and add a reserved section for RAM Disk as shown as below. It make sense to map this area on a physical portion of the RAM.
MEMORY
; Name Start Size Type
; ------- -------- -------- ----
BLDR 80000000 00058000 RESERVED
DRVGLOB 80058000 00001000 RESERVED
EMACBUF 80059000 0000E000 RESERVED
NK 80067000 01000000 RAMIMAGE
RAM 81067000 02BA7000 RAM ; 43.65 MB
RAMDISK 83C0E000 00300000 RESERVED ; 3.00 MB
In the example above, I reduced the size of RAM to have enough room for the RAMDISK section of 0x300000 (3MBytes).
Include RamDisk into OSDesign
Add the RamDisk support to your runtime image, by enabling the SYSGEN_RAMDISK variable into the OSDesign property window.
Configure RamDisk
The RamDisk driver is by default mounted by the storage manager and no configuration of the storage driver name allowed. So I prefer to make few registry modifications in my platform.reg to be able to fix the driver DSK name and index.
; HIVE BOOT SECTION
[HKEY_LOCAL_MACHINE\Drivers\BuiltIn\RamDisk]
"Dll"="ramdisk.dll"
"Prefix"="DSK"
"FriendlyName"="RAM Disk Driver"
"Order"=dword:0
"Ioctl"=dword:4
"IClass"=multi_sz:"{A4E7EDDA-E575-4252-9D6B-4195D48BB865}"
"Profile"="RAMDisk"
"Size"=dword:300000
"Address"=dword:83C0E000
"SectorSize"=dword:200
"index"=dword:9
[HKEY_LOCAL_MACHINE\System\StorageManager\AutoLoad\RAMDisk]
"DriverPath"="Drivers\\BuiltIn\\RamDisk"
"LoadFlags"=dword:1
"BootPhase"=dword:0
; END HIVE BOOT SECTION
Note that the Address and Size of the RamDisk driver definition match the values defined in the config.bib. The storage driver will then be accessible through DSK9:, and you can then easily configure a USB Function mass storage profile to point on this storage.
Configure USB Function Mass Storage
The USB Function driver loads profiles when device plugged to a host, the profile to be loaded by default is set through the registry.
[HKEY_LOCAL_MACHINE\Drivers\USB\FunctionDrivers]
"DefaultClientDriver"=- ; erase previous default
[HKEY_LOCAL_MACHINE\Drivers\USB\FunctionDrivers]
"DefaultClientDriver"="Mass_Storage_Class"
[HKEY_LOCAL_MACHINE\Drivers\USB\FunctionDrivers\Mass_Storage_Class]
"DeviceName"=- ; erase previous default
[HKEY_LOCAL_MACHINE\Drivers\USB\FunctionDrivers\Mass_Storage_Class]
"DeviceName"="DSK9:"
Note as the "DeviceName" is set to DSK9: matching the driver index described before for the RamDisk.
Note don't forget to add the USB Function driver of the BSP and set the following variables : SYSGEN_USBFN, SYSGEN_USBFN_STORAGE
To go further :
- RamDisk can be used in association to the ROM Only mechanism to reduce write access to the physical storage.
- RamDisk and USB Function, this to provide a way to drop files on your target using USB mass storage profile.
Special thanks to Juanito for the hints
[Updated on 08-22-2011] : fixed a platform configuration file name.
- Nicolas
Posted by Nicolas BESSON [MVP] 2 comments
Labels: Device Drivers, Windows CE 4.2, Windows CE 5.0, Windows CE 6.0
Friday, February 19, 2010
Windows Mobile 6.5.3 Developer Tool Kit
After a first try few weeks ago, Microsoft finally release the Windows Mobile 6.5.3 Developer Tool Kit. This update version provides access to the gesture API for your applications.
Get this update from Microsoft website.
- Nicolas
Posted by Nicolas BESSON [MVP] 0 comments
Labels: Windows Mobile
Adeneo at Embedded World
- Nicolas
Posted by Nicolas BESSON [MVP] 0 comments
Labels: Press Release
Friday, January 22, 2010
Adeneo First Training in Israel
Adeneo Embedded, as a leading Windows Embedded Gold partner is working in collaboration with Arrow, Atmel for delivering a series of Windows Embedded CE 6.0 R3 workshop.
Please join us in Israel on Feb 24th 2010 to learn about newest version of Windows Embedded CE 6.0 R3, and how Arrow, Atmel and Adeneo Embedded can help you with your next Windows Embedded development.
Link to the invitation you can use for the registration. For further details or questions, please contact sales@adeneo-embedded.com
- Nicolas
Posted by Nicolas BESSON [MVP] 0 comments
Labels: Press Release, Windows CE 6.0
Friday, January 15, 2010
Meet me on Feb 8th at Techdays 2010 (Paris)
During this event I will also do a presentation of the Silverlight Embedded feature of Windows Embedded CE 6.0 R3 , scheduled on Feb. 8th at 1:30 PM. Focussing on the development of Silverlight applications for Windows Embedded CE this talk will demonstrate cool applications illustration the capabilities of the language.
Microsoft France organise during this event, the first application development contest for students using Visual Studio tools and Windows Embedded platforms, to be showcased at TechDays Paris, an event which attracts 16,000 developers.
You will have the chance to exchange with us on your application.
Check-out this web page for more ( in French obviously !! )
To register for this event check this.
- Nicolas
Posted by Nicolas BESSON [MVP] 0 comments
Labels: Microsoft, Tradeshows