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

24

Comments

  • There's no mention of system clock frequencies. I presume they're somehow preset the same?
    We have the vastness of the internet and yet billions of people decided to spend most of their time within a horribly designed, fake-news emporium of a website that sucks every possible piece of personal information out of you so it can sell it to others. And they see nothing wrong with that.
  • evanh wrote: »
    There's no mention of system clock frequencies. I presume they're somehow preset the same?

    The times given are elapsed clock cycles, so they're independent of the frequency. Which raises an important point: the difference in P1 and P2 cycle counts are not the only factor in comparing performance of P1 and P2, since typically the P2 will be clocked 2x or 3x faster than the P1.
    FlexGUI, a GUI for programming the P1 and P2 in Spin, PASM, BASIC, and C.
    Help support its development at Patreon or PayPal.
  • Ah, cool.
    We have the vastness of the internet and yet billions of people decided to spend most of their time within a horribly designed, fake-news emporium of a website that sucks every possible piece of personal information out of you so it can sell it to others. And they see nothing wrong with that.
  • Thanks, Eric! So, FlexGUI supersedes Spin2GUI, I assume. I'll do a test drive.

    Kind regards, Samuel Lourenço
  • samuellsamuell Posts: 517
    edited 2019-11-11 - 21:38:19
    Hi Eric,

    I've been testing your program. If I try to compile "primos.c", it returns the following:

    C:/flexgui/include/stdlib.h:45: error: syntax error, unexpected __builtin_abs
    child process exited abnormally

    Spin2GUI compiles fine using similar settings. Please see the screenshot, and use the code attached if you wish to try to replicate the error. The code itself should be OK. I think the problem lies within "stdlib.h", by the looks of it.

    Kind regards, Samuel Lourenço
    1024 x 768 - 51K
    c
    c
  • Thank you, Samuel. The problem is actually a conflict between math.h and stdlib.h. You can work around it I think by re-ordering the include files so that stdlib.h comes before math.h. I will create a proper fix for the next FlexGUI release.

    Regards,
    Eric
    FlexGUI, a GUI for programming the P1 and P2 in Spin, PASM, BASIC, and C.
    Help support its development at Patreon or PayPal.
  • So, I am attempting to program the P2 ES RevB. with Flex GUI 4.0.3. No joy. "Could not find a P2" P2 is on COM2. I cannot program it with a SD card in the slot. I can on the RevA, but not RevB. This means I cannot program it "on the fly" if the program requires access to a file on the SD Card. I have to copy to the SD card then boot from SD.

    Any ideas?
    Terry's Workbench

    Feel the need for speed between your PC's com port and Prop?
    Try the FTDI 245 and the FullDuplexParallel Object.
    Check out my spin driver for the Parallax "96 x 64 Color OLED Display Module" Product ID: 28087
    22FPS video from the P2 on the Parallax "96 x 64 Color OLED Display Module" https://www.youtube.com/watch?v=ja84rf38QHM
  • Unclear. Can you download to rev B without the SD card inserted?
  • LtechLtech Posts: 230
    edited 2019-11-13 - 07:11:42
    Note.
    For P1 and example hello.spin fiber.spin.

    you use:
    ser.printf("Hello, world!\n")
    
    It do not compile, ser.printf is not know by fullduplexSerial.spin

    I make:
    ser.str(string("Hello, world!",13))
    

    Do you use a special modified fullduplexserial file?
  • yetiyeti Posts: 602
    edited 2019-11-13 - 07:19:41
    Ltech wrote: »
    Note.
    For P1 and example hello.spin fiber.spin.

    you use:
    ser.printf("Hello, world!\n")
    
    It do not compile, ser.printf is not know by fullduplexSerial.spin

    I make:
    ser.str(string("Hello, world!",13))
    

    Do you use a special modified fullduplexserial file?
    Check your include/library paths. FastSpin's FullDuplexSerial.spin includes "printf" by including std_text_routines.spinh. You probably are using a different version.
    ◁ propeller-wiki ▷ ◁ FastSpin ▷ ◁ Help Spin at RosettaCode.org ▷ ◁ No Source – No Go! ▷ ◁ DK-E ▷ ◁ :-D ▷ ◁ Stay OmmmmmmPtimistic! ▷ ◁ Why Asimov's Laws of Robotics Don't Work ▷ ◁ DNA is a four letter word. ▷ ◁ Stop slavery! Free all mitochondria! ▷
  • LtechLtech Posts: 230
    edited 2019-11-13 - 07:22:26
    So it is not the obex spin file, it is a modified.
    FullDuplesSerial was not inside the example folder, it take the obex file.

    I just try you code preparing to P2 evolution.

    Thank-you

  • yetiyeti Posts: 602
    edited 2019-11-13 - 07:34:10
    It should come with the other files you install from the FastSpin.zip or FlexGUI.zip. And it should be in FastSpin's default include search path. It works as exspected here.
    (I'm only using FastSpin without GUI, so there may be glitches in the GUI I'll never see.)
    $ cat hello.spin
    '' simple hello world program
    '' minimalised ... P1 only ... only print 3 times
    
    CON
      _clkmode = xtal1 + pll16x
      _clkfreq = 80_000_000
      baud = 115_200
      rx_pin = 31
      tx_pin = 30
    
    OBJ
      ser: "spin/FullDuplexSerial"
    
    PUB hello
      ser.start(rx_pin, tx_pin, 0, baud)
      repeat 3
        ser.printf("Hello, world!\n")
    
    $ fastspin hello.spin 
    Propeller Spin/PASM Compiler 'FastSpin' (c) 2011-2019 Total Spectrum Software Inc.
    Version 4.0.3 Compiled on: Nov  9 2019
    hello.spin
    |-FullDuplexSerial.spin
    hello.pasm
    Done.
    Program size is 3140 bytes
    
    $ spinsim -b hello.binary 
    Hello, world!
    Hello, world!
    Hello, world!
    
    ◁ propeller-wiki ▷ ◁ FastSpin ▷ ◁ Help Spin at RosettaCode.org ▷ ◁ No Source – No Go! ▷ ◁ DK-E ▷ ◁ :-D ▷ ◁ Stay OmmmmmmPtimistic! ▷ ◁ Why Asimov's Laws of Robotics Don't Work ▷ ◁ DNA is a four letter word. ▷ ◁ Stop slavery! Free all mitochondria! ▷
  • ke4pjw wrote: »
    So, I am attempting to program the P2 ES RevB. with Flex GUI 4.0.3. No joy. "Could not find a P2" P2 is on COM2. I cannot program it with a SD card in the slot. I can on the RevA, but not RevB. This means I cannot program it "on the fly" if the program requires access to a file on the SD Card. I have to copy to the SD card then boot from SD.

    Any ideas?

    Does your SD card have boot code on it? That might cause issues (it'll boot from SD rather than looking for serial).

    Otherwise I'm not sure what to suggest; perhaps to try a different SD card? Or check the settings of the boot mode selection switches on the ES board? I've got a Sony 8 GB microSD that I leave in my P2 board all the time and it hasn't interfered with using it.

    Does programming it work if you manually reset (with the reset button) it immediately before starting the download?
    FlexGUI, a GUI for programming the P1 and P2 in Spin, PASM, BASIC, and C.
    Help support its development at Patreon or PayPal.
  • Ltech wrote: »
    Note.
    For P1 and example hello.spin fiber.spin.

    you use:
    ser.printf("Hello, world!\n")
    
    It do not compile, ser.printf is not know by fullduplexSerial.spin

    I make:
    ser.str(string("Hello, world!",13))
    

    Do you use a special modified fullduplexserial file?

    Yes, the version of fullduplexserial in "include/spin/FullDuplexSerial.spin" in the flexgui distribution has a printf method. There's a file, "include/spin/std_text_routines.spinh", that provides a set of standard methods like "str", "dec", "hex", and "printf" and which may be added to any driver that has a "tx" method. The flexgui FullDuplexSerial uses that.
    FlexGUI, a GUI for programming the P1 and P2 in Spin, PASM, BASIC, and C.
    Help support its development at Patreon or PayPal.
  • whicker wrote: »
    Unclear. Can you download to rev B without the SD card inserted?

    Correct.
    Terry's Workbench

    Feel the need for speed between your PC's com port and Prop?
    Try the FTDI 245 and the FullDuplexParallel Object.
    Check out my spin driver for the Parallax "96 x 64 Color OLED Display Module" Product ID: 28087
    22FPS video from the P2 on the Parallax "96 x 64 Color OLED Display Module" https://www.youtube.com/watch?v=ja84rf38QHM
  • ersmith wrote: »
    Does your SD card have boot code on it? That might cause issues (it'll boot from SD rather than looking for serial).

    Otherwise I'm not sure what to suggest; perhaps to try a different SD card? Or check the settings of the boot mode selection switches on the ES board? I've got a Sony 8 GB microSD that I leave in my P2 board all the time and it hasn't interfered with using it.

    Does programming it work if you manually reset (with the reset button) it immediately before starting the download?

    The card did have boot code. I deleted the boot file, and even reformatted the card non-quick to ensure it was zeroed out. No dice.

    It works as expected on my Rev A. board.

    I have tried a manual reset immediately before programming. No change.

    There must be some nuance here that I am not "getting". I will try another card. I just hope others with Rev B. chips don't have this issue, because it will make prototyping with anything that reads from SD a huge pain.

    I am going to go dig up another SD card and see if it also has the same issue. I hope it is card specific.
    Terry's Workbench

    Feel the need for speed between your PC's com port and Prop?
    Try the FTDI 245 and the FullDuplexParallel Object.
    Check out my spin driver for the Parallax "96 x 64 Color OLED Display Module" Product ID: 28087
    22FPS video from the P2 on the Parallax "96 x 64 Color OLED Display Module" https://www.youtube.com/watch?v=ja84rf38QHM
  • OK, I got it working. Had to turn DIP switch 3 "ON". Sounds like I need to re-read the docs :)
    Terry's Workbench

    Feel the need for speed between your PC's com port and Prop?
    Try the FTDI 245 and the FullDuplexParallel Object.
    Check out my spin driver for the Parallax "96 x 64 Color OLED Display Module" Product ID: 28087
    22FPS video from the P2 on the Parallax "96 x 64 Color OLED Display Module" https://www.youtube.com/watch?v=ja84rf38QHM
  • I just downloaded the latest fastspin (4.0.3).
    I'm trying to figure out what I need to change to go from Rev.A to Rev.B.

    The fastspin.md file talks about the FPGA image the "(v32b FPGA images)".
    I'm guessing that's out of date...

    So, do you just do -2 for Rev.B and -2a for Rev.A?

    I tried -2b with an old version of fastspin and it didn't give an error but code didn't work either...
    I don't think my code has anything in it that changed with Rev.B, but something is off...
    Prop Info and Apps: http://www.rayslogic.com/
  • Rayman wrote: »
    I just downloaded the latest fastspin (4.0.3).
    I'm trying to figure out what I need to change to go from Rev.A to Rev.B.
    You use "-2a" for Rev A and "-2b" or just plain "-2" for Rev B. But only recent versions of fastspin support Rev B, if you have an older version "-2" and even "-2b" were probably interpreted as Rev A also.

    There weren't many instruction encoding changes (the only backwards incompatible one I can remember was a change in encoding of ptra[X] and ptrb[X] when X is negative or bigger than 15) so if you're having problems with old code it's more likely other hardware changes that are affecting you. Most notably the streamer modes (used for video) and some smartpin modes (e.g. for USB) have changed.
    FlexGUI, a GUI for programming the P1 and P2 in Spin, PASM, BASIC, and C.
    Help support its development at Patreon or PayPal.
  • Does flexgui have a way to set the font size in the status pane at the bottom in MacOS X? The text is microscopic there and just about unreadable.
  • @yeti I tested more, my print issue is with the osx build, have to find why.
    On windows there is the "printf" function in the bin map of fullduplexserial

    Thank-you

  • rogloh wrote: »
    Does flexgui have a way to set the font size in the status pane at the bottom in MacOS X? The text is microscopic there and just about unreadable.

    There's no way in the GUI yet (sounds like that would be a nice feature). You can edit the src/gui.tcl file and change the text that's near line 847:
    text .p.bot.txt -wrap none -xscroll {.p.bot.h set} -yscroll {.p.bot.v set} -height 10 -font "courier 8"
    

    The "courier 8" string is the font specification, changing it to "courier 10" or "courier 12" should help. The code is interpreted, so this change will take effect next time you start flexgui, no recompilation required.
    FlexGUI, a GUI for programming the P1 and P2 in Spin, PASM, BASIC, and C.
    Help support its development at Patreon or PayPal.
  • Thanks! That made all the difference.
  • Ltech wrote: »
    @yeti I tested more, my print issue is with the osx build, have to find why.
    On windows there is the "printf" function in the bin map of fullduplexserial
    The printf function is actually located in the include/spin/std_text_routines.spinh of the Spin2cpp source tree. I'm not sure how that gets included in flexgui-based compiles. Perhaps ersmith can advise.


    dgately

    Livermore, CA (50 miles SE of San Francisco)
  • dgately wrote: »
    The printf function is actually located in the include/spin/std_text_routines.spinh of the Spin2cpp source tree. I'm not sure how that gets included in flexgui-based compiles. Perhaps ersmith can advise.
    Look up! (Here no piano will fall on your head.)
    ◁ propeller-wiki ▷ ◁ FastSpin ▷ ◁ Help Spin at RosettaCode.org ▷ ◁ No Source – No Go! ▷ ◁ DK-E ▷ ◁ :-D ▷ ◁ Stay OmmmmmmPtimistic! ▷ ◁ Why Asimov's Laws of Robotics Don't Work ▷ ◁ DNA is a four letter word. ▷ ◁ Stop slavery! Free all mitochondria! ▷
  • yeti wrote: »
    dgately wrote: »
    The printf function is actually located in the include/spin/std_text_routines.spinh of the Spin2cpp source tree. I'm not sure how that gets included in flexgui-based compiles. Perhaps ersmith can advise.
    Look up! (Here no piano will fall on your head.)
    Ah, my mistaken assumption was that only SmartSerial.spin included std_text_routines.spinh and not FullDuplexSerial... I see that P1 and P2 can both get printf, with that extension. Either way, on my macOS flexgui installation, I had to add a "-L ~/mySourceDir/spin2cpp/include/spin" to get std_text_routines.spinh to be found.
    Livermore, CA (50 miles SE of San Francisco)
  • I would like to encourage others to become patrons to Eric Smith. I signed up today with a $10/mo donation. He is doing incredible work with FlexGUI.

    https://www.patreon.com/totalspectrum/posts


    Terry's Workbench

    Feel the need for speed between your PC's com port and Prop?
    Try the FTDI 245 and the FullDuplexParallel Object.
    Check out my spin driver for the Parallax "96 x 64 Color OLED Display Module" Product ID: 28087
    22FPS video from the P2 on the Parallax "96 x 64 Color OLED Display Module" https://www.youtube.com/watch?v=ja84rf38QHM
  • More choices...
    $ cat the_pain_of_choice.spin 
    obj stdio : "stdio.h"
    
    pub main
      stdio.printf(string("FastSpin is %d!",13,10),1337)
    $ fastspin -q the_pain_of_choice.spin 
    $ spinsim -b the_pain_of_choice.binary 
    FastSpin is 1337!
    
    That adventure will keep us busy for more than a while.
    ◁ propeller-wiki ▷ ◁ FastSpin ▷ ◁ Help Spin at RosettaCode.org ▷ ◁ No Source – No Go! ▷ ◁ DK-E ▷ ◁ :-D ▷ ◁ Stay OmmmmmmPtimistic! ▷ ◁ Why Asimov's Laws of Robotics Don't Work ▷ ◁ DNA is a four letter word. ▷ ◁ Stop slavery! Free all mitochondria! ▷
  • ersmith wrote: »
    Thank you, Samuel. The problem is actually a conflict between math.h and stdlib.h. You can work around it I think by re-ordering the include files so that stdlib.h comes before math.h. I will create a proper fix for the next FlexGUI release.

    Regards,
    Eric
    Thanks Eric. It worked!

    Kind regards, Samuel Lourenço
    c
    c
    10K
  • I'm preparing for a 4.0.4 release of FlexGUI, I hope on the weekend. In the meantime I've posted a sneak peek on my Patreon page for my patrons. Many thanks for those who've donated to support FlexGUI and fastspin, with your help I've been able to purchase a digital signing key and I'm saving up for a P2D2 board and other hardware to test with FlexGUI.
    FlexGUI, a GUI for programming the P1 and P2 in Spin, PASM, BASIC, and C.
    Help support its development at Patreon or PayPal.
Sign In or Register to comment.