Epson Research and Development
Page 79
Vancouver Design Center
Programming Notes and Examples
S1D13505
Issue Date: 01/02/05
X23A-G-003-07
For example, when building HELLOAPP.EXE for the x86 16-bit platform, you need the
HELLOAPP source files, the 13505HAL library and its include files, and some Standard C
library functions (which in this case would be supplied by the compiler as part of its run-
time library). As this is a DOS .EXE application, you do not need to supply start-up code
that sets up the chip selects or interrupts, etc... What if you wanted to build the application
for an SH-3 target, one not running DOS?
Before you can build that application to load onto the target, you need to build a C library
for the target that contains enough of the Standard C functions (like sprintf and strcpy) to
let you build the application. Epson supplies the LIBSE for this purpose, but your compiler
may come with one included. You also need to build the 13505HAL library for the target.
This library is the graphics chip dependent portion of the code. Finally, you need to build
the final application, linked together with the libraries described earlier. The following
examples assume that you have a copy of the complete source code for the S1D13505
utilities, including the nmake makefiles, as well as a copy of the GNU Compiler v2.7-96q3a
for Hitachi SH3. These are available on the Epson Electronics America Website at
http://www.eea.epson.com.
11.6.1 Building 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 specific code.
• makefiles that describe the build process to construct the library.
The C files are generic to all platforms, although there are some customizations for targets
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 jumps 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 board, 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 (TOOLDIR), enumerates the list of files that go into the
target and builds a .a library file as the output of the build process.
With nmake.exe in your path run:
nmake -fmakesh3.mk