Page 80 Epson Research and Development
Vancouver Design Center
S1D13505 Programming Notes and Examples
X23A-G-003-07 Issue Date: 01/02/05
11.6.2 Building the HAL library for the target example

Building the HAL for the target example is le ss complex because the code is written in C

and requires little platform specific adjustment. The nmake makefile for our example is

makesh3.mk.This makefile contains the rules for building sh3 objects, the files li st for the

library and the library creation rules. The Gnu compiler tools are pointed to b y TOOLDIR.

With nmake in your path run:

nmake -fmakesh3.mk

11.6.3 Building a complete application for the target example

The following source code is available on the Epson Electronics America Website at

http://www.eea.epson.com.

#include <stdio.h>
#include "Hal.h"
#include "Appcfg.h"
#include "Hal_regs.h"
int main(void);
#define RED16BPP 0xf800
#define GREEN16BPP 0x07e0
#define BLUE16BPP 0x001f
int main(void)
{int DevId;
UINT height, width, Bpp;
const char *p1, *p2, *p3;
DWORD color_red, color_blue;
BYTE RedBlueLut[3][3] = {
{0, 0, 0}, /* Black */
{0xF0, 0, 0}, /* Red */
{0, 0, 0xF0} /* Blue */
};
BOOL verbose = TRUE;
long x1, x2, y1, y2;
/*
** Call this to get hal.c linked into the image, and HalInfoArray
** which is defined in hal.c and used by other HAL pieces.
*/
seGetHalVersion( &p1, &p2, &p3 );
printf("1355 Hal version %s\n", p1);
/*
** Register the device with the HAL
** NOTE: HalInfo is an instance of HAL_STRUCT and is defined
** in Appcfg.h
*/
if (seRegisterDevice(&HalInfo, &DevId) != ERR_OK)