DeviceMaster Software Developer Kit Sample Programs

The SDK contains several sample application sources. The sample programs are intended to illustrate how you can write programs to use the DeviceMaster. In some cases, you may be able to take portions of the sample source and implement in your application..

Two of the sample applications include web servers.

  • The demoSocketServer.tar.gz: file is the source tree for SocketServer, a simplified version of the default DeviceMaster application (including the GoAhead web server). See Building the SocketServer Sample Application for instructions on how to build the sample SocketServer server.

  • The goahead.tar.gz file is the source distribution for the GoAhead web server version 2.1. The source files have been modified in order to fix bugs, add features, and build/run on the DeviceMaster. See Building the GoAhead Webserver for instructions on how to build the webserver sample application.

The third sample application program, demo.tar.gz, contains two example eCos applications that demonstrate the use of the DeviceMaster serial driver and the DeviceMaster Ethernet driver. You can review documentation for the Comtrol serial and Ethernet drivers, and information on the two small sample applications netecho and serecho. See Building the eCos Sample Applications (Serial and Ethernet) for the build procedures.

Building the SocketServer Sample Application

The demoSocketServer.tar.gz file contains the source tree for SocketServer, which is a simplified version of the default DeviceMaster application (including the GoAhead web server).

Use the following procedure to build the sample SocketServer application.

  1. If you have not done so, unpack and install the pre-compiled eCos libraries. See Installing the Pre-Compiled (Binary) eCos Libraries.

    [Note]
    Note

    If you already have the eCos libraries installed, or if you built them from sources, you can skip this step, but you must modify the Makefile to point to the location of the eCos install directory.

  2. Copy the gzipped tar files containing the SocketServer source files to your hard disk. In the following example, they were copied to the user's home directory.

  3. Create a work directory. This example uses the ss-demo directory.

    $ mkdir ss-demo
    $ cd ss-demo

  4. Unpack the SocketServer sources.

    $ tar xzf ~/demoSocketServer.tar.gz

  5. Modify the Makefile so that the ECOS variable points to the install directory containing the eCos object libraries. In this example you should use ECOS = ../install.

  6. Build SocketServer.

    $ cd demoSocketServer
    $ make clean

    rm -f  socket.srec socket.bin socket.elf  *.o *~ *.lst *.map 
    \#*\# *.bin *.elf10 core *.bak .*~ for d in snmp socketServer webserv 
    webpages admin ; do make -C $d clean; done
    make[1]: Entering directory `/WORK/demoSocketServer/snmp'
    rm -f  *.o *~ *.lst *.map \#*\# *.bin *.elf10 core *.bak .*~
    make[1]: Leaving directory `/WORK/demoSocketServer/snmp'
    make[1]: Entering directory `/WORK/demoSocketServer/socketServer'
    rm -f  *.o *~ *.lst *.map \#*\# *.bin *.elf10 core *.bak .*~
    make[1]: Leaving directory `/WORK/demoSocketServer/socketServer'
    make[1]: Entering directory `/WORK/demoSocketServer/webserv'
    rm -f  *.o *~ *.lst *.map \#*\# *.bin *.elf10 core *.bak .*~
    make[1]: Leaving directory `/WORK/demoSocketServer/webserv'
    make[1]: Entering directory `/WORK/demoSocketServer/webpages'
    rm -f  *.o *~ *.lst *.map \#*\# *.bin *.elf10 core *.bak .*~
    make[1]: Leaving directory `/WORK/demoSocketServer/webpages'
    make[1]: Entering directory `/WORK/demoSocketServer/admin'
    rm -f  *.o *~ *.lst *.map \#*\# *.bin *.elf10 core *.bak .*~
    make[1]: Leaving directory `/WORK/demoSocketServer/admin'
    make -C goahead/ECOS clean
    make[1]: Entering directory `/WORK/demoSocketServer/goahead/ECOS'
    rm -f webs libwebs.a ../asp.d ../balloc.d ../base64.d ../default.d 
    ../ejlex.d ../ejparse.d ../form.d ../h.d ../handler.d ../mime.d ../misc.d 
    ../page.d ../ringq.d ../rom.d ../sock.d ../sockGen.d ../security.d
    ../sym.d ../uemf.d ../url.d ../value.d ../webs.d ../websuemf.d 
    ../websda.d ../md5c.d main.d webserv.d websupp.d 
    ../asp.o ../balloc.o ../base64.o ../default.o ../ejlex.o 
    ../ejparse.o ../form.o ../h.o ../handler.o ../mime.o ../misc.o 
    ../page.o ../ringq.o ../rom.o ../sock.o ../sockGen.o 
    ../security.o ../sym.o ../uemf.o ../url.o ../value.o
    ../webs.o ../websuemf.o ../websda.o ../md5c.o ../*.lst 
    rm -f main.o webrom.c webcomp web_files .depend *.lst
    make[1]: Leaving directory `/WORK/demoSocketServer/goahead/ECOS'
  7. Compile the source dependencies.

    $ make depend

    arm-elf-gcc -g -mcpu=arm7tdmi -mbig-endian  -M -I/WORK/
    demoSocketServer/../ecos-build/install/include -D__ECOS  
    main.c watchdog.cxx commands.c portmon.c >.srcdeps
    for d in snmp socketServer webserv webpages admin ; 
    do touch $d/.srcdeps; make -C $d depend; done
    make[1]: Entering directory `/WORK/demoSocketServer/snmp'
    gcc -M -I/WORK/demoSocketServer/../ecos-build/install
    /include -D__ECOS  snmp.c >.srcdeps
    make[1]: Leaving directory `/WORK/demoSocketServer/snmp'
    make[1]: Entering directory `/WORK/demoSocketServer/socketServer'
    gcc -M -I/WORK/demoSocketServer/../ecos-build/install/
    include -D__ECOS  server.c flash.c >.srcdeps
    make[1]: Leaving directory `/WORK/demoSocketServer/socketServer'
    make[1]: Entering directory `/WORK/demoSocketServer/webserv'
    gcc -M -I/WORK/demoSocketServer/../ecos-build/install
    /include -I/WORK/demoSocketServer/goahead -D__ECOS  
    -DWEBS -DUEMF -DWEBS_PAGE_ROM -DOS="eCos" 
    -DECOS -D__NO_FCNTL=1 -DDIGEST_ACCESS_SUPPORT 
    websupp.c webserv.c  telnetserv.c >.srcdeps
    make[1]: Leaving directory `/WORK/demoSocketServer/webserv'
    make[1]: Entering directory `/WORK/demoSocketServer/webpages'
    gcc -M -I/WORK/demoSocketServer/../ecos-build/install/include 
    -I/WORK/demoSocketServer/goahead -D__ECOS  -DWEBS 
    -DUEMF -DWEBS_PAGE_ROM -DOS="eCos" -DECOS 
    -D__NO_FCNTL=1 -DDIGEST_ACCESS_SUPPORT 
    webcomp.c >.srcdeps
    make[1]: Leaving directory `/WORK/demoSocketServer/webpages'
    make[1]: Entering directory `/WORK/demoSocketServer/admin'
    gcc -M -I/WORK/demoSocketServer/../ecos-build/install
    /include -D__ECOS  tadmin.c madmin.c >.srcdeps
    make[1]: Leaving directory `/WORK/demoSocketServer/admin'
  8. Perform a make to build the demo applications.

    $ make

    make -C snmp
    make[1]: Entering directory `/home/grante/comtrol/sdk/
    DeviceMaster_Apps/SocketServer/Source/demoSocketServer/snmp'
    arm-elf-gcc -g -mcpu=arm7tdmi -mbig-endian  -c -o snmp.o 
    -fverbose-asm -Wall -O2 -I/home/grante/comtrol/sdk
    /DeviceMaster_Apps/SocketServer/Source/demoSocketServer/
    ../ecos-build/install/include -D__ECOS  snmp.c
    cp snmp.o app.o
    make[1]: Leaving directory `/home/grante/comtrol/sdk/
    DeviceMaster_Apps/SocketServer/Source/demoSocketServer/snmp'
    make -C socketServer
    make[1]: Entering directory `/home/grante/comtrol/sdk/
    DeviceMaster_Apps/SocketServer/Source/demoSocketServer/socketServer'
    arm-elf-gcc -g -mcpu=arm7tdmi -mbig-endian  -c -o server.o 
    -fverbose-asm -Wall -O2 -I/home/grante/comtrol/sdk
    /DeviceMaster_Apps/SocketServer/Source/demoSocketServer/
    ../ecos-build/install/include -D__ECOS  server.c
    arm-elf-gcc -g -mcpu=arm7tdmi -mbig-endian  -c -o flash.o 
    -fverbose-asm -Wall -O2 -I/home/grante/comtrol/sdk/
    DeviceMaster_Apps/SocketServer/Source/demoSocketServer/
    ../ecos-build/install/include -D__ECOS  flash.c
    arm-elf-ld -EB -i -o app.o server.o flash.o
    make[1]: Leaving directory `/home/grante/comtrol/sdk/
    DeviceMaster_Apps/SocketServer/Source/demoSocketServer/socketServer'
    make -C webserv
    make[1]: Entering directory `/home/grante/comtrol/sdk/
    DeviceMaster_Apps/SocketServer/Source/demoSocketServer/webserv'
    arm-elf-gcc -g -mcpu=arm7tdmi -mbig-endian  -c -o webserv.o 
    -fverbose-asm -Wall -O2 -I/home/grante/comtrol/sdk/
    DeviceMaster_Apps/SocketServer/Source/demoSocketServer/
    ../ecos-build/install/include -I/home/grante/comtrol/sdk/
    DeviceMaster_Apps/SocketServer/Source/demoSocketServer
    /goahead -D__ECOS  -DWEBS -DUEMF -DWEBS_PAGE_ROM -DOS="eCos" 
    -DECOS -D__NO_FCNTL=1 -DDIGEST_ACCESS_SUPPORT webserv.c
    arm-elf-gcc -g -mcpu=arm7tdmi -mbig-endian  -c -o websupp.o 
    -fverbose-asm -Wall -O2 -I/home/grante/comtrol/sdk/
    DeviceMaster_Apps/SocketServer/Source/demoSocketServer/
    ../ecos-build/install/include -I/home/grante/comtrol/sdk/
    DeviceMaster_Apps/SocketServer/Source/demoSocketServer
    /goahead -D__ECOS  -DWEBS -DUEMF -DWEBS_PAGE_ROM 
    -DOS="eCos" -DECOS -D__NO_FCNTL=1 -DDIGEST_ACCESS
    _SUPPORT websupp.c
    arm-elf-gcc -g -mcpu=arm7tdmi -mbig-endian  -c -o telnetserv.o 
    -fverbose-asm -Wall -O2 -I/home/grante/comtrol/sdk/
    DeviceMaster_Apps/SocketServer/Source/demoSocketServer/
    ../ecos-build/install/include -I/home/grante/comtrol/sdk/
    DeviceMaster_Apps/SocketServer/Source/demoSocketServer
    /goahead -D__ECOS  -DWEBS -DUEMF -DWEBS_PAGE_ROM 
    -DOS="eCos" -DECOS -D__NO_FCNTL=1 -DDIGEST_ACCESS
    _SUPPORT telnetserv.c
    arm-elf-ld -EB -i -o app.o webserv.o websupp.o telnetserv.o
    make[1]: Leaving directory `/home/grante/comtrol/sdk/
    DeviceMaster_Apps/SocketServer/Source/demoSocketServer/webserv'
    make -C webpages
    make[1]: Entering directory `/home/grante/comtrol/sdk/
    DeviceMaster_Apps/SocketServer/Source/demoSocketServer/webpages'
    gcc -o webcomp -O2 -I ../goahead -DWEBS -DUEMF  -DUNIX  webcomp.c
    webcomp.c: In function 'compile':
    webcomp.c:121: warning: comparison of distinct pointer types lacks a 
    cast echo root/images/blackbanner.gif root/images/DMLogo.jpg root/images
    /ecos-logo.gif root/images/goahead-logo.gif root/images/DMAirLogo.jpg 
    root/editPort.asp root/home.asp root/netCfg.asp root/netSaved.asp 
    root/portSaved.asp root/resetUnit.asp root/style.css | tr ' ' '\n' 
    > web_files
    ./webcomp root web_files >webrom.c
    arm-elf-gcc -g -mcpu=arm7tdmi -mbig-endian  -c -o webrom.o 
    -fverbose-asm -Wall -O2 -I/home/grante/comtrol/sdk/DeviceMaster_Apps
    /SocketServer/Source/demoSocketServer/../ecos-build/install/include 
    -I/home/grante/comtrol/sdk/DeviceMaster_Apps/SocketServer/Source
    /demoSocketServer/goahead -D__ECOS  -DWEBS -DUEMF 
    -DWEBS_PAGE_ROM -DOS="eCos" -DECOS -D__NO_FCNTL=1 
    -DDIGEST_ACCESS_SUPPORT webrom.c
    cp webrom.o app.o
    make[1]: Leaving directory `/home/grante/comtrol/sdk/DeviceMaster_Apps/
    SocketServer/Source/demoSocketServer/webpages'
    make -C admin
    make[1]: Entering directory `/home/grante/comtrol/sdk/DeviceMaster_Apps/
    SocketServer/Source/demoSocketServer/admin'
    arm-elf-gcc -g -mcpu=arm7tdmi -mbig-endian  -c -o tadmin.o 
    -fverbose-asm -Wall -O2 -I/home/grante/comtrol/sdk/DeviceMaster_Apps
    /SocketServer/Source/demoSocketServer/../ecos-build/install/include 
    -D__ECOS  tadmin.c arm-elf-gcc -g -mcpu=arm7tdmi -mbig-endian  -c -o madmin.o 
    -fverbose-asm -Wall -O2 -I/home/grante/comtrol/sdk/DeviceMaster_Apps
    /SocketServer/Source/demoSocketServer/../ecos-build/install
    /include -D__ECOS  madmin.c
    arm-elf-ld -EB -r -o app.o tadmin.o madmin.o
    make[1]: Leaving directory `/home/grante/comtrol/sdk/DeviceMaster_Apps/
    SocketServer/Source/demoSocketServer/admin'
    make -C goahead/ECOS
    make[1]: Entering directory `/home/grante/comtrol/sdk/DeviceMaster_Apps/
    SocketServer/Source/demoSocketServer/goahead/ECOS'
    arm-elf-gcc -g -mcpu=arm7tdmi -mbig-endian -c -o ../asp.o 
    -fverbose-asm -Wa,-ahlsn=../asp.lst -I -O2 -D__ECOS -DWEBS 
    -DUEMF -DWEBS_PAGE_ROM -DDIGEST_ACCESS_SUPPORT 
    -DOS="eCos" -DECOS -D__ECOS -D__NO_FCNTL=1 -I.. 
    -Wall -I/home/grante/comtrol/sdk/DeviceMaster_Apps/SocketServer/
    Source/demoSocketServer/../ecos-build/install/include -ffunction-sections 
    -fdata-sections -Wp,-MD,../asp.d ../asp.c
    arm-elf-gcc -g -mcpu=arm7tdmi -mbig-endian -c -o ../balloc.o 
    -fverbose-asm -Wa,-ahlsn=../balloc.lst -I -O2 -D__ECOS 
    -DWEBS -DUEMF -DWEBS_PAGE_ROM -DDIGEST_
    ACCESS_SUPPORT -DOS="eCos" -DECOS -D__
    ECOS -D__NO_FCNTL=1 -I.. -Wall -I/home/grante/comtrol/
    sdk/DeviceMaster_Apps/SocketServer/Source/demoSocketServer/
    ../ecos-build/install/include -ffunction-sections -fdata-sections 
    -Wp,-MD,../balloc.d ../balloc.c
    arm-elf-gcc -g -mcpu=arm7tdmi -mbig-endian -c -o ../base64.o 
    -fverbose-asm -Wa,-ahlsn=../base64.lst -I -O2 -D__ECOS 
    -DWEBS -DUEMF -DWEBS_PAGE_ROM -DDIGEST_ACCESS
    _SUPPORT -DOS="eCos" -DECOS -D__ECOS -D__NO_
    FCNTL=1 -I.. -Wall -I/home/grante/comtrol/sdk/DeviceMaster_Apps
    /SocketServer/Source/demoSocketServer/../ecos-build/install/
    include -ffunction-sections -fdata-sections -Wp,-MD,
    ../base64.d ../base64.c
    arm-elf-gcc -g -mcpu=arm7tdmi -mbig-endian -c -o ../default.o 
    -fverbose-asm -Wa,-ahlsn=../default.lst -I -O2 -D__ECOS 
    -DWEBS -DUEMF -DWEBS_PAGE_ROM -DDIGEST_ACCESS_
    SUPPORT -DOS="eCos" -DECOS -D__ECOS -D__NO_FCNTL=1 
    -I.. -Wall -I/home/grante/comtrol/sdk/DeviceMaster_Apps/
    SocketServer/Source/demoSocketServer/../ecos-build
    /install/include -ffunction-sections -fdata-sections -Wp,-MD,
    ../default.d ../default.c
    arm-elf-gcc -g -mcpu=arm7tdmi -mbig-endian -c -o ../ejlex.o 
    -fverbose-asm -Wa,-ahlsn=../ejlex.lst -I -O2 -D__ECOS 
    -DWEBS -DUEMF -DWEBS_PAGE_ROM -DDIGEST_ACCESS_
    SUPPORT -DOS="eCos" -DECOS -D__ECOS -D__NO_FCNTL=1
    -I.. -Wall -I/home/grante/comtrol/sdk/DeviceMaster_Apps/
    SocketServer/Source/demoSocketServer/../ecos-build/install
    /include -ffunction-sections -fdata-sections -Wp,-MD,../ejlex.d ../ejlex.c
    arm-elf-gcc -g -mcpu=arm7tdmi -mbig-endian -c -o ../ejparse.o 
    -fverbose-asm -Wa,-ahlsn=../ejparse.lst -I -O2 -D__ECOS 
    -DWEBS -DUEMF -DWEBS_PAGE_ROM -DDIGEST_ACCESS
    _SUPPORT -DOS="eCos" -DECOS -D__ECOS -D__NO_FCNTL=1
    -I.. -Wall -I/home/grante/comtrol/sdk/DeviceMaster_Apps/
    SocketServer/Source/demoSocketServer/../ecos-build/install/
    include -ffunction-sections -fdata-sections -Wp,-MD,../ejparse.d ../ejparse.c
    arm-elf-gcc -g -mcpu=arm7tdmi -mbig-endian -c -o ../form.o 
    -fverbose-asm -Wa,-ahlsn=../form.lst -I -O2 -D__ECOS 
    -DWEBS -DUEMF -DWEBS_PAGE_ROM -DDIGEST_
    ACCESS_SUPPORT -DOS="eCos" -DECOS -D__ECOS 
    -D__NO_FCNTL=1 -I.. -Wall -I/home/grante/comtrol/sdk/
    DeviceMaster_Apps/SocketServer/Source/demoSocketServer/
    ../ecos-build/install/include -ffunction-sections -fdata-sections 
    -Wp,-MD,../form.d ../form.c
    arm-elf-gcc -g -mcpu=arm7tdmi -mbig-endian -c -o ../h.o 
    -fverbose-asm -Wa,-ahlsn=../h.lst -I -O2 -D__ECOS -DWEBS 
    -DUEMF -DWEBS_PAGE_ROM -DDIGEST_ACCESS_
    SUPPORT -DOS="eCos" -DECOS -D__ECOS -D__NO_FCNTL=1 
    -I.. -Wall -I/home/grante/comtrol/sdk/DeviceMaster_Apps/
    SocketServer/Source/demoSocketServer/../ecos-build/install
    /include -ffunction-sections -fdata-sections -Wp,-MD,../h.d ../h.c
    arm-elf-gcc -g -mcpu=arm7tdmi -mbig-endian -c -o ../handler.o 
    -fverbose-asm -Wa,-ahlsn=../handler.lst -I -O2 -D__ECOS 
    -DWEBS -DUEMF -DWEBS_PAGE_ROM -DDIGEST_ACCESS
    _SUPPORT -DOS="eCos" -DECOS -D__ECOS -D__NO_FCNTL=1 
    -I.. -Wall -I/home/grante/comtrol/sdk/DeviceMaster_Apps/
    SocketServer/Source/demoSocketServer/../ecos-build/install/
    include -ffunction-sections -fdata-sections -Wp,-MD
    ,../handler.d ../handler.c
    arm-elf-gcc -g -mcpu=arm7tdmi -mbig-endian -c -o ../mime.o 
    -fverbose-asm -Wa,-ahlsn=../mime.lst -I -O2 -D__ECOS -DWEBS 
    -DUEMF -DWEBS_PAGE_ROM -DDIGEST_ACCESS_SUPPORT 
    -DOS="eCos" -DECOS -D__ECOS -D__NO_FCNTL=1
    -I.. -Wall -I/home/grante/comtrol/sdk/DeviceMaster_Apps/
    SocketServer/Source/demoSocketServer/../ecos-build/install
    /include -ffunction-sections -fdata-sections -Wp,-MD,../mime.d ../mime.c
    arm-elf-gcc -g -mcpu=arm7tdmi -mbig-endian -c -o ../misc.o 
    -fverbose-asm -Wa,-ahlsn=../misc.lst -I -O2 -D__ECOS 
    -DWEBS -DUEMF -DWEBS_PAGE_ROM -DDIGEST_ACCESS
    _SUPPORT -DOS="eCos" -DECOS -D__ECOS -D__NO_FCNTL=1 
    -I.. -Wall -I/home/grante/comtrol/sdk/DeviceMaster_Apps/
    SocketServer/Source/demoSocketServer/../ecos-build/install/
    include -ffunction-sections -fdata-sections -Wp,-MD,../misc.d ../misc.c
    ../misc.c: In function `gstrtoi':
    ../misc.c:662: warning: implicit declaration of function `atoi'
    arm-elf-gcc -g -mcpu=arm7tdmi -mbig-endian -c -o ../page.o 
    -fverbose-asm -Wa,-ahlsn=../page.lst -I -O2 -D__ECOS -DWEBS 
    -DUEMF -DWEBS_PAGE_ROM -DDIGEST_ACCESS_SUPPORT 
    -DOS="eCos" -DECOS -D__ECOS -D__NO_FCNTL=1 -I.. 
    -Wall -I/home/grante/comtrol/sdk/DeviceMaster_Apps/
    SocketServer/Source/demoSocketServer/../ecos-build/install
    /include -ffunction-sections -fdata-sections -Wp,-MD,../page.d ../page.c
    arm-elf-gcc -g -mcpu=arm7tdmi -mbig-endian -c -o ../ringq.o 
    -fverbose-asm -Wa,-ahlsn=../ringq.lst -I -O2 -D__ECOS -DWEBS
    -DUEMF -DWEBS_PAGE_ROM -DDIGEST_ACCESS_SUPPORT
    -DOS="eCos" -DECOS -D__ECOS -D__NO_FCNTL=1 -I.. -Wall 
    -I/home/grante/comtrol/sdk/DeviceMaster_Apps/SocketServer/
    Source/demoSocketServer/../ecos-build/install/include 
    -ffunction-sections -fdata-sections -Wp,-MD,../ringq.d ../ringq.c
    arm-elf-gcc -g -mcpu=arm7tdmi -mbig-endian -c -o ../rom.o 
    -fverbose-asm -Wa,-ahlsn=../rom.lst -I -O2 -D__ECOS 
    -DWEBS -DUEMF -DWEBS_PAGE_ROM -DDIGEST_
    ACCESS_SUPPORT -DOS="eCos" -DECOS -D__ECOS 
    -D__NO_FCNTL=1 -I.. -Wall -I/home/grante/comtrol/sdk/
    DeviceMaster_Apps/SocketServer/Source/demoSocketServer
    /../ecos-build/install/include -ffunction-sections -fdata-sections 
    -Wp,-MD,../rom.d ../rom.c
    arm-elf-gcc -g -mcpu=arm7tdmi -mbig-endian -c -o ../sock.o 
    -fverbose-asm -Wa,-ahlsn=../sock.lst -I -O2 -D__ECOS 
    -DWEBS -DUEMF -DWEBS_PAGE_ROM -DDIGEST_
    ACCESS_SUPPORT -DOS="eCos" -DECOS -D__ECOS 
    -D__NO_FCNTL=1 -I.. -Wall -I/home/grante/comtrol/sdk/
    DeviceMaster_Apps/SocketServer/Source/demoSocketServer
    /../ecos-build/install/include -ffunction-sections -fdata-sections 
    -Wp,-MD,../sock.d ../sock.c
    ../sock.c: In function `socketDoOutput':
    ../sock.c:506: warning: implicit declaration of function `inet_addr'
    arm-elf-gcc -g -mcpu=arm7tdmi -mbig-endian -c -o ../sockGen.o 
    -fverbose-asm -Wa,-ahlsn=../sockGen.lst -I -O2 -D__ECOS -DWEBS 
    -DUEMF -DWEBS_PAGE_ROM -DDIGEST_ACCESS_SUPPORT 
    -DOS="eCos" -DECOS -D__ECOS -D__NO_FCNTL=1 -I.. -Wall 
    -I/home/grante/comtrol/sdk/DeviceMaster_Apps/SocketServer
    /Source/demoSocketServer/../ecos-build/install/include 
    -ffunction-sections -fdata-sections -Wp,-MD,../sockGen.d ../sockGen.c
    ../sockGen.c: In function `socketOpenConnection':
    ../sockGen.c:134: warning: implicit declaration of function `inet_addr'
    ../sockGen.c: In function `socketAccept':
    ../sockGen.c:359: warning: passing arg 3 of `accept' 
    from incompatible pointer type
    ../sockGen.c: In function `socketSelect':
    ../sockGen.c:704: warning: unused variable `len'
    ../sockGen.c:704: warning: unused variable `nwords'
    arm-elf-gcc -g -mcpu=arm7tdmi -mbig-endian -c -o ../security.o 
    -fverbose-asm -Wa,-ahlsn=../security.lst -I -O2 -D__ECOS 
    -DWEBS -DUEMF -DWEBS_PAGE_ROM -DDIGEST_ACCESS
    _SUPPORT -DOS="eCos" -DECOS -D__ECOS -D__NO_FCNTL=1 
    -I.. -Wall -I/home/grante/comtrol/sdk/DeviceMaster_Apps/
    SocketServer/Source/demoSocketServer/../ecos-build/install/include
    -ffunction-sections -fdata-sections -Wp,-MD,../security.d ../security.c
    arm-elf-gcc -g -mcpu=arm7tdmi -mbig-endian -c -o ../sym.o 
    -fverbose-asm -Wa,-ahlsn=../sym.lst -I -O2 -D__ECOS -DWEBS 
    -DUEMF -DWEBS_PAGE_ROM -DDIGEST_ACCESS_SUPPORT 
    -DOS="eCos" -DECOS -D__ECOS -D__NO_FCNTL=1 -I.. -Wall
     -I/home/grante/comtrol/sdk/DeviceMaster_Apps/SocketServer
    /Source/demoSocketServer/../ecos-build/install/include 
    -ffunction-sections -fdata-sections -Wp,-MD,../sym.d ../sym.c
    arm-elf-gcc -g -mcpu=arm7tdmi -mbig-endian -c -o ../uemf.o 
    -fverbose-asm -Wa,-ahlsn=../uemf.lst -I -O2 -D__ECOS -DWEBS 
    -DUEMF -DWEBS_PAGE_ROM -DDIGEST_ACCESS_SUPPORT 
    -DOS="eCos" -DECOS -D__ECOS -D__NO_FCNTL=1 -I.. -Wall
    -I/home/grante/comtrol/sdk/DeviceMaster_Apps/SocketServer/
    Source/demoSocketServer/../ecos-build/install/include 
    -ffunction-sections -fdata-sections -Wp,-MD,../uemf.d ../uemf.c
    arm-elf-gcc -g -mcpu=arm7tdmi -mbig-endian -c -o ../url.o 
    -fverbose-asm -Wa,-ahlsn=../url.lst -I -O2 -D__ECOS -DWEBS 
    -DUEMF -DWEBS_PAGE_ROM -DDIGEST_ACCESS_SUPPORT 
    -DOS="eCos" -DECOS -D__ECOS -D__NO_FCNTL=1 -I.. -Wall 
    -I/home/grante/comtrol/sdk/DeviceMaster_Apps/SocketServer/
    Source/demoSocketServer/../ecos-build/install/include 
    -ffunction-sections -fdata-sections -Wp,-MD,../url.d ../url.c
    arm-elf-gcc -g -mcpu=arm7tdmi -mbig-endian -c -o ../value.o 
    -fverbose-asm -Wa,-ahlsn=../value.lst -I -O2 -D__ECOS -DWEBS 
    -DUEMF -DWEBS_PAGE_ROM -DDIGEST_ACCESS_SUPPORT 
    -DOS="eCos" -DECOS -D__ECOS -D__NO_FCNTL=1 -I.. -Wall 
    -I/home/grante/comtrol/sdk/DeviceMaster_Apps/SocketServer/
    Source/demoSocketServer/../ecos-build/install/include 
    -ffunction-sections -fdata-sections -Wp,-MD,../value.d ../value.c
    arm-elf-gcc -g -mcpu=arm7tdmi -mbig-endian -c -o ../webs.o 
    -fverbose-asm -Wa,-ahlsn=../webs.lst -I -O2 -D__ECOS -DWEBS 
    -DUEMF -DWEBS_PAGE_ROM -DDIGEST_ACCESS_SUPPORT 
    -DOS="eCos" -DECOS -D__ECOS -D__NO_FCNTL=1 -I.. -Wall 
    -I/home/grante/comtrol/sdk/DeviceMaster_Apps/SocketServer/
    Source/demoSocketServer/../ecos-build/install/include 
    -ffunction-sections -fdata-sections -Wp,-MD,../webs.d ../webs.c
    arm-elf-gcc -g -mcpu=arm7tdmi -mbig-endian -c -o ../websuemf.o 
    -fverbose-asm -Wa,-ahlsn=../websuemf.lst -I -O2 -D__ECOS -DWEBS 
    -DUEMF -DWEBS_PAGE_ROM -DDIGEST_ACCESS_SUPPORT 
    -DOS="eCos" -DECOS -D__ECOS -D__NO_FCNTL=1 -I.. -Wall 
    -I/home/grante/comtrol/sdk/DeviceMaster_Apps/SocketServer/
    Source/demoSocketServer/../ecos-build/install/include 
    -ffunction-sections -fdata-sections -Wp,-MD,../websuemf.d ../websuemf.c
    arm-elf-gcc -g -mcpu=arm7tdmi -mbig-endian -c -o ../websda.o 
    -fverbose-asm -Wa,-ahlsn=../websda.lst -I -O2 -D__ECOS -DWEBS
    -DUEMF -DWEBS_PAGE_ROM -DDIGEST_ACCESS_SUPPORT 
    -DOS="eCos" -DECOS -D__ECOS -D__NO_FCNTL=1 -I.. -Wall 
    -I/home/grante/comtrol/sdk/DeviceMaster_Apps/SocketServer/
    Source/demoSocketServer/../ecos-build/install/include 
    -ffunction-sections -fdata-sections -Wp,-MD,../websda.d ../websda.c
    In file included from ../websda.c:24:
    ./md5.h:48:20: warning: no newline at end of file
    arm-elf-gcc -g -mcpu=arm7tdmi -mbig-endian -c -o ../md5c.o 
    -fverbose-asm -Wa,-ahlsn=../md5c.lst -I -O2 -D__ECOS -DWEBS 
    -DUEMF -DWEBS_PAGE_ROM -DDIGEST_ACCESS_SUPPORT 
    -DOS="eCos" -DECOS -D__ECOS -D__NO_FCNTL=1 -I.. -Wall 
    -I/home/grante/comtrol/sdk/DeviceMaster_Apps/SocketServer/
    Source/demoSocketServer/../ecos-build/install/include 
    -ffunction-sections -fdata-sections -Wp,-MD,../md5c.d ../md5c.c
    In file included from ../md5c.c:26:
    ./md5.h:48:20: warning: no newline at end of file
    arm-elf-ar rv libwebs.a ../asp.o ../balloc.o ../base64.o 
    ../default.o ../ejlex.o ../ejparse.o ../form.o ../h.o ../handler.o 
    ../mime.o ../misc.o ../page.o ../ringq.o ../rom.o ../sock.o
    ../sockGen.o ../security.o ../sym.o ../uemf.o ../url.o ../value.o
    ../webs.o ../websuemf.o ../websda.o ../md5c.o
    a - ../asp.o
    a - ../balloc.o
    a - ../base64.o
    a - ../default.o
    a - ../ejlex.o
    a - ../ejparse.o
    a - ../form.o
    a - ../h.o
    a - ../handler.o
    a - ../mime.o
    a - ../misc.o
    a - ../page.o
    a - ../ringq.o
    a - ../rom.o
    a - ../sock.o
    a - ../sockGen.o
    a - ../security.o
    a - ../sym.o
    a - ../uemf.o
    a - ../url.o
    a - ../value.o
    a - ../webs.o
    a - ../websuemf.o
    a - ../websda.o
    a - ../md5c.o
    make[1]: Leaving directory `/home/grante/comtrol/
    sdk/DeviceMaster_Apps/SocketServer/Source/
    demoSocketServer/goahead/ECOS'
    make binaries
    make[1]: Entering directory `/home/grante/comtrol/
    sdk/DeviceMaster_Apps/SocketServer/Source/
    demoSocketServer'
    arm-elf-gcc -g -mcpu=arm7tdmi -mbig-endian  -c -o main.o
    -fverbose-asm -Wall -O2 -D__ECOS  -I/home/grante/comtrol
    /sdk/DeviceMaster_Apps/SocketServer/Source/
    demoSocketServer/../ecos-build/install/include main.c
    arm-elf-as --gstabs -EB -m arm7tdmi -amhlsnd=boot.lst 
    -o boot.o boot.s
    arm-elf-gcc -g -mcpu=arm7tdmi -mbig-endian 
    -c -o watchdog.o 
    -fverbose-asm -Wall -O2 -D__ECOS  -I/home
    grante/comtrol/sdk/DeviceMaster_Apps/
    SocketServer/Source/demoSocketServer/../
    ecos-build/install/include watchdog.cxx
    arm-elf-gcc -g -mcpu=arm7tdmi -mbig-endian 
    -c -o commands.o 
    -fverbose-asm -Wall -O2 -D__ECOS  -I/home
    /grante/comtrol/sdk/DeviceMaster_Apps/
    SocketServer/Source/demoSocketServer/
    ../ecos-build/install/include commands.c
    arm-elf-gcc -g -mcpu=arm7tdmi -mbig-endian  
    -c -o portmon.o 
    -fverbose-asm -Wall -O2 -D__ECOS  -I/home/
    grante/comtrol/sdk/DeviceMaster_Apps/
    SocketServer/Source/demoSocketServer
    /../ecos-build/install/include portmon.c
    echo "char linkTimeStamp[] = \"`date`\";" 
    >linkTimeStamp.c
    arm-elf-gcc -g -mcpu=arm7tdmi -mbig-endian  -c linkTimeStamp.c
    arm-elf-gcc -g -mcpu=arm7tdmi -mbig-endian 
    -Wl,-Map,socket.elf.map -nostartfiles -L/home/grante/
    comtrol/sdk/DeviceMaster_Apps/SocketServer/Source
    demoSocketServer/../ecos-build/install/lib -Wl,--gc-sections 
    -o socket.elf main.o boot.o watchdog.o commands.o 
    portmon.o snmp/app.o webserv/app.o webpages/app.o
     goahead/ECOS/libwebs.a socketServer/app.o  admin
    /app.o linkTimeStamp.o -Ttarget.ld -nostdlib
    arm-elf-objcopy -O srec socket.elf socket.srec
    arm-elf-objcopy -O binary socket.elf socket.bin
    make[1]: Leaving directory `/home/grante/comtrol/
    sdk/DeviceMaster_Apps/SocketServer/Source/
    demoSocketServer'
  9. Verify that the installation files copied.

    $ ls -l

    total 9324
    -rwxr-xr-x 1 grante users    2428 Jan  1 11:07 Makefile
    drwxr-xr-x 2 grante users    4096 Jan  1 11:10 admin
    -rwxr-xr-x 1 grante users     843 Jun  3  2004 assert.h
    -rw-r--r-- 1 grante users     323 Jan  1 11:10 boot.lst
    -rw-r--r-- 1 grante users     828 Jan  1 11:10 boot.o
    -rwxr-xr-x 1 grante users     138 Jun  3  2004 boot.s
    -rwxr-xr-x 1 grante users   16555 Jun  3  2004 commands.c
    -rwxr-xr-x 1 grante users     768 Jun  3  2004 commands.h
    -rw-r--r-- 1 grante users   37292 Jan  1 11:10 commands.o
    -rwxr-xr-x 1 grante users    4030 Apr  7  2004 dbgthreads.cxx
    -rwxr-xr-x 1 grante users    2089 Apr  7  2004 dm.README
    -rwxr-xr-x 1 grante users    2153 Jun 29  2004 dm.h
    drwxr-xr-x 9 grante users    4096 Jan  1 11:10 goahead
    -rwxr-xr-x 1 grante users     562 Jun  3  2004 ident.h
    -rw-r--r-- 1 grante users      55 Jan  1 11:10 linkTimeStamp.c
    -rw-r--r-- 1 grante users    1704 Jan  1 11:10 linkTimeStamp.o
    -rw-r--r-- 1 grante users       0 Jan  1 11:11 ls.out
    -rwxr-xr-x 1 grante users   14505 Jun 29  2004 main.c
    -rw-r--r-- 1 grante users   50952 Jan  1 11:10 main.o
    -rw-r--r-- 1 grante users   18060 Jan  1 11:10 make.out
    -rwxr-xr-x 1 grante users     198 Apr  7  2004 memconfig.ld
    -rwxr-xr-x 1 grante users     997 Apr  7  2004 memconfigDRAM0_Flash100.s
    drwxr-xr-x 2 grante users    4096 Jul  2  2004 myextension
    -rwxr-xr-x 1 grante users    4130 Jun  3  2004 portmon.c
    -rw-r--r-- 1 grante users   35084 Jan  1 11:10 portmon.o
    drwxr-xr-x 2 grante users    4096 Jan  1 11:10 snmp
    -rwxr-xr-x 1 grante users  639076 Jan  1 11:10 socket.bin
    -rwxr-xr-x 1 grante users 5627800 Jan  1 11:10 socket.elf
    -rw-r--r-- 1 grante users 1133670 Jan  1 11:10 socket.elf.map
    -rwxr-xr-x 1 grante users 1835046 Jan  1 11:10 socket.srec
    drwxr-xr-x 2 grante users    4096 Jan  1 11:10 socketServer
    -rwxr-xr-x 1 grante users    3247 Jun  3  2004 state.h
    -rwxr-xr-x 1 grante users     447 Jun  3  2004 watchdog.cxx
    -rwxr-xr-x 1 grante users     112 Jun  3  2004 watchdog.h
    -rw-r--r-- 1 grante users    5392 Jan  1 11:10 watchdog.o
    drwxr-xr-x 3 grante users    4096 Jan  1 11:10 webpages
    drwxr-xr-x 2 grante users    4096 Jan  1 11:10 webserv

You may download the resulting ELF binary (the file named socket.elf) using GDB, or use RedBoot to load the binary (socket.bin) or S-Record (socket.srec) versions of the file. See Downloading a Program to locate procedures for downloading files into the DeviceMaster.

Building the GoAhead WebServer

The goahead.tar.gz file contains the source distribution for the GoAhead web server version 2.1. The source files have been modified to:

  • Fix bugs

  • Add features

  • Build/run on DeviceMaster

Use the following procedure to build the sample demo server.

[Note]
Note

Before you perform this procedure, you should closely review the GoAhead WebServer License.

  1. If you have not done so, unpack and install the pre-compiled eCos libraries. See Installing the Pre-Compiled (Binary) eCos Libraries.

    [Note]
    Note

    If you already have the eCos libraries installed, or if you built them from sources, you can skip this step, but you must edit the Makefile and change the value of PKG_INSTALL_DIR so that it contains the path of the eCos install directory.

  2. Copy the GoAhead source files to your hard disk. In this example, they were copied to the user's home directory.

  3. Create a work directory, in this example, we-demo.

    $ mkdir ws-demo
    $ cd ws-demo

  4. Unpack the GoAhead sources.

    $ tar xzf ~/goahead.tar.gz

  5. Build the demonstration web server.

    $ cd goahead/ECOS

  6. Compile the sample program.

    $ make

    arm-elf-as --gstabs -EB -m arm7tdmi   -o boot.o boot.s
    arm-elf-gcc -g -mcpu=arm7tdmi -mbig-endian -c 
    -o ../asp.o -fverbose-asm -I -O2 -D__ECOS -DWEBS -DUEMF 
    -DWEBS_PAGE_ROM -DDIGEST_ACCESS_SUPPORT 
    -DOS="eCos" -DECOS -D__ECOS -D__NO_FCNTL=1 
    -I.. -Wall -I../../install/include -ffunction-sections 
    -fdata-sections -Wp,-MD,../asp.d ../asp.c
    arm-elf-gcc -g -mcpu=arm7tdmi -mbig-endian -c 
    -o ../balloc.o -fverbose-asm -I -O2 -D__ECOS -DWEBS -DUEMF 
    -DWEBS_PAGE_ROM -DDIGEST_ACCESS_SUPPORT 
    -DOS="eCos" -DECOS -D__ECOS -D__NO_FCNTL=1
    -I.. -Wall -I../../install/include -ffunction-sections 
    -fdata-sections -Wp,-MD,../balloc.d ../balloc.c
    arm-elf-gcc -g -mcpu=arm7tdmi -mbig-endian -c 
    -o ../base64.o -fverbose-asm -I -O2 -D__ECOS -DWEBS -DUEMF 
    -DWEBS_PAGE_ROM -DDIGEST_ACCESS_SUPPORT 
    -DOS="eCos" -DECOS -D__ECOS -D__NO_FCNTL=1 
    -I.. -Wall -I../../install/include -ffunction-sections 
    -fdata-sections -Wp,-MD,../base64.d ../base64.c
    arm-elf-gcc -g -mcpu=arm7tdmi -mbig-endian -c 
    -o ../default.o -fverbose-asm -I -O2 -D__ECOS -DWEBS -DUEMF 
    -DWEBS_PAGE_ROM -DDIGEST_ACCESS_SUPPORT 
    -DOS="eCos" -DECOS -D__ECOS -D__NO_FCNTL=1 
    -I.. -Wall -I../../install/include -ffunction-sections 
    -fdata-sections -Wp,-MD,../default.d ../default.c
    arm-elf-gcc -g -mcpu=arm7tdmi -mbig-endian -c 
    -o ../ejlex.o -fverbose-asm -I -O2 -D__ECOS -DWEBS -DUEMF 
    -DWEBS_PAGE_ROM -DDIGEST_ACCESS_SUPPORT
    -DOS="eCos" -DECOS -D__ECOS -D__NO_FCNTL=1 
    -I.. -Wall -I../../install/include -ffunction-sections 
    -fdata-sections -Wp,-MD,../ejlex.d ../ejlex.c
    arm-elf-gcc -g -mcpu=arm7tdmi -mbig-endian -c 
    -o ../ejparse.o -fverbose-asm -I -O2 -D__ECOS 
    -DWEBS -DUEMF 
    -DWEBS_PAGE_ROM -DDIGEST_ACCESS_SUPPORT 
    -DOS="eCos" -DECOS -D__ECOS -D__NO_FCNTL=1 
    -I.. -Wall -I../../install/include -ffunction-sections 
    -fdata-sections -Wp,-MD,../ejparse.d ../ejparse.c
    arm-elf-gcc -g -mcpu=arm7tdmi -mbig-endian -c 
     -o ../form.o -fverbose-asm -I -O2 -D__ECOS -DWEBS -DUEMF 
    -DWEBS_PAGE_ROM -DDIGEST_ACCESS_SUPPORT 
    -DOS="eCos" -DECOS -D__ECOS -D__NO_FCNTL=1
    -I.. -Wall -I../../install/include -ffunction-sections 
    -fdata-sections -Wp,-MD,../form.d ../form.c
    arm-elf-gcc -g -mcpu=arm7tdmi -mbig-endian -c 
    -o ../h.o -fverbose-asm -I -O2 -D__ECOS -DWEBS -DUEMF 
    -DWEBS_PAGE_ROM -DDIGEST_ACCESS_SUPPORT 
    -DOS="eCos" -DECOS -D__ECOS -D__NO_FCNTL=1 
    -I.. -Wall -I../../install/include -ffunction-sections 
    -fdata-sections -Wp,-MD,../h.d ../h.c
    arm-elf-gcc -g -mcpu=arm7tdmi -mbig-endian -c 
    -o ../handler.o -fverbose-asm -I -O2 -D__ECOS -DWEBS -DUEMF 
    -DWEBS_PAGE_ROM -DDIGEST_ACCESS_SUPPORT
    -DOS="eCos" -DECOS -D__ECOS -D__NO_FCNTL=1 
    -I.. -Wall -I../../install/include -ffunction-sections 
    -fdata-sections -Wp,-MD,../handler.d ../handler.c
    arm-elf-gcc -g -mcpu=arm7tdmi -mbig-endian -c 
    -o ../mime.o -fverbose-asm -I -O2 -D__ECOS -DWEBS -DUEMF 
    -DWEBS_PAGE_ROM -DDIGEST_ACCESS_SUPPORT 
    -DOS="eCos" -DECOS -D__ECOS -D__NO_FCNTL=1
    -I.. -Wall -I../../install/include -ffunction-sections 
    -fdata-sections -Wp,-MD,../mime.d ../mime.c
    arm-elf-gcc -g -mcpu=arm7tdmi -mbig-endian -c -o ../misc.o 
    -fverbose-asm -I -O2 -D__ECOS -DWEBS -DUEMF 
    -DWEBS_PAGE_ROM -DDIGEST_ACCESS_SUPPORT 
    -DOS="eCos" -DECOS -D__ECOS -D__NO_FCNTL=1 
    -I.. -Wall -I../../install/include -ffunction-sections 
    -fdata-sections -Wp,-MD,../misc.d ../misc.c
    ../misc.c: In function `gstrtoi':
    ../misc.c:662: warning: implicit declaration of function `atoi'
    arm-elf-gcc -g -mcpu=arm7tdmi -mbig-endian -c 
    -o ../page.o -fverbose-asm -I -O2 -D__ECOS -DWEBS -DUEMF 
    -DWEBS_PAGE_ROM -DDIGEST_ACCESS_SUPPORT 
    -DOS="eCos" -DECOS -D__ECOS -D__NO_FCNTL=1 
    -I.. -Wall -I../../install/include -ffunction-sections 
    -fdata-sections -Wp,-MD,../page.d ../page.c
    arm-elf-gcc -g -mcpu=arm7tdmi -mbig-endian -c 
    -o ../ringq.o -fverbose-asm -I -O2 -D__ECOS -DWEBS -DUEMF 
    -DWEBS_PAGE_ROM -DDIGEST_ACCESS_SUPPORT 
    -DOS="eCos" -DECOS -D__ECOS -D__NO_FCNTL=1 
    -I.. -Wall -I../../install/include -ffunction-sections 
    -fdata-sections -Wp,-MD,../ringq.d ../ringq.c
    arm-elf-gcc -g -mcpu=arm7tdmi -mbig-endian -c 
    -o ../rom.o -fverbose-asm -I -O2 -D__ECOS -DWEBS -DUEMF 
    -DWEBS_PAGE_ROM -DDIGEST_ACCESS_SUPPORT 
    -DOS="eCos" -DECOS -D__ECOS -D__NO_FCNTL=1 
    -I.. -Wall -I../../install/include -ffunction-sections 
    -fdata-sections -Wp,-MD,../rom.d ../rom.c
    arm-elf-gcc -g -mcpu=arm7tdmi -mbig-endian -c 
    -o ../sock.o -fverbose-asm -I -O2 -D__ECOS -DWEBS 
    -DUEMF -DWEBS_PAGE_ROM -DDIGEST_ACCESS_
    SUPPORT -DOS="eCos" -DECOS -D__ECOS -D__NO_
    FCNTL=1 -I.. -Wall -I../../install/include -ffunction-sections 
    -fdata-sections -Wp,-MD,../sock.d ../sock.c
    ../sock.c: In function `socketDoOutput':
    ../sock.c:506: warning: implicit declaration of function `inet_addr'
    arm-elf-gcc -g -mcpu=arm7tdmi -mbig-endian -c 
    -o ../sockGen.o -fverbose-asm -I -O2 -D__ECOS -DWEBS -DUEMF 
    -DWEBS_PAGE_ROM -DDIGEST_ACCESS_SUPPORT 
    -DOS="eCos" -DECOS -D__ECOS -D__NO_FCNTL=1 
    -I.. -Wall -I../../install/include -ffunction-sections 
    -fdata-sections -Wp,-MD,../sockGen.d ../sockGen.c
    ../sockGen.c: In function `socketOpenConnection':
    ../sockGen.c:134: warning: implicit declaration of function `inet_addr'
    ../sockGen.c: In function `socketAccept':
    ../sockGen.c:359: warning: passing arg 3 of `accept' from 
    incompatible pointer type
    ../sockGen.c: In function `socketSelect':
    ../sockGen.c:704: warning: unused variable `len'
    ../sockGen.c:704: warning: unused variable `nwords'
    arm-elf-gcc -g -mcpu=arm7tdmi -mbig-endian 
    -c -o ../security.o -fverbose-asm -I -O2 -D__ECOS -DWEBS -DUEMF
    -DWEBS_PAGE_ROM -DDIGEST_ACCESS_SUPPORT 
    -DOS="eCos" -DECOS -D__ECOS -D__NO_FCNTL=1
     -I.. -Wall -I../../install/include -ffunction-sections 
    -fdata-sections -Wp,-MD,../security.d ../security.c
    arm-elf-gcc -g -mcpu=arm7tdmi -mbig-endian 
    -c -o ../sym.o -fverbose-asm -I -O2 -D__ECOS -DWEBS -DUEMF 
    -DWEBS_PAGE_ROM -DDIGEST_ACCESS_SUPPORT
     -DOS="eCos" -DECOS -D__ECOS -D__NO_FCNTL=1 
    -I.. -Wall -I../../install/include -ffunction-sections 
    -fdata-sections -Wp,-MD,../sym.d ../sym.c
    arm-elf-gcc -g -mcpu=arm7tdmi -mbig-endian 
    -c -o ../uemf.o -fverbose-asm -I -O2 -D__ECOS -DWEBS -DUEMF 
    -DWEBS_PAGE_ROM -DDIGEST_ACCESS_SUPPORT 
    -DOS="eCos" -DECOS -D__ECOS -D__NO_FCNTL=1
    -I.. -Wall -I../../install/include -ffunction-sections 
    -fdata-sections -Wp,-MD,../uemf.d ../uemf.c
    arm-elf-gcc -g -mcpu=arm7tdmi -mbig-endian 
    -c -o ../url.o -fverbose-asm -I -O2 -D__ECOS
     -DWEBS -DUEMF -DWEBS_PAGE_ROM 
    -DDIGEST_ACCESS_SUPPORT -DOS="eCos"
    -DECOS -D__ECOS -D__NO_FCNTL=1 
    -I.. -Wall -I../../install/include -ffunction-sections 
    -fdata-sections -Wp,-MD,../url.d ../url.c
    arm-elf-gcc -g -mcpu=arm7tdmi -mbig-endian 
    -c -o ../value.o -fverbose-asm -I -O2 -D__ECOS 
    -DWEBS -DUEMF 
    -DWEBS_PAGE_ROM -DDIGEST_ACCESS_SUPPORT 
    -DOS="eCos" -DECOS -D__ECOS -D__NO_FCNTL=1 
    -I.. -Wall -I../../install/include -ffunction-sections 
    -fdata-sections -Wp,-MD,../value.d ../value.c
    gcc -o webcomp -O2 -DWEBS -DUEMF -DUNIX -I.. ../webcomp.c
    ../webcomp.c: In function 'compile':
    ../webcomp.c:121: warning: comparison of distinct pointer 
    types lacks a cast
    find ../web -name "*.*" >web_files
    ./webcomp ../web web_files >webrom.c
    arm-elf-gcc -g -mcpu=arm7tdmi -mbig-endian 
    -c -o webrom.o -fverbose-asm -I -O2 -D__ECOS -DWEBS -DUEMF
     -DWEBS_PAGE_ROM -DDIGEST_ACCESS_SUPPORT 
    -DOS="eCos" -DECOS -D__ECOS -D__NO_FCNTL=1 
    -I.. -Wall -I../../install/include -ffunction-sections
    -fdata-sections -Wp,-MD,webrom.d webrom.c
    arm-elf-gcc -g -mcpu=arm7tdmi -mbig-endian 
    -c -o ../webs.o -fverbose-asm -I -O2 -D__ECOS 
    -DWEBS -DUEMF 
    -DWEBS_PAGE_ROM -DDIGEST_ACCESS_SUPPORT
     -DOS="eCos" -DECOS -D__ECOS -D__NO_FCNTL=1
    -I.. -Wall -I../../install/include -ffunction-sections 
    -fdata-sections -Wp,-MD,../webs.d ../webs.c
    arm-elf-gcc -g -mcpu=arm7tdmi -mbig-endian 
    -c -o ../websuemf.o -fverbose-asm -I -O2 -D__ECOS -DWEBS 
    -DUEMF -DWEBS_PAGE_ROM -DDIGEST_ACCESS_
    SUPPORT -DOS="eCos" -DECOS -D__ECOS -D__NO_FCNTL=1
    -I.. -Wall -I../../install/include -ffunction-sections 
    -fdata-sections -Wp,-MD,../websuemf.d ../websuemf.c
    arm-elf-gcc -g -mcpu=arm7tdmi -mbig-endian
    -c -o ../websda.o -fverbose-asm -I -O2 -D__ECOS -DWEBS 
    -DUEMF -DWEBS_PAGE_ROM -DDIGEST_ACCESS_SUPPORT 
    -DOS="eCos" -DECOS -D__ECOS -D__NO_FCNTL=1 
    -I.. -Wall -I../../install/include -ffunction-sections 
    -fdata-sections -Wp,-MD,../websda.d ../websda.c
    In file included from ../websda.c:24:
    ../md5.h:48:20: warning: no newline at end of file
    arm-elf-gcc -g -mcpu=arm7tdmi -mbig-endian 
    -c -o ../md5c.o -fverbose-asm -I -O2 -D__ECOS -DWEBS 
    -DUEMF -DWEBS_PAGE_ROM -DDIGEST_ACCESS_
    SUPPORT -DOS="eCos" -DECOS -D__ECOS -D__NO_FCNTL=1 
    -I.. -Wall -I../../install/include -ffunction-sections 
    -fdata-sections -Wp,-MD,../md5c.d ../md5c.c
    In file included from ../md5c.c:26:
    ../md5.h:48:20: warning: no newline at end of file
    arm-elf-ar rv libwebs.a ../asp.o ../balloc.o
    ../base64.o ../default.o ../ejlex.o ../ejparse.o ../form.o ../h.o 
    ../handler.o ../mime.o ../misc.o ../page.o ../ringq.o ../rom.o 
    ../sock.o ../sockGen.o ../security.o ../sym.o ../uemf.o ../url.o 
    ../value.o webrom.o ../webs.o ../websuemf.o ../websda.o ../md5c.o
    a - ../asp.o
    a - ../balloc.o
    a - ../base64.o
    a - ../default.o
    a - ../ejlex.o
    a - ../ejparse.o
    a - ../form.o
    a - ../h.o
    a - ../handler.o
    a - ../mime.o
    a - ../misc.o
    a - ../page.o
    a - ../ringq.o
    a - ../rom.o
    a - ../sock.o
    a - ../sockGen.o
    a - ../security.o
    a - ../sym.o
    a - ../uemf.o
    a - ../url.o
    a - ../value.o
    a - webrom.o
    a - ../webs.o
    a - ../websuemf.o
    a - ../websda.o
    a - ../md5c.o
    arm-elf-gcc -g -mcpu=arm7tdmi -mbig-endian -o webs.elf 
    -fverbose-asm -I -O2 -D__ECOS -DWEBS -DUEMF 
    -DWEBS_PAGE_ROM -DDIGEST_ACCESS_SUPPORT 
    -DOS="eCos" -DECOS -D__ECOS -D__NO_FCNTL=1 -I..  \
    boot.o main.o libwebs.a -nostartfiles -L../../install/lib -Wl,
    --gc-sections -Ttarget.ld -nostdlib 
     
    $

    The ROM image of the website directory tree is constructed in a portable but inefficient manner: The webcomp program traverses the tree and generates a C-language file (webrom.c) containing a set of initialized byte arrays containing the directory tree's entire image. Compiling webrom.c may take a long time (several minutes).

  7. You may download the resulting ELF binary (the file named webs.elf) using a GDB, or convert it to binary or S-Record format for downloading via RedBoot: See Downloading a Program for more information about downloading programs to the DeviceMaster.

    $ arm-elf-objcopy -O binary webs.elf webs.bin
    $ arm-elf-objcoyp -O srec webs.elf webs.srec

Building the eCos Sample Applications (Serial and Ethernet)

The \DMDK\Sample_Apps\Source directory contains two example eCos applications that demonstrate the use of the DeviceMaster serial driver and the DeviceMaster Ethernet driver.

In the example below we'll assume that the user's home directory contains the demo.tar.gz and install.tar.gz files.

  1. If you have not done so, unpack and install the pre-compiled eCos libraries. See Installing the Pre-Compiled (Binary) eCos Libraries.

  2. Install the demo.tar.gz files. This example uses a directory named ecos-samples in the users home directory:

    $ cd
    $ mkdir ecos-samples
    $ cd ecos-samples
    $ tar xzf ~/demo.tar.gz

  3. If the install directory is somewhere else, edit the Makefile so that the ECOS variable points to the location of the install directory. The makefile in the demo directory assumes that the eCos install directory is in the same directory as the demo directory. For example:

     ECOS = /home/my-ecos-build-dir/install

  4. If the install directory is somewhere else, edit the Makefile so that the ECOS variable points to the location of the install directory. The makefile in the demo directory assumes that the eCos install directory is in the same directory as the demo directory. For example:

    ECOS = /home/my-ecos-build-dir/install

  5. Perform a make depend to fill in the srcdeps files.

    $ cd demo
    $ make depend

    Generating source dependencies
    arm-elf-gcc -mcpu=arm7tdmi -mbig-endian -fverbose-asm -g -Wa,-
    ahlsn=.lst -O0 -D__ECOS -I../install/include -M netecho.c 
    serecho.c >>srcdeps
  6. Perform a make to build the demo applications.

    $ make

    arm-elf-gcc -mcpu=arm7tdmi -mbig-endian -c -o netecho.o -fverbose-asm -g 
    -Wa,-ahlsn=netecho.lst -O0 -D__ECOS -I../install/include -Wall  netecho.c
    arm-elf-as --gstabs -EB -m arm7tdmi -amhlsnd=boot.lst  -o boot.o boot.s
    arm-elf-gcc -mcpu=arm7tdmi -mbig-endian -Wl,-Map,
    netecho.map -g -Wl,--gc-sections -nostartfiles -L../install/
    lib -o netecho.elf  netecho.o boot.o -Ttarget.ld -nostdlib
    arm-elf-gcc -mcpu=arm7tdmi -mbig-endian -c -o serecho.o 
    -fverbose-asm -g -Wa,-ahlsn=serecho.lst -O0 -D__ECOS 
    -I../install/include -Wall  serecho.c
    arm-elf-gcc -mcpu=arm7tdmi -mbig-endian -Wl,-Map,
    serecho.map -g -Wl,--gc-sections -nostartfiles -L../install/lib -o 
    serecho.elf  serecho.o boot.o -Ttarget.ld -nostdlib
    arm-elf-objcopy -O binary netecho.elf netecho.bin
    arm-elf-objcopy -O binary serecho.elf serecho.bin
    arm-elf-objcopy -O srec netecho.elf netecho.srec        
    arm-elf-objcopy -O srec serecho.elf serecho.srec 

The file raw.py is an example program that may be run on a Linux host that has Python 2.0 or later. It sends Ethernet frames to a DeviceMaster that is running the netecho demo application.

If you want to use eCos applications with the custom version of RedBoot, it's convenient if you build your image so that it has an entry point at address 0. That way you can download binary images and used the default start address of 0. Linking with boot.o (generated from boot.s) adds that entry point.

If you are downloading S-Record images with RedBoot, or using ELF images with a debugger, then you don't need an entry point at 0 and don't have to include boot.[so] in your build process. See Downloading a Program for information about downloading programs to the DeviceMaster.


nice color