Shop OBEX P1 Docs P2 Docs Learn Events
PNut/Spin2 Latest Version (v47 - Cooperative multitasking added to Spin2, up to 32 tasks) - Page 42 — Parallax Forums

PNut/Spin2 Latest Version (v47 - Cooperative multitasking added to Spin2, up to 32 tasks)

1394042444570

Comments

  • Cluso99Cluso99 Posts: 18,069
    edited 2021-03-19 20:41

    Thanks Chip. Will not get time to try it out today - surprise 70th party for the wife :)

    Luckily she doesn’t read these forums!

  • Cluso99Cluso99 Posts: 18,069

    Chip,
    SUCCESS :)

    This works first time

    CON 
      _clkfreq = 10_000_000
      DOWNLOAD_BAUD = 921_600
      DEBUG_BAUD = 921_600
    
    PUB go() | i
      repeat i from 0 to 9
        debug(udec(i))
    

    However, if I leave out the DOWNLOAD_BAUD and repower the board (RetroBlade2 and CP2102) and relaunch pnut35k, the very first compile/run (Ctrl-F10) there is no debug message displayed. A second compile/run (Ctrl-F10) works correctly, and from then on.

    Then I tried P2-EVAL...
    This code never shows the data in the debug screen after relaunching pnut35k

    CON 
      _clkfreq = 10_000_000
    '  DOWNLOAD_BAUD = 921_600
      DEBUG_BAUD = 921_600
    
    PUB go() | i
      repeat i from 0 to 9
        debug(udec(i))
    

    even with multiple Ctrl-F10's.
    But this does work first and subsequent times

    CON 
      _clkfreq = 10_000_000
      DOWNLOAD_BAUD = 921_600
      DEBUG_BAUD = 921_600
    
    PUB go() | i
      repeat i from 0 to 9
        debug(udec(i))
    

    So, from launch, the very first time DEBUG_BAUD is used without DOWNLOAD_BAUD, the debug terminal screen is blank. ie there is a problem setting the speed on the port with W10 and pnut somewhere.

  • cgraceycgracey Posts: 14,206

    Cluso, add "CON debug_delay = 100" and see if that helps.

    I wait 100ms before changing the baud rate for debug, so that the download can complete at the download baud. You may need to add DEBUG_DELAY.

  • evanhevanh Posts: 16,032

    Chip,
    How does Pnut extract command line parameters? I've just tried using it under Wine but nothing is picked up. Not even the filename. Pnut just opens a blank edit window.

  • evanhevanh Posts: 16,032

    PS: When I've used pnut previously, I've always relied on drag'n'drop. It worked from day dot and there wasn't any command line entry for a long while anyway. Once silicon was cast I migrated to fastspin/flexspin because I preferred another text editor and also got a liking for some of fastspin's and loadp2's extra features. Only just now thought about trying out the pnut command options.

  • Maybe you can tweak the extended settings for the CP2102?

    Go to windows device manager, double click the COM-port, connection settings, extended settings ... hope my translation from my german windows system is close enough for you to find it.

  • evanhevanh Posts: 16,032

    You might want to quote who you are replying to.

  • Ups ... there were some more pages :* I think I should go and get some sleep.

    I was actually replied to the entries around #1201 ... where the CP2102 seemed to be working for small junks of data.

  • @evanh said:
    Chip,
    How does Pnut extract command line parameters? I've just tried using it under Wine but nothing is picked up. Not even the filename. Pnut just opens a blank edit window.

    PNut does not want any extension on the file name. So to compile "foo.spin2" you do

       wine /path/to/PNut.exe foo -c
    

    Unfortunately no error messages get printed, so it's not as useful as it could be (you have to check afterwards to see if "foo.bin" actually got produced and/or updated).

    To open the editor with a file, just leave off the -c:

       wine /path/to/PNut.exe foo
    

    @cgracey : this issue has come up a few times... any chance that PNut could accept an optional file extension? Even something as simple as checking to see if the file name ends in ".spin2" and if so skipping the extension adding would be useful.

  • evanhevanh Posts: 16,032
    edited 2021-03-21 00:34

    Lol, thanks Eric. Oh, I see what you mean with no errors - That might just put a nail in the coffin of actually using Pnut with another editor ... Which I was thinking about doing.

  • cgraceycgracey Posts: 14,206

    I have been searching for how to output to StdErr from Delphi GUI's and it's not simple. Nothing clear, yet.

    I can change the file-extension sensitivity, no problem. I could also write a one-line file with the error information in it.

  • evanhevanh Posts: 16,032

    stdout is fine, especially since there's nothing else emitted anyway.

  • cgraceycgracey Posts: 14,206
    edited 2021-03-21 10:09

    Here is a test version of PNut which does some new things:

    1) It writes an ERROR.TXT file after command-line compilation.
    2) It accepts filenames with or without the .spin2 extension applied.

    The ERROR.TXT file is written with "okay" if no error or

    <file_path>:<line_number>:error:<error_message>

    https://drive.google.com/file/d/1mHAS5A30PavFRemdX7NpSBkQgdL6PgWm/view?usp=sharing

    If I can figure out how to get this error message out to StdErr, it should work with Stephen Moraco's VSC setup.

  • evanhevanh Posts: 16,032

    Maybe writeln(stderr,'An error has occurred');

  • cgraceycgracey Posts: 14,206

    @evanh said:
    Maybe writeln(stderr,'An error has occurred');

    That works in a Delphi console app, but not from a GUI.

  • evanhevanh Posts: 16,032
    edited 2021-03-21 11:25

    @cgracey said:
    The ERROR.TXT file is written with "okay" if no error or

    Z:\home\evanh\hoard\coding\prop2\testing\video1.spin2:65:error:Expected "," or end of line

    And line 65 is
    #ifdef revA

    Yep, it works rather well. I have the directory open on the desktop beside the console, so the error.txt appears at the top of the file list when written to. :)

  • evanhevanh Posts: 16,032

    @cgracey said:
    That works in a Delphi console app, but not from a GUI.

    Is this any help? https://www.freepascal.org/docs-html/current/fcl/process/tprocess.stderr.html

  • @cgracey said:

    @evanh said:
    Maybe writeln(stderr,'An error has occurred');

    That works in a Delphi console app, but not from a GUI.

    You'd have to make it a console app, anyways, because GUI apps don't make the shell wait for their completion.

  • Cluso99Cluso99 Posts: 18,069

    @cgracey said:
    Cluso, add "CON debug_delay = 100" and see if that helps.

    I wait 100ms before changing the baud rate for debug, so that the download can complete at the download baud. You may need to add DEBUG_DELAY.

    Sorry Chip, haven’t had time for P2 to test it. Hope I may get time this afternoon to try it.

  • cgraceycgracey Posts: 14,206

    If we had a console program that deleted ERROR.TXT, then conveyed arguments to PNut, and then waited for the ERROR.TXT file to appear, conveying it out on StdErr, we would have this working.

  • @cgracey said:
    If we had a console program that deleted ERROR.TXT, then conveyed arguments to PNut, and then waited for the ERROR.TXT file to appear, conveying it out on StdErr, we would have this working.

    Nah, that'd be extremely jank. Just make the command line compiker its own executable

  • SuracSurac Posts: 176
    edited 2021-03-22 08:21

    Hello,

    simple question:

    • I use Propeller Tool 2.5.3 from the download page. Is Pnut integrated into Propeller Tools or is Pnut independet?
    • Where can i find the compiler listing file after compiling a file in Propeller Tools?
    • if Pnut is fixed part of the Propeller Tools then is it possible to use the latest Pnut with Propeller Tools?
  • Cluso99Cluso99 Posts: 18,069
    • PropTool is based on pnut plus a GUI. However, the features lag pnut as it takes time to integrate pnut updates into PropTool.
    • None available (at least not in the listing sense). Try FlexProp if you need a listing, but the output is not the same.
    • No.
  • @Surac said:
    Hello,

    • if Pnut is fixed part of the Propeller Tools then is it possible to use the latest Pnut with Propeller Tools?

    Yes, this is my understanding. If you run PNut you're working with the latest-released compiler. Not the case @cgracey?

    Ken Gracey

  • Cluso99Cluso99 Posts: 18,069
    edited 2021-03-22 21:58

    pnut is not part of PropTool, but a copy of it with some necessary changes AFAIK.

    So, while you can edit and save with PropTool, and can use pnut to then compile this code, they are unrelated programs and operations. PropTool’s inbuilt compiler is a (modified???) copy of pnut from some perhaps/often prior version on pnut.

  • Cluso99Cluso99 Posts: 18,069

    @Cluso99 said:

    @cgracey said:
    Cluso, add "CON debug_delay = 100" and see if that helps.

    I wait 100ms before changing the baud rate for debug, so that the download can complete at the download baud. You may need to add DEBUG_DELAY.

    Sorry Chip, haven’t had time for P2 to test it. Hope I may get time this afternoon to try it.

    This fixed the first download problem on both P2-EVAL and RetroBlade2/CP2102. Thanks Chip.

    CON 
      _clkfreq = 10_000_000
      DOWNLOAD_BAUD = 921_600
      DEBUG_DELAY = 100
      DEBUG_BAUD = 921_600
    
    PUB go() | i
      repeat i from 0 to 9
        debug(udec(i))
    
  • cgraceycgracey Posts: 14,206
    edited 2021-03-23 08:01

    A new PNut_v35L.exe is posted at the top of this thread.

    I really beefed up the command-line interface of PNut.exe. It turns out that when you run a GUI app from a batch file, it waits for the app to close before going to the next line of the batch file, unlike the console, which immediately returns a prompt. So, PNut.exe writes the error status to a one-line text file and then the batch file passes it out to STDOUT, STDERR, and ERRORLEVEL. This should enable everyone to shell out from their favorite editor, in case they can't handle not having a scroll bar. Von Sarvas figured out all the cryptic batch file commands to make this happen. I had no idea.

  • evanhevanh Posts: 16,032
    edited 2021-03-23 11:51

    Bash shell prompt doesn't return until Pnut exits on Wine.

  • RamonRamon Posts: 484
    edited 2021-03-24 15:00

    Thanks so much for debug FIX. I can now see the debug screen with Retroblade2.

    While playing with debug I found something that is not working as I expected: (no loop is executed)

    (Edit: no issue actually here, reset command has missing 0 -> HUBSET ##$1000_0000 )

    CON 
      _clkfreq = 10_000_000
      DOWNLOAD_BAUD = 115_200
      DEBUG_DELAY = 100
      DEBUG_BAUD = 115_200
    
    PUB first()
    
        repeat
          pintoggle(36)
          waitms(100)
          ORG 
            HUBSET ##$1000_000
          END
    
    PUB go() 
    
       repeat
         ORG 
           HUBSET ##$1000_000
         END
    
  • Also, I cannot have the SD card plugged in on the Retroblade while I use PNUT or Propeller tool.

    I do NOT have this problem with Flexprop. Flexprop allows me to compile and upload even if the SD card is plugged in.

Sign In or Register to comment.