Epson Research and Development Page 65
Vancouver Design Center
Programming Notes and Examples S1D13705
Issue Date: 02/01/22 X27A-G-002-03
9.5.1 Bu ilding the LIBSE library for SH3 target example
In the LIBSE files, there are three main types of files:
C files that contain the library functions.
assembler files that contain the target spec ific code.
makefiles that describe the build process to construct the library.
The C files are generic to all platforms, although there are some cust omizat ions f or t arget s
in the form of #ifdef LCEVBSH3 code (the ifdef used for the example SH3 target Low Cost
Eval Board SH3). The majority of this code remains constant whichever target you build
for.
The assembler files contain some platform setup code (stacks, chip selects) and j umps into
the main entry point of the C code that is contained in the C file entry.c. For our example,
the assembler file is STARTSH3.S and it performs only some stack setup and a jump into
the code at _mainEntry (entry.c).
In the embedded targets, printf (in file rprintf.c), putchar (putchar.c) and getch (kb.c)
resolve to serial character input/output. For SH3, much of the detail of handling serial IO
is hidden in the monitor of the evaluation b o ard, but in general the primitives are fairly
straight forward, providing the ability to get characters to/from the serial port.
For our target example, the nmake makefile is makesh3.mk. This makefile calls the Gnu
compiler at a specific location (TOOLDI R ), enumerates the list of files that go into t h e
target and builds a .a library file as the output of the build process.
With nmake.exe in your path run:
nmake -fmakesh3.mk
9.5.2 Building the HAL library for the target example
Building the HAL for the target example is l ess complex because the code is written in C
and requires little platform specific adj ustment. The nmake makefile for our examp le is
makesh3.mk.This makefile contains the rules for building sh3 objects, the files list for the
library and the library creation rules. The Gnu compiler tools are pointed to by TOOLDIR.
With nmake in your path run:
nmake -fmakesh3.mk