Unable to link, TinyVMException: Offset out of range

This is where you talk about the NXJ software itself, installation issues, and programming talk.

Moderators: roger, 99jonathan, imaqine

Unable to link, TinyVMException: Offset out of range

Postby danvari » Fri Jan 11, 2013 12:03 am

Hey,

we have quite a big project

Master record : 20 bytes.
Class records : 222 (2664 bytes).
Field records : 393 (396 bytes).
Static fields : 138 (276 bytes).
Static state : 138 (548 bytes).
Constant records : 351 (1404 bytes).
Constant values : 351 (3664 bytes).
Method records : 957 (11484 bytes).
Exception records: 237 (1896 bytes).
Interface maps : 17 (16 bytes).
Code : 883 (43672 bytes).
Total : 65496 bytes.
Run time options : EnableCompact
Constant loads : 286N 115O 3W 283S
Static load/store: 81N 580O
Field load/store: 1000N 1117O



but at a certain point we cannot link the project anymore, we'll get the following error. I have


js.tinyvm.TinyVMException: Offset out of range (65617)
at js.tinyvm.WritableDataWithOffset.initOffset(WritableDataWithOffset.java:22)
at js.tinyvm.RecordTable.initOffset(RecordTable.java:212)
at js.tinyvm.RecordTable.initOffset(RecordTable.java:212)
at js.tinyvm.Binary.initOffsets(Binary.java:766)
at js.tinyvm.Binary.createFromClosureOf(Binary.java:324)
at js.tinyvm.TinyVMTool.link(TinyVMTool.java:97)
at js.tinyvm.TinyVMTool.link(TinyVMTool.java:48)
at lejos.pc.tools.NXJLink.start(NXJLink.java:134)
at lejos.pc.tools.NXJLink.run(NXJLink.java:101)
at lejos.pc.tools.NXJLink.start(NXJLink.java:33)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at lejos.pc.tools.ToolStarter.startTool(ToolStarter.java:31)
at lejos.pc.tools.NXJLink.main(NXJLink.java:28)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.apache.tools.ant.taskdefs.ExecuteJava.run(ExecuteJava.java:217)
at org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava.java:152)
at org.apache.tools.ant.taskdefs.Java.run(Java.java:771)
at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:221)
at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:135)
at org.apache.tools.ant.taskdefs.Java.execute(Java.java:108)


this is our link ant task:

Code: Select all
      <!-- Link the binary and create a signature file -->
      <property name="myclasspath" refid="lejos.nxt" />
      <echo>${myclasspath}</echo>
      <java classname="lejos.pc.tools.NXJLink" failonerror="true">
         <classpath refid="lejos.pc" />
         <arg value="--bootclasspath" />
         <arg pathref="lejos.nxt" />
         <arg value="--classpath" />
         <arg path="${botsrc}" />
         <arg value="--writeorder" />
         <arg value="LE" />
         <arg value="-o" />
         <arg file="${output.nxj}" />
         <arg value="-od" />
         <arg file="${output.nxd}" />
         <arg value="-v" />
         <arg value="${main.class}" />
      </java>


is there a way to use more than 64KB since the flash actually is bigger, or do we need to cut Strings/large datatypes to make it fit?
Last edited by danvari on Fri Jan 11, 2013 1:16 am, edited 1 time in total.
danvari
New User
 
Posts: 4
Joined: Thu Jan 10, 2013 11:57 pm

Re: Unable to link, TinyVMException: Offset out of range

Postby skoehler » Fri Jan 11, 2013 12:52 am

The 64KB limit has been eliminated in recent snapshots.
skoehler
leJOS Team Member
 
Posts: 1107
Joined: Thu Oct 30, 2008 4:54 pm

Re: Unable to link, TinyVMException: Offset out of range

Postby danvari » Fri Jan 11, 2013 1:15 am

skoehler wrote:The 64KB limit has been eliminated in recent snapshots.

Thanks for your answer. Is there any resource on how to build from the latest snapshots?
danvari
New User
 
Posts: 4
Joined: Thu Jan 10, 2013 11:57 pm

Re: Unable to link, TinyVMException: Offset out of range

Postby skoehler » Fri Jan 11, 2013 1:29 am

You don't need to build the latest snapshot yourself. Just checkout trunk/snapshot from SVN. The files you need to use it are all there. Just point the Eclipse plugin at it, or set the nxj.home ant variablle to the snapshot directory or whatever.
skoehler
leJOS Team Member
 
Posts: 1107
Joined: Thu Oct 30, 2008 4:54 pm

Re: Unable to link, TinyVMException: Offset out of range

Postby gloomyandy » Fri Jan 11, 2013 8:26 am

Out of interest what does your project do? Seems to have a lot of code!

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

Re: Unable to link, TinyVMException: Offset out of range

Postby danvari » Fri Jan 11, 2013 11:02 am

Looks like the snapshot did the trick, thanks.

We have a robotic game where 1-4 NXTs robots synchronously are performing an (heuristic) explorative search for mines over a variable gameboard. the nxts communicate by bluetooth with each other and a computer who is tracking and managing a game.
The whole computation is performed on the nxts, the computer is just monitoring and controlling the game. There are a lot of parallel Threads, about 7 behaviours, an own bluetooth protocol implementation, an event dispatcher with a lot of events, drive logic, pathfinding logic, datastructures for the gameboard and game mechanics. Ultimately this is used to compare different heuristic game-strategys against each other and perform field tests.

I'll check if I can make the code available for you.
danvari
New User
 
Posts: 4
Joined: Thu Jan 10, 2013 11:57 pm

Re: Unable to link, TinyVMException: Offset out of range

Postby gloomyandy » Fri Jan 11, 2013 11:29 am

Sounds cool. The code to allow larger programs is pretty new, so let us know how it works out...

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

Re: Unable to link, TinyVMException: Offset out of range

Postby danvari » Fri May 10, 2013 11:22 pm

Seems to work, however we noticed a few things.
Consider a file called Bot.nxj which is bigger than 64KB.

If you re-upload a Bot.nxj you have to delete the old Bot.nxj first, otherwise it will fail.

If you use bluetooth to upload each 2nd try it will fail our current build script therefore executes the bluetooth upload twice to ensure that the file has been uploaded which is kinda funny and insane.

At this point however i do not yet have permissions to provide project insights, this may change though.
danvari
New User
 
Posts: 4
Joined: Thu Jan 10, 2013 11:57 pm

Re: Unable to link, TinyVMException: Offset out of range

Postby gloomyandy » Sun May 12, 2013 2:51 am

Yes you will have to delete the old copy. There is not sufficient free flash memory to hold two versions of the file and the current leJOS file system is unable to reclaim the flash space of the old version.
User avatar
gloomyandy
leJOS Team Member
 
Posts: 3003
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK


Return to NXJ Software

Who is online

Users browsing this forum: No registered users and 1 guest

more stuff