Porting leJOS to another hardware

Post your NXJ projects, project ideas, etc here!

Moderators: 99jonathan, roger, imaqine

Porting leJOS to another hardware

Postby adamh » Sun Jan 03, 2010 5:16 pm

Hello, I really like Java so I would like to modify leJOS a bit and load to AT91SAM7S256 devkit (http://kramara.com/podklady/AT91SAM7S256-kit/foto/KIT015_web.jpg).

I've downloaded leJOS from SVN and tried to compile nxtvm (nxtvm/platforms/nxt). Then I tried to build VM using "make". I got error messages like this:

Code: Select all
c:\Program Files\yagarto\bin\arm-elf-ld.exe: ERROR: c:/program files/yagarto/bin/../lib/gcc/arm-elf/4.3.2/thumb/interwork/libgcc.a(_clz.o) uses hardware FP, whereas lejos_nxt_rom.elf uses software FP


I use the YAGARTO toolchain on Windows XP (GCC 4.3.2, binutils 2.18, newlib 1.16.0), I also tried GNUARM toolchain with older version of GCC with the same problems.

Is there anybody who compiled leJOS under Windows successfully? Or anybody who has already solved this problem? Or anzbody who modified leJOS for his own hardware? I've read some forum posts related to problems with FP, but they didn't help me. Which toolchain should I use?

Thank you very much,

Adam
adamh
New User
 
Posts: 3
Joined: Sun Jan 03, 2010 5:04 pm
Location: Czech Republic

Postby Alshain » Sun Jan 03, 2010 7:37 pm

Afaik the NXT does not support hardware based floating point operations, which is why a software based implementation is used.
Try using the flag "-msoft-float"
Alshain
New User
 
Posts: 14
Joined: Sat Jan 02, 2010 1:48 pm

Postby adamh » Sun Jan 03, 2010 8:39 pm

In environment.mak are these flags:

Code: Select all
BASE_ABI_FLAGS := -mcpu=arm7tdmi -mlittle-endian -mfloat-abi=soft  -mthumb-interwork
LIB_ABI_FLAGS  := $(BASE_ABI_FLAGS) -mthumb


I tried to add -mfloat-soft to LIB flags, I also tried to remove -mfloat-abi=soft from ABI flags. Adding -mfloat-soft had no effect, after removing "-mfloat-abi=soft" ran compilation without errors, but the outputed bin file was wrong, ARM with loaded bin file did nothing (I would expect some activity on USB after flashing compiled nxtvm).
adamh
New User
 
Posts: 3
Joined: Sun Jan 03, 2010 5:04 pm
Location: Czech Republic

Postby gloomyandy » Sun Jan 03, 2010 8:55 pm

Hi,
A couple of things....
1. You need to ensure that the support library that you are using is built with the same floating point options as the leJOS sources (this is also true of the other options like interworking etc.). The method of doing this various from one gcc build to another (some have all possible combinations pre-built others you need to create them at gcc build time)...
2. Are you trying to run the leJOS binary on none NXT hardware? If you are this almost certainly will not work without major changes to the code. There are various places in the code that involve handshake operations with various bits of the NXt hardware (like to ATmega etc.). If these do not work then the code may hang....
3. How are you flashing your hardware? The leJOS flash program modifies the downloaded binary on the fly to set various parameters into fixed locations. If you use some other flash program you will have to modify code to have suitable values...

Andy
User avatar
gloomyandy
leJOS Team Member
 
Posts: 4238
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Postby adamh » Sun Jan 03, 2010 9:41 pm

Thank you for your answer.

Yes, I know that I'll have to do some changes in source, but I wanted to compile the nxtvm first. If I can't compile nxtvm as is, I can't do any changes in it. I would like to run it on MCU and use only it's periphetials. Does anybody have some "bare" version of leJOS without the stuff for NXT hardware?

I flash the binary file by SAM-BA.

So should I check GCC settings? Do you all compile nxtvm on Linux or do you have some programmer who works on Windows with some pre-compiled toolchain like GNUARM or YAGARTO like me? I don't have Linux PC and I can't run it on my computer since I don't have enough disk space :-)

EDIT: erros in my code are in libraries like libgcc.a, they might be compiled for other FP options, like you wrote. Could you send me your libraries (maybe everything in library where libgcc.a is stored)? I'll try to replace them and re-compile, it might be the easiest way. My e-mail is a.heinrich ( a t ) seznam.cz, please write some text into th body of the mail, orelse it will be sent to bin by my stupid spamfilter :-)
adamh
New User
 
Posts: 3
Joined: Sun Jan 03, 2010 5:04 pm
Location: Czech Republic

Postby skoehler » Fri Jan 08, 2010 10:25 pm

adamh wrote:So should I check GCC settings?


During the compilation of gcc and probably newlib, you have to pass the "--with-float=soft" parameter to gcc's configure. In addition, you have to patch one little gcc file, to enable interworking.

Andy: you have a little shell script to built a toolchain. We should publish that on the Wiki.

adamh wrote:Do you all compile nxtvm on Linux or do you have some programmer who works on Windows with some pre-compiled toolchain like GNUARM or YAGARTO like me? I don't have Linux PC and I can't run it on my computer since I don't have enough disk space :-)


I have absolutely no experience with pre-compiled toolchains. If I had to work on Windows, that I would most likely use Cygwin to have a suitable Linux-like environment. I have no idea, whether a arm-elf toolchain will actually build on Cygwin, but I'm quite optimistic.


adamh wrote:EDIT: erros in my code are in libraries like libgcc.a, they might be compiled for other FP options, like you wrote. Could you send me your libraries (maybe everything in library where libgcc.a is stored)? I'll try to replace them and re-compile, it might be the easiest way. My e-mail is a.heinrich ( a t ) seznam.cz, please write some text into th body of the mail, orelse it will be sent to bin by my stupid spamfilter :-)


GCC would do a MUCH better job if it told you, that it didn't support software-floats. That's because hardware-floats is the default. Passing "--with-float=soft" to gcc's configure will tell gcc to support software-floats ONLY.


Update: just found the script used by the NXOS project:
http://github.com/danderson/nxos/blob/m ... olchain.sh

It should do the job. You might want skip the GDB part and you might want to use GCC 4.3.4 instead of 4.4.x.
skoehler
leJOS Team Member
 
Posts: 1458
Joined: Thu Oct 30, 2008 4:54 pm


Return to NXJ Projects

Who is online

Users browsing this forum: No registered users and 1 guest

more stuff