wiki:Projects/Expat

Expat

While exploring a more efficient way to port Apache to RTEMS, I am currently working with the RTEMS Addon Packages. One starter library to port is the Expat library. The Expat library is used by the Apache Runtime Utilities to parse XML.

Getting Expat

I checked out the CVS for Expat into the rtems-addon-packages folder:

~/rtems-addon-packages$ cvs -d:pserver:anonymous@expat.cvs.sourceforge.net:/cvsroot/expat login ~/rtems-addon-packages$ cvs -z3 -d:pserver:anonymous@expat.cvs.sourceforge.net:/cvsroot/expat co expat

rtems-addon-packages/RTEMS_MAKEFILES/Makefile.expat

Configures and makes the Expat library for RTEMS. This version is a modified version of the Makefile.ncurses.

The host is what many open-source projects use instead of a target. The libdir puts the Expat library in the same folder as the other RTEMS libraries, and static gives Expat the .a extension (to be uniform with the other RTEMS libraries).

include ../RTEMS_Makefiles/Makefile.common

# # The following will work only if you have the latest ncurses version # of infocmp installed before trying to build for an RTEMS target. # The cf_cv_type_of_bool hack works around a bug when configuring # for a cross-target. # all:

./configure \

--host=$(RTEMS_CPU)-rtems4.11 \ --prefix=$(exec_prefix) \ --libdir=$(exec_prefix)/$(RTEMS_BSP)/lib \ --includedir=$(exec_prefix)/$(RTEMS_BSP)/lib/include \ --enable-static

make make check make install

rtems-addon-packages/examples/expat/Makefile

Unlike examples/ncurses/Makefile, Expat has only one testing program, so no BuildTests?.sh was required.

# # $Id$ # # Templates/Makefile?.leaf # Template leaf node Makefile #

The source directory is a relative path to the expat library

SRCDIR=../../expat/tests

# C source names, if any, go here -- minus the .c

Because BuildTests?.sh was not used, each source was listed separately.

C_PIECES= init $(SRCDIR)/minicheck $(SRCDIR)/chardata $(SRCDIR)/runtests C_FILES=$(C_PIECES:%=%.c) C_O_FILES=$(C_PIECES:%=${ARCH}/%.o)

# C++ source names, if any, go here -- minus the .cc CC_PIECES=

CC_FILES=$(CC_PIECES:%=%.cc) CC_O_FILES=$(CC_PIECES:%=${ARCH}/%.o)

The header files for the test suite.

H_FILES= $(SRCDIR)/minicheck.h $(SRCDIR)/chardata.h

# Assembly source names, if any, go here -- minus the .s S_PIECES=

S_FILES=$(S_PIECES:%=%.s) S_O_FILES=$(S_FILES:%.s=${ARCH}/%.o)

SRCS=$(C_FILES) $(CC_FILES) $(H_FILES) $(S_FILES) OBJS=$(C_O_FILES) $(CC_O_FILES) $(S_O_FILES)

The program to turn into an executable.

PGMS=${ARCH}/expat.exe

# # RTEMS managers go here # MANAGERS=io event message semaphore

include $(RTEMS_MAKEFILE_PATH)/Makefile.inc include $(RTEMS_CUSTOM) include $(PROJECT_ROOT)/make/leaf.cfg

# # (OPTIONAL) Add local stuff here using +=

#

DEFINES +=

CPPFLAGS += -I$(SRCDIR) -I../$(SRCDIR) CFLAGS +=

LD_PATHS += $(RTEMS_MAKEFILE_PATH)/lib LD_LIBS += -lexpat

I opted not to increase the size for this execuatable, because Expat is a parser, not a server.

CFLAGS_LD += -Wl,--defsym -Wl,HeapSize?=0x200000 # network needs more space CFLAGS_DEBUG_V +=

# # Add your list of files to delete here. The config files # already know how to delete some stuff, so you may want # to just run 'make clean' first to see what gets missed. # 'make clobber' already includes 'make clean' #

CLEAN_ADDITIONS += CLOBBER_ADDITIONS +=

all: ${ARCH} $(SRCS) $(PGMS)

${ARCH}/expat.exe: ${OBJS} ${LINK_FILES}

$(make-exe)

# Install the program(s), appending _g or _p as appropriate. # for include files, just use $(INSTALL) install: all

$(INSTALL_VARIANT) -m 555 ${PGMS} /usr/local/tftpboot/bootfiles/m68360/

The next step would be to identify how to load the executable onto Qemu...

Last modified on Jun 21, 2012 at 9:11:15 PM Last modified on Jun 21, 2012, 9:11:15 PM