Shop OBEX P1 Docs P2 Docs Learn Events
Programming and developing for P2 from an rpi — Parallax Forums

Programming and developing for P2 from an rpi

My personal desktop happens to be a travel up a flight of stairs from the garage I do things in, so I was wondering if I can reasonably expect some of the P2's tooling to work on a Raspberry Pi 3 B+
I can live without one of the various IDEs, I'm more interested in if I can expect flexcc/flexspin and loadp2 to work.

Comments

  • Yes, the flex tools should work fine on a raspberry pi, although you'll have to build them yourself from source. Even the GUI (FlexProp) should work, since it's in Tcl and I'm pretty sure tcl/tk is available for the rpi.
  • I am hoping that whoever does this, and gets positive results, will provide a highly specific and detailed set of instructions. Just saying "Oh just get the source and type in make", will not suffice for the majority audience, especially if you are working with a Raspberry Pi. I believe there is a lot more to it than meets the eye.

    Ray
  • kwinnkwinn Posts: 8,697
    Rsadeika wrote: »
    I am hoping that whoever does this, and gets positive results, will provide a highly specific and detailed set of instructions. Just saying "Oh just get the source and type in make", will not suffice for the majority audience, especially if you are working with a Raspberry Pi. I believe there is a lot more to it than meets the eye.

    Ray

    +1

    Would love to try out the Flex tools on RPi. Currently using PropellerIDE on an RPi 400, and finding it to be a bit quirky. It seems like the cursor occasionally jumps to a random location in the source code and places keyboard presses there while still displaying the original text. Very disconcerting.
  • dgatelydgately Posts: 1,621
    edited 2021-01-15 18:05
    Other than a few requirements (make sure your RPi can execute git and has an installed tcl & bison), it's quite simple to clone the repository, build and run flexprop. All this can be done in the RPi Terminal...

    EDIT: latest RPi fresh install tested and the following was needed:

    The current RPi OS does not contain tcl, needed by flexprop, it is this easy to install it:
    $ sudo apt-get update
    $ sudo apt-get install tcl tk
    
    The current RPi OS does not contain bison, needed by flexprop, it is this easy to install it:
    $ sudo apt-get update
    $ sudo apt-get install bison
    
    If the current RPi OS does not contain git (doubtful), install with:
    $ sudo apt-get install git
    
    To clone flexprop (start within a directory where you store sources i.e. $ mkdir src ; $ cd src):
    $ git clone --recursive https://github.com/totalspectrum/flexprop.git
    
    To build flexprop:
    $ cd flexprop
    $ make install
    
    To run flexprop:
    $ cd ~/flexprop
    $ ./flexprop.tcl
    
    OR
    
    $ wish ./flexprop.tcl     <== wish should have been installed with tcl
    
    To keep up-to-date with flexprop's latest sources:
    $ cd src/flexprop    <== OR where ever you store the flexprop source directory
    $ git pull
    $ git submodule update
    $ make clean
    $ make install
    
    I may have over-simplified a bit, but you can always return here and post any problems that come up...

    flexprop_on_RPi.jpg
    dgately
    1327 x 765 - 300K
  • RaymanRayman Posts: 13,798
    edited 2021-01-15 18:11
    I got FlexSpin to work on a RasPi Zero...
    Some notes here: http://www.rayslogic.com/Propeller2/RaspberryPiZeroW.html

    But, @dgately's post looks better...
  • Thanks for the 'easy to follow' directions. I now have FlexSpin running on a RasPi 400.
  • kwinnkwinn Posts: 8,697
    +1
  • Thanks dgately, I just installed it on my RPi4, everything worked as expected.

    Since I have SimpleIDE installed and I had to join dialout, is that also required for a FlexProp installation? Has anybody figured out to place FlexProp in the Programing Menu.

    Since ersmith has been doing quite a few updates, would it be worthwhile to come up with some kind of automated update program. Any bash experts of maybe Python script experts to create such a program. Probably the best solution would be for FlexProp, itself to have an update provision.

    For the new people ersmith has a Patreon and a Paypal account for those of us that might be inclined to show their appreciation for the hard work that ersmith is doing. I am a Patreon account donor.

    Ray
  • dgatelydgately Posts: 1,621
    edited 2021-01-16 14:45
    To add flexprop to RPi's Programming menu:
    https://raspberrypi.stackexchange.com/questions/60577/how-can-i-add-custom-application-launchers-to-the-panel
    flexprop%20RPi%20Menu.jpg

    When it comes to finding out these handy procedures, "google.com is your friend!"...
    989 x 582 - 195K
  • Anyone having this issue with Flexprop in Raspberry Pi 400?
    It started showing after opening more than one tab.

    LBgDB0v.png

    Error message:
    invalid command name "Date"
    invalid command name "Date"
        while executing
    "Date 2021.01.15  Time 18.08"
        invoked from within
    "subst $msg"
        (procedure "showBalloonHelp" line 9)
        invoked from within
    "showBalloonHelp $w $msg"
        (procedure "tabHelp" line 14)
        invoked from within
    "tabHelp .p.nb 187 3"
        ("after" script)
    
  • @jrullan : that's a new one to me. Could you try changing line 48 of flexprop/src/balloon.tcl to add "-nocommand" after the "subst"? The revised version should read:
      pack [label $t.l -text [subst -nocommand $msg] -bg yellow -font {Helvetica 9}]\
    

    That may help -- please let me know if it does.
  • Today I did a PropWare update on the RPi 4, using "git clone --recursive https://github.com/totalspectrum/flexprop.git", this only works if the flexprop folder is empty. Is there another command that just overwrites what is in the flexprop folder, or is the preferred method to work with a clean folder.

    Ray
  • If you already have cloned flexprop, you should not use clone again...

    To update to the current repository revision:
    cd PATH_TO_YOUR_SOURCES/flexprop
    git pull
    git submodule update
    make clean
    make install
    
  • ersmith wrote: »
    @jrullan : that's a new one to me. Could you try changing line 48 of flexprop/src/balloon.tcl to add "-nocommand" after the "subst"? The revised version should read:
      pack [label $t.l -text [subst -nocommand $msg] -bg yellow -font {Helvetica 9}]\
    

    That may help -- please let me know if it does.

    @ersmith Yes, it did work! The error is not showing anymore. Thanks and sorry for the late reply, I did not have time this week for the follow up.
  • jrullanjrullan Posts: 159
    edited 2021-01-23 21:44
    @ersmith

    Do you know what could be the cause of this error I am having when compiling with debug enabled?:
    Unable to open file `libsys/fmt.c': No such file or directory


    Full message:
    "/home/pi/Downloads/flexprop/bin/flexspin" -2 -l -D_BAUD=230400 -O1 -g -I "/home/pi/Downloads/flexprop/include" "/home/pi/Documents/encoder_test_program.spin2"
    Propeller Spin/PASM Compiler 'FlexSpin' (c) 2011-2021 Total Spectrum Software Inc.
    Version 5.0.6 Compiled on: Jan 12 2021
    Unable to open file `libsys/fmt.c': No such file or directory
    encoder_test_program.spin2
    child process exited abnormally
    Finished at Sat Jan 23 11:41:40 2021
  • jrullan wrote: »
    @ersmith

    Do you know what could be the cause of this error I am having when compiling with debug enabled?:
    Unable to open file `libsys/fmt.c': No such file or directory


    Full message:
    "/home/pi/Downloads/flexprop/bin/flexspin" -2 -l -D_BAUD=230400 -O1 -g -I "/home/pi/Downloads/flexprop/include" "/home/pi/Documents/encoder_test_program.spin2"
    Propeller Spin/PASM Compiler 'FlexSpin' (c) 2011-2021 Total Spectrum Software Inc.
    Version 5.0.6 Compiled on: Jan 12 2021
    Unable to open file `libsys/fmt.c': No such file or directory
    encoder_test_program.spin2
    child process exited abnormally
    Finished at Sat Jan 23 11:41:40 2021

    As per instructions of @ersmith, fixed it by running the make install command specifying the directory where I cloned the repo:
    make install INSTALL=/home/pi/Downloads/flexprop
    

    This fixed it.
  • I'm trying to install flexprop on a raspberry pi. dgately's post above was very helpful but after install i'm getting a warning: openspin not found , P1 loader is not built. I need the P1 support. My question is where do I put openspin. (I believe it is a single file)

  • Build openspin by cloning https://github.com/parallaxinc/openspin and then making it. The final program ends up in build/openspin. Just copy that to anywhere on your PATH. I think the steps would be something like:

    git clone https://github.com/parallaxinc/openspin
    cd openspin
    make
    sudo cp build/openspin /usr/local/bin
    
  • @ersmith said:
    Build openspin by cloning https://github.com/parallaxinc/openspin and then making it. The final program ends up in build/openspin. Just copy that to anywhere on your PATH. I think the steps would be something like:

    git clone https://github.com/parallaxinc/openspin
    cd openspin
    make
    sudo cp build/openspin /usr/local/bin
    

    thank you sir. that works

  • Stephen MoracoStephen Moraco Posts: 300
    edited 2021-04-30 02:21

    In case you hadn't thought of this.... (For people running across this thread and looking for alternatives...)

    Visual Studio Code is available to run directly on an RPi. See VSCode Download/Setup Instructions after which you can install Spin2 syntax highlighting and FlexProp per instructions at P2 code development with FlexProp on Raspberry Pi also here's a list of useful extensions for VSCode use VSCode Extensions for P2 development

  • pik33pik33 Posts: 2,347
    edited 2021-08-19 15:23
    I tried to build flexprop on my RPi3.

    sudo apt install tcl-dev tk-dev needed to compile.

    The program works and compiles but doesn't see any serial port. While I tried to load anything to P2 I got
    Could not find a P2 
    Press enter to continue
    

    Edit: rebooting a Pi was needed to make a serial port visible. Now the RPi can program the P2.


  • pik33pik33 Posts: 2,347
    edited 2021-08-20 08:30

    I recompiled flexprop on a RPi4.
    The result now is: if I compile and run blink3.spin on a P2 edge it runs until I close the terminal window
    If I close the terminal, LEDs stops blinking and P2 restarts with what it has in the flash.
    If I disconnect a prop plug before I close the terminal window, LEDs continue to blink

  • evanhevanh Posts: 15,126

    No surprise. A side effects of the comport DTR line being the Propeller's reset control.

  • Thanks to all who have contributed to this thread. I just updated my pi 2B to 6.1.5 After running flexprop on my laptop with SSD I do find the RPi painfully slow, but I needed an alternative programming system for P2.
    Jim

  • The default build settings don't enable optimizations.

    do make install "OPT=-O2" for an optimized build.

  • The default build settings don't enable optimizations.

    do make install "OPT=-O2" for an optimized build.

    Advantage?

    Jim

Sign In or Register to comment.