Application Programs

GNU assembler (for PC and UNIX) or C compiler (for PC and UNIX) can easily be used. For information see the GNU Manual Page. To download gcc use the EyeBot ftp server.

However, other compilers or assemblers for 68,000 may be used as well. See demo.asm for a sample assembly program in Motorola syntax.

You can either write your own assembly programs or your own C programs to control EyeBot. Your C programs should make use of the EyeBot libraries, which prepares functions for display output (text via "printf" or graphics), camera input (grayscale or color), sound output, and servo control (motors).

How to Create an Application Program

Compiler

Create a subdirectory on your host system and write your application program as a combination of C and M68332 assembly language modules.

File extensions:

Use the shell script gcc68 for compiling a C program.

The standard "main.c" source program looks like the following:

/* ------------------------------------------ */
/*     Sample User Program for ROBIOS         */
/* ------------------------------------------ */

#include "librobi/librobi.h"
#include "libimpro/improc.h"
#include "librobi/protos.h"

#include "keys.h"
#include "lcd.h"
#include "cam.h"
#include "types.h"
#include "const.h" 
#include "kern.h"
#include "vw.h"
#include "rs232.h"

#include <math.h>
#include <stdio.h>
#include <unistd.h>

void main ()
{

/* disable input/output buffer */

        setvbuf (stdout,NULL,_IONBF,0);
        setvbuf (stdin,NULL,_IONBF,0);

/* clear display and write message */

        LCDClear();
        LCDMode(SCROLLING);

        printf("HELLO !! \n");
        printf("and bye !!\n");

        KEYWait(0);

        printf("KeyPressed !\n");
}

Assembler

Please note, that the gnu assembler for 68,000 requires a few conventions, which differ from the Motorola standard. These are: Use the shell script gas68 for translating an ASM program.

Makefiles

Makefiles are only needed when compiling several C or ASM source files into a single executable. A typical "Makefile" for Unix looks like to following:
# Makefile for executables

CC = gcc-m68k
AS = as-m68k
LD = ld-m68k
OBJCOPY = objcopy-m68k

OPTIMZE = -O -g
CPU = 68332

LFLAGS = -T../ldfiles/robi-ram.ld -L../librobi -L../libs
CFLAGS = -I../include -m${CPU} ${OPTIMZE} -c -msoft-float

# --------------------------------------------------------
# You will only have to modify this for your own userprg

OBJS = main.o gh.o
PROG = userprg
# --------------------------------------------------------

.s.o:
        ${AS} ${AFLAGS} -o $*.o $*.s

.c.o:
        ${CC} ${CFLAGS} $*.c

all:    echocwd ${PROG}

${PROG}:        ${OBJS} ${ROBIOS_LIB}
                ${LD} ${LFLAGS} -o $@ ${OBJS} -lmyc -lmygcc -lrobi
                ${OBJCOPY} -O srec ${PROG} ${PROG}.hex

clean:  echocwd
        rm -f ${OBJS} ${PROG} ${PROG}.hex core

echocwd:
        @pwd

Thomas Bräunl, 1997