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

Spin Tools IDE

11112131517

Comments

  • dgatelydgately Posts: 1,628

    @macca said:
    The arguments box can include keywords that will be replaced with the file currently opened in the editor or the pinned top-level file.
    The first 9 program have an hot-key ALT-1 to ALT-9 automatically assigned.
    The output of the program is written to the console window.

    The program's launch (or current) directory is the folder of the selected file.

    Running loadp2 from Spin Tools IDE results in the app hanging on macOS... With lots of changes & testing of various arguments to loapdp2, the app still hangs. Note: the upload to the P2 completes successfully!

    What arguments do you use for loadp2? I tried -p ${serial} -b 230400 ${file.name}.binary -9 / and variations of quoting (or not) the port name, as well as removing -9 / (taken from flexprop's Configure Commands options), but no difference in results. SpinTools IDE hangs and has to be force-quit after the upload.

    I'm able to successfully run the same command from the command-line with success.

    loadp2 -p /dev/cu.usbserial-P7znrt90 -b 230400 cordicTest.binary -9 /

    dgately

  • maccamacca Posts: 750

    @JonnyMac said:
    1. PNut doesn't have a library path so you have to put a copy of the PNut executable into your library folder.

    Oh.. I'm a bit surprised this works, the launched program's "current directory" is set to the folder containing the source files so no matter where you place the executable. Interesting...

    Confirmed that ${file} -rd works with PNut on Windows to provide graphical debugging tools in Spin Tools IDE.

    Very good!

    Question: Would you consider adding an option so that I can set the downloading hotkeys to external tools, e.g., when I press F10 I get a RAM download via PNut?

    Well, I'm not sure, uploading a program with Spin Tools or PNut should make no difference (there are some differences due to how expressions are evaluated but should be minimal). If the program uses methods or syntax not implemented you get compile error and F10 doesn't work anyway. You can still run an external program in that case (I'm thinking about structures and the new methods implemented in v44, that generates an error in Spin Tools but you can compile and upload with PNut as external tool).

  • maccamacca Posts: 750
    edited 2024-05-07 07:52

    @dgately said:
    Running loadp2 from Spin Tools IDE results in the app hanging on macOS... With lots of changes & testing of various arguments to loapdp2, the app still hangs. Note: the upload to the P2 completes successfully!

    What arguments do you use for loadp2? I tried -p ${serial} -b 230400 ${file.name}.binary -9 / and variations of quoting (or not) the port name, as well as removing -9 / (taken from flexprop's Configure Commands options), but no difference in results. SpinTools IDE hangs and has to be force-quit after the upload.

    Seems that the program never exits...
    I'm not familiar with loadp2, but I read that -9 / means "serve 9p remote filesystem from dir", I guess that it keeps the program running, right ? Well.. this is actually not supported, the program is launched then Spin Tools waits for it to exit (there is only one console window and is not meant to run background servers). If you remove that parameter it should work.

  • Borrowing the attached screenshot as an example, is it correct that the function PUB asc2dec is yellow underlined as unused, when it is actually called from the function asc2val directly above it ?

    I'm seeing a lot of cases in code where this occurs (seemingly incorrect), and many other cases where it doesn't (seemingly correct), so not sure if it's a feature in development, or just something I've neglected to do.

  • Oh... on clicking X- close window, this error pops up:

    org.eclipse.swt.SWTException: Widget is disposed
        at org.eclipse.swt.SWT.error(SWT.java:4922)
        at org.eclipse.swt.SWT.error(SWT.java:4837)
        at org.eclipse.swt.SWT.error(SWT.java:4808)
        at org.eclipse.swt.widgets.Widget.error(Widget.java:450)
        at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:369)
        at org.eclipse.swt.widgets.Composite.setFocus(Composite.java:1073)
        at com.maccasoft.propeller.EditorTab.setFocus(EditorTab.java:813)
        at com.maccasoft.propeller.SpinTools$8.focusGained(SpinTools.java:470)
        at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:143)
        at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
        at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4274)
        at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1066)
        at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1090)
        at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1071)
        at org.eclipse.swt.widgets.Control.sendFocusEvent(Control.java:2941)
        at org.eclipse.swt.widgets.Widget.wmSetFocus(Widget.java:2321)
        at org.eclipse.swt.widgets.Control.WM_SETFOCUS(Control.java:5425)
        at org.eclipse.swt.widgets.Control.windowProc(Control.java:4816)
        at org.eclipse.swt.widgets.Display.windowProc(Display.java:5039)
        at org.eclipse.swt.internal.win32.OS.DestroyWindow(Native Method)
        at org.eclipse.swt.widgets.Control.destroyWidget(Control.java:780)
        at org.eclipse.swt.widgets.Widget.release(Widget.java:831)
        at org.eclipse.swt.widgets.Widget.dispose(Widget.java:428)
        at com.maccasoft.propeller.SourceEditor.dispose(SourceEditor.java:1290)
        at com.maccasoft.propeller.EditorTab$9.widgetDisposed(EditorTab.java:705)
        at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:127)
        at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
        at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4274)
        at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1066)
        at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1090)
        at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1071)
        at org.eclipse.swt.widgets.Widget.release(Widget.java:814)
        at org.eclipse.swt.widgets.Widget.dispose(Widget.java:428)
        at org.eclipse.swt.custom.CTabItem.dispose(CTabItem.java:133)
        at org.eclipse.swt.custom.CTabFolder.onDispose(CTabFolder.java:1697)
        at org.eclipse.swt.custom.CTabFolder.lambda$0(CTabFolder.java:326)
        at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
        at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4274)
        at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1066)
        at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1090)
        at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1071)
        at org.eclipse.swt.widgets.Widget.release(Widget.java:814)
        at org.eclipse.swt.widgets.Composite.releaseChildren(Composite.java:925)
        at org.eclipse.swt.widgets.Widget.release(Widget.java:821)
        at org.eclipse.swt.widgets.Composite.releaseChildren(Composite.java:925)
        at org.eclipse.swt.widgets.Widget.release(Widget.java:821)
        at org.eclipse.swt.widgets.Composite.releaseChildren(Composite.java:925)
        at org.eclipse.swt.widgets.Widget.release(Widget.java:821)
        at org.eclipse.swt.widgets.Composite.releaseChildren(Composite.java:925)
        at org.eclipse.swt.widgets.Widget.release(Widget.java:821)
        at org.eclipse.swt.widgets.Composite.releaseChildren(Composite.java:925)
        at org.eclipse.swt.widgets.Canvas.releaseChildren(Canvas.java:168)
        at org.eclipse.swt.widgets.Decorations.releaseChildren(Decorations.java:711)
        at org.eclipse.swt.widgets.Shell.releaseChildren(Shell.java:1375)
        at org.eclipse.swt.widgets.Widget.release(Widget.java:821)
        at org.eclipse.swt.widgets.Widget.dispose(Widget.java:428)
        at org.eclipse.swt.widgets.Decorations.dispose(Decorations.java:392)
        at org.eclipse.swt.widgets.Decorations.closeWidget(Decorations.java:270)
        at org.eclipse.swt.widgets.Decorations.WM_CLOSE(Decorations.java:1550)
        at org.eclipse.swt.widgets.Control.windowProc(Control.java:4746)
        at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:340)
        at org.eclipse.swt.widgets.Decorations.windowProc(Decorations.java:1478)
        at org.eclipse.swt.widgets.Shell.windowProc(Shell.java:2305)
        at org.eclipse.swt.widgets.Display.windowProc(Display.java:5039)
        at org.eclipse.swt.internal.win32.OS.DefWindowProc(Native Method)
        at org.eclipse.swt.widgets.Shell.callWindowProc(Shell.java:508)
        at org.eclipse.swt.widgets.Control.windowProc(Control.java:4845)
        at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:340)
        at org.eclipse.swt.widgets.Decorations.windowProc(Decorations.java:1478)
        at org.eclipse.swt.widgets.Shell.windowProc(Shell.java:2305)
        at org.eclipse.swt.widgets.Display.windowProc(Display.java:5039)
        at org.eclipse.swt.internal.win32.OS.DefWindowProc(Native Method)
        at org.eclipse.swt.widgets.Shell.callWindowProc(Shell.java:508)
        at org.eclipse.swt.widgets.Control.windowProc(Control.java:4845)
        at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:340)
        at org.eclipse.swt.widgets.Decorations.windowProc(Decorations.java:1478)
        at org.eclipse.swt.widgets.Shell.windowProc(Shell.java:2305)
        at org.eclipse.swt.widgets.Display.windowProc(Display.java:5039)
        at org.eclipse.swt.internal.win32.OS.DispatchMessage(Native Method)
        at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3658)
        at com.maccasoft.propeller.SpinTools$100.run(SpinTools.java:3300)
        at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:339)
        at com.maccasoft.propeller.SpinTools.main(SpinTools.java:3264)
    
    

    Clicking OK to close the error results in the IDE shutting gracefully, so all good in the end. Maybe my Windows 11 is missing the right java version?:

    java -version
    java version "21.0.3" 2024-04-16 LTS
    Java(TM) SE Runtime Environment (build 21.0.3+7-LTS-152)
    Java HotSpot(TM) 64-Bit Server VM (build 21.0.3+7-LTS-152, mixed mode, sharing)
    
  • @macca said:
    I'm not familiar with loadp2, but I read that -9 / means "serve 9p remote filesystem from dir", I guess that it keeps the program running, right ? Well.. this is actually not supported, the program is launched then Spin Tools waits for it to exit (there is only one console window and is not meant to run background servers). If you remove that parameter it should work.

    -9 does basically the same as the normal -t "connect to terminal after loading" flag. It exits normally when you close the terminal connection, so that shouldn't be causing a problem.

  • maccamacca Posts: 750

    @VonSzarvas said:
    Borrowing the attached screenshot as an example, is it correct that the function PUB asc2dec is yellow underlined as unused, when it is actually called from the function asc2val directly above it ?

    Yes, it is correct because also asc2val is unused, if I see correctly.
    This case is a bit confusing, I understand, a common problem with library sources where none of the method is actually used, and the first method is just a stub.

    Oh... on clicking X- close window, this error pops up:

    I tought I have fixed that, are you using the latest 0.36.0 release ?
    Anyway, it is annoying but harmless, there is a race condition somewhere that I haven't yet identified and apparently happens on Windows only (so even more difficult since I don't use Windows that much).

  • @macca said:
    Yes, it is correct because also asc2val is unused, if I see correctly.
    This case is a bit confusing, I understand, a common problem with library sources where none of the method is actually used, and the first method is just a stub.

    I read it that asc2val is used (or at least referenced). I would not expect to see it marked as unused (at least not in the same file). After some testing, seems I get underlined methods unless they are referenced in the first function of the file. Anyway- not a major concern for today. Might be just a windows or 0.35 thing :)

    Oh... on clicking X- close window, this error pops up:

    I tought I have fixed that, are you using the latest 0.36.0 release ?
    Anyway, it is annoying but harmless, there is a race condition somewhere that I haven't yet identified and apparently happens on Windows only (so even more difficult since I don't use Windows that much).

    Darn- I recall seeing your announcement, but didn't follow through with the upgrade! That error was 0.35. Ignore :)

  • maccamacca Posts: 750

    @Wuerfel_21 said:

    @macca said:
    I'm not familiar with loadp2, but I read that -9 / means "serve 9p remote filesystem from dir", I guess that it keeps the program running, right ? Well.. this is actually not supported, the program is launched then Spin Tools waits for it to exit (there is only one console window and is not meant to run background servers). If you remove that parameter it should work.

    -9 does basically the same as the normal -t "connect to terminal after loading" flag. It exits normally when you close the terminal connection, so that shouldn't be causing a problem.

    It is, because the IDE doesn't open a new terminal (or shell) window, it starts the process, captures the output to display on the internal console window and waits for it to terminate. It doesn't even provide a way to send commands to the process so there is no way to exit from it. An enhancements for the future, maybe.

  • maccamacca Posts: 750

    @VonSzarvas said:

    @macca said:
    Yes, it is correct because also asc2val is unused, if I see correctly.
    This case is a bit confusing, I understand, a common problem with library sources where none of the method is actually used, and the first method is just a stub.

    I read it that asc2val is used (or at least referenced). I would not expect to see it marked as unused (at least not in the same file). After some testing, seems I get underlined methods unless they are referenced in the first function of the file. Anyway- not a major concern for today. Might be just a windows or 0.35 thing :)

    It is a cascading effect... since the "main" method in Spin is always the first, if methods are not referenced from it (or from other methods called by the first) then are marked as unused. The warnings are directly captured from the unused methods removal code from the compiler (you'll see the same warnings with the command-line compiler), all underlined methods will be removed from the final binary.

    Maybe adding a way to differentiate direct and indirect usage... need to think about it.

  • Thanks for thinking about it.

    I feel like it would be important for indirect usage because if we were to remove that function, then the code could not compile. ie. the function is actually required for compilation (so not "unused" to my mind).

    It's so enjoyable to click through the little red error blocks and resolve them. Would be nice to clean up the yellow unused blocks in the same way- but I can't remove the ones that the code does need, but are reported as unused. Yeah- not life's biggest problem :)

  • Not seen this error before:

  • also... should we expect a difference in the F8 report between Spin Tools IDE and Propeller Tool ?

    (Caveat: This is the code that's not able to upload, so maybe a code error is causing the discrepancy. I'll try the command line compiler in case that reports some clues)

  • maccamacca Posts: 750

    @VonSzarvas said:
    Not seen this error before:

    Me neither... if 14454 is a byte count (can't be sure without a stack trace) then it is not a multiple of 4, seems that something in the code doesn't generate the correct byte count.
    Can you post the source code ?

    also... should we expect a difference in the F8 report between Spin Tools IDE and Propeller Tool ?

    Some differences, yes, my reference implementation was OpenSpin.
    It is a while since I used Propeller Tool, I don't remember if it removes unused methods, I think not, so this is one major difference if there are unused methods.
    There are also some optimizations like constants folding and a bit different constant encoding in some cases.

  • Thanks for the offer to check this.... I could e-mail you the source- can I use the email address you have registered here ?

  • maccamacca Posts: 750

    @VonSzarvas said:
    Thanks for the offer to check this.... I could e-mail you the source- can I use the email address you have registered here ?

    Yes, sure.

  • Is there a way to disable unused-code-removal? I'm thinking if that is causing an alignment issue on rare occasions, then a tick-box to disable it for testing could be handy?

    Maybe adding an external tool with the right command line params would do it.... Save cluttering preferences if a seldom needed option.

  • VonSzarvasVonSzarvas Posts: 3,329
    edited 2024-05-08 13:00

    Well that worked nicely - compiling can continue by adding OpenSpin to preferences/tools, and not including the -u argument so that unused code removal disabled.

    openspin.exe
    "${file.loc}\${file.name}.spin"

    Just don't be tempted to add the -v (verbose) option... Kaboom! Windows force-close required. :wink:

  • maccamacca Posts: 750

    @VonSzarvas said:
    Is there a way to disable unused-code-removal? I'm thinking if that is causing an alignment issue on rare occasions, then a tick-box to disable it for testing could be handy?

    No, the unused code removal should work, if doesn't work it needs to be fixed, adding a button to disable it, means that the problem may not show for a long time, like in this case.

    Well that worked nicely - compiling can continue by adding OpenSpin to preferences/tools, and not including the -u argument so that unused code removal disabled.

    With openspin you can include the -u, it is only a Spin Tools issue.

    Just don't be tempted to add the -v (verbose) option... Kaboom! Windows force-close required. :wink:

    Ok, waiting for the process to terminate was not a good idea, that need to be fixed!

  • JonnyMacJonnyMac Posts: 8,991

    It is a while since I used Propeller Tool, I don't remember if it removes unused methods,

    It does not. For my big laser-tag project I am forced to compiler with BST with dead-code removal turned on.

  • maccamacca Posts: 750

    Released version 0.36.1

    Fixed the object padding issue.
    Changed a bit the external tools process run, that should fix the lock issues (a very stupid mistake on my side...). Also added a check to make sure the process exited before launching a new tool, if not, it warns the user with a dialog that allows to terminate it.

  • @macca said:
    Released version 0.36.1

    Fixed the object padding issue.
    Changed a bit the external tools process run, that should fix the lock issues (a very stupid mistake on my side...). Also added a check to make sure the process exited before launching a new tool, if not, it warns the user with a dialog that allows to terminate it.

    Thank you Marco. The very fast response is truely appreciated.

  • dgatelydgately Posts: 1,628

    @macca said:
    Changed a bit the external tools process run, that should fix the lock issues (a very stupid mistake on my side...). Also added a check to make sure the process exited before launching a new tool, if not, it warns the user with a dialog that allows to terminate it.

    No longer hangs when exec'ing loadp2... And, appears to upload the binary!

    THx!

    dgately

  • VonSzarvasVonSzarvas Posts: 3,329
    edited 2024-05-19 17:00

    Hi @macca & all
    Any thoughts about adding a method/function jump-to and return feature for the IDE ?

    Something like...

    1. Shift-click a function name in the source code; code view jumps to that function definition. (or right-click/jump-to, or double click, etc..)
    2. Click the mouse return button, and the IDE jumps back to last location.
  • VonSzarvasVonSzarvas Posts: 3,329
    edited 2024-05-19 17:16

    This one is a report...

    Sometimes when clicking enter at the end of a statement, the IDE will bring up a variable suggestion, instead of going to the next line.

    Any function call seems to trigger the behavior - example, something simple like:

    pin.low(2)

    Often the IDE will suggest a local parameter or variable instead of going to the next line.
    Other times, entering the same code, and the IDE does perform the enter function.

    Adding a space after the closing ) bracket seems to ensure works as expected every time.

    It's a bit random- sometimes occurs, sometimes doesn't. Maybe it's related to the speed of hitting enter. Maybe it's related to prior code or line spaces. Haven't quite figured the exact combo to replicate every time, but it happens often enough that figured it's worth raising a flag, and maybe other regular users have also spotted this, or could keep an eye out for it ?

  • VonSzarvasVonSzarvas Posts: 3,329
    edited 2024-05-19 17:25

    Ah... maybe it is speed related. If I'm not quick enough (or too quick?) to hit enter, the IDE can suggest something, which hitting enter will be accepted.. Maybe that's the thing..


    Thus, hitting space before enter always ensures the correct behaviour. Update: No, the space doesn't help once the IDE suggestion pops up. Also- the position of the mouse cursor doesn't seem to make a difference, although I almost thought it did!

  • maccamacca Posts: 750

    @VonSzarvas said:
    Hi @macca & all
    Any thoughts about adding a method/function jump-to and return feature for the IDE ?

    Something like...

    1. Shift-click a function name in the source code; code view jumps to that function definition. (or right-click/jump-to, or double click, etc..)
    2. Click the mouse return button, and the IDE jumps back to last location.

    Already there... if I understand correctly what you mean: ctrl-click on a function name (or variable or PASM label) to go to the definition, then click the left cyan arrow on the toolbar to go back the last location. Clicking on the right arrow will go again to the label or function definition. These arrows can be used to move between edit positions. I think there is an explanation somewhere in the thread...

    Sometimes when clicking enter at the end of a statement, the IDE will bring up a variable suggestion, instead of going to the next line.

    Any function call seems to trigger the behavior - example, something simple like:

    pin.low(2)

    Often the IDE will suggest a local parameter or variable instead of going to the next line.
    Other times, entering the same code, and the IDE does perform the enter function.

    Hmm... doesn't seems correct... it may be a timing issue (as you guessed in the last post).

    Anyway, the code suggestions is triggered by the dot in the object.function syntax, when you type the dot a suggestion window will pop-up after few milliseconds.
    You can also trigger the suggestions with CTRL-SPACE anywhere within a name (or even an empy line).
    Other triggers are the # in PASM code.
    Hit ESC to close the suggestions popup without selecting an entry.

    I really should invest some time to write some documentation...

  • @macca said:

    @VonSzarvas said:
    Hi @macca & all
    Any thoughts about adding a method/function jump-to and return feature for the IDE ?

    Something like...

    1. Shift-click a function name in the source code; code view jumps to that function definition. (or right-click/jump-to, or double click, etc..)
    2. Click the mouse return button, and the IDE jumps back to last location.

    Already there... if I understand correctly what you mean: ctrl-click on a function name (or variable or PASM label) to go to the definition, then click the left cyan arrow on the toolbar to go back the last location. Clicking on the right arrow will go again to the label or function definition. These arrows can be used to move between edit positions. I think there is an explanation somewhere in the thread...

    Ooh... that is VERY cool.
    Is there a hotkey config available, especially for the blue arrow?

  • Ah... one thing... probably the reason I didn't find CTRL+click whilst experimenting... It's not enough to hold ctrl; you have to move the mouse slightly to get the little hand to appear (or at least that's one way, required on a Windows PC).

    And if you get the hand, but then don't click, then the little hand doesn't clear and things get uncertain for future hovers until something gets clicked..

  • maccamacca Posts: 750

    @VonSzarvas said:

    @macca said:

    @VonSzarvas said:
    Hi @macca & all
    Any thoughts about adding a method/function jump-to and return feature for the IDE ?

    Something like...

    1. Shift-click a function name in the source code; code view jumps to that function definition. (or right-click/jump-to, or double click, etc..)
    2. Click the mouse return button, and the IDE jumps back to last location.

    Already there... if I understand correctly what you mean: ctrl-click on a function name (or variable or PASM label) to go to the definition, then click the left cyan arrow on the toolbar to go back the last location. Clicking on the right arrow will go again to the label or function definition. These arrows can be used to move between edit positions. I think there is an explanation somewhere in the thread...

    Ooh... that is VERY cool.
    Is there a hotkey config available, especially for the blue arrow?

    No, mouse only.

    Ah... one thing... probably the reason I didn't find CTRL+click whilst experimenting... It's not enough to hold ctrl; you have to move the mouse slightly to get the little hand to appear (or at least that's one way, required on a Windows PC).

    And if you get the hand, but then don't click, then the little hand doesn't clear and things get uncertain for future hovers until something gets clicked..

    Need to check that, I tought the CTRL is enough to toggle the hand icon (and maybe I always move the mouse to properly position it, so I don't notice...), maybe some differences with Linux.

Sign In or Register to comment.