Shop OBEX P1 Docs P2 Docs Learn Events
SpinEdit - Editor for Spin, Spin2 and FastBasic - Page 2 — Parallax Forums

SpinEdit - Editor for Spin, Spin2 and FastBasic

245

Comments

  • Rayman wrote: »
    btw: I see a "Simple_Serial" in the Parallax Library. It probably won't work so well with P2 Eval because uses DIRA, which only goes to P31 and the Eval serial port is on P62,P63

    There's a "SimpleSerial.spin" in the fastspin Lib directory that will work on P1 and P2 (and PC if you use spin2cpp and compile with the right options). It does need a compiler that supports #ifdef, but bstc, openspin, and fastspin should all be able to handle it I think.
  • RaymanRayman Posts: 14,744
    edited 2019-01-05 16:48
    Ok, found the library in spin2cpp download, thanks.

    Is there a wait function that will work in P2 mode?
  • RaymanRayman Posts: 14,744
    edited 2019-01-05 19:08
    I'm this out on my Mac Mini. Trying the one from macupdate.com Getting version 4.0-rc1 (although maybe I should get the older one..)
    It's telling me I need to install XQuartz first. Sound right?
    Wants to install Mono and Gecko, guess I'll do it...

    Wow, the fonts for Spin looks OK with Parallax.ttf installed, but the rest of the text in the app looked horrible. Seems I picked a XQuartz that was too new... Downgraded like it says here and all better:
    https://superuser.com/questions/1122027/font-smoothing-in-wine-using-winetricks-does-not-work-on-os-x

    I'll see if I can get the attached to work on a Mac mini.
  • RaymanRayman Posts: 14,744
    edited 2019-01-05 20:00
    Ok, I'm getting a "No such file or directory" error on Mac with the program above for SimpleSerial.spin, even though it is in the path... This was because had a .spin2 extension...

    Changed extension to .spin2:
    [code]OBJ
    ser: "SimpleSerial.spin"/code]

    and I get the attached errors. Must think it's some other kind of file...
    Actually, looks like indentation got messed up somehow on these two lines...
    Now it compiles... Trying to install serial port now...
    Clearly need a better way to specify serial port for Mac...
  • RaymanRayman Posts: 14,744
    edited 2019-01-05 20:47
    Ok, I'm stuck... LoadP2.exe crashes on me now when trying to do this:
    [code]cmd.exe /C loadp2.exe -m 010c1f08 -p /dev/tty.usbserial-P2EEJWO "C:\users\ray\Desktop\SpinEdit\SimpleSerial.binary" > loadp2.out/code]

    Do I need a different binary for Mac? I don't think so...
    Actually, I think I do... It's trying to run under Wine due to .exe extension.
    And, changing filename extension to .APP doesn't work...
  • You definitely need a different loadp2 binary for Mac. I'm not sure if anyone has one pre-built (I don't, my Mac isn't working :( ). Theoretically you could build one from the source code in github.com/totalspectrum/spin2gui/loadp2 with the build_macos script, but I haven't tried that.
  • RaymanRayman Posts: 14,744
    Ok thanks, I did figure out how to build it. I see now that it should have no extension.
    I think I have it running. But, now need to find a terminal program..
  • loadp2 should be able to function as a terminal program, if you give it the -t option

    Ah, or did you mean a command line program like cmd.exe for Windows or xterm for Linux? If so I can't help you there, but perhaps a Mac expert will be able to chime in. (xterm would work, but requires installing X11 for Mac)

  • RaymanRayman Posts: 14,744
    edited 2019-01-05 21:23
    Ok, it's working!
    It kinda worked using
    screen /dev/tty/usbserial-P2EEJWO 115200 -L
    
    But, seemed to freeze after a few lines...
    using the -t option with loadp2 is definitely better...

    Think I see you hit "ESC" to quit the loadp2 terminal...
  • RaymanRayman Posts: 14,744
    edited 2019-01-05 21:27
    So, maybe it's like this:
    1. user builds loadp2 on their Mac.
    2. I change SpinEdit for Mac so there's no .exe on loadp2 (will this work? Can you launch Mac programs from Wine? Need to add folder to path?)
    3. change SpinEdit so load command is not in background so can use the -t option...
  • Re: loadp2 on mac
    I don't know if there's a dedicated repo just for loadp2, but I have Mac builds of both p2gcc and spin2gui and loadp2 can be grabbed from there.

    Re: building with wine on Linux

    I started by downloading the new version, enabling the new checkboxes, and changing the library search path to <spin2gui source root>/lib. It failed. I noticed that SpinEdit automatically appended "Library" to the end of the search path, so I opened the options again and removed "Library". The change stuck, but fastedit.exe reverted to printing the help message. So I removed the trailing slash and yay! I got a bit further. No longer complaining about missing "SimpleSerial"... now it's just complaining about "multiply." So I symlinked <spin2gui source root>/samples/multiply.spin into the lib folder and compiled once again. SUCCESS! I have "multest.binary" and "multest.p2asm" files.

    None of the com ports worked by default. Google told me that I could find the mapping of Linux devices to com ports in ~/.wine/dosdevices and, whadyaknow, there they all were! I remove com1 and recreate the symlink pointing to /dev/ttyUSB0, configured SpinEdit to point to com0, and it works! Interestingly, I can actually leave minicom open on /dev/ttyUSB0 while SpinEdit programs the board. That's cool!!!

    Anyway, my Spin is VERY rusty (don't think I've touched a Spin file in 5+ years), but it seems to be working. I got some output :smiley:
    Multiply test...
    software mul gives 00000001,00000000 in 28 cycles.
    cordic gives 00000001,00000000 in 69 cycles.
    mul16 gives 00000001,00000000 in 44 cycles.
    software mul gives 80000001,7FFFFFFE in 987 cycles.
    cordic gives 80000001,7FFFFFFE in 69 cycles.
    mul16 gives 80000001,7FFFFFFE in 44 cycles.
    software mul gives 2343DCBB,00000001 in 539 cycles.
    cordic gives 2343DCBB,00000001 in 69 cycles.
    mul16 gives 2343DCBB,00000001 in 44 cycles.
    
  • RaymanRayman Posts: 14,744
    edited 2019-01-05 22:40
    I did that same thing with symbolic link on COM1 and it seems to be working for me too..
    I also did a "wine regedit" thing that maybe I didn't have to do...
    Well, it's downloading anyway. Doesn't seem to be running correctly, but at least downloading.

    I think that "Library" append is a bug, have to fix that.

    Thanks for testing!
  • RaymanRayman Posts: 14,744
    edited 2019-01-06 00:27
    I don't get it... It appears to download (see led light), but doesn't seem to run right...
    Might take me some time to figure this out...

    Running from the terminal, I can see some errors (no idea what it means):

    I can load P2 Eval with the old version of loadp2 (without the-m).
    It still shows those strange messages, but I guess that's OK.
  • I'm not sure that you can call standard macOS binaries from within wine...

    And, note: on macOS itself, a binary's extension is not really relevant. This is especially true when you try to execute a binary on the command line. macOS looks at the content of the binary and determines its execution type.

    As an example, the 'file' command in macOS will display a file's type. Here, the file is a Mach-O executable (macOS's favorite executable type!), which will execute from the command line:
    $ file loadp2 
    loadp2: Mach-O 64-bit executable x86_64
    $ loadp2  <== Note: I have placed loadp2 in my /opt/parallax/bin directory
      loadp2 - a loader for the propeller 2 - version 0.007, 2018-12-29
      usage: loadp2...
    

    Here's what macOS displays for a Windows binary (not normally executable on macOS, without something like wine):
    SpinEdit_4Jan19]$ file loadp2.exe 
    loadp2.exe: PE32 executable (console) Intel 80386, for MS Windows
    
    Trying to execute the Windows binary variant of loadp2, will result in:
    SpinEdit_4Jan19]$ ./loadp2.exe 
    -bash: ./loadp2.exe: cannot execute binary file
    
    To get the Win binary to run on macOS, you need to install wine and any dependency code in order to run the Win executable (as you've noted). When initially executed, wine creates a special Windows-file-hierarchy inside the user's main directory "~/.wine", which includes files relevant to running the Windows binary on a "Windows-like" environment. Wine may actually move your binary into that directory set... When wine-executable binaries look for files, they look inside that directory set, first. Typically, other macOS files & executables are outside of that directory and are a special case for wine. This may be part of the issue that you are seeing (it not finding or being able to access other files & directories).

    On macOS file extensions...
    Adding the '.app' extension to a macOS binary (Mach-O) does not really work (it might execute on the command-line, but...) as the '.app' extension designates an application package (really just a file directory) that contains a Mach-O executable, within a specific file hierarchy.
    myApp/
       Content/
          MacOS/
             myAppBinary  <== this gets executed when you double click on the app's icon
          some_other_directory
          another_directory
          ...
    
  • I am confused. I see two different gui with this ide. One has find prop. The one I downloaded does not.
    ??
  • RaymanRayman Posts: 14,744
    edited 2019-01-06 16:11
    Find prop currently only works with p1.
    P1 used to be the default mode, but the new version has P2 as the default mode (because there are other tools for P1).
  • RaymanRayman Posts: 14,744
    There's something magic about the old loadp2...
    Works with P123 and P2Eval and works on Mac under Wine. Going to have to bring that back as an option for P2 loading.
    Also, I'll make the command line editable (not just viewable) to make it easier to try things out...
  • loadp2 used a 2-stage loader at the beginning, but I changed it to a single stage loader for a while. I switch back to the 2-stage loader several months ago, and this may be the cause of your problems. The most recent version of loadp2 has a -SINGLE option that will force using the single stage loader. Maybe that will work for you.
  • RaymanRayman Posts: 14,744
    -SINGLE does work, thanks! (-single doesn't work, case sensitive).
  • RaymanRayman Posts: 14,744
    I just tested and can use the same tricks to use the Windows version of propeller-load to load a P1 under Wine :)
  • RaymanRayman Posts: 14,744
    Hurray! It now compiles and loads in P2 mode on my Mac (new version in first post).
  • Hi!

    Downloaded the zip in your first post, and also tried the newer loadp2.exe in the second post.

    With both I get an error when trying to load RAM:
    Invoking LoadP2 to loader P2.
    Loadp2 output:
    Invalid option -m
    loadp2 - a loader for the propeller 2 - version 0.005, 2018-04-04
    


    Any tips ?
  • The latest version of loadp2 is 0.007. I don't believe version 0.005 supports the -m option.
  • Thank you Dave. That did the trick.


    For anyone else, the latest loadp2.exe can currently be found in the first post here: http://forums.parallax.com/discussion/166470/cant-wait-for-propgcc-on-the-p2

  • RaymanRayman Posts: 14,744
    Sorry, sounds like my zip has the old version of loadp2...

    You can also get the new one compiled from spin2gui here:
    https://github.com/totalspectrum/spin2gui/releases

    Sounds like I need to retest to make sure I was using the right version.
    Think I would have noticed these error messages though if I had wrong version...
  • RaymanRayman Posts: 14,744
    Something goes wrong with loadp2.exe on big downloads on Mac. Not sure what, but locks up... The TX light stays lit... Have to reboot to fix it...
  • Dave HeinDave Hein Posts: 6,347
    edited 2019-01-08 02:21
    How large is the binary? Can you post it, and I'll try loading it from my Windows and Linux machines. What's the command line that you use to load it?

    I haven't tried running any really large binaries. Maybe I'll try some of the VGA programs included with PNut. I don't have VGA hardware yet, but at least I can see if it loads.

    EDIT: I tried VGA_640_x_480_16bpp.obj, which is 452,128 bytes in size. It seem to load fine in both the -SINGLE mode and the -CHIP mode from my Windows box.
  • RaymanRayman Posts: 14,744
    edited 2019-01-08 02:52
    I’m doing the 8bpp vga demo
    Maybe I didn’t do -chip
  • You shouldn't have specify the -CHIP parameter. loadp2 should automatically detect whether the P2 is FPGA or silicon, but it doesn't hurt to specify -CHIP if you're using the P2 Eval board.

    I'll try my Linux machine tomorrow to see if it works OK. Both Linux and Mac use the baud rate workaround.
  • Rayman wrote: »
    Something goes wrong with loadp2.exe on big downloads on Mac. Not sure what, but locks up... The TX light stays lit... Have to reboot to fix it...
    Same issue here... Also, have this issue when exec'ing the macOS version of loadp2. It seems to load and exec smaller example programs, but not the larger programs (the VGA examples, the crickets example, etc...) and ones that include the bitmap files (like, Ray's bird :-).

    Those examples (found in a download of: Prop2_FPGA_v32i) when modified for P2ES from P2D2, compiled, loaded & ran in PNut.exe. But, the same binaries do not load & run with loapd2.

    my loadp2 version and usage:
    loadp2 version:
    $ loadp2
    loadp2 - a loader for the propeller 2 - version 0.007, 2018-12-29
    
    loadp2 use:
    $ loadp2 -v -p /dev/cu.usbserial-2EEI8V -T -m 010c1f08 -SINGLE "Cordic Crickets 2.20_P2D2.obj"
    

    dgately
Sign In or Register to comment.