Shop OBEX P1 Docs P2 Docs Learn Events
Propeller JVM Project: PASM Java VM - Page 10 — Parallax Forums

Propeller JVM Project: PASM Java VM

14567810»

Comments

  • jmspaggijmspaggi Posts: 629
    edited 2010-07-30 02:34
    Look like we are making some progress.

    Programming Next 32K EEPROM with 000EE4 Bytes ... verified. Operation Complete!
    
    



    But as you suggested, I had to switch to BST 0.19.3 for that since 0.19.4 is causing issues.

    Now, am I supposed to see anything else after that? Because that's all what I'm getting. I tried to press Y just in case [noparse];)[/noparse]

    JM

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Linux? There is worst, but it's more expensive.
  • jazzedjazzed Posts: 11,803
    edited 2010-07-30 03:22
    Ok. You should be able to just press reset button or hit F7 do see your Javelin program run (assuming you have already done step 1 with #define EE32STACK somewhere for JVM (in PasmA0EEPROM.spin or pjvm_demo.spin).

    If you don't see your Javelin program output with the JVM, you should do steps 3.a, 3.b, 4.a, 4.b.

    --Steve
    jmspaggi said...
    Look like we are making some progress.

    Programming Next 32K EEPROM with 000EE4 Bytes ... verified. Operation Complete!
    
    



    But as you suggested, I had to switch to BST 0.19.3 for that since 0.19.4 is causing issues.

    Now, am I supposed to see anything else after that? Because that's all what I'm getting. I tried to press Y just in case [noparse];)[/noparse]

    JM
    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Propeller Pages: Propeller JVM
  • jmspaggijmspaggi Posts: 629
    edited 2010-07-30 12:22
    Hi Steve,

    Here is what I'm doing to see my FiboTest working:

    1) Program the pjvm_demo.spin to EEPROM using BST F11.
    2) Set EEprog32Kplus.spin verbose to 0, readonly to 0, program with F11.
    3) Program the pjvm_demo.spin to EEPROM using BST F11.
    
    



    When I try EEprog32K with F10, I still see the previous programme output. I'm flipping between HelloWorld and FiboTest.

    If I do F11 with EEprog, then I can see the "Programming Next 32K..." output. But when I do F7, I see it again and again. So I have to re-load pjvm with F11 and then it's working.

    Does it mean I use the stack option? Not sure at all [noparse]:([/noparse]

    When I do step 1. I don't see the new program. I see the previous one. I can see the new only after the 3 steps.

    Here is what I have added in EEprog and pjvm:
    #ifndef EE32STACK
    #define EE32STACK
    #endif
    
    



    That's strange. It really looks like F10 is not working. Because when I try it, I always see the previous programme running. Not the one I'm trying to load.

    Any idea why?

    JM

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Linux? There is worst, but it's more expensive.

    Message Edité (jmspaggi) : 7/30/2010 3:36:54 PM GMT
  • jazzedjazzed Posts: 11,803
    edited 2010-07-30 15:25
    jmspaggi said...

    Here is what I'm doing to see my FiboTest working ...
    If you're seeing FiboTest running that's great [noparse]:)[/noparse]

    This should work too:

    1) Program the pjvm_demo.spin to EEPROM using BST F11 (do only once).
    2) Set EEprog32Kplus.spin verbose to 0, readonly to 0, program with F10.
    3) Press reset button or hit F7 in BST and see Javelin program run.
    
    
    



    If you program EEprog32Kplus.spin with F11, that means you're overwriting the JVM in EEPROM.

    --Steve

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Propeller Pages: Propeller JVM
  • jmspaggijmspaggi Posts: 629
    edited 2010-07-30 15:47
    Hi Steve,

    I don't know why, but with F10 it's never working.

    Initial situation: FiboTest running on the Prop.

    Steps:
    1) build.sh HelloWord => Successful
    2) Program the pjvm_demo.spin to EEPROM using BST F11 (do only once). => Successful. Output: Fibo steps.
    3) Set EEprog32Kplus.spin verbose to 0, readonly to 0, program with F10. => Successful. Output: Fibo steps.
    4) Press reset button or hit F7 in BST and see Javelin program run. => Successful. Output: Still Fibo steps.
    
    



    If I want to see the HelloWorld, I have to push EEProg with F11 instead of F10, and then reload the JVM with F11 (Step 2 above). That way, I can see the HelloWorld.

    What I suspect is that there is a reset after F10. Which mean BST is pushing the code into the Prop, and reset it. But when he reset, the Prop is getting fresh code from the EEPROM, and that's why he never execute EEprog. Because I never see EEprog output unless I use F11.

    I will try to redo all the steps with the console off of see the result...

    JM

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Linux? There is worst, but it's more expensive.
  • jmspaggijmspaggi Posts: 629
    edited 2010-07-30 15:53
    Ok. So I can confirm. The issue is coming from the console!

    I closed the console and redid all the steps, and I was able to see Fibo when I have reconnected the console! (HelloWorld when into the Prop).

    So I don't know exactly why, and when, but under Linux, BST is sending a reset to the propeller when the console reconnect to it.

    JM

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Linux? There is worst, but it's more expensive.
  • jazzedjazzed Posts: 11,803
    edited 2010-07-30 16:51
    Hi JM.

    Sorry you're having trouble with BST console. I'm not seeing that. Maybe there is a driver setting?

    Here is an alternative that uses bstc and microcom with the scripts provided. There are small changes: make.sh uses -p2 instead of -p1, EEprog32Kplus.spin has a prompt until enter to accommodate the microcom progam startup. The steps here are identical to the steps I enumerated before in that make.sh programs JVM to EEPROM ($0..$7fff) and load.sh programs Javelin bytecode to EEPROM ($8000+) I'll attach a new package for reference later, but I think I'll add an expect script for linux to automate the procedure.

    steve@steve-laptop:~/Propeller/JVM/PropellerJVM-32K-EeCache$ ./make.sh /dev/ttyUSB1
    Brads Spin Tool Compiler v0.15.3 - Copyright 2008,2009 All rights reserved
    Compiled for i386 Linux at 08:17:46 on 2009/07/20
    Loading Object pjvm_demo
    Loading Object FullDuplexSingleton
    Loading Object pjvmInterpreterCOG
    Loading Object PasmA0EEPROM
    Loading Object pjdata
    Loading Object pjcon
    Loading Object pnative
    Loading Object pjdef
    Loading Object pjvmvp
    Loading Object properties
    Program size is 19164 longs
    27 Constants folded
    Compiled 3956 Lines of Code in 0.521 Seconds
    We found a Propeller Version 1
    Propeller Load took 6.369 Seconds
    steve@steve-laptop:~/Propeller/JVM/PropellerJVM-32K-EeCache$ ./build.sh FiboTest
    Linking
    steve@steve-laptop:~/Propeller/JVM/PropellerJVM-32K-EeCache$ ./load.sh /dev/ttyUSB1
    Brads Spin Tool Compiler v0.15.3 - Copyright 2008,2009 All rights reserved
    Compiled for i386 Linux at 08:17:46 on 2009/07/20
    Loading Object EEprog32Kplus
    Loading Object properties
    Loading Object PasmEEPROM
    Loading Object FullDuplexSingleton
    Program size is 12172 longs
    1 Constants folded
    Compiled 650 Lines of Code in 0.059 Seconds
    We found a Propeller Version 1
    Propeller Load took 1.578 Seconds
    steve@steve-laptop:~/Propeller/JVM/PropellerJVM-32K-EeCache$ microcom --speed 115200 --port /dev/ttyUSB1
    *** Welcome to microcom (2009.06) ***
    connected to /dev/ttyUSB1
    Escape character: Ctrl-\
    Type the escape character followed by c to get to the menu or q to quit
    
    Press any key to start> 
    Press any key to start> 
    Programming Next 32K EEPROM with 00238A Bytes ... verified. Operation Complete! '' Press reset button 
    
    FIBO(00) =     0 (    8 ticks) (    4 ms)
    FIBO(01) =     1 (    9 ticks) (    5 ms)
    FIBO(02) =     1 (    9 ticks) (    5 ms)
    FIBO(03) =     2 (    9 ticks) (    5 ms)
    FIBO(04) =     3 (   10 ticks) (    6 ms)
    FIBO(05) =     5 (   10 ticks) (    6 ms)
    FIBO(06) =     8 (   11 ticks) (    6 ms)
    FIBO(07) =    13 (   13 ticks) (    7 ms)
    FIBO(08) =    21 (   16 ticks) (    9 ms)
    FIBO(09) =    34 (   21 ticks) (   12 ms)
    FIBO(10) =    55 (   28 ticks) (   16 ms)
    FIBO(11) =    89 (   39 ticks) (   22 ms)
    FIBO(12) =   144 (   57 ticks) (   32 ms)
    FIBO(13) =   233 (   87 ticks) (   48 ms)
    FIBO(14) =   377 (  136 ticks) (   76 ms)
    FIBO(15) =   610 (  215 ticks) (  119 ms)
    FIBO(16) =   987 (  343 ticks) (  191 ms)
    FIBO(17) =  1597 (  549 ticks) (  305 ms)
    FIBO(18) =  2584 (  883 ticks) (  491 ms)
    FIBO(19) =  4181 ( 1423 ticks) (  790 ms)
    FIBO(20) =  6765 ( 2297 ticks) ( 1276 ms)
    FIBO(21) = 10946 ( 3710 ticks) ( 2061 ms)
    FIBO(22) = 17711 ( 5998 ticks) ( 3332 ms)
    FIBO(23) = 28657 ( 9698 ticks) ( 5387 ms)
    FIBO(24)
    **********Help***********
      x - exit microcom
      q - quit microcom
      b - send break
      l - log on             
      t - set terminal
      w - send window size
      e - exit help
    *************************
    Command: 
    exiting
    steve@steve-laptop:~/Propeller/JVM/PropellerJVM-32K-EeCache$ ./build.sh HelloWorld
    Linking
    steve@steve-laptop:~/Propeller/JVM/PropellerJVM-32K-EeCache$ ./load.sh /dev/ttyUSB1
    Brads Spin Tool Compiler v0.15.3 - Copyright 2008,2009 All rights reserved
    Compiled for i386 Linux at 08:17:46 on 2009/07/20
    Loading Object EEprog32Kplus
    Loading Object properties
    Loading Object PasmEEPROM
    Loading Object FullDuplexSingleton
    Program size is 6888 longs
    1 Constants folded
    Compiled 650 Lines of Code in 0.045 Seconds
    We found a Propeller Version 1
    Propeller Load took 1.011 Seconds
    steve@steve-laptop:~/Propeller/JVM/PropellerJVM-32K-EeCache$ microcom --speed 115200 --port /dev/ttyUSB1
    *** Welcome to microcom (2009.06) ***
    connected to /dev/ttyUSB1
    Escape character: Ctrl-\
    Type the escape character followed by c to get to the menu or q to quit
    
    Press any key to start> 
    Press any key to start> 
    Press any key to start> 
    Programming Next 32K EEPROM with 000EE7 Bytes ... verified. Operation Complete! '' Press reset button 
    Hello World!
    
    **********Help***********
      x - exit microcom
      q - quit microcom
      b - send break
      l - log on             
      t - set terminal
      w - send window size
      e - exit help
    *************************
    Command: 
    exiting
    steve@steve-laptop:~/Propeller/JVM/PropellerJVM-32K-EeCache$ 
    
    
    



    Here are changes added for EEprog32Kplus.spin

    Old:
    pub main
      sx.start(hw#UCRXP, hw#UCTXP, hw#UCMODE, hw#UCBAUD)
      'waitcnt(clkfreq+cnt)
      waitcnt(clkfreq*hw#UCWAIT/2+cnt)
      ee.start(hw#BEESCLP,hw#BEESDAP)
    
    New:
    pub main
      sx.start(hw#UCRXP, hw#UCTXP, hw#UCMODE, hw#UCBAUD)
      ee.start(hw#BEESCLP,hw#BEESDAP)
    
      repeat
        waitcnt(clkfreq+cnt)
        sx.str(string($a,$d,"Press any key to start> "))
      until sx.rxready
    
    Also using $a,$d for other output.
    
    
    



    I may change EEprog32Kplus.spin to issue reset automatically after programming later.

    --Steve

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Propeller Pages: Propeller JVM
  • jmspaggijmspaggi Posts: 629
    edited 2010-10-19 03:47
    Hi Steve,

    Any update on the JVM?

    BTW, do you think the C3 will be a good plateform to have the JVM running?

    I'm currently working on my music plateform in Spin for my car, but my 2 next projects are planned in Java on Propeller ;)

    Also, should we have a Java section on OBEX? Since we can upload C objects, why not Java objects? That way, it might be possible to keep the Javelin Objects we have on Yahoo Groups?


    JM
  • jazzedjazzed Posts: 11,803
    edited 2010-10-19 09:00
    I've been focusing on the 32MB SDRAM and I2C Keyboard/Mouse projects.

    The JVM is on hold until those are done. The JVM could be ported to any platform.

    Having Javelin classes in the OBEX is unlikely. If there are enough requests Parallax might put up the effort.
    jmspaggi wrote: »
    Hi Steve,

    Any update on the JVM?

    BTW, do you think the C3 will be a good plateform to have the JVM running?

    I'm currently working on my music plateform in Spin for my car, but my 2 next projects are planned in Java on Propeller ;)

    Also, should we have a Java section on OBEX? Since we can upload C objects, why not Java objects? That way, it might be possible to keep the Javelin Objects we have on Yahoo Groups?


    JM
  • David BetzDavid Betz Posts: 14,511
    edited 2010-10-19 10:54
    What does the JVM interface to external memory look like? The C3 has two 32k SPI SRAM chips that could be used to provide 64k of external memory. What would I have to do to interface that with the JVM code?
  • jazzedjazzed Posts: 11,803
    edited 2010-10-19 12:19
    David Betz wrote: »
    What does the JVM interface to external memory look like? The C3 has two 32k SPI SRAM chips that could be used to provide 64k of external memory. What would I have to do to interface that with the JVM code?
    @David, look for "JAVAEE", "init(cmdptr)" and "loadByteEE" in jvmInterpreterCOG.spin (please ignore other variations of this spin file). The byte-code storage driver is expected to run in a separate COG.

    You could probably just replace the PasmA0EEPROM.spin file with a SPI driver that has equivalent functionality to run the byte-code program. The jlink.exe linker puts byte-code offsets at $8000 and will be used with #define HIEE ... this allows using HUB for stack and object variables; your driver will need to map address $8000+ to SRAM start.

    Of course a way would be needed to get the byte-code into the SPI SRAM, but you probably already have a handle on that.

    You may notice pjvm_demo calls pjd.init(...). That is the first access to the byte-code storage. If you are able to read the SPI SRAM from pjdata.spin "init" via the "eeReadByte" method, you're doing good - there are leftover debug prints in eeReadByte you can uncomment if necessary.

    If the initialization shows reasonable values, but you run into trouble fetching/executing bytecodes for some reason, you can enable the BMAD debugger and trace the byte-code interpreter progress. Hopefully, just #define BMAD will enable the debugger. I've often run out of room using the debugger though. There is a small tutorial and help page to get you started if necessary in the BMADebugger_Demo.spin v1.8 file at: http://forums.parallax.com/showthread.php?t=115068

    Propeller JVM is complicated. I'll be happy to answer any questions since you seem willing to try porting. Thanks.
  • David BetzDavid Betz Posts: 14,511
    edited 2010-10-19 12:44
    Thanks for the information on interfacing to external RAM. It sounds a little more complicated than I'm prepared to deal with right now. After I get some other stuff running on the C3 I'll come back to it.
  • jazzedjazzed Posts: 11,803
    edited 2010-10-20 09:22
    JM and David, I just realized according to Andre's feature list the C3 should ship a 64KB EEPROM.

    This means the latest Propeller JVM should work on C3 today without any code changes. Longer term the JVM can be ported to take advantage of C3's SPI SRAM.
    jmspaggi wrote: »
    BTW, do you think the C3 will be a good plateform to have the JVM running?
    David Betz wrote: »
    Thanks for the information on interfacing to external RAM. It sounds a little more complicated than I'm prepared to deal with right now. After I get some other stuff running on the C3 I'll come back to it.
  • jmspaggijmspaggi Posts: 629
    edited 2010-10-20 12:13
    jazzed wrote: »
    take advantage of C3's SPI SRAM.

    Hi Steve,

    I don't know what a SPI SRAM is ;)

    What will that give to the JVM?

    Thanks,

    JM
  • jazzedjazzed Posts: 11,803
    edited 2010-10-20 12:33
    jmspaggi wrote: »
    Hi Steve,

    I don't know what a SPI SRAM is ;)

    What will that give to the JVM?

    Thanks,

    JM

    Flexibility. Today with JVM running from EEPROM, you download one program at a time from your computer and run it.

    By using C3 and SPI SRAM (with changes to the JVM of course), you could put all your Javelin programs on SDCARD and load/run any of them without programming the EEPROM. There are other possibilities, but this is just one example.

    Of course there are many other much greater things possible with the big SDRAM board on the GadgetGangster Propeller Platform :)
  • jmspaggijmspaggi Posts: 629
    edited 2010-10-20 12:49
    Ok, I see.

    I'm using the parallax components the other way ;) Instead of having one propeller with multiple programs, I have one program per propeller and then multiply them ;) For now, I have 2 parallax controllers running the house, and will have 4 soon ;)

    Is there a way to use the SRAM to speed-up the JVM? Also, have you made any progress on the JNI calls to call PASM objects from the Java code?

    JM
  • jazzedjazzed Posts: 11,803
    edited 2010-10-20 14:19
    jmspaggi wrote: »
    Is there a way to use the SRAM to speed-up the JVM? Also, have you made any progress on the JNI calls to call PASM objects from the Java code?

    There may be marginal speed-up using SPI SRAM relative to EEPROM. More speed-up comes using SDRAM. Of course, for the Propeller JVM, the biggest speed-up is to use only HUB RAM, but then there would not be enough useful byte-code space.

    I have not given Propeller JVM attention in months - Parallax is not interested in Propeller JVM at all despite my 2 hour lunch with Andy on the subject in June (something I really enjoyed). If there is a bigger market for JVM, I'll redirect my efforts. I'm too busy trying to get other solutions out the door. JNI is still interesting of course. My attention is more focused on big things like 32MB SDRAM and getting Linux running on a Propeller for example.
  • jmspaggijmspaggi Posts: 629
    edited 2010-12-13 09:27
    Hi Steve,

    Can you please update the 1st post to include the last package to use?

    I have 2 or 3 small projects to implement, and I really don't want to waste time with Spin for them ;) Will take me about 5 minutes to implement in Java, compared to 5 months with Spin ;)

    Thanks,

    JM
  • jazzedjazzed Posts: 11,803
    edited 2010-12-13 13:16
    Hi JM. I've updated the first post and may edit a few things there later today. Do you need build instructions?
  • This is seems to be an old thread but WOW..

    A few notes on getting started, the first post on this thread has a download which I couldn't get to work on windows. However the same toolkit that uses propDirect instead of jlink is available at this mysterious Propeller JVM website in the Software Section there is a PropellerJVM_Windows_Alpha.zip SDK

    Doing a bit of back-reading I think this is the website of Jazzed? a.k.a Steve? and it's the evolution of the SDK attached to the beginning of this thread on the JVM for the propeller.

    Amazingly, I was able to get this to work and as something of an embedded java (self proclaimed) expert there is some really great work done there.

    I wanted to put the PropVM through it's paces and have in the past worked with the Embedded Java benchmarks at JopDesign.com which probe some of the JVM basics. I modified the suite slightly for some of the minor PropJVM differences that effected the tests but was able to get it to run and spit out the following metrics.

    Add 76000
    Iinc 106000
    Ldc 78000
    BranchTaken 59000
    BranchNotTaken 60000
    GetField 60000
    GetStatic 70000
    Array 49000
    InvokeVirtual 23000
    InvokeStatic 29000
    BenchSieve 42

    The numbers are in operations per second, so this is effectively a bytecodes/second metric except for BenchSieve which is a prime number search.

    There has obviously been considerable effort to get this far so any idea's why this effort has gone dead?

    Good work.
  • My guess is that it went dead because no one wanted to use it. 99% of Propeller users, at least at the time, were only interested in using Spin.
  • That would make sense but I would have thought a JVM solution would be more about attracting new users rather than converting existing ones.
  • MJBMJB Posts: 1,235
    David Betz wrote: »
    My guess is that it went dead because no one wanted to use it. 99% of Propeller users, at least at the time, were only interested in using Spin.

    And now we have the much faster und comfortable TACHYON
  • MJB wrote: »
    David Betz wrote: »
    My guess is that it went dead because no one wanted to use it. 99% of Propeller users, at least at the time, were only interested in using Spin.

    And now we have the much faster und comfortable TACHYON
    Faster I will grant you and far more space efficient. Comfortable I'm not sure of yet! :-)

  • Following some of the TACHYON threads some incredible work has also been done there. The problem is both SPIN and TACHYON is that they are both niche cryptic languages but the again so was Basic Stamp but at least that was 'basic' and at the time of it's release Visual Basic was one of the top integration languages. These days C/CPP is the standard and I suppose this is behind the push to Propeller C but then you are directly comparing yourself to more mature C solutions/chipsets.
  • Awwwww man! Now I have to convert PropWare to Java!
  • (Just reading up on PropWARE) Wow.. another amazing chunk of work. There seems to be several big chunks of work done for the propeller waiting to be polished
  • TorTor Posts: 2,010
    You're right there..
    And I wasn't even aware of the earlier JVM work, but then again Steve has done some amazing things over the years.
Sign In or Register to comment.