FlexGUI 4.2.6: Program your P2 in Spin, BASIC, or C

1235

Comments

  • ersmith wrote: »
    JRoark wrote: »
    @ersmith In FlexBASIC version 4.1.9, is there a way to OPEN a file (using Mount then Open) in append mode? The docs only mention "input" and "output" mode (which will truncate an existing file to zero bytes before writing).

    No, there is no append mode (yet).

    Ah... “yet”. :) That would be Eric-speak for “ya’ll hold my beer/watch this!”. Lol!

    Happy to wait patiently! (Did I mention I’m really liking the new syntax highlighting? Two thumbs up!)

  • larryvclarryvc Posts: 39
    edited 2020-05-15 - 05:27:15
    Closing all open tabs and then trying "Commands-->run binary on device" always results in this error. Also occurs when starting Flexgui without loading a file before trying the same command, but not always. Confirmed on versions 4.1.8 and 4.1.9, the only ones I have on my computer. Windows 10 latest build.

    Flexgui_error.png
    367 x 312 - 17K
  • eric,
    I finally got back to trying to build flexguii, and the build was sucessfull, however, when i attempt to run it I get the following error:
    *********************************-Notebook-PC:~/flexgui$ ./flexgui.tcl
    /usr/bin/env: ‘wish’: No such file or directory
    
    what next?
    JIm
  • BTW, is there any documentation about what is necessary to build FlexGui? Is this possible on a windows system at all? Is a general C compiler like GCC (MinGw oder TDM-GCC for Windows) enough? I read something about TCL. What is it? I've found this but I don't understand a single word.
    kopfkratz.gif
  • larryvc wrote: »
    Closing all open tabs and then trying "Commands-->run binary on device" always results in this error. Also occurs when starting Flexgui without loading a file before trying the same command, but not always.

    Thanks for the bug report. I've fixed it in github. The workaround for now is to have some tab open before using run binary on device.
  • RS_Jim wrote: »
    eric,
    I finally got back to trying to build flexguii, and the build was sucessfull, however, when i attempt to run it I get the following error:
    *********************************-Notebook-PC:~/flexgui$ ./flexgui.tcl
    /usr/bin/env: ‘wish’: No such file or directory
    
    what next?

    You'll have to install Tcl/Tk. In debian (and probably any debian derivative) that's provided by the 'tk' package.
    ManAtWork wrote: »
    BTW, is there any documentation about what is necessary to build FlexGui? Is this possible on a windows system at all? Is a general C compiler like GCC (MinGw oder TDM-GCC for Windows) enough? I read something about TCL. What is it? I've found this but I don't understand a single word.
    kopfkratz.gif

    To actually build flexgui.exe you need a Linux system. But honestly you don't need/want to do that; flexgui.exe is just the Tcl interpreter with the file flexgui.tcl built in, which does nothing more than load the .tcl files in the src directory. Those are the things you want to edit, and since they're plain ASCII files and are reloaded every time flexgui starts up they may be changed without recompiling flexgui.exe.

    The main GUI file is src/gui.tcl, and that has most of the logic in it. The other files (like autoscroll.tcl, fontchooser.tcl, and so on) have some helper functions. src/ctext/ctext.tcl has the text editor widget, which I modified slightly.


  • JRoark wrote: »
    (Did I mention I’m really liking the new syntax highlighting? Two thumbs up!)


    Glad you're liking it!
  • Eric,
    Jumping for joy! finally got flexgui up and running! RTFD, lol. my first attempt at compiling a program did product an error:
    Propeller Spin/PASM Compiler 'FastSpin' (c) 2011-2020 Total Spectrum Software Inc.
    Version 4.1.9 Compiled on: May 15 2020
    Unable to open file `com.serial.terminal.ansi': No such file or directory
    NRF24L01-RXDemoWithAAQS-ISR.spin
    child process exited abnormally
    Finished at Fri May 15 08:17:21 2020
    
    does that mean that I need to move the missing obj into the same directory as the top level program or do I need to provide some kind of path information to flexgui?
    Jim
  • RS_Jim wrote: »
    does that mean that I need to move the missing obj into the same directory as the top level program or do I need to provide some kind of path information to flexgui?
    Jim

    You can do either. There's a menu item File > Library Directories... that let's you tell the compiler where to look for objects and include files.
  • ersmith wrote: »
    ... flexgui.exe is just the Tcl interpreter with the file flexgui.tcl built in, which does nothing more than load the .tcl files in the src directory. Those are the things you want to edit, and since they're plain ASCII files and are reloaded every time flexgui starts up they may be changed without recompiling flexgui.exe.

    The main GUI file is src/gui.tcl, and that has most of the logic in it. The other files (like autoscroll.tcl, fontchooser.tcl, and so on) have some helper functions. src/ctext/ctext.tcl has the text editor widget, which I modified slightly.

    Ok, I see, thanks. I hoped I could relieve you a bit and contribute some very basic things to the text editor like automatic indention. But unfortunatelly, the text editor (ctext.tcl) has the least documentation and I fear it would take months for me to understand how it works. Not to talk about being able to modify it without screwing things up. hammer.gif

  • I've posted FlexGUI 4.1.10-beta to my Patreon page. This one has APPEND mode for BASIC, ONES, BMASK, QLOG, and QEXP operators for Spin2, and several bug fixes.
  • Eric,
    I can confirm that fastspin 4.1.9 fixes the REG[x] := REG[y] bug :)
    Thanks heaps:)

    Can you confirm that cog $000-$01F is now free to use please?

    I presume $1E0-$1EF is no longer available as Chip's interpreter uses it???

    Are you also making PR0-PR7 available for passing parameters (although I'm not sure how this might work) ???
  • Cluso99 wrote: »
    Eric,
    I can confirm that fastspin 4.1.9 fixes the REG[x] := REG[y] bug :)
    Thanks for checking this.
    Can you confirm that cog $000-$01F is now free to use please?
    Yes, those are free to use, and I've documented them in spin.md (under Compatibility with Spin2 > Memory Map).
    I presume $1E0-$1EF is no longer available as Chip's interpreter uses it???
    Why would you presume that? I have always made those available because the ROM uses them, and I've formalized that (it's documented in spin.md now).
    Are you also making PR0-PR7 available for passing parameters (although I'm not sure how this might work) ???

    I haven't implemented those yet, but I probably will. I'm very puzzled as to why PR0-PR7 are defined at $1d8-$1df and yet there's a "hole" from $1e0-$1ef that's apparently used by the PNut interpreter. @cgracey, what's in $1e0-$1ef? Could that space be freed up for ROM compatibility?
  • Eric,
    I’ve figured since Chip used the areas used by the ROM I had to redo both the serial monitor ($1E0-1ef) and SD ($1c0-1df) since they’re no longer free. So that’s what I’ve done and by removing the load/run file and added write, I’ve reduced the registers to 16 or less.
  • @ersmith When coding in FlexBASIC V4.1.10-beta on a P2-EVAL/B: Undeclared variables in a FOR/NEXT loop dont throw an error even if OPTION EXPLICIT is present. Simple demo:
    OPTION EXPLICIT
    
    	for myVar = 1 to 10
    		print myVar
    	next myVar
    
    This behavior wouldn't be a real issue, except that under some odd confluence of circumstances (that I can't yet pin down), myVAR will unexpectedly change its value. I suspect that behavior is related to the above bug. I'll try to isolate a solid test case for this.
  • JRoark wrote: »
    @ersmith When coding in FlexBASIC V4.1.10-beta on a P2-EVAL/B: Undeclared variables in a FOR/NEXT loop dont throw an error even if OPTION EXPLICIT is present.
    Ah, looks like I overlooked a case (FOR, like LET, defines variables by default, but it probably shouldn't under OPTION EXPLICIT). I'll fix this soon.
    This behavior wouldn't be a real issue, except that under some odd confluence of circumstances (that I can't yet pin down), myVAR will unexpectedly change its value. I suspect that behavior is related to the above bug. I'll try to isolate a solid test case for this.

    If you are able to pin this down it would be great, because I don't think the declaration should have caused a problem. Unless myVAR is explicitly declared elsewhere with a type other than integer, perhaps... that might cause an issue?
  • ersmith wrote: »
    If you are able to pin this down it would be great, because I don't think the declaration should have caused a problem. Unless myVAR is explicitly declared elsewhere with a type other than integer, perhaps... that might cause an issue?

    It was a self-inflicted wound, not a compiler issue. I was being silly with a pointer to a byte array and the pointer went rogue. Oops.
  • Eric,
    I am receiving an error on the last line of this code fragment (fastspin 4.1.9).
    FWIW pnut v34s does not produce an error.

    sd_dir.p2asm:207: error: Redefining symbol _dir
            checkError(@filename1, $F0, String("Bad Wildcard Format"))              ' if error, display & abort
        elseif filename1[j] == "."
          repeat while i < 8
            fname1[i++] := char                             ' fill with "?" or " "
          if i > 8
            checkError(@filename1, $F1, String("Filename too long"))                ' if error, display & abort
        else
          if i < 11
            fname1[i++] := filename1[j]
          else
            checkError(@filename1, $F1, String("Filename too long"))                ' <<<<<< errors on this line
    
    where
    PRI checkError(errorMessage, errorNumber, errorString) : result
      if errorNumber == 0
        return 0
      else
        Print.Str(string("*ERROR: on file "))
        Print.Str(errorMessage)
        Print.Str(String(" - "))
        Print.Hex(errorNumber,2)
        Print.Char(":")
        Print.StrCR(errorString)
    '   waitcnt(cnt + clkfreq * 2)                          ' delay
        waitms(2000)                                        ' delay
        abort errorNumber
    

    Any ideas??? I presume fastspin does not like the constant literal $F1.
  • Cluso99 wrote: »
    Eric,
    I am receiving an error on the last line of this code fragment (fastspin 4.1.9).
    FWIW pnut v34s does not produce an error.

    sd_dir.p2asm:207: error: Redefining symbol _dir

    Note that the error is in the generated code ("sd_dir.p2asm") and not in the original source file sd_dir.spin2. It's upset about redefinition of a symbol "dir". Is it possible that you have two methods or variables called "dir" in the same object? The compiler should catch this earlier, but maybe it's missing something.

    If you could post the whole project, or at least the generated sd_dir.p2asm, I'd be happy to try to figure out what's going on.
  • I looked at the p2asm file but didn't find any DIR that could cause the duplication. I note that the PUB DIR call becomes _dir in pasm.
    Anyway, here is the code.
    SD_DIR.spin2 is the top file.
    Thanks Eric.
  • Ray: It looks like there's a conflict with an internal variable named "_dir". This shouldn't happen, and I'll fix it soon. In the meantime you'll be able to get your program to compile by renaming the top level method in SD_DIR.spin2 from PUB dir() to PUB dirmain() (or anything else).

    Thanks,
    Eric
  • Cluso99Cluso99 Posts: 16,385
    edited 2020-05-17 - 12:33:46
    Thanks Eric. I can do that easily.

    It compiles now but the program does not work properly (after moving the regs to $0[32]). Doesn't list the files although it makes it thru the prelim part ok. It works with pnut so there is a problem lurking somewhere. Finished for tonight so it will have to wait.
  • I've updated FlexGUI to 4.1.11. There are various bug fixes, especially for the P1 (but enough for the P2 that I recommend that you update to it). It's available from my Patreon page and from github (see my signature for links).

  • I just upped my Patreon. Thank you for your fine work on a very useful tool.



  • potatohead wrote: »
    I just upped my Patreon. Thank you for your fine work on a very useful tool.

    Thank you! I appreciate your support
  • The new version of FlexGUI (4.2.0) is available from the usual places; links are in the first post in this thread and/or my signature. The changes are mostly in the compiler, although there have also been some documentation fixes. The compiler changes include:
    - Added ways to store functions permanently into COG or LUT
    - Made ORG in Spin2 run the inline asm via fcache
    - Enabled fcache by default for P2
    - Moved P2 FCACHE to second half of LUT
    - Changed symbol resolution so Spin symbols are case insensitive in C
    - Dramatically improved parsing of large initializer lists
    - Accepted large addresses for jump instructions in inline assembly.
    - Fixed C builtin function definitions for _wypin, _wrpin, etc.
    - Fixed some cases where user code might be optimized when it shouldn't
    - Used ZEROX/SIGNX for sign extension on P2
    - Improved handling of floating point constants
    - Improved warning messages for indirect jumps
    - Reduced namespace clutter (accidental Spin influences) in C and BASIC
    
  • BTW love your warning messages for missing wc/wz/wcz on cmp instructions :)
    Found a bug that would show up later, but not with my current testing. pnut ignores this.

    And of course, the missing # in jump and call instructions is invaluable too, especially that the warning can be removed by using label-0 if it's a real case. On P1 I used bst to show up any missing #, and for the few cases I used to put a note in the comments that it was ok.
  • I've posted a beta version of 4.2.1 to my Patreon page. I hope to follow up with a general release of the "final" 4.2.1 soon.
  • Thanks Eric. Looking forward to the binary :)
  • The official 4.2.1 release is on github now. As always, if you have problems please do *not* bother Parallax about them, post here or on my github issues page.
Sign In or Register to comment.