Shop OBEX P1 Docs P2 Docs Learn Events
Spin Tools IDE - Page 17 — Parallax Forums

Spin Tools IDE

11213141517

Comments

  • @macca said:
    About the content proposal popup issue, I have examined the thing and I don't think it is a bug, as long as the popup is open, hitting enter will insert the suggested content, the problem, I think, is that the popup is opened too early and is not clear how to close. I have added a small delay to the trigger characters so it is possible to type an object.method call without opening the popup (can still be opened with Ctrl+SPACE). The popup can then be closed without inserting the suggested content by pressing ESC. Hope this helps to mitigate the issue.

    From my experience, the issue was that the popup appears sometimes inappropriately, and so not an issue with speed of appearance.
    Ie. after finishing a complete statement on a line, it would not be appropriate to see a popup.

    Ah.. unless you are thinking that the popup algorithm might decide on completion suggestions too early, before the final closing bracket had been pressed (for example), and so an increased delay might help ensure against such false-positives; allowing the user a bit more typing time between characters, before detecting a pause in entry and suggesting content.

    OK, first steps, I'd better download and test! Will report back :)

    Thanks for all the improvements Macca.
    Very awesome!

  • @JonnyMac said:

    Can anyone tell me if "SPIN Tools IDE" supports the [debug_baud] command.

    If you use the external compiler feature (thank you, Marco!) and use PNut, yes.

    Thanks for that JonnyMac.
    I actually tried PNut but mine often fails to load into PNut for some reason, (it does work sometimes though).
    I think my setup the same as yours (I did it based on your earlier post on this subject) but it often doesn't pass the parameter into PNut.
    I am doubtless doing something wrong somewhere, but I usually just get this when I try PNut from SpinTools:-

    Do i need to add that library path into here as well?

    I had a look at the "Propeller Live Forum" & I think you mentioned something about the same path?

    @macca latest version 0.37.0 fixes the < DEBUG_BAUD = 115_200 > problem I was talking about above.
    The close serial port part also works, I just wish there was a button on the terminal to do that without closing the IDE.

  • JonnyMacJonnyMac Posts: 9,067
    edited 2024-06-14 12:36

    Do i need to add that library path into here as well?

    If you're using the default library path, put a copy of PNut there.

    I don't like having my libary files in the Program Files (x86) folder which is protected by Windows and difficult to access from Windows explorer. The Propeller Tool library folder is under Documents so it's no problem to get to. It is a unified folder, though, so your Spin1 and Spin2 libraries will be there (I don't mind this).

    My configuration:

  • JonnyMacJonnyMac Posts: 9,067

    Added the editor context menu

    Thank you, Marco! -- for all your hard work on Spin Tools.

  • LtechLtech Posts: 379
    edited 2024-06-16 18:03

    Thank you,

    I can install the new version in arch64 on my M3.
    I do not test the comports at this point, only compiling.
    Flashing is working too

    Nice, Love this IDE!

  • Hi ALL,
    I have been struggling with learning debug on the P2 and noticed that in "Spin Tools IDE 0.37.0" (still the latest version , I believe?) a simple debug command by itself, generates an "undefined symbol debug" error.
    From "Parallax Spin2 Documentation v43" it shows "DEBUG without parentheses will invoke that cog's PASM-level debugger, from either Spin2 or PASM. There is no limit on the number of plain DEBUG commands."
    While I know that "Spin Tools IDE" only supports text based debug commands but I wouldn't expect an error, just that it would ignore an unsupported command. I guess this is so new it isn't supported yet?
    I am unclear at this time exactly what this command does verses debug() as I am still working that out, but I don't think an error is correct.

  • VonSzarvasVonSzarvas Posts: 3,398
    edited 2024-07-11 14:08

    Not sure if this is a compiler or IDE request, but I'm thinking it could be good to have a warning when a "greater or equals to" operator is used incorrectly within an "if" statement condition...

    if x >= y -vs- if x => y

    Two very different outcomes, but only the latter should be a valid condition in most-all cases?

    Is this something anyone else has tripped up on?.... How do you remember to avoid the devilish assignment trap?

  • JonnyMacJonnyMac Posts: 9,067

    @lab_ges You can do basic debugging with Spin Tools by enabling DEBUG with Ctrl+D or Tools/Enable P2 DEBUG. The first image shows the output from Chip's basic debug demo that is included with his PNut archive. The first image is basic debugging inside Spin Tools. The second shows debugging via PNut. See post #479 for how I setup Spin Tools to use PNut for compiling and debugging.

    1920 x 1030 - 54K
    1920 x 1031 - 65K
  • JonnyMacJonnyMac Posts: 9,067

    @macca While trying to help lab_ges I accidently clicked on a .bin file and got into an infinite error loop; nothing I did could shutdown the program. I forced it closed through Task Manager but reopening put me right back into the error loop. Personally, I usually don't care about reopening the files I was working on when I close the program. Could you add feature like "Reopen last files" to the Preferences/General section?

    I tried deleting the folder with the program but that didn't help, either. Finally, I found a JSON file called .spin-tools in my Users folder. Deleting that allowed me to get going again. Is there any reason this file couldn't be located in the same folder as the executable?

    1918 x 1022 - 149K
  • maccamacca Posts: 766

    @lab_ges said:
    I have been struggling with learning debug on the P2 and noticed that in "Spin Tools IDE 0.37.0" (still the latest version , I believe?) a simple debug command by itself, generates an "undefined symbol debug" error.
    From "Parallax Spin2 Documentation v43" it shows "DEBUG without parentheses will invoke that cog's PASM-level debugger, from either Spin2 or PASM. There is no limit on the number of plain DEBUG commands."
    While I know that "Spin Tools IDE" only supports text based debug commands but I wouldn't expect an error, just that it would ignore an unsupported command. I guess this is so new it isn't supported yet?
    I am unclear at this time exactly what this command does verses debug() as I am still working that out, but I don't think an error is correct.

    Handling unsupported keywords/commands is aways a problem: throw an error ? then people may be confused because it should work. ignore the keyword ? still, people may be confused because it has no effects. Maybe a warning that the keyword is temporarily unsupported may be the good solution. I'm not sure either what it should do but since the PASM level debugger is not supported in the IDE it may have some unwanted effects (like throwing a lot of debug text out of the serial port).

    I also tought that the new typescript compiler was almost ready, I think I'll wait for it before doing more work on the compiler.

  • lab_geslab_ges Posts: 87
    edited 2024-07-11 15:31

    Thanks for your help @JonnyMac
    I had got the basic DEBUG stuff working, simular to what you show above and I think I now understand how to use that for spin2 now, even a little in PASM, in both Pnut and Spin Tools but am not sure what the point of the single "debug" statement, mentioned in the <Parallax Spin2 Documentation v43> it says "DEBUG without parentheses will invoke that cog's PASM-level debugger, from either Spin2 or PASM."

    I have used the DEBUG() version in a few places and they seem to work well, such as :-
    * DEBUG(UDEC(x))
    or
    DEBUG("* The Code is at stage 3!")

    but when i tried to use just the "debug" version (with no brackets) to see what that does it comes up with an "undefined symbol debug" error in Spin Tool IDE
    DEBUG
    So, is that a typo in the Manual? I am not clear on what this command is meant to do and why it gives an error in Spin Tools IDE?

    PS. Just tried that in a sample PASM section of Code and:-
    DEBUG
    gives no error there, only in the SPIN2 section of the code, I just get a heap of Cog1 messages in the debug windows, so is this just generating the debug Break command?

  • maccamacca Posts: 766

    @JonnyMac said:
    @macca While trying to help lab_ges I accidently clicked on a .bin file and got into an infinite error loop; nothing I did could shutdown the program. I forced it closed through Task Manager but reopening put me right back into the error loop. Personally, I usually don't care about reopening the files I was working on when I close the program. Could you add feature like "Reopen last files" to the Preferences/General section?

    That's interesting, how you opened it ? The file browser should filter-out .bin files, in addition I did a change sometime ago so if the file ends with .spin or .spin2 it opens in the editor, all other extensions open with the system-handler (a .bmp or .png image should open the image viewer).

    I tried deleting the folder with the program but that didn't help, either. Finally, I found a JSON file called .spin-tools in my Users folder. Deleting that allowed me to get going again. Is there any reason this file couldn't be located in the same folder as the executable?

    It is outside the program directory so you can delete the folder (to upgrade) without losing the settings.

  • maccamacca Posts: 766

    @VonSzarvas said:
    Not sure if this is a compiler or IDE request, but I'm thinking it could be good to have a warning when a "greater or equals to" operator is used incorrectly within an "if" statement condition...

    if x >= y -vs- if x => y

    Two very different outcomes, but only the latter should be a valid condition in most-all cases?

    Is this something anyone else has tripped up on?.... How do you remember to avoid the devilish assignment trap?

    AFAIK, the latter is not a valid operator (I don't see it documented), it throws an error in both the IDE and PNut.
    I'm missing something ?

  • maccamacca Posts: 766

    @lab_ges said:
    Thanks for your help @JonnyMac
    I had got the basic DEBUG stuff working, simular to what you show above and I think I now understand how to use that for spin2 now, even a little in PASM, in both Pnut and Spin Tools but am not sure what the point of the single "debug" statement, mentioned in the <Parallax Spin2 Documentation v43> it says "DEBUG without parentheses will invoke that cog's PASM-level debugger, from either Spin2 or PASM."

    I have used the DEBUG() version in a few places and they seem to work well, such as :-
    * DEBUG(UDEC(x))
    or
    DEBUG("* The Code is at stage 3!")

    but when i tried to use just the "debug" version (with no brackets) to see what that does it comes up with an "undefined symbol debug" error in Spin Tool IDE
    DEBUG
    So, is that a typo in the Manual? I am not clear on what this command is meant to do and why it gives an error in Spin Tools IDE?

    PS. Just tried that in a sample PASM section of Code and:-
    DEBUG
    gives no error there, only in the SPIN2 section of the code, I just get a heap of Cog1 messages in the debug windows, so is this just generating the debug Break command?

    To be clear: the DEBUG alone command (without parenthesis) is not supported by Spin Tools IDE only, it should work in PNut and (AFAIK) should open a window like the visible on the first page of the PNut thread
    https://forums.parallax.com/discussion/171196/pnut-spin2-latest-version-v44-data-structures-added-new-methods-for-memory-testing-manipulation/p1

  • JonnyMacJonnyMac Posts: 9,067

    That's interesting, how you opened it ?

    To be honest, I'm not sure, because I thought I clicked on a Spin2 file. When I clicked Open, though, things went kind of haywire.

    It is outside the program directory so you can delete the folder (to upgrade) without losing the settings.

    Well, that makes sense, especially since I had to restore the file temporarily so I could see what settings I have (by opening it manually). I do hope you'll consider the "Open last files" as an option.

  • JonnyMacJonnyMac Posts: 9,067

    @lab_ges If your goal is to get the big debugger window, put debug_main into a constant section.

    1920 x 1031 - 503K
  • VonSzarvasVonSzarvas Posts: 3,398
    edited 2024-07-11 15:49

    @macca said:

    @VonSzarvas said:
    Not sure if this is a compiler or IDE request, but I'm thinking it could be good to have a warning when a "greater or equals to" operator is used incorrectly within an "if" statement condition...

    if x >= y -vs- if x => y

    Two very different outcomes, but only the latter should be a valid condition in most-all cases?

    Is this something anyone else has tripped up on?.... How do you remember to avoid the devilish assignment trap?

    AFAIK, the latter is not a valid operator (I don't see it documented), it throws an error in both the IDE and PNut.
    I'm missing something ?

    Perhaps I should have mentioned "P1 - SPIN". Either of these will compile.

    if (result => 5)                                 
            value += 10
    
    if (result >= 5)                                    ' oops- this compiles, but is nasty stuff ?
            value += 10
    
  • maccamacca Posts: 766

    @VonSzarvas said:

    @macca said:

    @VonSzarvas said:
    Not sure if this is a compiler or IDE request, but I'm thinking it could be good to have a warning when a "greater or equals to" operator is used incorrectly within an "if" statement condition...

    if x >= y -vs- if x => y

    Two very different outcomes, but only the latter should be a valid condition in most-all cases?

    Is this something anyone else has tripped up on?.... How do you remember to avoid the devilish assignment trap?

    AFAIK, the latter is not a valid operator (I don't see it documented), it throws an error in both the IDE and PNut.
    I'm missing something ?

    Perhaps I should have mentioned "P1 - SPIN". Either of these will compile.

    if (result => 5)                                 
            value += 10
    
    if (result >= 5)                                    ' oops- this compiles, but is nasty stuff ?
            value += 10
    

    Ah, P1, ok.
    Some compilers generates a warning if an assignment is used in a conditional statement, this is what generates GCC:
    warning: suggest parentheses around assignment used as truth value

    Don't know how difficult is to implement.

  • @JonnyMac said:
    If your goal is to get the big debugger window, put debug_main into a constant section.

    Thanks Jon, I have found P2 debug very confusing but I understand that now.

  • JonnyMacJonnyMac Posts: 9,067
    edited 2024-07-12 15:18

    Thanks Jon, I have found P2 debug very confusing but I understand that now.

    Me, too. I'm going to encourage Chip to develop more (practical) demos, especially as the debugging system is being translated to TS as the PNut compiler has. This will open up opportunities for those running MacOS or Linux to use those features.

  • DiverBobDiverBob Posts: 1,108

    Is there a way to run DEBUG in a separate terminal window in Spin Tools?

  • JonnyMacJonnyMac Posts: 9,067
    edited 2024-08-22 21:48

    Yes, if you're on Windows and using PNut to compile. Up-side of the Spin Tools debug terminal is that you can scroll back, something that's not possible with PNut (I asked Chip to consider fixing this the other day).

    See attached screenshots. Note that I had to put the path to PNut in double quotes because the Parallax path has a space in it. I had to do the same thing so that I can invoke PST, which I'm so used to that I prefer over the Spin Tools internal terminal (which doesn't scroll back).

    1920 x 1080 - 158K
    1920 x 1080 - 193K
  • JonnyMacJonnyMac Posts: 9,067

    @macca In a future release could you add an indicator to the toolbar that shows debug is enabled?

  • DiverBobDiverBob Posts: 1,108
    edited 2024-08-23 21:58

    @JonnyMac said:
    Yes, if you're on Windows and using PNut to compile. Up-side of the Spin Tools debug terminal is that you can scroll back, something that's not possible with PNut (I asked Chip to consider fixing this the other day).

    See attached screenshots. Note that I had to put the path to PNut in double quotes because the Parallax path has a space in it. I had to do the same thing so that I can invoke PST, which I'm so used to that I prefer over the Spin Tools internal terminal (which doesn't scroll back).

    Thanks for the information Jon. I followed your screenshot and updated the tool preference in Spin Tools with the latest version of PNut and Spin Tools, but Spin Tools isn't using PNut to compile and continues to use its own compiler. So I'm missing another setting to get it to use the PNut compiler (I have very little experience with PNut so not sure what to look for).

    Edit: After searching in previous entries you made (#475) that to use the PNut compiler you use the Spin Tools : Tools : Run command to use the PNut compiler. I also copied the PNut app into the Propeller library path. So now at the bottom of the Spin Tools screen it shows the Pnut_v44.exe path with the correct top object for my project. However the PNut Debug popup doesn't show the top object, says Untitled.spin2. The top object is located in the Library path but in a separate folder. I'll continue to experiment and see if I can figure this out.

  • JonnyMacJonnyMac Posts: 9,067

    There are some details to the setup. This is what I do.

    • I use the Propeller Tool Library folder for all of my library files (P1 and P2).

    • I put the latest copy of PNut into the Library folder. Why? Because PNut doesn't have a library path; libraries must be local to it.

    Here's my setup for running in RAM via PNut. The only difference with using DEBUG is that the Arguments line ends in -rd

    Now, Spin Tools does not remap the F10 key for PNut -- it uses Alt + [number key] based on your order of assignments. In my case, [Alt]+[1] compiles with PNut and runs in RAM.

    Caveat. You need to press [Ctrl]-[S] (or click Save on the toolbar) before running PNut if you made changes. If you don't, Spin Tools will give you a dialog.

    Caveat2: Standard Parallax paths in Windows have spaces which create problems for launching files from Spin Tools. Put the path in quotes and that will sort things out.

    It takes a minute to get used to, but it's nice. I've been experimenting with floating point values lately and the now-abandoned version of Propeller Tool has some errors when it comes to floats. As I said before, I like PST, so I've enabled a [Alt] key for that.

    Maybe down the road @macca will provide a way to map the "standard" keys to the compiler of our choice, though I think he'll always use his own compiler for live checks while editing. With the PNut-TS release coming soon it will be interesting to see how that might impact Spin Tools.

    I hope this helps.

  • maccamacca Posts: 766

    @DiverBob said:
    Is there a way to run DEBUG in a separate terminal window in Spin Tools?

    No, the debug window is not detachable.

    Thanks for the information Jon. I followed your screenshot and updated the tool preference in Spin Tools with the latest version of PNut and Spin Tools, but Spin Tools isn't using PNut to compile and continues to use its own compiler. So I'm missing another setting to get it to use the PNut compiler (I have very little experience with PNut so not sure what to look for).

    Spin Tools always uses its own internal compiler, the external programs are just that, programs that can be launched to do whatever you want to do. Using PNUt is an example, you can also configure an entry to compile the source with flexspin or openspin to verify that it is compatible or generate an optimized binary.

  • maccamacca Posts: 766

    @JonnyMac said:
    @macca In a future release could you add an indicator to the toolbar that shows debug is enabled?

    I was thinking of removing the debug toggle because the IDE can compile and upload the debug-enabled binary regardless of that setting (with the bug icon or the menu entry). Enabling the debug will actually make the upload and upload with debug equal.

    With the PNut-TS release coming soon it will be interesting to see how that might impact Spin Tools.

    The "plan" is to make a Java port of the source and replace the internal compiler with it.

  • JonnyMacJonnyMac Posts: 9,067
    edited 2024-08-26 20:31

    I was thinking of removing the debug toggle because the IDE can compile and upload the debug-enabled binary regardless of that setting (with the bug icon or the menu entry). Enabling the debug will actually make the upload and upload with debug equal.

    I grew up in the desert where we would sometimes say, "Had it been a snake it would have bit me!" I never noticed the bug on the toolbar and I agree that you don't need Ctrl-D when you have that option with a mouse click. Ctrl-D isn't needed for [external] PNut, either, for obvious reasons.

    Would it be possible to put dynamic buttons on the toolbar that correspond with defined external tools? They could have simply labels ("1", "2", etc.) corresponding to the [Alt]+ combination. It would save a couple mouse clicks to run an external tool. Thanks for considering.

    While I'm asking... could you add a Save To... menu (under Save As...) and in the flyouts for Open From... and Save To... add the paths defined in Preferences/General/File Browser Visible Paths to the middle section where the library path is shown? I would like those paths to be easy to get to at any time.

    Again, thank you for all your work on Spin Tools.

  • maccamacca Posts: 766
    edited 2024-09-12 06:59

    Released version 0.38.0

    With this release, I have update almost all dependent Java libraries, including SWT with the latest Eclipse release (2024-09 or 4.33), and added some new features:

    • Removed the P2 debug toggle
      Since there are the 'Upload with debug' menu commands, the debug toggle is not needed anymore. As a consequence, the debug statements are always parsed and compiled to check for errors, but are included in the binary only when the debug option is selected.

    • Added p2img (flash binary) export
      This generates a binary suitable for direct write to the flash rom, as described here. The p2img binary can be generated from the Program Informations dialog


      or with using the -e command line switch spinc -u -e -o flasher.p2img Hello.spin2.

    • Added LZ4 compressed binary images
      This generates a compressed binary image using the LZ4 compressor as described here. The Spin2 preferences page has a new option to enable the compression.


      From the command line compiler use the -z switch to enable the compression spinc -u -z Hello.spin2

    • Added 'Save To...' menu
      This menu allows to save the current source to a set of directories composed with the file browser visible paths and the folders used by the recently used sources.

    Enjoy!

  • JonnyMacJonnyMac Posts: 9,067

    Thank you, Marco!

Sign In or Register to comment.