Page 1 of 2

NXT Mindstorms 2.0 Program Size limit

Posted: 04 Oct 2012, 01:01
by jcatricala
Is there a limit to the size of an NXT program? Even though I may have 90kbs+ of space can I use it all for single application?

Re: NXT Mindstorms 2.0 Program Size limit

Posted: 04 Oct 2012, 01:10
by inxt-generation
The only limit is your imagination. And how much memory is on the NXT. So yes, the programs can be as large as you want, as long as they don't hit the memory limit.

Re: NXT Mindstorms 2.0 Program Size limit

Posted: 04 Oct 2012, 01:19
by mattallen37
If you use NXT-G I have a feeling your computer would crash before you build a 90kB program (NXT-G does not run well on a computer, especially when the program get large).

Re: NXT Mindstorms 2.0 Program Size limit

Posted: 04 Oct 2012, 01:21
by inxt-generation
mattallen37 wrote:If you use NXT-G I have a feeling your computer would crash before you build a 90kB program (NXT-G does not run well on a computer, especially when the program get large).
This is true. I have nightmares about NXT-G and its slowness and glitchiness.

Re: NXT Mindstorms 2.0 Program Size limit

Posted: 04 Oct 2012, 13:03
by hassenplug
I think the actual limit is around 59kb. I'm sure John knows the exact size, but the limit is between 50 and 60kb. I have written a program in Labview that I had to reduce to get under the limit.

Steve

Re: NXT Mindstorms 2.0 Program Size limit

Posted: 04 Oct 2012, 13:10
by jcatricala
Thank you Steve, I knew that it wasn't anywhere close to 90kbs. This isn't usually a problem except for FLL where the students that I coach begin to combine missions so that they have only one program (with a menu) to run.
I'll pass the information on.
John

Re: NXT Mindstorms 2.0 Program Size limit

Posted: 04 Oct 2012, 20:27
by HaWe
I think the actual limit is around 59kb
Available memory of course is the RAM size for code plus variable memory plus fw (bytecode interpreter, VM).
So my guess also was sth close to 60 kB for code plus variable memory, the rest up to 64 kB is for the VM.

The max variable memory I ever could allocate was round 30 KB (once for an astar and in another case, for a neural net), in that case the code was limited to about 30 kB, too.

Re: NXT Mindstorms 2.0 Program Size limit

Posted: 05 Oct 2012, 13:18
by hassenplug
doc-helmut wrote:Available memory of course is the RAM size for code plus variable memory plus fw (bytecode interpreter, VM).
There is a program size limit, that is different from the available memory. It has something to do with how programs are stored in the RAM.

Oh, that's another important point. Programs must occupy consecutive RAM. So, sometimes a program won't fit, because there is no single block that's large enough because of deleted files and such. If you delete all the files, and download them again, you may find more programs will fit.

Labview has a tool for doing this. I'm not sure if it's available in NXT-G.

Steve

Re: NXT Mindstorms 2.0 Program Size limit

Posted: 05 Oct 2012, 13:53
by HaWe
I expressed myself probably wrong.
you wrote "the actual limit is around 59kb".
I agree, because the RAM is 64kByte, and I assume that the fw/VM takes the remaining (first) 4-5kB or what ever.

But I wanted to express that the 59 ? kByte for program code depends on how much the code is allocating variable memory,
so it might be max 59 kByte but maybe even much less (e.g., 30 kByte code limit if the code needs additionally 30 kByte for variables).

CMIIW, but IMO the "deleted files issue" is an issue of the 256 kByte flash memory ("linear" unfragmented vs. fragmented files), not of the 64 kByte RAM.
So source code stored on the flash which should be larger than these 59 kByte probably would never fit into the RAM and so never could be executed.

Re: NXT Mindstorms 2.0 Program Size limit

Posted: 05 Oct 2012, 14:09
by mattallen37
Programs are stored in flash, not RAM. There is about 30k of RAM available to the user, and it seems quite independent of the program size.

The ARM 7 HW in the NXT has 256k of flash, and 64k of RAM. Obviously a large chunk of each is used by the FW, VM, and other resources.