VAR-SOM-OM37 Windows GS

From Variscite Wiki
Revision as of 18:05, 15 January 2014 by Admin (talk | contribs) (Created page with "{{DocImage|category1=VAR-SOM-OM37|category2=Windows}} =VAR-SOM-OM37 - Windows CE support = __toc__ =Support= Variscite supports its VAR-SOM-OM37 with Windows CE 6 R3 and Windo...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

VAR-SOM-OM37 - Windows CE support

Support

Variscite supports its VAR-SOM-OM37 with Windows CE 6 R3 and Windows Embedded compact 7 BSPs.

The BSP provides support for all on-board peripherals. Your Windows CE folder on your CD contains:

  1. Ready-to-run pre-built binaries of the : NK.bin , Eboot, Xloader
  2. Sources files
  3. SDK
  4. C# wrappers for device drivers
  5. OpenGL / PowerVR demos
  6. Sample media contents for playing via the DM3730 hardware acceleration.

Resources

WindowsCE OS Update Service

overview

Variscite's Windows CE BSP includes a proprietary OS update service.

The service provides the ability to remotely update the OS run-time-image which resides on the on-board NAND-flash.

Windows embedded compact 7 releases 1.25 and forth, support EBOOT, boot configuration and screen logo update as well.

O.S. update procedure is power-fail proof.  OS image will not replace current one, until the flashing process is successfully completed and verified.

All other updates are not power fail proof, user must ensure proper power stability before procedure start.


Boot Configuration API

Boot configuration structure (BOOT_CFG) declared in file boot_args.h Two IOCTLs provided: OSU_IOCTL_READ_BOOTARGS - Reads boot configuration from flash memory into user buffer OSU_IOCTL_WRITE_BOOTARGS - Saves boot configuration from user buffer into flash memory Note that OSU_IOCTL_WRITE_BOOTARGS is not fail-safe: if for some reason (like power removal) if will fail, it may leave boot configuration in undefined state.

OS image, EBOOT and Logo update API

OS image update (like EBOOT and Logo update) uses two IOCTLs:
OSU_IOCTL_SET_FILE - Sets the file-name for consequent update operation. For OS image update file shall be of "nb0" (raw binary) type.
OSU_IOCTL_UPDATE - Initiates the OS image update procedure

Updating EBOOT also uses two IOCTLs: same OSU_IOCTL_SET_FILE followed by OSU_IOCTL_UPDATE_EBOOT. EBOOT file shall be in "nb0" (raw binary) format. Please ensure that correct file is specified, because there is no way for the driver to determine that raw binary contains EBOOT.

Updating EBOOT also uses two IOCTLs: same OSU_IOCTL_SET_FILE followed by OSU_IOCTL_UPDATE_LOGO. Logo file shall be in "bmp" (24-bit RGB) format. Make sure that supplied bitmap has exactly the size of your screen, otherwise it will not be displayed correctly by EBOOT.


Note:
The NK.nb0 and EBOOTND.nb0 files are generated as part of OS build. The files may be found in the Release directory under the corresponding project. For example, if the user builds the VAR_SOM-OM37_P BSP with VAR-SOM-OM3X_REL project, then the file will reside in the \WINCE600\Osdesign\VAR-SOM-OM3X_REL\VAR-SOM-OM3X_REL\RelDir\VAR_SOM_OM37_P_ARMV4I_Release folder.


Note:
The OS update procedure requires reboot for updated OS image activation. User should reset the system when ready.

Application may use the following command to reset the system:

SetSystemPowerState(NULL, POWER_STATE_RESET, 0);
Note:
The driver uploads full OS image file to the RAM. Therefore, for successful update operation, driver requests 32M of free RAM.

Service limitation: OS update service nk0 size limit:

Windows CE6: 40MB

Windows embedded compact 7:  VAR-SOM-AM35   -  80MB, VAR-SOM-OM37 - 62MB

Sample application - all O.S. update features

Note that preprocessor variable DYNAMIC_OS_BOOT must be defined (in project properties)
// OSUpdate.cpp : Defines the entry point for the console application.
//
#pragma warning(push)
#pragma warning(disable : 4115 6067)
#include <windows.h>
#include "oalex.h"
#include "boot_args.h"

void RetailPrint(wchar_t *pszFormat, ...);
//extern int	CreateArgvArgc(TCHAR *pProgName, TCHAR *argv[20], TCHAR *pCmdLine);

#define OSU_IOCTL_BASE				0x35300000
#define OSU_IOCTL_SET_FILE			((OSU_IOCTL_BASE)+0)
#define OSU_IOCTL_UPDATE			((OSU_IOCTL_BASE)+1)
#define OSU_IOCTL_UPDATE_EBOOT		((OSU_IOCTL_BASE)+2)
#define OSU_IOCTL_UPDATE_LOGO		((OSU_IOCTL_BASE)+3)
#define OSU_IOCTL_READ_BOOTARGS		((OSU_IOCTL_BASE)+4)
#define OSU_IOCTL_WRITE_BOOTARGS	((OSU_IOCTL_BASE)+5)

TCHAR	strOsImage[MAX_PATH] = L"\\Hard Disk\\NK.nb0";
TCHAR	strOsEboot[MAX_PATH] = L"\\Hard Disk\\Eboot.nb0";
TCHAR	strOsLogo[MAX_PATH] = L"\\Hard Disk\\logo.bmp";
BOOT_CFG BootArgs;

int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPWSTR lpCmdLine, int nCmShow)
{
	HANDLE		hDrvContext;
	DWORD		dwErr=1;
	DWORD		dwRet;
    
    UNREFERENCED_PARAMETER(hInst);
    UNREFERENCED_PARAMETER(hPrevInst);
    UNREFERENCED_PARAMETER(nCmShow);

	// Open OSU driver
	hDrvContext = 
        CreateFile(L"OSU0:", GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL);

	if (hDrvContext == INVALID_HANDLE_VALUE) {
		RETAILMSG(1, (TEXT("ERROR: Can't open OSU driver\r\n")));
		return -1;
	}	

	RETAILMSG(1, (TEXT("Reading boot config\r\n")));
	if (!DeviceIoControl(hDrvContext, OSU_IOCTL_READ_BOOTARGS, NULL, 0, &BootArgs, sizeof(BootArgs), &dwRet, NULL))
	{
		RETAILMSG(1, (L"ERROR: can't read Boot_CFG, err = %d\r\n", GetLastError()));
	}
	RETAILMSG(1, (L"Boot Args ver %d signature %x\r\n", BootArgs.version, BootArgs.signature));

	if (!DeviceIoControl(hDrvContext, OSU_IOCTL_WRITE_BOOTARGS, &BootArgs, sizeof(BootArgs), NULL, 0, &dwRet, NULL))
	{
		RETAILMSG(1, (L"ERROR: can't write Boot_CFG, err = %d\r\n", GetLastError()));
	}
	
        RetailPrint(TEXT("Updating Eboot from %s\n"), strOsEboot);
	DeviceIoControl(hDrvContext, OSU_IOCTL_SET_FILE, strOsEboot, _tcslen(strOsEboot)*sizeof(TCHAR), NULL, 0, NULL, NULL);	

	// start update process
	if (!DeviceIoControl(hDrvContext, OSU_IOCTL_UPDATE_EBOOT, NULL, 0, NULL, 0, NULL, NULL))
	{		
		LPVOID lpMsgBuf = NULL;
		DWORD dw = GetLastError(); 

		// REQUIRES SYSGEN_FMTMSG AND SYSGEN_FMTRES
		dwErr = FormatMessage(
			FORMAT_MESSAGE_ALLOCATE_BUFFER | 
			FORMAT_MESSAGE_FROM_SYSTEM |
			FORMAT_MESSAGE_IGNORE_INSERTS,
			NULL,
			dw,
			0,
			(LPTSTR) &lpMsgBuf,
			512, NULL );

		// Display the error message		
		RETAILMSG(1, (L"ERROR: can't update Logo, err = %d/%d, %s\r\n", dw, dwErr, lpMsgBuf));		
	}

	RetailPrint(TEXT("Updating Logo from %s\n"), strOsLogo);

	DeviceIoControl(hDrvContext, OSU_IOCTL_SET_FILE, strOsLogo, _tcslen(strOsLogo)*sizeof(TCHAR), NULL, 0, NULL, NULL);	

	// start update process
	if (!DeviceIoControl(hDrvContext, OSU_IOCTL_UPDATE_LOGO, NULL, 0, NULL, 0, NULL, NULL))
	{		
		LPVOID lpMsgBuf = NULL;
		DWORD dw = GetLastError(); 

		// REQUIRES SYSGEN_FMTMSG AND SYSGEN_FMTRES
		dwErr = FormatMessage(
			FORMAT_MESSAGE_ALLOCATE_BUFFER | 
			FORMAT_MESSAGE_FROM_SYSTEM |
			FORMAT_MESSAGE_IGNORE_INSERTS,
			NULL,
			dw,
			0,
			(LPTSTR) &lpMsgBuf,
			512, NULL );

		// Display the error message		
		RETAILMSG(1, (L"ERROR: can't update Logo, err = %d/%d, %s\r\n", dw, dwErr, lpMsgBuf));		
	}

	RetailPrint(TEXT("Updating NK image from %s\n"), strOsImage);
	// set file name holding new OS image
	DeviceIoControl(hDrvContext, OSU_IOCTL_SET_FILE, strOsImage, _tcslen(strOsImage)*sizeof(TCHAR), NULL, 0, NULL, NULL);
	// start update process
	if (!DeviceIoControl(hDrvContext, OSU_IOCTL_UPDATE, NULL, 0, NULL, 0, NULL, NULL))
	{		
		LPVOID lpMsgBuf = NULL;
		DWORD dw = GetLastError(); 

		// REQUIRES SYSGEN_FMTMSG AND SYSGEN_FMTRES
		dwErr = FormatMessage(
			FORMAT_MESSAGE_ALLOCATE_BUFFER | 
			FORMAT_MESSAGE_FROM_SYSTEM |
			FORMAT_MESSAGE_IGNORE_INSERTS,
			NULL,
			dw,
			0,
			(LPTSTR) &lpMsgBuf,
			512, NULL );

		// Display the error message		
		RETAILMSG(1, (L"ERROR: can't update OS, err = %d/%d, %s\r\n", dw, dwErr, lpMsgBuf));		
	}

    return 0;
}

///////////////////////////////////////////////////////////////////////////////
// Used to show message serial terminal AND console window
void RetailPrint(wchar_t *pszFormat, ...)
{
    va_list al;
    wchar_t szTemp[2048];
    wchar_t szTempFormat[2048];

    va_start(al, pszFormat);
    vwprintf(pszFormat, al);
    // Show message on RETAILMSG
    swprintf(szTempFormat, L"OSUPDATE: %s\r", pszFormat);
    pszFormat = szTempFormat;
    vswprintf(szTemp, pszFormat, al);
    RETAILMSG(1, (szTemp));

    va_end(al);
}
#pragma warning(pop)

R3 Silverlight Support

This chapter describes how to enable Windows Embedded CE 6.0 R3 Silverlight support

OpenGL Support

Silverlight uses OpenGL API, therefore uses the OMAP3530 / dm3730 on-chip OpenGL HW accelerator.

In order to use the OpenGL accelerator, the PowerVR SW component should be included in the workspace.

Follow the following steps:

  • Download PowerVR latest version from Variscite FTP site. The package should reside under /OMAP/WindowsCE/Release/x.y.z/PowerVR/ folder, where "x.y.z" should be substituted with the version of latest BSP.
  • Follow the installation instructions in the _Installation.txt file, residing in the mentioned above folder
  • Open working solution in Visual Studio 2005. For example VAR_OM35xx_REL.
  • Go to the Catalog view
  • Open Third Party folder
  • Check PowerVR and open it as folder
  • Check OpenGLES 2.0 form the 3D API folder

For more details reference to OpenGL on VAR-SOM-OM35 Windows CE topic.

Enable Silverlight Components

  • Go to the Solution Explorer
  • Right click on the solution name
  • Choose Properties
  • Go to the Configuration Properties > Environment
  • Set New environment variable SYSGEN_XAML_RuntimeCreates to be 1
  • Set New environment variable BSP_XRPLUGIN_OPENGL to be 1
  • Set New environment variable SYSGEN_SAMPLEXAMLPERF to be 1. This settings optional for including Silverlight examples

Building

Perform CLEAN SYSGEN build.

Suspend Service - Graceful shutdown

Below you can find information on the Suspend service, which enables a graceful shutdown of the FAT file-system, in case of a power failure.

Power failure and file-systems

During the device's life-time, power failure may occur. These failures threaten the reliability of the FAT file-system. The use of Windows CE's TFAT (Transaction-safe FAT) / ExFAT significally reduces the risk of a file-system corruption. However, no file system is 100% fail-safe. Power failure while file-system is actively writing, might rarely cause errors, even while using TFAT. Therefore, a graceful shutdown at power failure incident, when possible, is recommended. The suspend service requires 250ms to complete the File-system shutdown, while SOMs power consumption is 1.32Watt (400ma @3.3v)

Suspend service - Graceful shutdown. Usage guidelines

Suspend service is waiting for a falling-edge event of a specific GPIO, at a high-priority task. Once such event is triggered, the Suspend-service gracefully shuts-down the FAT file-system at the highest priority.

Suspend service is available from BSP version 1.3.6 and forth.

Usage Guidelines:

  • To enable the Suspend Service, please set:
set BSP_SSP=1

in VAR_OM35xx_P.bat

  • in FILES\platform.reg you may choose the appropriate GPIO which triggers the event:
[HKEY_LOCAL_MACHINE\Drivers\BuiltIn\SSP]
   "Prefix"="SSP"
   "Dll"="sspdrv.dll"
   "Index"=dword:0
   "Order"=dword:40
   "GpioId"=dword:6D ;GPIO#109

OpenGL

Introduction

TI OMAP3530 application processor includes the "PowerVR SGX" Core that provides advanced hardware accelerated support for OpenGL ES and OpenVG graphics. This topic explains how to enable the 3D graphics capabilities under Windows CE.

PowerVR Installation

  • Download the latest PowerVR package from Variscite FTP. The file resides in the OMAP/WindowsCE/Release/x.y.z/PowerVR/ folder, where x.y.z should be replaced with the current version.
Note: The PowerVR version should be compatible with BSP version. Therefore customer is encouraged to upgrade to the latest BSP release. Otherwise, OpenGL and/or regular display capabilities may be corrupted!
  • Close Visual studio
  • Unzip downloaded file to the \WINCE600\PUBLIC to create in order two subdirectories - PowerVR and PowerVR-SDK.
  • Open OMAP solution in Platform Builder
  • Switch to the Catalog view
  • Check all the PowerVR components as it shown on the following picture:

Powervr.JPG

Note: Only one 3D API may be chosen for the application. Then, unnecessary components from 3D API may be removed in order to reduce OS image size.
  • Perform SYSGEN build of the solution