C Development
EPOC supports C console applications using libc through the ESTLIB.dll provided
by Symbian as an add-on to the standard EPOC system.
This is freely available as an EPOC SIS installation file in zip format here. Its also
included on the Symbian C++ SDK.
I have been using three different options for developing C console applications for EPOC:
- The GNU gcc/cygwin C/C++ ARM710 cross-compiler for Windows - part of the Symbian ER5 C++ SDK.
- The epocemx package for C/C++ compilation on EPOC devices.
- The epocemx package for C/C++ compilation on Linux.
Symbian ER5 C++ SDK for Windows
A version of this SDK for the Psion Netbook/Netpad
is available free from PsionTeklogix
here. This very large download (94MB) includes the SDK files mentioned below.
The package runs under Windows and is intended for use with Microsoft's Visual C++ but can
be used without an IDE as I am doing here.
Part of the package comprises a version of GNU gcc and associated tools for compiling ARM710
target code for EPOC devices (Symbian refer to this as MARM). The sources for the GNU stuff can again be downloaded
from PsionTeklogix here.
My stripped down development environment for C libc development comprises
the following parts of the Symbian SDK:
- GNU Tools (\epoc32\gcc\bin\):
[These all rely upon cygwin.dll also in this directory]
- C/C++ compiler: gcc.exe (cpp.exe, cc1.exe, cc1plus.exe)
- Assembler: as.exe
- Linker: ld.exe
- Dlltool: dlltool.exe
- Symbian Tools (\epoc32\tools\):
- PE to EPOC executable converter: petran.exe
- Symbian Include Files (\epoc32\include\):
- libc header files: libc\*.h, libc\arpa\*.h, libc\machine\*.h, libc\netinet\*.h, libc\sys\*.h
- Symbian Library Files (\epoc32\release\MARM\Rel\):
- libc library file: estlib.lib
- E32 user library file (needed by estlib): euser.lib
- entrypoint object files: Ecrt0.o
- exe stub object file: Eexe.o
In addition I use a make project management tool downloaded from the internet:
- Microsoft nmake.exe (free download)
here):
or
- GNU/Cygwin make.exe here
The Microsoft nmake option is the simplest as its just a single file.
The Cygwin GNU make option is more complex as it has to be downloaded as part of a larger package.
(You get a bash shell too, though, so if you know how to drive Linux this is a better console
than the DOS prompt!)
Nmake and GNU make are not 100% compatible by any means but if you keep to the basic syntax
you can produce makefiles which work with either.
Epocemx
Epocemx is available here.
Epocemx consists of a basic set of GNU compiler tools (some modified) that will run
on an EPOC machine. The package includes a very nice bash like command shell for EPOC which is worth having
on its own!
To use the epocemx package the following files are needed from the Symbian C++ SDK:
- Symbian Include Files (\epoc32\include\):
- libc header files: libc\*.h, libc\arpa\*.h, libc\machine\*.h, libc\netinet\*.h, libc\sys\*.h
- Symbian Library Files (\epoc32\release\MARM\Rel\):
- libc library file: estlib.lib
- E32 user library file (needed by estlib): euser.lib
- entrypoint object file: Ecrt0.o
- exe stub object file: Eexe.o
Epocemx compiles on a Linux machine. This provides a Linux crosss-compiler which can also be used to compile
Epoc executables from C/C++ source. The libraries and headers are the same as thosed used for epocemx on Epoc.
Makefile
I have avoided any of the project management batchfiles or perl scripts used by Symbian in the SDK.
I am using a straightforward make file which will work for all the above options
(EPOC C++ SDK / EPOCEMX / nmake / GNU make).
#Universal Makefile for development
#with EPOC C++ SDK and EPOCEMX
OPTFLAGS=-fomit-frame-pointer -O
CPUFLAGS=-mapcs-32 -mshort-load-bytes -msoft-float -mcpu=arm710
WARNFLAGS=-Wall
OTHERFLAGS=-Wno-ctor-dtor-privacy -fcheck-new -fvtable-thunks
CCFLAGS=$(OPTFLAGS) $(CPUFLAGS) $(WARNFLAGS) $(OTHERFLAGS)
CCDEFS=-D__SYMBIAN32__ -D__PSISOFT32__ -D__GCC32__ -D__EPOC32__ -D__MARM__ \
-D__DLL__ -DNDEBUG -U__EPOCEMX_EMX__
LIBPATH=/usr/epocsdk/lib/
#-----------------------------
#
#Epoc estlib.dll shell app
ESTLIBS=$(LIBPATH)Ecrt0.o $(LIBPATH)estlib.lib
ESTSTARTUP=$(LIBPATH)EEXE.o
#Emx emx.dll shell app
EMXLIBS=/usr/lib/libemx.a
EMXSTARTUP=/usr/lib/emxexe.o
#
#------------------------------
#lpdclient
PROJ=lpdclient
SOURCE=lpdclient.c
LIBS=$(ESTLIBS) $(LIBPATH)euser.lib
STARTUP=$(ESTSTARTUP)
all : lpdclient.exe
#--------------------------
$(PROJ).o : $(SOURCE)
gcc -c $(SOURCE) -o $@ $(CCFLAGS) $(CCDEFS)
$(PROJ).exe : $(PROJ).o
ld -e _E32Startup --base-file $(PROJ).bas \
-o dump.tmp $(STARTUP) $(PROJ).o \
--no-whole-archive $(LIBS)
dlltool --output-exp $(PROJ).exp \
--base-file $(PROJ).bas $(STARTUP)
ld -e _E32Startup \
-o $(PROJ).pex $(PROJ).exp $(STARTUP) $(PROJ).o \
--no-whole-archive $(LIBS)
petran $(PROJ).pex $@ \
-nocall -uid1 0x1000007a -uid2 0x01000a00 -uid3 0x00000000
rm dump.tmp
rm $(PROJ).bas
rm $(PROJ).exp
rm $(PROJ).pex
|