User`s manual
SDK 2 Programmer’s Guide Developing User Applications
3-4
Compiling and Linking your Application
Under PCG SDK, compiling and linking is done from DOS command mode. Because of this, you
will need to create a make file before compiling and linking a program.
Creating a Make File
For tcc.exe, the following parameters should be enabled or properly assigned.
-I – assign include files directory.
-L – assign library files directory.
-O – optimize jumps.
-Z – maximum register usage.
-1 – 80186/286 instructions.
-ml – large mode
-c – compile only
-w – enable all warnings
For tlink.exe, the following parameters should be enabled or properly assigned.
-s – detailed map of segment.
For instance, the make file for C:\PCGSDK2\Example\Serial\SDKser23.c is as follows.
C:\PCGSDK2\Example\Serial> type sdkser23.bat
tcc -I..\..\include -L..\..\library -O -Z -1 -ml -c -w SDKser23.c
tlink /s ..\..\library\C0sdk+SDKser23,SDKser23,SDKser23,..\..\library\moxa_sdk
*1. Please note that C0sdk.obj must be placed in the first position when linking object codes. If not,
the entry point of the program will be incorrect.
Generating an EXE file
You should be able to generate an EXE file after compiling and linking a program without
receiving any error messages. For example, after you run the make file, SDKser23.bat, in
C:\PCGSDK2\Example\Serial, the file SDKser23.exe is generated in the same directory.