Shop OBEX P1 Docs P2 Docs Learn Events
FlexPropGui installation under Linux — Parallax Forums

FlexPropGui installation under Linux

Hi there, I want to install MicroPython on P2.

For that, I do need to install FlexProp on Linux (I'm using a Linux Mint derived from Ubuntu). Windows is banned here!

As the documentation is not ready (link missing) on https://www.parallax.com/propeller-2/get-started/micropython/ then I did try to find my way but I'm stuck with an error.


Here what I do

sudo apt update
sudo apt-get install wish
sudo apt install build-essential
sudo apt-get install g++
git clone --recursive https://github.com/totalspectrum/flexgui.git
cd flexgui 
git submodule update --recursive
make install

which creates the ~/flexprop in my user folder.

Then I do the following to start FlexProp

cd ~/flexprop
export ROOTDIR="`pwd`"
# execute the GUI
./flexprop.tcl

And it throw the following error

domeur$ ./flexprop.tcl 
Error in startup script: can't read "spin2gui_version": no such variable
   while executing
"set aboutMsg "
GUI tool for FlexProp
Version $spin2gui_version
Copyright 2018-2021 Total Spectrum Software Inc.
------
There is no warranty and no gua..."
   (file "/home/domeu/flexprop/src/gui.tcl" line 9)
   invoked from within
"source $ROOTDIR/src/gui.tcl"
   (file "./flexprop.tcl" line 25)


Some help would be welcome.

Any suggestion?

Comments

  • Everybody welcome @domeu, a Python microcontroller coder with some significant experience in authoring. If there's anything we can do to help get him going I'd be most grateful and I'll document the FlexProp/Linux combination for others as a Quick Byte, should it be manageable for me to do so. @ersmith any tips on the Linux install?


    Welcome again, @domeu!


    Ken Gracey

  • This is my recipe for FlexProp in Ubuntu.. The update part doesn't work, I delete the source folder and redo the clone.

    Don't forget permissions needed for serial access...

    Thanks to ERsmith, Dgately, Wuerful for the help!


    Original install:

    dgately wrote: »

    » show previous quotes

    All the source is available in the github flexprop repository...

    https://github.com/totalspectrum/flexprop

    As ersmith stated, you can easily build the whole project (i.e. GUI, all the binaries for compiling & loading) on WIN10, Linux, macOS...

    I suggest (on Linux or macOS) something like:

    $ mkdir source

    $ cd source

    $ git clone --recursive https://github.com/totalspectrum/flexprop.git

    $ cd flexprop

    $ make clean # only if you had previously run make

    $ make install

    Note: '--recursive' allows git to include all of the projects sub-modules (PropLoader, loadp2, & spin2cpp).

    If successful, you'll find a new flexprop directory in your home directory, where you'll find the flexprop.tcl GUI, tools & sample code:

    $ cd ~/flexprop

    $ ls

    License.txt bin doc include src

    README.md board flexprop.tcl samples

    $ ls bin

    fastspin flexcc flexspin loadp2 mac_terminal.sh proploader


    Use flexprop.tcl if you like or the tools in the bin directory from the Linux/macOS command line. It's "all there".

    Note: flexprop may have some requirements for successful building... If make install does not work, you can probably get help here in the forum...

    dgately

  • try running "wish ~/flexprop/flexprop.tcl" without the quotes


    Thats how I start it on my mac.

  • Welcome @domeu ! I don't know what could have gone wrong, your installation steps looked OK to me and I just tried the same thing on a fresh Ubuntu 18.04 installation; I had to add a "sudo apt-get install bison" after the "build-essentials" but otherwise it was identical. In my case things worked though :(.

    The spin2gui_version variable should be set in a file called ~/flexprop/src/version.tcl. Does that file exist for you?

    If things don't work (as in this case) it's always worth doing a "make clean; make install" again. It's possible that somewhere in the initial build the version.tcl file got borked (or didn't get built the first time around).

  • Great, this time, the flexprop.tcl is running :-)

    Will now tries to upload P2MP

  • @ersmith

    I did clone the wrong Git.

    When a followed the instructions AND THE RIGHT Git at https://github.com/totalspectrum/flexprop ). Everything when right

  • domeudomeu Posts: 9
    edited 2021-01-30 01:08

    MicroPython is now Flashed with instruction from n https://www.parallax.com/propeller-2/get-started/micropython/

    So the P2 module and USB-Serial modules are working properly.

    HOWEVER REPL does not respond to KeyStroke ?!?! (not echo back in the terminal).


    I can connect Putty to /dev/ttyUSB0 at 115200 baud.

    I can see the REPL prompt appearing in putty when pressing the reset button on the Edge Module Breadboard (when sending REPL prompt, the USB-Serial led is RED --> OK )


    When I do type on the keyboard, the USB-Serial bling in blue --> char are sent to the P2. But nothing appears on the terminal (No echo from REPL and USB-Serial does not blink red).

    Pressing the ENTER key doesn't do anything (eg: showing REPL error message because of invalid key stroke).


    I did also tried the Mu-Editor in "ESP mode" (this should be mentioned in the installation doc).

    The REPL doesn't respond to keyboard Stroke.


    Any suggestion or additional test ?

  • Yes Mu editor in ESP mode is fine.

    I think someone else reported this problem too, let me find what fixed it for them

  • Try this to replace "step2"... let me know if it works, thanks


  • Great, this new step2 did effectively uploaded running version of MicroPython to the P2, REPL is now running.

    I can reach REPL from Mu editor and Putty (terminal Emulator)... but an important issue still exists (I will post a new comment)


  • It is not possible to manage file on the P2 from Mu Editor (click "file" icon produce and error).


    As I'm use to terminal MicroPython tool like RShell (very popular tool) and Ampy (from Adafruit Industries), I did tried them to get more information.

    Here what I did grab with RShell

    domeu@dom$ rshell --port /dev/ttyUSB0 --buffer-size 32
    Using buffer-size of 32
    Connecting to /dev/ttyUSB0 (buffer-size 32)...
    Trying to connect to REPL connected
    Testing if ubinascii.unhexlify exists ... b'OK\r\nexit\r\n\xff\x00\x00'
    Traceback (most recent call last):
     File "/home/domeu/.local/lib/python3.6/site-packages/rshell/main.py", line 1307, in connect
       ip_address = socket.gethostbyname(port)
    socket.gaierror: [Errno -2] Name or service not known
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
     File "/home/domeu/.local/bin/rshell", line 8, in <module>
       sys.exit(main())
     File "/home/domeu/.local/lib/python3.6/site-packages/rshell/command_line.py", line 4, in main
       rshell.main.main()
     File "/home/domeu/.local/lib/python3.6/site-packages/rshell/main.py", line 2966, in main
       real_main()
     File "/home/domeu/.local/lib/python3.6/site-packages/rshell/main.py", line 2928, in real_main
       connect(args.port, baud=args.baud, wait=args.wait, user=args.user, password=args.password)
     File "/home/domeu/.local/lib/python3.6/site-packages/rshell/main.py", line 1313, in connect
       connect_serial(port, baud=baud, wait=wait)
     File "/home/domeu/.local/lib/python3.6/site-packages/rshell/main.py", line 1337, in connect_serial
       dev = DeviceSerial(port, baud, wait)
     File "/home/domeu/.local/lib/python3.6/site-packages/rshell/main.py", line 1627, in __init__
       Device.__init__(self, pyb)
     File "/home/domeu/.local/lib/python3.6/site-packages/rshell/main.py", line 1391, in __init__
       unhexlify_exists = self.remote_eval(test_unhexlify)
     File "/home/domeu/.local/lib/python3.6/site-packages/rshell/main.py", line 1515, in remote_eval
       return eval(self.remote(func, *args, **kwargs))
     File "/home/domeu/.local/lib/python3.6/site-packages/rshell/main.py", line 1493, in remote
       self.pyb.enter_raw_repl()
     File "/home/domeu/.local/lib/python3.6/site-packages/rshell/pyboard.py", line 203, in enter_raw_repl
       raise PyboardError('could not enter raw repl')
    rshell.pyboard.PyboardError: could not enter raw repl
    

    And what I get

  • The Ampy did return the following error message

    domeu@dom$ ampy --port /dev/ttyUSB0 ls
    b'OK\r\nexit\r\n\xff\x00\x00'
    Traceback (most recent call last):
     File "/home/domeu/.local/bin/ampy", line 8, in <module>
       sys.exit(cli())
     File "/home/domeu/.local/lib/python3.6/site-packages/click/core.py", line 829, in __call__
       return self.main(*args, **kwargs)
     File "/home/domeu/.local/lib/python3.6/site-packages/click/core.py", line 782, in main
       rv = self.invoke(ctx)
     File "/home/domeu/.local/lib/python3.6/site-packages/click/core.py", line 1259, in invoke
       return _process_result(sub_ctx.command.invoke(sub_ctx))
     File "/home/domeu/.local/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
       return ctx.invoke(self.callback, **ctx.params)
     File "/home/domeu/.local/lib/python3.6/site-packages/click/core.py", line 610, in invoke
       return callback(*args, **kwargs)
     File "/home/domeu/.local/lib/python3.6/site-packages/ampy/cli.py", line 194, in ls
       for f in board_files.ls(directory, long_format=long_format, recursive=recursive):
     File "/home/domeu/.local/lib/python3.6/site-packages/ampy/files.py", line 162, in ls
       self._pyboard.enter_raw_repl()
     File "/home/domeu/.local/lib/python3.6/site-packages/ampy/pyboard.py", line 198, in enter_raw_repl
       raise PyboardError('could not enter raw repl')
    ampy.pyboard.PyboardError: could not enter raw repl
    
    

    Apparently, there is an issue with the response provided in RAW REPL mode

    b'OK\r\nexit\r\n\xff\x00\x00'

    I will do additional checks with a standard Pyboard to check what is the expected response.

    Dominique

  • Ok great that you got further along, Dominique


    We haven't tried Rshell or Ampy yet, but do have Pyboards.


    We have our own way of managing files one the P2, ozffs. To list the files type `files from serial tty or from usb keyboard or wireless keyboard. That will list the files in the extended flash memory, if there are any. The ` is the backtick character shared with the tilde ~ character at upper left of keyboard, typically

  • The difference is probably because when the P2 native micropython image exits it simple stops (and prints the exit message and from the terminal with chars 255 0 0) while the other platforms appear to now do a soft-reset and restart their REPLs. The difference comes about due to the original port the P2 native port started from (minimal vs stm32/esp32 which are more widely supported and have had far more work and changes done on them recently).

  • domeudomeu Posts: 9
    edited 2021-02-01 22:29

    OZFSS

    Understood for ozfss and tried it. I got an error on `files and on `save demo because it says

    exit
    �`save demo
    No FLASH detected!
    

    So I cannot save MicroPython files on the P2 at the moment.

    I did also notices that file extension is not used in ozffs. Is this possible to save bitmap or binary files on the file system.


    Soft Reset - Ctrl-D

    I did noticed that Ctrl-D (so named soft-reset) does completely stuck (Freeze) the REPL on the P2.

    On usual MicroPython life cycle, we are use transfert files, then to soft-reset in REPL session to start with clean session (from inside REPL). Then you can import your module from REPL with "import modulename".

    This is a very convenient way do develop large code file or tune a micropython driver for some hardware.

    So the defective support of Soft Reset is the reason why the RShell, Ampy and Mu file manager tool completely fails to work.


    MicroPython FileSystem not accessible from MicroPython

    It also appears that I can't open a file in write mode from the REPL session

    The following code

    f = open( "myfile", "w" ) 
    

    does returns an OSError: 1

  • roglohrogloh Posts: 5,171
    edited 2021-02-01 23:17

    The soft reset behavior from the other ports is something that could potentially be ported in an updated release assuming it didn't interfere with the stuff OzPropDev added to intercept serial characters and control things from another hidden level.


    For the filesystem you might need to open up a FAT volume and init the SPI interface for it. There are typically some extra steps needed there before you can start to read/write files and unfortunately a volume is not automounted by default because the SPI bus is shared with the SPI flash which is part of the ozffs thing and outside of MicroPython's reach.

  • Any advice on compiling flexprop on Arch?

    I'm getting the following errors and not sure if it is a makefile incompatibility with Arch or if it indicates missing dependencies on my system:

    After executing:

    make install INSTALL=~/flexprop

    I get:

    if test -f /home/otis/flexprop/Makefile; then echo "ERROR: Install directory contains a Makefile (possibly installing to original source)"; exit 1; fi
    make: *** No rule to make target 'spin2cpp/version.h', needed by 'src/version.tcl'. Stop.

    No "flexprop" directory exists at the target path thus no Makefile can exist there....

  • @proPonent said:
    Any advice on compiling flexprop on Arch?

    I'm getting the following errors and not sure if it is a makefile incompatibility with Arch or if it indicates missing dependencies on my system:

    After executing:

    make install INSTALL=~/flexprop

    I get:

    if test -f /home/otis/flexprop/Makefile; then echo "ERROR: Install directory contains a Makefile (possibly installing to original source)"; exit 1; fi
    make: *** No rule to make target 'spin2cpp/version.h', needed by 'src/version.tcl'. Stop.

    No "flexprop" directory exists at the target path thus no Makefile can exist there....

    The error is the line with the ***, which is that it cannot find the file spin2cpp/version.h. That most likely means that you forgot to clone the submodules of the project (one of which is spin2cpp). The detailed steps to follow are:

    cd $HOME
    mkdir -p src
    cd src
    rm -rf flexprop
    git clone --recursive https://github.com/totalspectrum/flexprop
    cd flexprop
    make install INSTALL=~/flexprop
    cd ~/flexprop
    ./flexprop
    

    It's very important to remember the --recursive flag on the git clone command.

Sign In or Register to comment.