Page 1 of 1

NXT Bytecode interpreter for different hardware

Posted: 11 Apr 2012, 14:56
by frazras
Hi all,
I am working on a project to get the NXT bytecode running on a different hardware - Arduino to be exact.

    • How possible is that in the first place? Is the executable file specifications provided by LEGO my only resource (It seems a little complex)?
    • If no other resource is available will I need to use all the specifications it provides(memory map etc)?
    • Would I be infringing on any LEGO patent?

Re: NXT Bytecode interpreter for different hardware

Posted: 11 Apr 2012, 16:06
by mattallen37
I'm not really sure why you would want to create an NXT VM on an Arduino, but it would be nearly impossible as far as I know. NXT FW by itself takes about 128k of flash, and uses about 32k of RAM. Both those numbers are far outside what an AVR can provide.

If you want any chance at all to get it to work with an Arduino, wait for the Due to be released. It's supposed to have 256k flash, and 50k RAM (close to the NXT's 256k flash and 64k RAM).

However, I still think it's next to impossible to make it work.

Lego released many documents for the NXT, as well as the source-code of their FW, so obviously they expect people to use it other than in the way it was originally designed. If you are doing it just for the fun and learning process, I'm quite sure you will legally be fine.

Re: NXT Bytecode interpreter for different hardware

Posted: 11 Apr 2012, 18:06
by frazras
I was proposing to build a scaled down version in terms of the memory requirements. I really wanted to create a byte-code interpreter that could accommodate a simple nxt program. That should be ok right?

Re: NXT Bytecode interpreter for different hardware

Posted: 11 Apr 2012, 18:14
by mattallen37
NXT programs are extremely dependent on the FW layer. An Arduino also wouldn't have the HW resources that the NXT has. It would be next to impossible IMO.

I am curious though, what would be the point of such a project? The learning aspect?

Re: NXT Bytecode interpreter for different hardware

Posted: 12 Apr 2012, 07:21
by mightor
ROBOTC uses a VM with similar functionality that works on many platforms, including the NXT and Arduino, so I am sure it can be done. Naturally, the Arduino port has fewer resources at its disposal but I am pretty sure the compiled code that runs on the VM is fairly similar to the one on the NXT.

- Xander

Re: NXT Bytecode interpreter for different hardware

Posted: 12 Apr 2012, 13:17
by frazras
NICE!! ROBOTC seems cool, always heard about it but never looked it up before.

The focus of my project is primarily academic, its a part of my research thesis in the aim of creating an extensible, modular, scalable, inexpensive robotics platform.
To get it done quickly and to get potential users utilizing it without a learning curve, I wanted to make it adaptable to those who are already doing robotics. (Focus on our local high school and college students)
So it would support LEGO NXT and all their programming tools. But that would just be a subset of its capability, for instance, the design I have already done for its architecture
allows support for hundreds of sensors and actuators, scaling far easier and less expensive than the LEGO system.
The choice of Arduino as a platform was also for the speed of initial implementation and hardware availability. The long term processor would perhaps be an AVR32 or even utilizing
arduino's potential ARM processor the Leonardo. I really wanted to start off a proof of concept with a LEGO bytecode interpreter that manages small programs.

Re: NXT Bytecode interpreter for different hardware

Posted: 12 Apr 2012, 15:09
by HaWe
this project seems to be perfectly designed to make it by my favourite PL:
Image
;)

Re: NXT Bytecode interpreter for different hardware

Posted: 12 Apr 2012, 18:54
by frazras
LOL :lol: But is that a BAD thing?

Re: NXT Bytecode interpreter for different hardware

Posted: 14 Apr 2012, 12:25
by spillerrec
Some guy managed to boot Linux on a 8-bit Atmel ATmega1284p microcontroller by writing his own ARM emulator to bypass the 32-bit requirement. It took 2 hours to boot to the terminal, but it worked...

On a more serious note, the executable file specification from Lego is what you want to use.