Shop Learn
FlexProp: a complete programming system for P2 (and P1) - Page 27 — Parallax Forums

FlexProp: a complete programming system for P2 (and P1)

12223242527

Comments

  • @ersmith, I have a couple suggestions for editor GUI behavior. Maybe this is just on the linux version, but a couple things I'm used to from other editors that don't work the same:

    • highlighting a block of code and hitting tab or shift+tab erases the block and puts a tab in its place, instead of indenting the whole block more or less.
    • highlighting a piece of code and pressing ctrl+V or paste inserts the clipboard contents after the highlighted section, rather than replacing the highlighted section with it.

    Neither of these are showstoppers, but if I've been away from flexprop for a bit my editor muscle memory makes me do them at least once before I remember they don't work.

  • @kwagner : thank you for the suggestions. I'm just using a stock tcl/tk editor, and changing it is pretty much beyond my capabilities. But the source code is available in the src/ctext directory, so in principle each user could customize the editor.

  • Ah good to know, I'll check it out, thanks!

  • pik33pik33 Posts: 1,226
    edited 2021-12-27 16:49

    Basic channel # question:

    This works: ("kwas" printed under "Basic test")

    const _clkfreq = 320_000_000
    dim v as class using "hng030rm"
    v.start(64,0)
    v.writeln ("Basic test")
    open SendRecvDevice(@v.putchar, nil, nil) as #2
    print #2,"kwas"
    

    This doesn't work (only "Basic test" printed)

    const _clkfreq = 320_000_000
    dim v as class using "hng030rm"
    v.start(64,0)
    v.writeln ("Basic test")
    open SendRecvDevice(@v.putchar, nil, nil) as #3
    print #3,"kwas"
    
    

    It works only for #2. Any other (3..7) doesn't work. Why?

    Edit: tried try/catch on open #3 and print #3 - no error caught.

    Edit 2 - It works with #0 (!) but you mustn't close #0 (!)

    If I did

    open SendRecvDevice(@v.putchar, nil, nil) as #0
    print "kwas"
    

    it printed "kwas" using my video driver. If I did

    close #0
    open SendRecvDevice(@v.putchar, nil, nil) as #0
    print "kwas"
    

    nothing was printed, neither on the screen, nor on the serial terminal. Having the #0 channel redirected to my own procedure is very good, I can use simply "print" without any combinations.
    Still there is the puzzle - why #3..#7 doesn't work

  • @pik33 : SendRecvDevice is supposed to work with any channel, but as you've discovered it only works with channels 0..2; or more accurately, it only works to re-open an already opened channel (0..2 are opened automatically by the system). I will try to fix that bug for the next FlexBasic release.

    Thanks for the bug report,

  • pik33pik33 Posts: 1,226
    edited 2021-12-29 21:35

    Another -o2 problem.

    Making stupid assignment e=0 (left from a previous version and now unneeded) makes the program work good while commenting the line out (as unneeded) making the program work not so good. The variable name can be anything, the variable is not used anymore else. With a standard optimization both versions work good.

    I checked listings of both version. The e=0 line was optimized out where it was not commented, but the listings differ starting from 0858

    "e=0" statement is at a8c / a9c

    Good:

    00858                 | _program
    00858     5A 5A 05 F6 |     mov COUNT_, #90
    0085c     B0 00 A0 FD |     call    #pushregs_
    00860     02 00 00 FF 
    00864     84 0E 06 F1 |     add objptr, ##1156
    00868     07 01 68 FC |     wrlong  #0, objptr
    0086c     40 54 06 F6 |     mov local01, #64
    00870     02 00 00 FF 
    00874     58 0E 86 F1 |     sub objptr, ##1112
    00878     07 57 02 F6 |     mov local02, objptr
    

    Bad:

    00858                 | _program
    00858     5A 5A 05 F6 |     mov COUNT_, #90
    0085c     B0 00 A0 FD |     call    #pushregs_
    00860     40 54 06 F6 |     mov local01, #64
    00864     2C 0E 06 F1 |     add objptr, #44
    00868     07 57 02 F6 |     mov local02, objptr
    

    Full listings attached.


    Edit: I found a bug in my program. The problem was: the stack for spincog (I reserved 32 longs) seemed to be too small
    When the "e" unused variable was not commented out, it seems the compiler still reserved the place for the variable, exactly after this stack, and this another long was enough for the code to run
    .lst file is your best friend when debugging :)

    I tried to place a dummy variable in several places to find where it works and where it doesn't. It worked in the main program or after the "long serialstack[32]" in the serial object.
    So I changed 32 to 36 and I have no no more anomalies with -o2 in this code.

    The only strange thing left is why the compiler reserved the place for the unused variable in the main program while in full optimization?

    zip
    158K
    o2.zip 157.9K
  • @pik33 said:
    So I changed 32 to 36 and I have no no more anomalies with -o2 in this code.

    I'm glad you were able to resolve your problem!

    The only strange thing left is why the compiler reserved the place for the unused variable in the main program while in full optimization?

    The optimizer is not perfect...

  • RS_JimRS_Jim Posts: 1,570
    edited 2022-01-11 14:11

    @ersmith
    Eric, I have been attempting to compile a piece of code from JonnyMac (jm_as5040.spin2 in the chip select thread in P2Pasam) and I keep getting a "bad AST 60" error and the following message when I click on the line number for the error:
    "/home/jim/flexprop/include/library/as_5040.spin2:89, error is not found" I am running on a Mint20 linux platform. I have checked with the files program and do not find the -spin2:89 anywhere accept in the error report.
    Do I have a bug or what. I have not encountered this error in any other attempt at compiling a P2 program. Running flexprop5.9.2
    Jim

  • ersmithersmith Posts: 5,193

    @RS_Jim : Clicking on the error and not going to the right place is a bug in the flexprop GUI (it's confused by the two occurences of the string "error:" in the message). When that happens, you'll have to resort to reading the error message itself. The error is reported on line 89 of jm_as5040.spin2 (the declaration of the "pri read()" function and is because flexspin is mis-interpreting the word "result" as being a special reserved word, as it is in Spin 1.

    I will fix this in the next version of the compiler. In the meantime you can work around it by renaming the "result" variable in that function to "myresult" or something else. (The reason "result" is OK in other functions is that there is some code for dealing with "result" as the name of the single value returned by a function, but the "read" function is returning two values and that's not handled.)

  • RS_JimRS_Jim Posts: 1,570

    Thanks Eric. I will do the rename.
    Jim

  • ersmithersmith Posts: 5,193

    I have published a new beta release of FlexProp on my Patreon page. There are some major changes coming, so this is a work in progress. There are some significant new features:

    • Support for programming P2s over internet (using the WX Wifi add-on board). This requires a new loader program, proploader, instead of loadp2. So to use it, you will have to re-set your commands to the default ones (go to Commands > Configure Commands and press P2 defaults).
    • A new built-in terminal window. This is optional (it's enabled under the "Options" menu; if enabled, FlexProp will use its own window that communicates directly with the loader). This provides a much nicer experience on the Mac, I think, but is also handy because it allows DEBUG messages to be parsed (see below).
    • Preliminary support for Spin2 DEBUG graphics. For now only the TERM and PLOT commands are understood, but eventually I hope more will be. This requires that the built in terminal window be used.
    • The compiler has the usual set of bug fixes, some new optimizations, and some new BASIC keywords and functions.

    For now the binaries are only available to my Patreon supporters, but the source code is on github so anyone can build it (it's tagged as v5.9.7-beta).

  • Sweet!!! Cant wait to see what you’ve done!

  • RsadeikaRsadeika Posts: 3,657

    I did a test run with the WX Wifi add-on board, plugged in. A program compiles with no errors, but when I hit the 'Compile & Run on P2', nothing happens. No terminal window opens up, like before.

    I verified that the correct WiFi port was selected, and the blue LED was flashing. I tried this on my Linux setup and my Win 10 Pro setup. It is not working on either one.

    I also tried, in the Commands, to add the IP manually, using -p, that did not help to use the the Run command. Not sure what to try next.

    Ray

  • ersmithersmith Posts: 5,193

    @Rsadeika said:
    I did a test run with the WX Wifi add-on board, plugged in. A program compiles with no errors, but when I hit the 'Compile & Run on P2', nothing happens. No terminal window opens up, like before.

    I verified that the correct WiFi port was selected, and the blue LED was flashing. I tried this on my Linux setup and my Win 10 Pro setup. It is not working on either one.

    I also tried, in the Commands, to add the IP manually, using -p, that did not help to use the the Run command. Not sure what to try next.

    Ray

    Make sure you re-set the command lines to the default (e.g. by switching from P2 to P1, and then back again), or even better yet by deleting your .flexprop.config file and starting from scratch. The run command should use proploader, and not loadp2.

    To manually add the IP don't edit the command line, use the "Add IP address..." menu item under Ports. If the automatic detection isn't working it's worth trying that.

  • RsadeikaRsadeika Posts: 3,657

    Running into some install problems. I did not find .flexprop.config file on either my linux or Win 10 Pro system, so I decided to do a scratch install on my Linux system first.

    Using the instructions in the readme file, it goes through the install process OK, but after it does the 'make install', which it does without any noticeable errors, it does not create create that new flexprop folder, that would hold the flexprop program. Is it being created some where other than the home dir.

    Ray

  • ersmithersmith Posts: 5,193

    @Rsadeika said:
    Running into some install problems. I did not find .flexprop.config file on either my linux or Win 10 Pro system, so I decided to do a scratch install on my Linux system first.

    Using the instructions in the readme file, it goes through the install process OK, but after it does the 'make install', which it does without any noticeable errors, it does not create create that new flexprop folder, that would hold the flexprop program. Is it being created some where other than the home dir.

    Do you have an environment variable called INSTALL already set? If so that's where the "make install" will put flexprop. If you want to be really sure, do make install INSTALL=$HOME/flexprop.

    The .zip file actually contains an x86 flexprop.linux binary, so you could use that if you're on x86 linux.

    Finally, it looks like the auto-detection of WiFi cards isn't working right (that's the problem you initially had). You'll have to manually enter your board's IP address using the menu entry under Ports.

  • RsadeikaRsadeika Posts: 3,657

    A couple of problems.

    First, on my Linux system, I cannot get 'make install INSTALL=$HOME/flexprop' to work. It is not creating a flexprop folder, in the $HOME dir. This morning I will try another scratch install, to see if that works.

    Second, on my Win 10 Pro system, it is not running the compiled program, when I do a Compile & Run, when I have the WiFi port selected. And, yes, you have to do the 'Add port' for a manual selection for it to work. So, there are a few problems to be resolved. Is it happening with my equipment only?

    Ray

  • ersmithersmith Posts: 5,193
    edited 2022-01-16 16:20

    @Rsadeika said:
    First, on my Linux system, I cannot get 'make install INSTALL=$HOME/flexprop' to work. It is not creating a flexprop folder, in the $HOME dir. This morning I will try another scratch install, to see if that works.

    What version of Linux are you using? What is the output of the "make install" command? I've run this on several different systems and it has worked as expected. I develop on Debian x86 Linux, so the Linux version definitely works there. Obviously there's some quirk of your system that's causing failure, and we need some additional information to figure this out.

    Second, on my Win 10 Pro system, it is not running the compiled program, when I do a Compile & Run, when I have the WiFi port selected. And, yes, you have to do the 'Add port' for a manual selection for it to work. So, there are a few problems to be resolved. Is it happening with my equipment only?

    What's your P2 hardware setup? Does it work wirelessly with a different program (like Propeller Tool)? Did you make sure to select the manually added address under the Ports menu, and not the automatically found one (the one with the long string with "Name: xxxx" in it)?

    For reference, I'm using a P2 Edge with a mini breakout board, together with a P2-WX adapter (part #64007) which is plugged in to pins 63-56 header on the breakout board. There is no Prop Plug installed, I only program it wirelessly, and am able to do so from my WIndows 10 Home laptop and my Debian Buster desktop.

  • RsadeikaRsadeika Posts: 3,657

    For my Linux setup I am using a Gigabyte Brix box with a Raspberry Pi Desktop OS, which is Debian based. I have not had any problems, with installing flexprop, until now.

    As for my Win 10 Pro system, I am using the P2 Edge with a mini breakout board, together with a P2-WX adapter (part #64007) which is plugged in to pins 63-56 header on the breakout board.. Again, I have not had any problems, until this installation. I did not have the prop plug installed at first, at this point I did have the prop plug installed just see if it was working with a com port, which it did.

    When I try out the Compile & Run, what it is doing is going through the procedure of opening up a terminal program, and it shows that it has loaded the correct binary file, but it is actually running whatever it had in the EEPROM. So at first glance it looks like it is working correctly, but it is not running the correct file.

    Ray

  • Check the positions of the 4 dip switches on the mini breakout board. What do you have them set to?

  • ersmithersmith Posts: 5,193

    @Rsadeika said:
    For my Linux setup I am using a Gigabyte Brix box with a Raspberry Pi Desktop OS, which is Debian based. I have not had any problems, with installing flexprop, until now.

    I suggest starting over from scratch. I have been able to install my my Raspberry Pi with a similar OS, so in principle it should work. Could you post the output from "make install"? Maybe try "make install INSTALL=/tmp/try2" and see if a folder "/tmp/try2" gets created? If it does, you could then do "mv /tmp/try2 /home/ray/flexprop" or whereever you want it to be at the end.

    When I try out the Compile & Run, what it is doing is going through the procedure of opening up a terminal program, and it shows that it has loaded the correct binary file, but it is actually running whatever it had in the EEPROM. So at first glance it looks like it is working correctly, but it is not running the correct file.

    OK, it looks like the WX isn't seeing the serial download in time to prevent booting from EEPROM. I suspect this will be a common problem with WX boards, there's significant latency getting from the PC to the P2, since the WX is sitting in the way. The best solution, I think, is to change the DIP switch settings on your P2-Edge so that the boot mode is "Serial Only".

  • RsadeikaRsadeika Posts: 3,657

    Not making any headway with my Win 10 Pro setup, and the P2 Edge with WiFi. After a little bit of time the flexprop GUI shows the FlexProp(Not Responding) message.

    I played around with the dips, for this setting I have from right to left - down, up, down, up.

    Ray

    ' testp2.bas
    
    pinlo(56)
    pinlo(57)
    print "where am I!"
    
    end
    
    Opening file 'F:/programs/flexbasic/testp2/testp2.binary'
    Downloading file to port 192.168.35.111
    Download successful!
    [ Entering terminal mode. Type Control-] or Control-Z to exit. ]
    
    
  • RsadeikaRsadeika Posts: 3,657

    I switched over to my Linux Raspberry Pi PC OS, and I found the problem as to why the flexprop folder was not being created.

    I had installed pandoc, and texlive-latex-recommended programs, after removing these two, now the make install is creating the flexprop folder. I tried running a test program and using the WiFi port, no success. Will have to play around some more.

    Ray

  • ersmithersmith Posts: 5,193

    @Rsadeika said:
    Not making any headway with my Win 10 Pro setup, and the P2 Edge with WiFi. After a little bit of time the flexprop GUI shows the FlexProp(Not Responding) message.

    I played around with the dips, for this setting I have from right to left - down, up, down, up.

    Set them to "Serial Only" boot mode, as described on the other side of the P2 Edge: up/down (LED), up, up, down

  • ersmithersmith Posts: 5,193

    @Rsadeika said:
    I switched over to my Linux Raspberry Pi PC OS, and I found the problem as to why the flexprop folder was not being created.

    I had installed pandoc, and texlive-latex-recommended programs, after removing these two, now the make install is creating the flexprop folder. I tried running a test program and using the WiFi port, no success. Will have to play around some more.

    Were there any error messages during the make? Something about those versions of pandoc and/or texlive must not be agreeing with the Makefile.

  • RsadeikaRsadeika Posts: 3,657

    There was a lot of stuff zipping by on the screen, but I did not see any error messages.

    Ray

  • dgatelydgately Posts: 1,494
    edited 2022-01-18 16:30

    I just pulled the latest flexprop sources onto a Raspberry Pi4, built flexprop and was able to upload a simple blink program via WiFi...
    I found the best way to ensure a complete build of flexprop was to enter each submodule in the sources (I know, seems like I should not need to) and do a "git pull". I then run "make clean" & "make -j4" in each submodule (spin2cpp, loadp2, PropLoader), before running a "make clean" & 'make install -j4" within the main flexprop directory. The submodules may actually not build the first time through as they have dependencies on other modules, but after initial builds, they eventually build and install flexprop in the user's main directory (/home/pi).

    In order for the WiFi upload to work, you need to reset the Configure Commands options to "P2 Defaults" to change the loader to proploader from loadp2. And, you need to specify the IP Address manually as Eric stated.

    In this video, displayed via VNC Viewer on a MacBook Pro (to the RPi4), the blink39.bas program is compiled and uploaded successfully to the P2 Edge. The RPi4 is actually in another room, with its own display, keyboard & mouse.

    https://youtu.be/HQHeMC1o3_8
    So, it's possible to upload from an RPi4. I can't comment on any other configuration, but it does work at least in this case!

    dgately

  • RsadeikaRsadeika Posts: 3,657

    I have not tried installing the new flexprop on my RPI4 yet. What are your dip settings on the Edge card?

    Ray

  • dgatelydgately Posts: 1,494

    I have not tried installing the new flexprop on my RPI4 yet. What are your dip settings on the Edge card?

    ON | ON | OFF | OFF

  • RsadeikaRsadeika Posts: 3,657

    Well, since ersmith and dgately have their systems working with the WiFi, and I cannot get mine to work, I think that I may have a hardware problem. Now, how do I figure out which piece of hardware is causing the problem.

    There are a lot of different components, in this assembly, that could be creating the problem, how do I check these in total and individually. Anybody create a P2 and components diagnostic program yet?

    Ray

Sign In or Register to comment.