Shop OBEX P1 Docs P2 Docs Learn Events
Command line compiling and linking — Parallax Forums

Command line compiling and linking

m817m817 Posts: 11
edited 2005-11-18 20:02 in General Discussion
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

Comments

  • Ryan C. PayneRyan C. Payne Posts: 38
    edited 2005-01-19 04:17
    I have been kicking around the idea of writing a Javelin plugin for Eclipse (http://www.eclipse.org). I have been using Eclipse as an IDE for Java projects for the past three years and it is a very full featured IDE...
  • Chris WChris W Posts: 4
    edited 2005-01-22 20:14
    It would be awesome to have an Eclipse plugin for the Javelin, especially one that supported the debugger. The information that you need to implement a full Javelin debugger is now available in the JavelinDirect source code at http://www.parallax.com/javelin/downloads.asp. Of course writing an Eclipse debugger subclass would be very challenging....

    Regards,

    Chris.
  • Ryan C. PayneRyan C. Payne Posts: 38
    edited 2005-01-22 21:00
    If people will use it, I will build it. [noparse]:)[/noparse] I'd like to set it up as a SourceForge project.

    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
  • m817m817 Posts: 11
    edited 2005-01-23 04:38
    Actually, I was excited in having Jikes and JavelinDirect available because I wanted to work in Emacs.
  • cybersapiencybersapien Posts: 13
    edited 2005-11-15 15:24
    I've been able to create an Eclipse project for doing Javelin development and, while not as feature rich as a plugin would be, its not too bad.

    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?
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2005-11-15 15:38
    The print functions used are printf() and vprintf().

    printf() and vprintf both go to stdout, that's why you can redirect them from command line.

    regards peter
  • cybersapiencybersapien Posts: 13
    edited 2005-11-15 18:38
    Thanx! But perhaps I wasn't clear.

    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
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2005-11-15 19:15
    If you specify --listen the following loop is entered in main() (JavelinDirect 1.0)


    ·· 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
    ·
  • cybersapiencybersapien Posts: 13
    edited 2005-11-16 13:51
    I need to get System.out.print messages from the Javelin so I need --listen. Without --listen, as I'm sure you are aware, JavelinDirect exits after resetting the Javelin.

    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)?
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2005-11-16 14:34
    I did a topic search·in C++ builder for HandleMessage. Two results.

    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
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2005-11-16 14:42
    You·say you need to process the data send by System.out.print,

    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
  • cybersapiencybersapien Posts: 13
    edited 2005-11-16 18:19
    Yes.

    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.
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2005-11-16 19:50
    Right, now there I can help you.

    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

    ·
  • cybersapiencybersapien Posts: 13
    edited 2005-11-16 20:54
    Sounds promising.

    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.
    643 x 129 - 13K
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2005-11-16 21:22
    Put attached file into windows\system32 folder and try again.

    regards peter
  • cybersapiencybersapien Posts: 13
    edited 2005-11-16 21:30
    That helped.

    Now I'm getting another dependency·error for·rtl60.bpl
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2005-11-16 21:36
    Strange, both vcl and rtl runtime packages are included in the build.

    Put atached file in windows\system32 folder and try again.

    regards peter
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2005-11-16 22:14
    I tested JideTerm on a windows 98 system where Borland C++ builder was not installed.

    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
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2005-11-16 22:37
    JavelinDirect version 1.2
    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
    ·
  • cybersapiencybersapien Posts: 13
    edited 2005-11-17 01:50
    That did the trick. All utilities run now.

    You're not going to believe this, though. Still no output is coming thru.

    JideTerm --port 4 > output.txt produces an empty file.
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2005-11-17 02:27
    Hmm, I experience the same problem with JideTerm.

    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
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2005-11-17 08:49
    Solved the problem with JideTerm. Appears·while parsing the commandline, I checked for --log

    instead of --out, hence no file was created.

    The corrected version is uploaded here

    ·http://groups.yahoo.com/group/JavelinCode/files/JideTerm/

    regards peter
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2005-11-17 10:40
    I used JavelinDirect 1.2 to create a jem file.

    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
  • cybersapiencybersapien Posts: 13
    edited 2005-11-18 19:13
    Thanx! I wish I could say it worked for me too.

    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.
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2005-11-18 20:02
    Can you redirect output using JideDebug (for the runtime messages)?
    JideDebug is a singlethread utility and does not call Handlemessage.
    Let me know the result.
    regards peter
    ·
Sign In or Register to comment.