[kaffe] Problem with kaffe for m68k platform

daniel at fh-konstanz.de daniel at fh-konstanz.de
Thu Jan 5 09:28:56 PST 2006


Hello!

I m a newbie! 
I have so many problems with my DIL/NetPC DNP/5282 Coldfire specific platform.

Zhis platform has following features:

    * Motorola 32-bit MCF528x ColdFire with 66 MHz Clock Speed

    * 63 MIPS (Dhrystone 2.1)

    * 16 MByte SDRAM Memory, 8 MByte FLASH Memory

    * 10/100 Mbps Ethernet LAN Interface

    * Two Ethernet LAN Status LEDs

I want to port kaffe-1.0.7 for this platform with "eCos" as OS. I have taken
this version of kaffe, because some "sinby" people have made modifications for
kaffe-1.0.7.

I have made following modifications:

1. in kaffe-1.0.7/config/m68k/ecos

*********************************
    config.frag:
*********************************
Khost_cpu=m68k
Khost_os=ecos

if [ "$cross_compiling" = yes ]; then
# if we use cross environment, following values may not be detected.
  ac_cv_alignmentof_voidp=${ac_cv_alignmentof_voidp='4'}
  ac_cv_c_bigendian=${ac_cv_c_bigendian='yes'}
  ac_cv_sizeof___int64=${ac_cv_sizeof___int64='0'}
  ac_cv_sizeof_int=${ac_cv_sizeof_int='4'}
  ac_cv_sizeof_long=${ac_cv_sizeof_long='4'}
  ac_cv_sizeof_long_long=${ac_cv_sizeof_long_long='8'}
  ac_cv_sizeof_short=${ac_cv_sizeof_short='2'}
  ac_cv_sizeof_voidp=${ac_cv_sizeof_voidp='4'}
  ac_cv_typedef_bool='yes'
  ac_cv_c_char_unsigned='yes'
  ac_cv_func_strerror='yes'
  
fi

dynamic_libraries='no' 
ac_cv_func_dlopen='no'
ac_cv_func_dlerror='no'
with_threads=ecos-native

*********************************

2. in kaffe-1.0.7\kaffe\kaffevm\systems

the "sinby" guys have developed a thread scheduler for "eCos" stored in the
directory "ecos-natve".

3. in kaffe-1.0.7/config/m68k/, replacing the "cas1" instruction, because my
processor do not support the cas instruction.

*********************************
    common.h:
*********************************



#define COMPARE_AND_EXCHANGE(A,O,N)		\
({						\
    int ret = 0;				\
    jthread_suspendall();			\
						\
    if (*(A) == (O)) {				\
	*(A) = (N);				\
	ret = 1;				\
    }						\
    jthread_unsuspendall();			\
    ret;					\
})

#endif


*******************************

4. kaffe-1.0.7/config/m68k/ecos

*********************************
    md.c:
*********************************
xtern char **environ;

void 
kaffe_ecos_main(int *pargc, char ***pargv)
{
	static char *ecos_argv[] = {
		"Kaffe",
		"-mx",
		"7340032",
		"-ms",
		"6291456",
		"-as",
		"1048576",
		"-ss",
		"65536",
		"Hello",
		NULL
	};

	static char *env[] = {
		"CLASSPATH=.:/lib:/lib/kjc.jar:/lib/tools.jar:/lib/security:/",
		"KAFFELIBRARYPATH=/lib",
		"LD_LIBRARY_PATH=/lib:/include",	
		"PATH=/lib",
		"KAFFEHOME=/lib",
		NULL
	};
	environ = env;

	*pargv = &ecos_argv;
	*pargc = sizeof(ecos_argv)/sizeof(char *) - 1;
}

**********************************************************

5. in kaffe-1.0.7/config/m68k/ecos

*********************************
    md.h:
*********************************

#ifndef __m68k_ecos_md_h
#define __m68k_ecos_md_h

#include "m68k/common.h"
#include "m68k/threads.h"

#include <pkgconf/libc_startup.h>
#include <sinby/kaffe/md.h>

#define INIT_MD kaffe_ecos_init
#define MAIN_MD kaffe_ecos_main(&argc, &argv)

#define CREATE_NULLPOINTER_CHECKS 1

#endif

*****************************************

6. Definition of the systemdependent calls of eCos (read, write open).

7. Writing a Shell script with necessary compiling and linking kaffe-options in
/kaffe-1.0.7 directory:

*********************************
    Buildshell.sh:
*********************************
#!/usr/bin/sh
#--------------------------------------------------------------------
# "Kaffe for I386/eCos" install script                        by NIC 
#--------------------------------------------------------------------

whereis_ecosbase="/usr/local/Projekt/kaffe_install"
whereis_kaffeh="/usr/local/kaffe-1.0.7/kaffe/kaffeh/kaffeh_for_1.0.7.exe"

export KAFFEH=${whereis_kaffeh}
export ECOS_ENV_DIR=${whereis_ecosbase}
export LDFLAGS="-nostartfiles -Ttarget.ld -nostdlib -L$ECOS_ENV_DIR/lib"
export OPTS="-O0 -Wall"
export CFLAGS="-g $OPTS"
export CPPFLAGS="-I$ECOS_ENV_DIR/include -nostdinc -D__ECOS"
export COMMAND_PREFIX=i386-elf

export CC=i386-elf-gcc
export LD=$COMMAND_PREFIX-ld
export NM=$COMMAND_PREFIX-nm
export AR=$COMMAND_PREFIX-ar
export RANLIB=$COMMAND_PREFIX-ranlib
export CPP=$COMMAND_PREFIX-cpp
export OBJCOPY=$COMMAND_PREFIX-objcopy

mv -f config.cache config.cache.old
make clean

sh configure --with-engine=intrp
--with-includes=/usr/local/i386-gcc/lib/gcc/i386-elf/3.4.3/include
--host=i386-ecos --build=i686-cygwin --with-staticlib --with-staticbin
--with-staticvm --without-x  

*************************************************************************


After these modofications, i have build an eCos library and compiled and linked
kaffe-1.0.7 against this eCos library.
When executing the kaffe-bin, an error occurs during debugging the
"baseClasses.c" in the function "initThreads()" with following message:

Internal Error: Check your Classpath and your installation.
NegativeArraySizeException at ThreadGroup.java

 i have tried to find out the reason for this error, but without success.
The error occurs, when kaffe want to execute the Java Method "add" from the
JavaClass "ThreadGroup.java". 
During processing the "add" method, I have seen, that there is a wrong value in
the structure "sp -> taddr" (wrong value is 0xf) , right value is something
with "0xce...). during executing of the runVirtualMachine-function.
I have verified the machine dependent and os dependent parts of kaffe, but it
seems that these parts are okay.
I don`t no, if the error occurs because of a wrong configuration in "eCos" or in
kaffe!

My Question:

Does anybody suited kaffe for "eCos" using an Coldfire hardware platform with
success?

When you have had succeeded, can you describe the important steps, you have made
in the eCos configuration and for kaffe? Or is it possible to send me the ecos
configuration file and kaffe parts, which were adapted?

Thank you so much!

Danny!


  




More information about the kaffe mailing list