Shop OBEX P1 Docs P2 Docs Learn Events
PNut/Spin2 Latest Version (v46 - DEBUG gating, clock-setter control, VAR flexibility, C_Z for DEBUG) — Parallax Forums

PNut/Spin2 Latest Version (v46 - DEBUG gating, clock-setter control, VAR flexibility, C_Z for DEBUG)

cgraceycgracey Posts: 14,150
edited 2024-11-20 09:46 in Propeller 2
This is the latest version (v46) of the PNut tool with example files. Documentation is up-to-date.

ZIP File:
https://obex.parallax.com/obex/pnut-spin2-latest-version/

Latest PNut Documentation:
https://docs.google.com/document/d/16qVkmA6Co5fUNKJHF6pBfGfDupuRwDtf-wyieh_fbqw/edit

Propeller 2 Silicon Documentation:
https://docs.google.com/document/d/1gn6oaT5Ib7CytvlZHacmrSbVBJsD9t_-kmvjd7nUR6o/edit?usp=sharing

Propeller 2 Assembly Language Instructions:
https://docs.google.com/spreadsheets/d/1_vJk-Ad569UMwgXTKTdfJkHYHpc1rZwxB-DcIiAZNdk/edit?usp=sharing

General Propeller 2 Documentation:
https://www.parallax.com/propeller-2/documentation/

PNut GitHub Repository (will be updated to v45 shortly):
https://github.com/parallaxinc/P2_PNut_Public


6ry6t7dcrily.png

v46 - 2024.11.20 - DEBUG gating and disabling, PASM-only clock-setter inhibiting, improved VAR line syntax, new DEBUG command Z_C will show C and Z flags
v45 - 2024.11.13 - Improved data structures, new pointer variables
v44 - 2024.03.12 - Implemented data structures, new methods FILL/SWAP/COPY/COMP, BOOL DEBUG output, DEBUG Scope auto-triggering, no clock setup needed for DEBUG since 20MHz will be assumed.
v43 - 2023.12.13 - Implemented keyword gating for future versions Spin2 to avoid namespace conflicts. Added packed-chr constants (%"ABCD" --> %44_43_42_41). Added AUTO-scaling for DEBUG SCOPE Display. Renamed BYTES()/WORDS()/LONGS() methods to BYTE()/WORD()/LONG() to conserve namespace.
v42 - 2023.11.11 - Added LSTRING()/BYTES()/WORDS()/LONGS() methods for convenient arrays.
v41 - 2023.09.24 - Fixed bug in floating-point equality operators (<., >., <>., ==., <=., >=.).
v40 - 2023.09.21 - New 'REPEAT count WITH variable' added to simplify 0..n-1 loops, where n>0.
v39 - 2023.03.05 - Bug fixed from v37 that caused differently-parameterized child objects to be identical. No more automatic generation of .obj/.lst/.txt/.bin files from compilation from GUI.
v38 - 2023.02.03 - Bug fixed from v37 that didn't allow child-object constants to be used in parent-object CON blocks. Bug fixed in interpreter which caused ROTXY/POLXY/XYPOL to not work properly. REPEAT-var returned to pre-v35n behavior where var = (final value +/- step) after REPEAT block. All DEBUG displays now use gamma-correct alpha-blending for anti-aliasing.
v37 - 2022.11.19 - OBJ's can now be parameterized. New ^@var field pointers with FIELD[fieldpointer] access. Local variables now initialized to zeros. New '...' line continuance. New GETCRC and STRCOPY methods. New DEBUG display BITMAP 'SPARSE' mode for large round pixels.
v36 - 2022.09.18 - DEBUG/debugger now adapts to clock-frequency changes.
v35v - 2022.09.11 - P62 now outputs high before the PASM-level debugger runs, so that older P2 Edge modules without serial pull-ups will work. Automatic clock setup added for PASM-only programs.
v35u - 2022.08.26 - Serial moved to a separate thread from the GUI to improve performance.
v35t - 2022.08.12 - New PASM-level debugger, PC_MOUSE now reports pixel color.
v35s - 2022.02.21 - Floating-point improvements, BYTEFIT/WORDFIT added, @"TextString" added.
v35r - 2021.12.22 - PC_KEY/PC_MOUSE added for host keyboard/mouse feedback in DEBUG Displays.
v35q - 2021.10.13 - Main symbol table increased from 64KB to 256KB, others from 4KB to 32KB.
v35p - 2021.09.23 - Fixed bug in compile-time FSQRT behavior.
v35o - 2021.09.22 - Added floating-point math to Spin2. Operators "+.", "-.", "*.", "/.", and others, with precedence.
v35n - 2021.05.23 - Added sprites to DEBUG PLOT window. Fixed REPEAT-var so that var = last value, after loop.
v35m - 2021.05.03 - Improved command-line interface for compiling and saving bin files.
v35L - 2021.03.23 - Complete command-line interface for compiling/running/flashing/debugging.
v35k - 2021.03.19 - Added DOWNLOAD_BAUD, in addition to existing DEBUG_BAUD.
v35j - 2021.03.16 - Hopefully fixed DEBUG_BAUD problems on P2 Eval board and other USB serial chips.
v35i - 2021.02.21 - Now supports DEBUG-only mode via command line: PNut_v35i -debug {CommPort if not 1} {BaudRate if not 2_000_000}.
v35h - 2021.02.15 - First 16 LUT registers freed for streamer 'imm->LUT' usage. DEBUG_WINDOWS_OFF symbol added.
v35g - 2021.02.13 - Exceptions due to floating point errors in DEBUG Displays fixed. Line clipping works now.
v35f - 2021.01.29 - Now properly handles 255 DEBUGs (was erring at 63), DEBUG.log bug fixed.
v35e - 2021.01.06 - The symbol DEBUG_BAUD was added to change the baud rate. The DEBUG window now stays where you put it.
v35d - 2021.01.03 - A bug that caused Spin2 programs to launch with indeterminate stack bases was fixed.
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
«13456765

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: 14,150
    edited 2020-02-15 03:45
    > @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.
  • AribaAriba Posts: 2,690
    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.
  • cgraceycgracey Posts: 14,150
    KMyers, try turning all the DIP switches OFF. Maybe that's the issue.
  • evanhevanh Posts: 15,910
    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.
  • cgraceycgracey Posts: 14,150
    > @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.
  • evanhevanh Posts: 15,910
    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);
        }
    
  • Cluso99Cluso99 Posts: 18,069
    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: 14,150
    edited 2020-02-15 06:40
    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: 15,910
    edited 2020-02-15 07:58
    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: 14,150
    edited 2020-02-15 08:42
    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: 14,150
    edited 2020-02-15 08:37
    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?
  • evanhevanh Posts: 15,910
    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.
  • evanhevanh Posts: 15,910
    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.
  • cgraceycgracey Posts: 14,150
    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.
  • Cluso99Cluso99 Posts: 18,069
    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: 867
    edited 2020-02-15 23:13
    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: 14,150
    edited 2020-02-16 09:47
    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: 15,172
    edited 2020-02-16 18:44
    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          
    -----------------------------------------------------------------
    
  • cgraceycgracey Posts: 14,150
    I can improve it. That whole list file sort of started out as an afterthought.
  • Cluso99Cluso99 Posts: 18,069
    Chip,
    bst and homespun both have nice listings for P1 as a reference.
  • cgraceycgracey Posts: 14,150
    edited 2020-02-18 09:19
    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.