Announcing JavelinTools for Linux!
All,
I have just completed a release candidate of a Java version of JavelinDirect for use on Linux (hopefully the Mac too in the future). It is called JavelinTools and supports:
* Linking – Linking programs for later uploading
* Uploading – Uploading a linked program to the Javelin
* Running – Running the currently loaded program
This release (0.1.0) is pretty basic in functionality. I am planning a future release that will include an Eclipse plugin and debugging support.
I have created a distribution with documentation, so when you download it, you should have everything you need to get started. That said, to use it, you will need:
* JavelinTools
* RXTX
* Javelin java files that come with JIDE.
I am in the process of uploading the source code to SourceForge (assuming the project is approved). Everything is now available at the yahoo JavelinCode group (http://tech.groups.yahoo.com/group/JavelinCode/). Once I get everything squared away on SourceForge, I will remove the rather large JavelinTools tarball from the yahoo group, and it will be available on SourceForge.
If you are a Linux user, please try it out and let me know of your experience with it (good or bad).
I have just completed a release candidate of a Java version of JavelinDirect for use on Linux (hopefully the Mac too in the future). It is called JavelinTools and supports:
* Linking – Linking programs for later uploading
* Uploading – Uploading a linked program to the Javelin
* Running – Running the currently loaded program
This release (0.1.0) is pretty basic in functionality. I am planning a future release that will include an Eclipse plugin and debugging support.
I have created a distribution with documentation, so when you download it, you should have everything you need to get started. That said, to use it, you will need:
* JavelinTools
* RXTX
* Javelin java files that come with JIDE.
I am in the process of uploading the source code to SourceForge (assuming the project is approved). Everything is now available at the yahoo JavelinCode group (http://tech.groups.yahoo.com/group/JavelinCode/). Once I get everything squared away on SourceForge, I will remove the rather large JavelinTools tarball from the yahoo group, and it will be available on SourceForge.
If you are a Linux user, please try it out and let me know of your experience with it (good or bad).
Comments
http://sourceforge.net/projects/javelintools
- Andrew
JavekinTools
on the introduction text at that page.
regards peter
It's been fixed.
- Andrew
This version has been tested on Ubuntu Edgy Eft (6.10). I am working more kinks out of it now, and adding more features. I'll post again when I create another release.
- Andrew
I tested it with:
$ java -version
java version "1.6.0_02"
Java(TM) SE Runtime Environment (build 1.6.0_02-b05)
Java HotSpot(TM) Server VM (build 1.6.0_02-b05, mixed mode)
, added '(/usr/lib' and '/usr/share/java/RXTXcomm.jar' in bin/javelintool:
...
java -Djava.library.path=${JAVELINTOOLS_HOME}/lib/linux/i386:/usr/lib -D
java.util.logging.config.file=${JAVELINTOOLS_HOME}/etc/log.properties -cp ${JAVE
LINTOOLS_HOME}/lib/commons-logging.jar:${JAVELINTOOLS_HOME}/lib/commons-cli-1.0.
jar:${JAVELINTOOLS_HOME}/lib/comm_203.jar:${JAVELINTOOLS_HOME}/lib/commwrapper.j
ar:${JAVELINTOOLS_HOME}/lib/javelintools-core.jar:${JAVELINTOOLS_HOME}/etc/:/usr
/share/java/RXTXcomm.jar net.sf.javelintools.cli.Main $@
...
it works, but it don't find a javelin board:
$ bin/javelintools -test -port /dev/ttyS0
Experimental: JNI_OnLoad called.
Stable Library
=========================================
Native lib Version = RXTX-2.1-7
Java lib Version = RXTX-2.1-7
RXTX Warning: Removing stale lock file. /var/lock/LCK..ttyS0
$ bin/javelintools -list
Experimental: JNI_OnLoad called.
Stable Library
=========================================
Native lib Version = RXTX-2.1-7
Java lib Version = RXTX-2.1-7
RXTX Warning: Removing stale lock file. /var/lock/LCK..ttyS0
Connection List
===================================
SERIAL: /dev/ttyS1 - NOT a Javelin
SERIAL: /dev/ttyS0 - NOT a Javelin
---
with minicom i can see something is coming via ttyS0 port.
Any hints?
Thanks Jaanus
As a test, you can run "chmod 777 /dev/ttyS0" and "chmod 777 /dev/ttyS1", and retry it.
If that does it, make sure you are in the correct group, or that the tty's are owned by some group other than root.
On Ubuntu, there is the dialup group that owns that file. Users are in that group by default I believe.
If this doesn't fix it, can you send me your log files?
They should be in /tmp, and named javelintools.log.* ?
It might help if you turned the logging up all the way too. The log config file is in etc/log.properties. Change the line:
net.sf.javelintools.level = WARNING
to:
net.sf.javelintools.level = ALL
This is quite verbose, and I would recommend putting it back after we get you going.
- Andrew
For the next release I'll try to remember to use Java 5 instead of 6, since I am not using and Java 6 features.
This will allow older JVMs to run it.
- Andrew
here is the info,
Thanx Jaanus
$ ls -l /dev/ttys[noparse][[/noparse]01]
crw-rw-rw- 1 root tty 3, 48 2007-08-22 20:36 /dev/ttys0
crw-rw-rw- 1 root tty 3, 49 2007-08-22 20:36 /dev/ttys1
$ cat /tmp/javelintools.log.0
Aug 22, 2007 10:32:46 PM net.sf.javelintools.core.PropertiesManager loadPropertiesFile
FINE: Found default application properties file jar[noparse]:file:[/noparse]/home/jaanus/javelintools/lib/javelintools-core.jar!/net/sf/javelintools/core/javelinDefault.properties
Aug 22, 2007 10:32:46 PM net.sf.javelintools.core.PropertiesManager loadPropertiesFile
FINE: Found application properties file file:/home/jaanus/javelintools/etc/javelin.properties
Aug 22, 2007 10:32:46 PM net.sf.javelintools.core.PropertiesManager loadPropertiesFile
FINE: Found default timeouts file jar[noparse]:file:[/noparse]/home/jaanus/javelintools/lib/javelintools-core.jar!/net/sf/javelintools/core/timeoutsDefault.properties
Aug 22, 2007 10:32:46 PM net.sf.javelintools.core.PropertiesManager loadPropertiesFile
FINE: Found timeouts file file:/home/jaanus/javelintools/etc/timeouts.properties
Aug 22, 2007 10:32:47 PM net.sf.javelintools.core.PropertiesManager convertStringToInt
FINE: Found value serialport.open.wait, using: 2000
Aug 22, 2007 10:32:47 PM net.sf.javelintools.core.serial.SerialPortFactory create
INFO: Serial port parameters could not be specified. Check your serial IO version (Invalid Parameter).
Aug 22, 2007 10:32:47 PM net.sf.javelintools.cli.Main list
FINE: Exception caught connecting to javelin /dev/ttyS1 : SERIAL
net.sf.javelintools.exception.JavelinException: Serial port parameters could not be specified. Check your serial IO version (Invalid Parameter).
at net.sf.javelintools.core.serial.SerialPortFactory.create(SerialPortFactory.java:159)
at net.sf.javelintools.core.serial.SerialPortFactory.create(SerialPortFactory.java:120)
at net.sf.javelintools.core.driver.serial.SerialIODriver.connect(SerialIODriver.java:212)
at net.sf.javelintools.core.Javelin.connect(Javelin.java:156)
at net.sf.javelintools.cli.Main.list(Main.java:219)
at net.sf.javelintools.cli.Main.main(Main.java:119)
Caused by: javax.comm.UnsupportedCommOperationException: Invalid Parameter
at net.sf.commwrapper.rxtx.RxTxSerialPortAdapter.setSerialPortParams(RxTxSerialPortAdapter.java:332)
at net.sf.javelintools.core.serial.SerialPortFactory.create(SerialPortFactory.java:151)
... 5 more
Aug 22, 2007 10:32:47 PM net.sf.javelintools.core.PropertiesManager convertStringToInt
FINE: Found value serialport.open.wait, using: 2000
Aug 22, 2007 10:32:47 PM net.sf.javelintools.core.serial.SerialPortFactory create
INFO: Serial port parameters could not be specified. Check your serial IO version (Invalid Parameter).
Aug 22, 2007 10:32:47 PM net.sf.javelintools.cli.Main list
FINE: Exception caught connecting to javelin /dev/ttyS0 : SERIAL
net.sf.javelintools.exception.JavelinException: Serial port parameters could not be specified. Check your serial IO version (Invalid Parameter).
at net.sf.javelintools.core.serial.SerialPortFactory.create(SerialPortFactory.java:159)
at net.sf.javelintools.core.serial.SerialPortFactory.create(SerialPortFactory.java:120)
at net.sf.javelintools.core.driver.serial.SerialIODriver.connect(SerialIODriver.java:212)
at net.sf.javelintools.core.Javelin.connect(Javelin.java:156)
at net.sf.javelintools.cli.Main.list(Main.java:219)
at net.sf.javelintools.cli.Main.main(Main.java:119)
Caused by: javax.comm.UnsupportedCommOperationException: Invalid Parameter
at net.sf.commwrapper.rxtx.RxTxSerialPortAdapter.setSerialPortParams(RxTxSerialPortAdapter.java:332)
at net.sf.javelintools.core.serial.SerialPortFactory.create(SerialPortFactory.java:151)
... 5 more
It is before it does any real communication.
Did you install RXTX from the tarball I had on Sourceforge, or did you get it directly from the rxtx website ? I modified rxtx to support
28.8K bps. The official version may complain if you try to set this bitrate. This sounds like something different, since as I recall the
unmodified version does not complain - it just doesn't do it right (defaults to 38.4k bps).
What kind of serial port do you have? Is it a regular on-board uart? It looks like it based on the tty's being assigned.
Have you done anything to the timeouts file in etc ?
- Andrew
My laptop doesn't have a serial port , i'm using docking-station serial port.
i uninstalled it ant tried sourceforge version - still got errors, should i try jre1.5?:
$ bin/javelintools -test -port /dev/ttyS0
Experimental: JNI_OnLoad called.
Stable Library
=========================================
Native lib Version = RXTX-2.1-7
Java lib Version = RXTX-2.1-7
RXTX Warning: Removing stale lock file. /var/lock/LCK..ttyS1
RXTX Warning: Removing stale lock file. /var/lock/LCK..ttyS0
$ cat /tmp/javelintools.log.0
Aug 22, 2007 11:34:33 PM net.sf.javelintools.core.PropertiesManager loadPropertiesFile
FINE: Found default application properties file jar[noparse]:file:[/noparse]/home/jaanus/javelintools/lib/javelintools-core.jar!/net/sf/javelintools/core/javelinDefault.properties
Aug 22, 2007 11:34:33 PM net.sf.javelintools.core.PropertiesManager loadPropertiesFile
FINE: Found application properties file file:/home/jaanus/javelintools/etc/javelin.properties
Aug 22, 2007 11:34:33 PM net.sf.javelintools.core.PropertiesManager loadPropertiesFile
FINE: Found default timeouts file jar[noparse]:file:[/noparse]/home/jaanus/javelintools/lib/javelintools-core.jar!/net/sf/javelintools/core/timeoutsDefault.properties
Aug 22, 2007 11:34:33 PM net.sf.javelintools.core.PropertiesManager loadPropertiesFile
FINE: Found timeouts file file:/home/jaanus/javelintools/etc/timeouts.properties
Aug 22, 2007 11:34:33 PM net.sf.javelintools.core.PropertiesManager convertStringToInt
FINE: Found value serialport.open.wait, using: 2000
Aug 22, 2007 11:34:33 PM net.sf.javelintools.core.serial.SerialPortFactory create
INFO: Serial port parameters could not be specified. Check your serial IO version (Invalid Parameter).
Aug 22, 2007 11:34:33 PM net.sf.javelintools.cli.Main testJavelin
SEVERE: net.sf.javelintools.exception.JavelinException: Serial port parameters could not be specified. Check your serial IO version (Invalid Parameter).
Did you go through all of the install steps I had in the docs? Have you successfully used that serial port before?
If you have another serial device you could try on that port, that would be great.
What distro and kernel are you running?
I don't have access to a docking station to try this type of hardware configuration myself. Most of the development has
been on my laptop using a usb-serial adapter. I'll try it on another machine with an on-board serial port. I have done
this in the past, but not with the latest javelintools version.
I have to run at the moment, but I'll create either a custom build or a test app for you to see what we can figure out.
- Andrew
there are actually 2 additional steps:
download & install rxtx and check serialport permissions.
I'm running Ubuntu 7.10. and tested with Ubuntu kernels: 2.6.20-16 and 2.6.22-9.
And i tested with USB-serial adapter, but the result is the same.
usb-serial adapter info:
[noparse][[/noparse] 3566.392000] pl2303 5-8.5:1.0: pl2303 converter detected
[noparse][[/noparse] 3566.392000] usb 5-8.5: pl2303 converter now attached to ttyUSB0
[noparse][[/noparse] 3566.392000] usbcore: registered new interface driver pl2303
[noparse][[/noparse] 3566.392000] drivers/usb/serial/pl2303.c: Prolific PL2303 USB to serial adaptor driver
I tested with VMware too, 'Javelin Stamp IDE' gave :
[noparse][[/noparse]Debug] Found connected Javelin Stamp, now testing for power
[noparse][[/noparse]Debug] Resetting
[noparse][[/noparse]Error IDE-0022] Error reading from the serial port (timeout).
I don't have windows partition in my laptop, but i was able to program my javelin stamp using friend computer.
I looked with minicom, but as there is no way to set there speed 28800, so i was able to see only meaningless symbols.
Jaanus
I just posted version 0.1.1. It now bundles RXTX with it, so you don't need to install it. Could you please remove RXTX from your jre before trying it? The files your need to remove are:
- jre/lib/extRXTXcomm.jar
- jre/lib/i386/librxtx*
This will ensure that you are running with the correct version of RXTX.
- Andrew
Make sure you srcub your machine of all versions of rxtx as I described in my previous post, and use
version 0.1.1 of javelintools. I'll update the documentation in a future release in a troubleshooting
section describing the problem.
Let me know if you have any more issues. As an upside, you'll get to try the integrated compiling in this version.
I'm not sure it's in the notes, but this version (and the next couple, probably), has a limitation of not supporting jar
files for the link stage. You'll need to have the unzipped javelinlib.jar on the path.
- Andrew
P.S. The next major release will also offer Eclipse support via an Eclipse plugin. What is available now I will rename to
javelintools-cli. I expect to get this out in the next 2-3 weeks if all goes according to plan.
as the error-messages were same on both ports ttyS0 and ttyS1, i started to suspect that 'chmod 666 /dev/ttyS0'
isn't enough . (my user is in dialout group too)
tested as root and it works:
$ ls -l /dev/ttyS0
crw-rw-rw- 1 root dialout 4, 64 2007-08-23 13:38 /dev/ttyS0
jaanus@nodsu:~/javelintools$ bin/javelintools -test -port /dev/ttyS0
Experimental: JNI_OnLoad called.
Stable Library
=========================================
Native lib Version = RXTX-2.1-7
Java lib Version = RXTX-2.1-7
$ sudo bin/javelintools -test -port /dev/ttyS0
Experimental: JNI_OnLoad called.
Stable Library
=========================================
Native lib Version = RXTX-2.1-7
Java lib Version = RXTX-2.1-7
Javelin successfully tested, status: PC[noparse][[/noparse]1085]; Activity[noparse][[/noparse]0]; Bytecode[noparse][[/noparse]37]
Jaanus
$ javac -target 1.1 -source 1.2 -classpath ~/javelintools/lib/:./ HelloWorld.java
$ bin/javelintools -link -cp ~/javelintools/lib/:./ -file HelloWorld.jem -class HelloWorld
Class HelloWorld not linked - check log.
$ cat /tmp/javelintools.log.0
Aug 23, 2007 4:10:10 PM net.sf.javelintools.core.link.NativeJemLinker link
SEVERE: Unable to load class file: `java/lang/Throwable', './java/lang/Throwable.class'.
Aug 23, 2007 4:10:10 PM net.sf.javelintools.cli.Main linkJem
SEVERE: net.sf.javelintools.exception.JavelinException: Unable to load class file: `java/lang/Throwable', './java/lang/Throwable.class'.
Thanks,
Jaanus
Install:
* Unzip javelintools. For this example, we'll assume $HOME/bin
* Download javelinlib.jar from sourceforge, and unzip to $HOME/bin/javelintools/javelinlib
* Modify your .bashrc and add the following:
export JAVELINTOOLS_HOME=$HOME/bin/javelintools
export JAVELINTOOLS_CLASSPATH=$JAVELINTOOLS_HOME/javelinlib
export PATH=$PATH:$JAVELINTOOLS_HOME/bin
* Close that terminal, and upon another (to make sure the .bashrc is loaded).
Usage:
* cd to the directory where you source is
* To compile, link and upload HelloWorld, simply run the following commands:
javelintools -compile -class HelloWorld.java
javelintools -link -class HelloWorld -file HelloWorld.jem
javelintools -upload -file HelloWorld.jem -port /dev/ttyS0
This example compiles HelloWorld.java, links it into HelloWorld.jem, and uploads the linked file to /dev/ttyS0
I hope this helps.
- Andrew
Post Edited (aprunicki) : 8/23/2007 2:49:51 PM GMT
$ javelintools -compile -class HelloWorld.java
The following errors were encountered:
Error: Could not find package named:
$ env|grep JAVELIN
JAVELINTOOLS_HOME=/home/jaanus/javelintools
JAVELINTOOLS_CLASSPATH=/home/jaanus/javelintools/javelinlib
$ ls $JAVELINTOOLS_CLASSPATH/*
/home/jaanus/javelintools/javelinlib/javelinlib.jar
- Andrew
It's important to get something up and running quickly.
and is it OK, when i'm running tehe javelin code, it sends hundreds of empty lines on terminal screen?:
# javelintools -run -port /dev/ttyS0
Experimental: JNI_OnLoad called.
Stable Library
=========================================
Native lib Version = RXTX-2.1-7
Java lib Version = RXTX-2.1-7
Hello World!~
~~
==20 empty pages===
Javelin successfully run
$ javelintools -compile -class ServoControl.java
$ javelintools -link -class ServoControl -file ServoControl.jem
Class ServoControl successfully linked into ServoControl.jem
# javelintools -upload -file ServoControl.jem -port /dev/ttyS0
Experimental: JNI_OnLoad called.
Stable Library
=========================================
Native lib Version = RXTX-2.1-7
Java lib Version = RXTX-2.1-7
# cat /tmp/javelintools.log.0
Aug 23, 2007 9:03:50 PM net.sf.javelintools.core.driver.serial.SerialIODriver reset
SEVERE: Firmware version does not match, is 0, but should be 80
Aug 23, 2007 9:03:50 PM net.sf.javelintools.cli.Main uploadJavelin
SEVERE: net.sf.javelintools.exception.JavelinException: Firmware version does not match, is 0, but should be 80
# javelintools -test -port /dev/ttyS0
Experimental: JNI_OnLoad called.
Stable Library
=========================================
Native lib Version = RXTX-2.1-7
Java lib Version = RXTX-2.1-7
Javelin successfully tested, status: PC[noparse][[/noparse]1040]; Activity[noparse][[/noparse]0]; Bytecode[noparse][[/noparse]0]
docs since I simplified the install process and added compiling.
The long lines when running are unfortunately part of the current release.
I have that in my plan to fix as part of the next major release.
Would you mind sending me your source code you are trying to upload. I am at work now, but when
I get home tonight I'll try to upload it to my javelin.
- Andrew
import stamp.core.*;
public class ServoControl {
static PWM servo = new PWM(CPU.pin12,173,2304);
public static void main(){
System.out.println("start");
CPU.delay(5000);
servo.update(130,2304);
CPU.delay(5000);
System.out.println("end");
}
}
i was able to install 'helloworld' again and it is running without problems
Jaanus
do not have my javelin handy. I'll try to upload this to my javelin tonight.
I've seen this problem before when I was developing the validation part. There are any of a number of
reasons why this had occurred in the past.
Would you mind modifying your HelloWorld example to do something besides emitting a string,
like perhaps sum two integers or something?
- Andrew
public class HelloWorld{
static int i;
public static void main(){
System.out.println("Hello World!");
i=5+14;
System.out.println(i);
}
}
worked well too,
but when i added
CPU.delay(5000);
before secont println, it started acting funny.
Jaanus
public class ServoControl {
static PWM servo = new PWM(CPU.pin12,173,2304);
public static void main(){
System.out.println("start");
// CPU.delay(5000);
servo.update(130,2304);
// CPU.delay(5000);
System.out.println("end");
}
}
don't work too
This gives me plenty to work with. I'll debug this tonight.
One quick question, though. When you say it started "acting funny", I assume you
mean it gave you the same error?
- Andrew
Post Edited (aprunicki) : 8/23/2007 9:28:18 PM GMT
There was a bug in the final reset of the Javelin, so there are no longer any errors
in the log. Unfortunately, the program does not seem to run properly once loaded.
I'll have to debug it this weekend. I quickly looked at the code again, but didn't see
anything amiss. I'll post again with what I find.
- Andrew
The code looks very solid from the Java side, and I verified that the program is properly streamed. I suspect
there may be an issue with RXTX itself. I plan to debug what is happening in RXTX. If all else fails, I'll replace
the RXTX-based implementation with a native one.
- Andrew
P.S. I am extremely busy for the next 3 or so months, so I'll be working on this as time permits.
Post Edited (aprunicki) : 9/11/2007 9:37:53 PM GMT
do you have any updates?
my javelin-project has been stuck so far.
but now I got 'motor mount & wheel kit':
http://www.parallax.com/Store/Accessories/MotorServos/tabid/163/ProductID/507/List/0/Default.aspx?SortField=ProductName,ProductName
and test-platform is ready to move...
Thanks,
Jaanus