my name is Norbert and I am student at Freiburg University. The Department I am currently working for has developed a own JVM. They want me to port this JVM to the NXT platform.

So far I had a look at LeJOS, and did a small project with NetBeans programming a small robot to get familiar with the hardware.

Now I am trying to recompile LeJOS on my own and there the first problems arise On the PC I am working I have Ubuntu 8.04 installed. I have installed LeJOS in /opt/lejos and found the source in /opt/lejos/src/nxtvm/platform/nxt
I installed GCC-3.4 toolchain from http://www.gnuarm.com/ and did "make" (as advised in the /opt/lejos/src/nxtvm/platform/nxt/readme) but I get the following error:

Can anyone give me some hints how to compile LeJOS the right way, so that I can understand how to use the arm compiler properly?

Where can I get some hints for porting another JVM to NXT? So far I know I have to write native methods, but as I understood it, this is for Java using the functionalities provided by the hardware.
So somewhere there have to be some C/C++ code (I think) that provides these functionalities to Java.

Any help is appreciated.
Norbert

Last edited by wiederma on Tue Nov 24, 2009 8:25 am, edited 1 time in total.

thanks for your answer. To get you right: Only gcc 4.3.2 is necessary to compile leJOS for the NXT?
What about the other tools mentioned at gnuarm.com?
* binutils-2.14.tar.bz2 [10.4MB]
* gcc-3.3.3.tar.bz2 [22.2MB]
* newlib-1.12.0.tar.gz [6.37MB]
* gdb-6.0.tar.bz2 [11.4MB]
* insight-6.0.tar.bz2 [17.9MB]

Do I have to use special parameters for the gcc (e.g. chiptype) ?
Can you post the complete command you are using to compile please?

The thing with "objcopy" and "objdump" is somehow strange to me:objdump was found correctly (I think; /usr/local/cross/arm-elf/arm-elf/bin/objdump) but without my changes objcopy wasn't found and compilation failed.I checked where the file is located and found it here:/usr/local/cross/arm-elf/bin/arm-elf-objcopy

But there is also a "arm-elf-objdump" file in that folder, so which one shall I use?

I've never seen the inline warnings before. The others are normal. The set of files you have built are correct, we don't build the other targets by default anymore....

But since none of those toolchains in the link you gave match the version of gcc I recommended you use (4.3.2 which is the one we use to build the release - for lots of good reasons), I guess you are on your own... Good luck...

gloomyandy wrote:I've never seen the inline warnings before. The others are normal. The set of files you have built are correct, we don't build the other targets by default anymore....

But since none of those toolchains in the link you gave match the version of gcc I recommended you use (4.3.2 which is the one we use to build the release - for lots of good reasons), I guess you are on your own... Good luck...

Andy

Don't get me wrong: I am not using this toolchain on purpose to annoy you. I am using it, because I had problems to get the tools you suggested installed and found by the make.
Maybe you can give me some hints to get them work ?
I will download all the stuff you told me:

Hi,
Yes you need to build those tools and get them installed, then you may need to modify your local environment or the leJOS build scripts to make sure you use the tools you have just built. The leJOS make system will display what tools it is using you just need to get it to pick up the correct ones.

Oh and a quick note... I assume the JVM you are looking at porting is takatuka? If this is the case you may have some problems ahead from a licensing point of view if you use any leJOS code. leJOS is currently licensed under MPL, I noticed that takatuka is GPL3. My understanding is that these two licenses are not compatible... I'm not a lawyer but I have had a lot of experience with this sort of thing, and it can be a real pain. So if you ever intend to make the results of your project available to anyone else you may want to investigate this a little more before you get too far down the road of using any leJOS source in your project... We have been trying to move leJOS away from MPL but it is not an easy thing to do...

Good luck...

Andy

PS You didn't annoy me, it is simply that if you are using different tools to the ones that are normally used with leJOS then I have no way of knowing if it is the tools that are causing the problem or not. So for instance your warning about inline functions is not one I have seen with the build system we use... Once you have things working then feel free to use whatever tools you want, but if you want our help then using the standard tools will make it much easier...

But if you are going to be building for a system that is not AT91 based then you may be as well using some other version of gcc... The reason we use that particular version is that for the Arm processor (and with the options we use for the AT91), that version of gcc produces the best combination of speed and size (compared with more recent versions). But this may not be the case for other targets. Which platform are you building for?

I also used bintuils 2.19.
Recently I upgraded to 2.20, but newlib <=1.17.0 didn't compile due to some bugs in some assembler code. They fixed the issue in SVN head though.

I don't know anything about precompiled toolchains. I built my own one using crossdev on Gentoo (which is not straightforward, because gcc needs a very small patch so that interworking can be enabled).

In the SVN version of leJOS, the COMP_PATH variable has been replaced by the variables LEJOS_NXT_ARM_GCC. You can set that variable to an absolute path or the name of an executable that is in the path. You can set that variable in your ~/.bashrc or ~/.cshrc, depending on your shell. If not set, the default is "arm-elf-gcc".

gloomyandy wrote:But if you are going to be building for a system that is not AT91 based then you may be as well using some other version of gcc... The reason we use that particular version is that for the Arm processor (and with the options we use for the AT91), that version of gcc produces the best combination of speed and size (compared with more recent versions). But this may not be the case for other targets. Which platform are you building for?

Andy

I'm targeting a Phillips LPC2888, which is ARM7TDMI based. Not that much different from the AT91. For now I'm trying to establish a reference point by recompiling the firmware and successfully loading onto a NXT brick.

Since you are building from source, which I am attempting to do also, could you share how you are configuring the various components?

I've been able to successfully build a complete gnu-arm-elf toolchain and compile lejos 0.85 without any problems, but the resulting binary fails to run on the NXT. I don't know if it is a misconfiguration of the toolchain or the fact that I'm trying to do it on a Mac.