PNut/Spin2 Latest Version (v35b - DEBUG MIDI display updated)

cgraceycgracey Posts: 13,128
edited 2020-11-22 - 10:51:37 in Propeller 2
This is the latest version (v35b) of the PNut tool with example files. Documentation is up-to-date.

ZIP File:
https://drive.google.com/file/d/1SVxRx1LNfmZ7NhcbrZIaU4bWSAUawJ7G/view?usp=sharing

Documentation:
https://docs.google.com/document/d/16qVkmA6Co5fUNKJHF6pBfGfDupuRwDtf-wyieh_fbqw/edit?usp=sharing


v35b - 2020.11.22 - The DEBUG MIDI display was updated to show proper background color.
v35a - 2020.11.20 - The interpreter was shrunk by protecting CORDIC operations using REP as a shield, instead of STALLI/ALLOWI.
v35 - 2020.11.18 - DEBUG updated with new anti-aliased graphics throughout. Many PLOT syntax changes. QSIN/QCOS added to Spin2.
v34z - 2020.09.09 - DEBUG displays added and enhanced, lot of DEBUG examples.
v34y - 2020.08.27 - Now supports all three text-file formats: PC (CR+LF), Linux (LF-only), and Mac (CR-only). Format preserved on save.
v34x - 2020.08.26 - Graphical DEBUG bitmap and FFT windows added. Bug from v34i fixed: object array methods now compile as terms.
v34w - 2020.08.19 - Graphical DEBUG logic-analyzer window added, improvements, related bugs fixed.
v34v - 2020.08.12 - Graphical DEBUG windows added, several display types, examples included.
v34u - 2020.07.19 - DEBUG improved - initial delay, flexible tx pin, and timestamp added. PASM hub address bug fixed.
v34t - 2020.07.15 - DEBUG added - Watch variables as your Spin2 and PASM code runs. ASMCLK added for easy PASM clock setup.
v34s - 2020.05.12 - Bug fixed - nested bitfields now okay. BYTE/WORD/LONG/FVAR/FVARS overrides added to data declarations
v34r - 2020.04.09 - Bug fixed - Object.Constant now validates object constants, was returning zero for non-existent symbols
v34Q - 2020.04.02 - Bug fixed - 'REPEAT var[constant]' now works properly (flag in compiler needed clearing)
v34p - 2020.03.28 - CORDIC operations in interpreter now protected from interrupts, REG changed to allow PASM symbols, clean @variable
v34o - 2020.03.19 - Lots of constant symbols added for smart pins and streamer (see doc), GETSECS() renamed to GETSEC()
v34n - 2020.03.15 - All methods now require '()', GETSECS() added for getting seconds since reset
v34m - 2020.03.10 - empty blocks allowed, hub-exec PASM code orients properly in Spin2 programs
v34L - 2020.02.28 - branching bug fixed that was affecting all 64..128-size branches
v34k - 2020.02.25 - ELSEIF/ELSEIFNOT and NEXT/QUIT bugs fixed
v34j - 2020.02.23 - 'top..bottom' added for pinfields/bitfields, -c added to command line for 'compile'
v34i - 2020.02.20 - automatic constant-expression resolving improved, bitfield operations improved
v34h - 2020.02.18 - .byte/.word/.long variable modifiers, in-line PASM symbols allowed, Ctrl-A selects all
v34g - 2020.02.16 - automatic constant-expression resolving, improved list file
v34f - 2020.02.15 - in-line PASM code no longer requires RET
v34e - 2020.02.12 - added automatic list file output
v34d - 2020.02.12 - fully fixed and improved STRING()
v34c - 2020.02.12 - partially fixed bug in STRING()
v34b - 2020.02.11 - allowed OBJ.CON symbols to begin with '_'
v34a - 2020.02.11 - fixed bug in mul/div assignment operators
v34 - 2020.02.09 - first release
«13456738

Comments

  • Begineer here with P2. What do I have to do to get PNut to recognize my P2 Eval board on Windows 10? No prob with Flexgui reports on Com 9. Pnut can not find it but reports nothing on port 10 after I set it in the gui to port 9. What am I missing?

    Thanks
    Ken
  • cgraceycgracey Posts: 13,128
    edited 2020-02-15 - 03:45:16
    > @KMyers said:
    > Begineer here with P2. What do I have to do to get PNut to recognize my P2 Eval board on Windows 10? No prob with Flexgui reports on Com 9. Pnut can not find it but reports nothing on port 10 after I set it in the gui to port 9. What am I missing?
    >
    > Thanks
    > Ken

    Ken, I have no idea why that's happening. It should just work.

    Would it be possible to use the control panel to renumber your P2 serial port to COM8 or lower? I added COM10+ support a few months ago and perhaps it's got a problem. My P2 shows up on COM6 and it works fine.

    You are using the files from the link above, right, and you're actually running PNut_v34e.exe?
  • My P2 Eval Board is on COM22 and I am able to use PNut without problems.
  • I also use COM9 and it works well with PNUT.
    But I get the same error message, if I have a SD card inserted. Flexgui can program the P2 over serial also with an SD card inserted.
  • KMyers, try turning all the DIP switches OFF. Maybe that's the issue.
  • Yeah, there was some care needed in selecting pause lengths after a DTR reset to provide all the options. Getting that right caused a number of revisions with loadp2.
  • > @evanh said:
    > Yeah, there was some care needed in selecting pause lengths after a DTR reset to provide all the options. Getting that right caused a number of revisions with loadp2.

    Ah, okay. I've been trying to figure out what the issue could be.
  • Also make sure Flexgui's terminal is closed, otherwise Pnut is locked out from the port.
  • Here's the push to solve it - https://forums.parallax.com/discussion/comment/1480393/#Comment_1480393

    Eric ended up opting for JMG's idea of having short pauses and multiple tries with timeout. Looking at the source, I note it's currently at a hundred tries of 20 ms each!

    It relies on this piece of magic for detecting a reply with timeout:
        if (select(hSerial + 1, &set, NULL, NULL, &toval) > 0) {
            if (FD_ISSET(hSerial, &set))
                bytes = read(hSerial, buff, n);
        }
    
  • Eric,
    Just a suggestion. It's nice to be consistent :wink:
    This time to download flexgui 4.1.3 I needed to download flexgui.zip which of course does not contain LoadP2.
    The flexgui-master.zip which I normally download this time does not contain the actual flexgui.exe program.
  • cgraceycgracey Posts: 13,128
    edited 2020-02-15 - 06:40:30
    I have a 64GB Samsung SD card plugged in right now, but it's not causing the normal wait to fail. I can talk to the P2 Eval board through PNut with it plugged in and the Flash DIP switch ON.
  • evanhevanh Posts: 10,091
    edited 2020-02-15 - 07:58:33
    Chip,
    I think it's either/or. Either the EPPROM is booted accessed with the Flash switch on, or the SD is booted accessed with the Flash switch off.
  • cgraceycgracey Posts: 13,128
    edited 2020-02-15 - 08:42:30
    I just posted PNut_v34f at the top of this thread. It no longer requires a RET instruction after in-line PASM code:
    pub go() | x
      repeat
        org
    	getrnd	wc
    	rcl	x,#1
        end
        pinwrite(56 addpins 7, x)
        waitms(100)
    
  • cgraceycgracey Posts: 13,128
    edited 2020-02-15 - 08:37:09
    evanh wrote: »
    Chip,
    I think it's either/or. Either the EPPROM is booted accessed with the Flash switch on, or the SD is booted accessed with the Flash switch off.

    Ah, thanks. I get it to err now and then with the flash switch OFF and an SD card plugged in.

    So, it was necessary to wait 2 seconds, in case the SD was present?
  • I never tested loadp2 with an SD card myself. I'm not sure, the 100 attempts was just as likely a big round number that Eric figured would cover any eventuality.
  • I remember now: One problem was the 100 ms serial window boot timer in the prop2 ROM code for booting the EEPROM. Early loadp2 revisions were waiting too long after a reset and missing out on the 100 ms serial window.

    The other problem we solved was if the prop2 was spewing garbage at the PC when DTR reset is toggled. There was a need to wait for the PC's serial hardware to finish shifting data in before flushing the buffers.

    Eric was probably already aware of the longer SD block load needs and maybe that's why he implemented the magic timeout handler.

  • Well thanks for the info on this. I do have a 64 gig sd in with all dip switches off except boe. The sd is NOT formated fat32 if that matters. Will try the new version and remove the sd to see.

    Thanks guys!
  • Well I feel pretty stupid now. Removed the sd card
    ( non fat 32) and it loaded fine no errors. Loaded spin2 flash, got three leds lite. Is that normal? Nothing on terminal...
  • KMyers wrote: »
    Well I feel pretty stupid now. Removed the sd card
    ( non fat 32) and it loaded fine no errors. Loaded spin2 flash, got three leds lite. Is that normal? Nothing on terminal...

    What do you expect to see in the terminal? You'll be the one writing the software, make it say what you want.
  • That vga_text_demo.spin2 is driving a VGA monitor using the AV Board, plugged into pins P8..P15. The pins driving the LED buffers are floating, so anything could be on the LEDs.
  • Cluso99 wrote: »
    Eric,
    Just a suggestion. It's nice to be consistent :wink:
    This time to download flexgui 4.1.3 I needed to download flexgui.zip which of course does not contain LoadP2.
    The flexgui-master.zip which I normally download this time does not contain the actual flexgui.exe program.

    Always download flexgui.zip, it's the binary release and contains all the .exe files. flexgui-master.zip is the source code.
  • ersmith wrote: »
    Cluso99 wrote: »
    Eric,
    Just a suggestion. It's nice to be consistent :wink:
    This time to download flexgui 4.1.3 I needed to download flexgui.zip which of course does not contain LoadP2.
    The flexgui-master.zip which I normally download this time does not contain the actual flexgui.exe program.

    Always download flexgui.zip, it's the binary release and contains all the .exe files. flexgui-master.zip is the source code.
    OK, but flexgui is missing the bin directory this time
  • twm47099twm47099 Posts: 866
    edited 2020-02-15 - 23:13:46
    Cluso99 wrote: »
    OK, but flexgui is missing the bin directory this time

    Here's a couple of screenshots of the unzipped FLEXGUI 4.1.3 directory showing the bin folder and one of the bin folder showing the loadp2.exe file.
  • Got it.
  • cgraceycgracey Posts: 13,128
    edited 2020-02-16 - 09:47:33
    I just posted v34g.

    1) Automatic constant-expression resolving implemented for smaller, faster code.
    2) REPEAT-constant made more efficient, REPEAT-0 results in nothing.
    3) List file improved, names of types shown, instead of their ID numbers.

    List file from inline_pasm.spin2:
    TYPE: METHOD          VALUE: 00000000          NAME: GO
    TYPE: CON             VALUE: 00000000          NAME: CLKMODE_
    TYPE: CON             VALUE: 01312D00          NAME: CLKFREQ_
    TYPE: LOC_LONG        VALUE: 00000000          NAME: X
    
    
    CLKMODE:   $00000000
    CLKFREQ:  20,000,000
    XINFREQ:           0
    
    
    OBJ bytes:          40
    VAR bytes:           4
    
    00000- 08 00 00 80 27 00 00 00 04 22 5A 00 00 02 00 1B   '....'...."Z.....'
    00010- 00 74 FD 01 C0 A7 F0 2D 00 64 FD 47 F8 01 E0 36   '.t.....-.d.G...6'
    00020- 45 64 22 78 11 64 04 00                           'Ed"x.d..'
    
  • jmgjmg Posts: 14,541
    edited 2020-02-16 - 18:44:05
    cgracey wrote: »
    3) List file improved, names of types shown, instead of their ID numbers.

    List file from inline_pasm.spin2:
    TYPE: METHOD          VALUE: 00000000          NAME: GO
    TYPE: CON             VALUE: 00000000          NAME: CLKMODE_
    TYPE: CON             VALUE: 01312D00          NAME: CLKFREQ_
    TYPE: LOC_LONG        VALUE: 00000000          NAME: X
    

    That's useful, but a minor suggestion : most .lst files I'm used to seeing, have the VAR names first, then type value and other info.
    It's also useful to have a clear start/end so SW tools like debuggers or smarter editors can scan the VAR info (LINE and FullFileName confirm what was actually used for build)

    Here is an example
    SYMBOL                 TYPE         VALUE       LINE   FILE (etc)
    -----------------------------------------------------------------
    GO                     METHOD       00000000          
    CLKMODE_               CON          00000000          
    CLKFREQ_               CON          01312D00          
    X                      LOC_LONG     00000000          
    -----------------------------------------------------------------
    
  • I can improve it. That whole list file sort of started out as an afterthought.
  • Chip,
    bst and homespun both have nice listings for P1 as a reference.
  • cgraceycgracey Posts: 13,128
    edited 2020-02-18 - 09:19:59
    I just posted v34h with the following improvements:

    1) Variable.byte/.word/.long size overrides are now supported.
    2) Constant indexes are now folded into offsets for smaller/faster bytecode.
    3) Symbols are now supported in in-line PASM sections within methods.
    4) Ctrl-A now 'selects all'.

    Now I'm thinking about what to do about the bitfield syntax.
  • Thanks Chip.
Sign In or Register to comment.