Command line compiling and linking
m817
Posts: 11
Been playing with around with the Javelin for a short while...
Okay, so it looks like I can use Jikes to compile my Javelin code ( reference http://www.parallax.com/javelin/articles.asp·) and use JavelinDirect for linking and downloading to Javelin.
C:\Program Files\Parallax Inc\Javelin Stamp IDE\Projects>..\jikes\jikes -classpath ../lib i2cTest.java
(Produces i2cTest.class)
C:\Program Files\Parallax Inc\Javelin Stamp IDE\Projects>..\JavelinDirect\JavelinDirect --path "..\lib;." i2cTest
Linking
(links and downloads to javelin)
Sound about right, Jon?
Yeah, I want to work outside of the Javelin IDE.
bob
Okay, so it looks like I can use Jikes to compile my Javelin code ( reference http://www.parallax.com/javelin/articles.asp·) and use JavelinDirect for linking and downloading to Javelin.
C:\Program Files\Parallax Inc\Javelin Stamp IDE\Projects>..\jikes\jikes -classpath ../lib i2cTest.java
(Produces i2cTest.class)
C:\Program Files\Parallax Inc\Javelin Stamp IDE\Projects>..\JavelinDirect\JavelinDirect --path "..\lib;." i2cTest
Linking
(links and downloads to javelin)
Sound about right, Jon?
Yeah, I want to work outside of the Javelin IDE.
bob
Comments
Regards,
Chris.
Phase·1 would just be creating Javelin projects, compiling using the Jikes compiler and allowing it to kick off the Downloader.
Phase 2 would incorporate debugging in the IDE.
Would anybody else use such a thing if it was developed?
Ryan
My only problem is that I'm using JavelinDirect and the messages coming out of the Javelin are·getting lost. If I run JavelinDirect in a cmd.exe window, all is well. If I run the same command in Eclipse, the messages are lost. I can produce the same effect in the cmd prompt window (outside of Eclipse) if I redirect JavelinDirect output to a file.
I'm not sure how the Javelin messages are output, but they don't appear to be coming thru stdout or stderr. Is that possible?
printf() and vprintf both go to stdout, that's why you can redirect them from command line.
regards peter
The Javelin messages received by JavelinDirect couldn't be redirected to a file. For example, in a command prompt window:
Without redirection:
>JavelinDirect --path build\classes --listen --port 4 HelloWorld
Linking
Finding Javelin
Downloading .......................
Listening for Messages
HelloWorld
With redirection:
>JavelinDirect --path build\classes --listen --port 4 HelloWorld > output.txt
(output.txt):
Linking
Finding Javelin
Downloading .......................
No further output was produced
·· if (Listen) {
····· printf("Listening for messages\n");
····· while (1) {
······· Application->HandleMessage();
······· if (kbhit()) {
········· int c = getch();
········· jvm->SendTerminalByte(c);
······· }
····· }
··· }
Try it without listening, I never use --listen when I use JavelinDirect.
regards peter
·
I'm really perplexed as to why the messages come out on the cmd prompt console but cant be redirected. I also tried
>JavelinDirect --path build\classes --listen --port 4 HelloWorld | cat
with the same result (i.e. Nothing after Downloading .......................)
I don't care so much that output can't be redirected but, back to my·original goal of using Eclipse, I'm reasonably sure this is why the messages aren't showing up in the Eclipse console because·Eclipse simply eats stdout and stderr.
Here's another tidbit of information. When I redirect the output, I don't even see the result of·printf("Download complete. Resetting Javelin.\n")·from Main.cpp (line 200) after the download.
Do you think something·has happened to stdout (buffering or other options)?
1.
· CLX Reference
TApplication::HandleMessage
TApplication·See also ·Example
Interrupts the execution of an application to process a single event.
void __fastcall HandleMessage(void);
Description
HandleMessage interrupts the execution of the application so that the widget layer can process a single event before returning control to the application.
Note:·If the application goes idle, HandleMessage may take a long time to return. Therefore, do not call HandleMessage when waiting for something event-based while priority actions are also being processed. Instead, call ProcessMessages when processing more than just events.
2.
·VCL Reference
TApplication::HandleMessage
TApplication·See also ·Example
Interrupts the execution of an application while Windows processes a message in the Windows message queue.
void __fastcall HandleMessage(void);
Description
HandleMessage interrupts the execution of the application so that Windows can process a single message from the Windows message queue before returning control to the application. If the message queue is empty, HandleMessage generates an OnIdle event and starts the process of updating the actions in the application.
Note:·If the application goes idle, HandleMessage may take a long time to return. Therefore, do not call HandleMessage when waiting for something message-based while priority actions are also being processed. Instead, call ProcessMessages when processing more than just messages.
The JavelinDirect uses VCL.
Here is info on ProcessMessages
·VCL Reference
TApplication::ProcessMessages
TApplication·See also·Example
Interrupts the execution of an application so that it can process the message queue.
void __fastcall ProcessMessages(void);
Description
Call ProcessMessages to permit the application to process messages that are currently in the message queue. ProcessMessages cycles the Windows message loop until it is empty, and then returns control to the application.
Note:·Neglecting message processing affects only the application calling ProcessMessages, not other applications. In lengthy operations, calling ProcessMessages periodically allows the application to respond to paint and other messages.
Note:·ProcessMessages does not allow the application to go idle, whereas HandleMessage does.
Perhaps the Application->HandleMessage(); should be replaced by
Application->ProcessMessage(); so the application never goes idle.
regards peter
Post Edited (Peter Verkaik) : 11/16/2005 2:43:18 PM GMT
do you mean the messages of the running javelin program·after
a new program has been downloaded and the javelin has been reset?
regards peter
I use the messages for debugging as well as ensuring all is well with·my BOE-BOT before I cut it loose from its tether (i.e. the USB cable).
Actually, it may help to mention that I'm using a USB-BOE to host my Javelin and using the FTDI (rev. 2151) USB -> Serial Converter driver on my PC.
BTW, Thanks for all the attention you're giving.
For debug (catch output on Javelin SOUT pin)
http://groups.yahoo.com/group/JavelinCode/files/JideDebug/
For terminal (catch output on Javelin SOUT pin and send data to Javelin SIN pin)
http://groups.yahoo.com/group/JavelinCode/files/JideTerm/
Make sure you have a javelin program running.
Close (exit) the Jide program. Start either JideDebug or JideTerm.
Now you should see the runtime messages.
If all is well you CAN redirect those messages as I programmed
both debug and terminal using printf only.
Let me know.
regards peter
·
Can you build standalone versions of JideTerm and JideDebug?
I'm getting the attached error dialog when I attempt to run either one.
I also noticed a newer JavelinDirect (1.2) which also has the dependency issue.
regards peter
Now I'm getting another dependency·error for·rtl60.bpl
Put atached file in windows\system32 folder and try again.
regards peter
That also gave the dependency errors. After installing VCL60.BPL and RTL60.BPL in the
windows/system32 folder JideTerm runs without a problem.
I have uploaded the file JideRuntime.zip (contains VCL60.BPL and RTL60.BPL) to
http://groups.yahoo.com/group/JavelinCode/files/JideTerm/
and updated the descriptions for JavelinDirect, JideDebug and JideTerm.
regards peter
JavelinDirect [noparse][[/noparse]options] filename
·· Link and/or download a Javelin program or download a jemfile from the command line.
·· Filename is the name of the .class file containing the
·· main() method or the jem file. Do not use the .class, .java or .jem suffix.
·· --path <path> Classpath. Multiple paths are separated by semicolons.
················ Use quotes if there are spaces in the paths.
·· --port <port> Serial port number. e.g. 2 for COM2.
················ The port number will be automatically chosen if not specified.
·· --listen····· After downloading the program listen and receive any
················ debug messages from the Javelin.
·· --link······· Only link sources and create jem file.
·· --load······· Only download a jem file to the Javelin.
·· --help······· Display this help message
Version 1.2 allows you to compile a jem file only, which can be send to a customer
together with JavelinDirect.exe so a customer can download a new program into
the javelin without requiring access to your sources.
regards peter
·
You're not going to believe this, though. Still no output is coming thru.
JideTerm --port 4 > output.txt produces an empty file.
Will investigate this. For now, use JideDebug.
I just tested it and that works.
If you use JideDebug --port 4 --out out.txt
messages are output to screen and file out.txt
If you use JideDebug --port 4 > out.txt
nothing appears on screen but out.txt is created and filled with messages
You must exit JideDebug by pressing CTRL-C
For your convenience I attached JideDebug.exe
regards peter
instead of --out, hence no file was created.
The corrected version is uploaded here
·http://groups.yahoo.com/group/JavelinCode/files/JideTerm/
regards peter
Then I used JavelinDirect 1.2 with the --listen option to download the jemfile
to the javelin, using > out.txt to redirect output. That worked. The file contained
all the messages including messages from the running javelin program.
So it should work for you too.
regards peter
The fact that you're having success now leads me to believe I might have an issue with my environment.
I'm currently using the FTDI USB <-> Serial Converter under Windows XP on an IBM ThinkPad and using a USB cable to connect to my USB-BOE.
I'm wondering if there's some issue with the FTDI driver/Windows XP pairing.
If I find anything useful in my investigation, I'll let you know.
Thanks for all your help.
JideDebug is a singlethread utility and does not call Handlemessage.
Let me know the result.
regards peter
·