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

123457»

Comments

  • ke4pjw wrote: »
    Feature request from a patron :smile:

    At some point could it be put on the roadmap to be able to directly load the program through the P2 eval board, directly to the SD card as a boot file? I think it would necessitate loading a program on the P2 to do that, and then reset the P2 so it can boot from SD. This is a "like to have", but would give a lot of polish!

    That's definitely on the road map, and is one of the reasons I added loadp2's multiple file loading mechanism. If you look at how the SPI flash programming is done we can do something very similar to write to an SD card too, and I hope to add that to FlexGUI eventually.

  • I've uploaded another FlexGUI 4.1.0 beta version to my Patreon page. As requested by patrons, it has support for SD card writing and the BASIC exponentiation operator ^. There are some other improvements too (like method pointers in Spin, BIN$ and HEX$ in BASIC, [] pointer dereference operator in BASIC, and automatic clock setting based on _clkfreq).

    I hope there will be a public release of it soon, but I wanted to give those supporting it a sneak preview.
  • JRoarkJRoark Posts: 335
    edited 2020-01-11 - 02:38:40
    @ersmith .... and in addition to the above, we now have a native COS, EXP, LOG, SIN, LONGINT, ULONGINT, and XOR! Sweet!!!

    I'm still trying to find where the support is for SD card writing however. I see the header files and C-lang stuff sitting in the BOARD subdirectory, but nothing in the doc that tells me how to access it from BASIC. If you could point me in the right direction, I'll have an even happier weekend!

    Thank, Eric!
  • BASIC USERS: A new mini-gotcha after upgrading to 4.1.0B(2): The first time you attempt to compile and download BASIC code you will get an error, the text of which I did not catch, but in essence it is a squawk about needing to choose to download to either SD card or flash. To cure this, from the toolbar select "COMMANDS" -> "Choose P2 Flash Program" and select "P2ES_flashloader.bin", or "P2ES_sdcard.bin" as appropriate.
  • JRoark wrote: »
    @ersmith .... and in addition to the above, we now have a native COS, EXP, LOG, SIN, LONGINT, ULONGINT, and XOR! Sweet!!!

    I'm still trying to find where the support is for SD card writing however. I see the header files and C-lang stuff sitting in the BOARD subdirectory, but nothing in the doc that tells me how to access it from BASIC. If you could point me in the right direction, I'll have an even happier weekend!

    Thank, Eric!

    I didn't phrase my message well -- the support for SD card writing is only for writing a binary image to SD instead of flash. Obviously we do have code for doing I/O to the SD, but it isn't packaged up nicely for use in BASIC or Spin yet.
    JRoark wrote: »
    BASIC USERS: A new mini-gotcha after upgrading to 4.1.0B(2): The first time you attempt to compile and download BASIC code you will get an error, the text of which I did not catch, but in essence it is a squawk about needing to choose to download to either SD card or flash. To cure this, from the toolbar select "COMMANDS" -> "Choose P2 Flash Program" and select "P2ES_flashloader.bin", or "P2ES_sdcard.bin" as appropriate.

    Sorry about that -- it's an error in the command configuration. Selecting P1 or P2a will also fix the error, which is why I didn't notice it before. It'll be fixed in the final release.
  • Cluso99Cluso99 Posts: 15,767
    edited 2020-01-11 - 04:46:34
    @ersmith,
    May have found a bug or two in Fastspin when converting spin1 to P2asm...

    Fastspin cannot handle multiple line spin operation
      if( (dataOutPin <> clockPin) and (dataOutPin <> dataInPin) and (dataOutPin <> chipSelectPin) and {
        } (clockPin <> dataInPin) and (clockPin <> chipSelectPin) and (dataInPin <> chipSelectPin) and {
        } (writeProtectPin <> dataOutPin) and (writeProtectPin <> chipSelectPin) and {
        } (cardDetectPin <> dataOutPin) and (cardDetectPin <> chipSelectPin) and {
        } (++cardLockID) and (++cardCogID) and (chipver == 1) )
    
    Is there an alternate way of using multiple lines? If not, I can put all on the one long line.

    This one identifies the problem but gives no indication of where the problem is
    PUB FATEngineStart(DOPin, CLKPin, DIPin, CSPin, WPPin, CDPin, RTCReserved1, RTCReserved2, RTCReserved3) '' 15 Stack Longs
    
    reports
    C:\P2\Propeller II OS2>f406 -w -2 _SD_FAT2.spin2
    Propeller Spin/PASM Compiler 'FastSpin' (c) 2011-2019 Total Spectrum Software Inc.
    Version 4.0.6 Compiled on: Dec 30 2019
    _SD_FAT2.spin2
    error: .cog.spin functions may not have more than 8 arguments
    
    C:\P2\Propeller II OS2>
    
    FWIW I can reduce the parameters so a limit of 8 is not a problem for me.

    And a typo for you: "mackes"
    '' Code to lock access to the PASM COG
    '' The idea here is that (in theory) multiple Spin bytecode threads might
    '' want access to the PASM COG, so this lock mackes sure they don't step on each other.
    '' This method also makes sure the remote COG is idle and ready to receive commands.
  • Thanks for the bug reports, Ray! I'm working now on trying to get the end of line comment problem fixed; the code for parsing indentation is a little hairy, so it make take me a day or two.

    That .cog.spin functions may not have more than 8 arguments is a limit built in to the compiler. We could raise it, but at the cost of increasing the size of every program compiled that way. Given that code produced by -w is intended to be run in a COG that's probably not really something most people would want. It only applies to -w mode, code normally compiled by fastspin (for HUBEXEC) doesn't have the 8 parameter limit.
  • ersmith wrote: »
    Thanks for the bug reports, Ray! I'm working now on trying to get the end of line comment problem fixed; the code for parsing indentation is a little hairy, so it make take me a day or two.
    There were only 4 such lines and I made them a single long line each. There isn't a need to fix it but I thought you'd like to know.
    That .cog.spin functions may not have more than 8 arguments is a limit built in to the compiler. We could raise it, but at the cost of increasing the size of every program compiled that way. Given that code produced by -w is intended to be run in a COG that's probably not really something most people would want. It only applies to -w mode, code normally compiled by fastspin (for HUBEXEC) doesn't have the 8 parameter limit.
    Again, doesn't need a fix although an error with the line number would be helpful as I had to track it down the long way. There was only one such call.

    For converting spin to hubexec code, what options do I need to compile that?

  • Cluso99 wrote: »
    For converting spin to hubexec code, what options do I need to compile that?

    That's the default for fastspin, so no options are required. In fact fastspin always produces a .p2asm (or .pasm for P1) file containing the hubexec code (LMM for p1).

    If you're really keen on translating Spin to PASM, spin2cpp is probably the better tool, because it has more control over the options (under the hood fastspin and spin2cpp are the same, but they have different emphasis in the command line options they have). So for example you can do something like:
    spin2cpp --p2 --asm --code=hub --data=hub foo.spin
    
    to translate foo.spin into hubexec ASM code for P2. You can change where the code and data go explicitly with "hub" or "cog" options (beware, --data=cog hasn't been thoroughly tested).

    But I definitely would suggest just compiling it to binary first with fastspin and making sure it runs on the P2 before trying to convert it to P2ASM.
  • Thanks Eric.
    I'll give it a try later as I don't have the time to follow thru today :(
  • Received the following error when compiling my p2asm code?

    C:/Program Files (x86)/Parallax/P2/CM2302/CM2302.spin2:245: error: Changing hub value for symbol temp

    temp is defined:
    temp long 0
  • Also when using Jon's simple_serial object I cannot get the cursor to HOME?

    con
    HOME = 1
    .
    .
    .
    term.tx(HOME)
  • ke4pjw wrote: »
    Feature request from a patron :smile:

    At some point could it be put on the roadmap to be able to directly load the program through the P2 eval board, directly to the SD card as a boot file? I think it would necessitate loading a program on the P2 to do that, and then reset the P2 so it can boot from SD. This is a "like to have", but would give a lot of polish!

    What if we had a Propeller program which would turn the Popeller and the SD card into a mass storage class device via USB? Then, we could address the SD card as a disk drive.
  • Re: Propeller & SD as mass storage.
    Adafruit already does this for many of their Circuit Python based microcontrollers. It works very nicely
  • jorike wrote: »
    Received the following error when compiling my p2asm code?

    C:/Program Files (x86)/Parallax/P2/CM2302/CM2302.spin2:245: error: Changing hub value for symbol temp

    temp is defined:
    temp long 0

    That looks like there may be multiple definitions for temp.
    Also when using Jon's simple_serial object I cannot get the cursor to HOME?

    I believe he's using a different terminal emulator than the one in FlexGUI. FlexGUI uses standard ANSI, but some Prop terminals use a different standard.
  • I believe he's using a different terminal emulator than the one in FlexGUI. FlexGUI uses standard ANSI, but some Prop terminals use a different standard.

    Yes, I am using PST which has control codes for moving the cursor around. This is in the code -- I will add a comment to indicate that special codes only work with PST.
    con { pst formatting }
    
      HOME    =  1
      CRSR_XY =  2
      CRSR_LF =  3
      CRSR_RT =  4
      CRSR_UP =  5
      CRSR_DN =  6
      BELL    =  7
      BKSP    =  8
      TAB     =  9
      LF      = 10
      CLR_EOL = 11
      CLR_DN  = 12
      CR      = 13
      CRSR_X  = 14
      CRSR_Y  = 15
      CLS     = 16
    
Sign In or Register to comment.