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

Spin Tools IDE

1282930313234»

Comments

  • TheoHaugenTheoHaugen Posts: 10
    edited 2026-03-12 17:51

    spinc in the Spin Tools Compiler - Version 0.53.2 is not working for me in Fedora 42 Linux, but the spinide is working fine. Version 0.45.1 of spinc works.

    Linux fedora 6.18.16-100.fc42.x86_64

    theo@fedora:~$ spinc -r -p /dev/ttyUSB0 led_flasher_6led.spin2
    Spin Tools Compiler - Version 0.53.2
    Copyright (c) 2021-26 Marco Maccaferri and others. All rights reserved.
    Compiling...
    led_flasher_6led.spin2
    Program size is 6416 bytes
    Uploading...
    Exception in thread "main" java.lang.NoClassDefFoundError: org/eclipse/swt/SWT
    at com.maccasoft.propeller.devices.SerialComPort.setParams(SerialComPort.java:65)
    at com.maccasoft.propeller.Propeller2Loader.upload(Propeller2Loader.java:73)
    at com.maccasoft.propeller.PropellerLoader.upload(PropellerLoader.java:41)
    at com.maccasoft.propeller.SpinCompiler.main(SpinCompiler.java:475)
    Caused by: java.lang.ClassNotFoundException: org.eclipse.swt.SWT
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(Unknown Source)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(Unknown Source)
    at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
    ... 4 more

    theo@fedora:~$ spin-tools-old/spinc -r -p /dev/ttyUSB0 led_flasher_6led.spin2
    Spin Tools Compiler - Version 0.45.1
    Copyright (c) 2021-25 Marco Maccaferri and others. All rights reserved.
    Compiling...
    led_flasher_6led.spin2
    Program size is 6136 bytes
    Uploading...
    Propeller 2 on port /dev/ttyUSB0
    Loading binary image to hub memory
    6140 bytes sent
    Verifying checksum ... OK
    Done.
    theo@fedora:~$

  • maccamacca Posts: 1,017

    @TheoHaugen said:
    Exception in thread "main" java.lang.NoClassDefFoundError: org/eclipse/swt/SWT
    at com.maccasoft.propeller.devices.SerialComPort.setParams(SerialComPort.java:65)

    Yes, there is a missing dependency in the spinc executable. It affects only the upload from spinc, all other functions should work without problems, as well as the IDE.
    I'll do a new release in few days.
    Sorry for the inconvenience.

  • maccamacca Posts: 1,017

    Released version 0.54.0

    With this release I have updated a number of runtime libraries, including the Java runtime to version 21 LTS.
    The upgrade from an existing install should not have any problem, just unzip/untar the package and overwrite the existing files.
    I tried to upgrade and downgrade on Linux and Windows without deleting the spin-tools folder and I haven't experienced any problem.

    Also updated the SWT libraries to the latest release 4.39.

    Implemented some enhancements to the external tools dialog, I have removed the label with the list of variable substitutions and replaced with a content assist popup, press $ or Ctrl-Space to open the popup and insert the variable:

    Also added run in background and show console when run options.
    Run in background runs the program without capturing the output to the console.
    Show console simply doesn't open the console view, the output is still captured and can be seen by toggling the console view.

    Added option to search from top or cursor to the search dialog:

    Some more fixes for the PST terminal emulation on both the command-line and IDE terminal.

    The Linux and Windows launchers now also configure the console to work more like a terminal, disabling the line input mode and some other things. Running the terminal from the command-line compiler should now work much better.

    Implemented the OFFSETOF function from the latest PNut release.

    On open, the IDE now switches to the last selected editor tab instead of the first.

  • JonnyMacJonnyMac Posts: 9,748

    Thank you, Marco!

    The Linux and Windows launchers now also configure the console to work more like a terminal,

    Does this mean we can do command line activities through the console?

  • maccamacca Posts: 1,017

    @JonnyMac said:
    Thank you, Marco!

    The Linux and Windows launchers now also configure the console to work more like a terminal,

    Does this mean we can do command line activities through the console?

    I'm not sure to understant, let me explain better what was changed.

    That change is related to the spinc command line compiler, when entering the terminal mode after upload (with the -T or -t parameter), the original Linux or Windows console mode was retained like the line input mode (you need to press the ENTER key to actually send something to the Propeller). Now the launcher executable configure the Linux or Windows console to disable the line input mode (and some other flags) so typed characters are sent immediately.

    This only affects the command line compiler, the IDE still works as before.

  • ke4pjwke4pjw Posts: 1,295
    edited 2026-03-16 19:05

    @macca Can prop-tool.exe be called from the command line to program the P2? The log facility when debug is called is ideal for a project I am working on.

    Nevermind. I just found spinc.exe

  • JonnyMacJonnyMac Posts: 9,748
    edited 2026-03-16 19:21

    @macca said:

    @JonnyMac said:
    Thank you, Marco!

    The Linux and Windows launchers now also configure the console to work more like a terminal,

    Does this mean we can do command line activities through the console?

    I'm not sure to understant, let me explain better what was changed.

    That change is related to the spinc command line compiler, when entering the terminal mode after upload (with the -T or -t parameter), the original Linux or Windows console mode was retained like the line input mode (you need to press the ENTER key to actually send something to the Propeller). Now the launcher executable configure the Linux or Windows console to disable the line input mode (and some other flags) so typed characters are sent immediately.

    This only affects the command line compiler, the IDE still works as before.

    Thanks. I misunderstood.

    I don't know if I ever asked for this, but I will now in case I haven't. I've seen in a couple editors (e.g., Thonny) the ability to select a bunch of lines and then comment them out, or remove the comment so they're back. This seems to work by looking at the first character of each line; if it's not a comment character it makes it a comment character (apostrophe in our case). If the first character is a comment character, it changes it to a space. Could we have something like that in Spin Tools?

  • ke4pjwke4pjw Posts: 1,295
    edited 2026-03-17 04:37

    @macca I almost have want I want with spinc.exe Is it possible to have spinc.exe (or an external program) log to a file the same way that the GUI does for debug?

    Nevermind. I had Claud build a debugger for the P2 so it can directly receive debug data. I am having Claude Code program the P2 with spinc.exe with debug enabled. I will share with others in the "AI Tools and Techniques" very soon. Currently only works with Powershell, because it is a built in tool on Windows. I am sure a python version will be available if anyone else find this useful.

    https://forums.parallax.com/discussion/178056/claudedebug-for-spin-tools

  • maccamacca Posts: 1,017

    @ke4pjw said:
    @macca I almost have want I want with spinc.exe Is it possible to have spinc.exe (or an external program) log to a file the same way that the GUI does for debug?

    Nevermind. I had Claud build a debugger for the P2 so it can directly receive debug data. I am having Claude Code program the P2 with spinc.exe with debug enabled. I will share with others in the "AI Tools and Techniques" very soon. Currently only works with Powershell, because it is a built in tool on Windows. I am sure a python version will be available if anyone else find this useful.

    I see you found a solution, however I would like to give some suggestions for a more portable solution.

    You end the debug log with debug("TEST_DONE"), sometime ago PNut introduced the DEBUG_END_SESSION flag to signal receivers that the debug has ended, if you use debug(DEBUG_END_SESSION), the spinc terminal mode will exit after receiving the code (it is translated to ESC CR LF).

    Spin Tools Compiler - Version 0.54.0
    Copyright (c) 2021-26 Marco Maccaferri and others. All rights reserved.
    Compiling...
    MyTest.spin2
    Program size is 9225 bytes
    Uploading...
    Propeller 2 on port /dev/ttyUSB0
    Loading binary image to hub memory
    9232 bytes sent                  
    Verifying checksum ... OK
    Entering terminal mode. CTRL-C to exit.
    Cog0  INIT $0000_0000 $0000_0000 load
    Cog0  INIT $0000_0F64 $0000_1868 jump
    Cog0  Hello from P2
    Cog0  Result: value = 42
    Cog0                      <--- this is the DEBUG_END_SESSION signal
    

    spinc doesn't have a way to log to a file, however you can always redirect the output.
    With the above change, you can compile, upload, switch to terminal mode, redirect to a file and exit when done automatically.

    spinc -p /dev/ttyUSB0 -d -r -t 2000000 MyTest.spin2 >debug.log

    Then you need a script to generate the json data from the log (it includes all compiler output so you need some filtering).

    On Linux you can also use tee to log to a file and see the output on the terminal, if that matters, don't know if Windows has something like that.

    spinc -p /dev/ttyUSB0 -d -r -t 2000000 MyTest.spin2 | tee debug.log

    I may add some log file options to help automations, I see that these AI tools are becoming popular among Propeller users.

  • RaymanRayman Posts: 16,162

    Would like to know more about the included C compiler for P2…. Is it complete? Work in progress? Compatible with some standard like C89? Maybe there is some documentation on this but didn’t find it yet…

  • maccamacca Posts: 1,017

    @Rayman said:
    Would like to know more about the included C compiler for P2…. Is it complete? Work in progress? Compatible with some standard like C89? Maybe there is some documentation on this but didn’t find it yet…

    It is a work in progress, though I haven't had much time to work on it lately, and it is far from complete.
    There is only one example in the examples/P2 folder, i2c_scanner.c that gives an idea of how to use it with spin objects.

    It is basically a spin compiler with C syntax, it produces standard spin bytecodes for both P1 and P2.

  • RaymanRayman Posts: 16,162

    @macca Ok thanks. I thought maybe bytecode was an option because seeing two versions of stuff in Github, but think you are saying it is all bytecode. Thanks for the info.

  • @macca said:
    I see you found a solution, however I would like to give some suggestions for a more portable solution.

    You end the debug log with debug("TEST_DONE"), sometime ago PNut introduced the DEBUG_END_SESSION flag to signal receivers that the debug has ended, if you use debug(DEBUG_END_SESSION), the spinc terminal mode will exit after receiving the code (it is translated to ESC CR LF).

    I thought the -T would launch a terminal so I didn't try it. I haven't tested but it looks like it does exactly what I needed, redirect debug to STDOUT.

    Well, at least I learned how to vibe code a debugger! I will give this a try. What you have here is really the ideal solution. Thank you!

Sign In or Register to comment.