PNut/Spin2 Latest Version (v47 - Cooperative multitasking added to Spin2, up to 32 tasks)
cgracey
Posts: 14,204
This is the latest version (v47) of the PNut tool with example files. Documentation is almost 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:
https://github.com/parallaxinc/P2_PNut_Public
v47 - 2024.12.07 - Cooperative multitasking added to Spin2, allows up to 32 tasks. Tasks may be gated from PASM code via HALT bits in register $120.
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
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:
https://github.com/parallaxinc/P2_PNut_Public
v47 - 2024.12.07 - Cooperative multitasking added to Spin2, allows up to 32 tasks. Tasks may be gated from PASM code via HALT bits in register $120.
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
Comments
Thanks
Ken
> 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?
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.
> 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.
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:
Just a suggestion. It's nice to be consistent
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.
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?
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.
Thanks guys!
( 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.
Always download flexgui.zip, it's the binary release and contains all the .exe files. flexgui-master.zip is the source code.
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.
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:
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
bst and homespun both have nice listings for P1 as a reference.
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.