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

Spin Tools IDE

11314151618

Comments

  • @macca said:

    • 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

    :+1:
    What kind of ratios are you getting? (especially with large bytecode projects, I never actually tested it for that). I looked at the code and you're using compression level 12 - I think(TM) the java library counts differently and 17 is the maximum (which is what you want, max level LZ4HC is still plenty fast)

  • maccamacca Posts: 779

    @Wuerfel_21 said:
    What kind of ratios are you getting? (especially with large bytecode projects, I never actually tested it for that). I looked at the code and you're using compression level 12 - I think(TM) the java library counts differently and 17 is the maximum (which is what you want, max level LZ4HC is still plenty fast)

    I tried with MAX_COMPRESSION_LEVEL (17) but generated files larger by 1 or 2 bytes, at least with the few files I tried.
    With 12 it generates files exactly as your example compression.

  • Ah, interesting. Maybe that's some oddity of jvm vs native implementations. So all is good.

  • VonSzarvasVonSzarvas Posts: 3,448
    edited 2024-10-07 11:36

    After upgrading to 0.38, the search feature seems different (or broken?).

    If I click the icon for search, or press CTRL+F, I don't see a modal to type in a search term.
    However after clicking the icon I can type a search term, then hit enter, and it works. But then CTRL+K doesn't find the next result.

    Maybe the modal window is not showing up on my screen for some reason...
    Does anyone else see the same issue, or is this just my PC causing havoc?

  • maccamacca Posts: 779
    edited 2024-10-07 14:16

    @VonSzarvas said:
    After upgrading to 0.38, the search feature seems different (or broken?).

    If I click the icon for search, or press CTRL+F, I don't see a modal to type in a search term.
    However after clicking the icon I can type a search term, then hit enter, and it works. But then CTRL+K doesn't find the next result.

    Maybe the modal window is not showing up on my screen for some reason...

    The symptoms suggests that the window is open but hidden somewhere (outside the screen ?), CTRL-K doesn't work in this case because the search window still have the focus, if you continue to hit enter you should see the search progress.

    Check the preferences file .spin-tools in the home directory, there is a section "search" -> "window" that defines the location and size. You can delete the whole "window" section to reset the size and position to the default.

  • VonSzarvasVonSzarvas Posts: 3,448
    edited 2024-10-07 14:40

    @macca said:
    Check the preferences file .spin-tools in the home directory, there is a section "search" -> "window" that defines the location and size. You can delete the whole "window" section to reset the size and position to the default.

    That solved it. I changed the monitor recently- probably that was it.

    Thanks!

  • pilot0315pilot0315 Posts: 910
    edited 2024-10-11 06:23

    @macca

    I got this error and it will not go away. What is it?
    All I did was x out the program to shut it off.

  • maccamacca Posts: 779

    @pilot0315 said:
    @macca

    I got this error and it will not go away. What is it?
    All I did was x out the program to shut it off.

    Happened to me a couple of times, when the P2 was running with a continuous debug output, is that what you were doing ?
    I tought I had fixed but clearly something doesn't work as expected. Are you using the latest IDE version ?

    The dialogs can be closed with the OK button (there are a lot of them), and the program should close. In the worst case you need to force kill the program.

    I suggest to always reset the P2 or somehow stop the serial output before closing the IDE, until I can fix the issue.

  • maccamacca Posts: 779

    Released version 0.39.0

    With this release I started to implement the debug windows to make it independent from PNut. The implementation is still at the early stages, currently I have implemented bitmap, logic, scope, scopeXY and plot, however not all commands/features are implemented or implemented correctly.

    I have also rewritten the language tokenizer to fix the backtick debug commands parsing, hope to not have broken something.

    Also updared the Spin2 interpreter and debug to the PNut-TS version.

    In short:

    • Token stream parser refactorings
    • Fixed debug backtick commands
    • Initial debug windows implementation
    • Spin2 interpreter and debugger updated to version 2023.11.11
  • :+1: Great work!

  • JonnyMacJonnyMac Posts: 9,102
    edited 2024-10-18 18:37

    Thank you, Marco!

  • @macca said:
    Released version 0.39.0

    With this release I started to implement the debug windows to make it independent from PNut. The implementation is still at the early stages, currently I have implemented bitmap, logic, scope, scopeXY and plot, however not all commands/features are implemented or implemented correctly.

    Nicely done and we appreciate this, too!

    Ken Gracey

  • @macca said:
    With this release I started to implement the debug windows to make it independent from PNut.

    Awesome! :)

  • JonnyMacJonnyMac Posts: 9,102

    I find the highlighted line visually annoying. Can you please add a feature to disable it? Perhaps a checkbox on Preferences/Editor.

  • SavageCircuitsSavageCircuits Posts: 253
    edited 2024-11-01 15:23

    @JonnyMac said:
    I find the highlighted line visually annoying. Can you please add a feature to disable it? Perhaps a checkbox on Preferences/Editor.

    I second that motion / suggestion. The only time I like a line highlighted is when using real-time debugging / breaking to show the current / last line of code executed (used in some older systems / other platforms).

  • maccamacca Posts: 779

    Release version 0.40.0

    Implemented the PAsm-level debugger window:

    I have implemented several of the features found in the PNut Public repository, however since I never used it before, I'm not sure everything works as expected and certainly there are things not yet implemented.
    The disassembler may not be precise with all the instruction variants.
    Note: the hub map window is blank but is clickable (good luck find the right pixel...).

    Working on the disassembler I found some missing things in the PAsm compiler: effects on the pin instructions (out,drv,flt, etc.) and the TJV instruction. Seems that these things are not much used... :smile:

    Also added an initial implementation of the serial terminal back-scroll buffer. It keeps the last 500 lines (not configurable for now), it may need some more enhancements.

    Some fixes for the external tools command arguments splitter, mainly to allow to start Windows programs detached from the IDE console window (using the START command).
    For example, to start the stand-alone Parallax Serial Terminal (or any other program) and still be able to run another tool like pnut_ts:

    Should also fix the use of spaces in files and paths.

    Other things:

    • Added show info with debug menu (and CTRL+click on the info icon on the toolbar)
    • Added highlight current editor line preference
    • Fixed external tools command line with quotes parsing
    • Added move tools up and and down the list and double-click editing
    • Some other fixes
  • JonnyMacJonnyMac Posts: 9,102
    edited 2024-11-02 22:08

    Release version 0.40.0

    Thank you.

    PST does in fact run with the syntax you show. That said, this dialog does pop up, depending on the state of the editor window.

    As you were so kind to implement my suggestion about active line highlighting, I wonder if you'd consider a checkbox that allows the state of the editor window to be ignored for external tools that don't care. This is just a "nice to have" feature, as Spin Tools has matured to the place of excellent functionality and now it's about touch-ups that make the user experience even more pleasant.

    Thanks for considering.

  • maccamacca Posts: 779
    edited 2024-11-03 08:33

    @JonnyMac said:
    As you were so kind to implement my suggestion about active line highlighting, I wonder if you'd consider a checkbox that allows the state of the editor window to be ignored for external tools that don't care. This is just a "nice to have" feature, as Spin Tools has matured to the place of excellent functionality and now it's about touch-ups that make the user experience even more pleasant.

    Ah forgot about that, yes I'll add a check to ignore the editor state, and also to auto-save, that seems useful for external compilers.

  • Spin Tools IDE 0.40.0 has been working great for most things, but I recently I ran into the error shown below:

    The "object address not set" error appears to be related to the coginit of the PASM routine @pwm_led.
    The same code runs fine in both the latest versions of PNut and FlexProp.

    I don't know why Spin Tools IDE is unhappy, please advise...

    Here is the code:

    CON { timing }
    
      CLK_FREQ = 200_000_000                                        ' system freq as a constant
      _clkfreq = CLK_FREQ                                           ' set system clock
    
    
    CON { PWM LED parameters }
      clk_wait = 50
    
      LED1     = 56                                                 ' LED 1 on P2 Edge board
      LED2     = 57                                                 ' LED 2 on P2 Edge board
    
      HZ    = 1000
      UNITS = 25
    
      XREG  = (UNITS << 16) | ((CLK_FREQ / HZ) / UNITS)
    
    
    VAR
        long cog, cog1
    
    
    OBJ
    
    
    PUB main() : ok
    
        debug("main()")
    
        debug("start pwm_led")
        ok := cog := coginit(COGEXEC_NEW, @pwm_led, 0)              ' start pwm_led cog
        if ok == -1
          debug("pwm_led NOT started")
          abort
        else
          debug("pwm_led started ", udec_long(cog))
    
        repeat
    
    
    dat
    
    '' Use PWM to slowly blink the two LEDs on the P2 Edge board
    
      org
    
    pwm_led asmclk
            nop
    
            fltl      leds
            wrpin     #(P_OE | P_PWM_SAWTOOTH), leds                ' set pins to PWM mode
            wxpin     ##XREG, leds
            wypin     duty, ##LED1                                    ' set pin to initial duty cycle value
            wypin     duty1, ##LED2                                   ' set pin to initial duty cycle value
            drvl      leds
    
    uploop  waitx     ##(CLK_FREQ / clk_wait)
            incmod    duty, ##UNITS                                 ' increment duty  cycle value
            decmod    duty1, ##UNITS                                ' decrement duty1 cycle value
            tjz       duty,#dnloop
            wypin     duty, ##LED1
            wypin     duty1, ##LED2
            tjnz      duty,#uploop                                  ' jump to uploop while duty not zero
    
    dnloop  waitx     ##(CLK_FREQ / clk_wait)
            decmod    duty, ##UNITS                                 ' decrement duty  cycle value
            incmod    duty1, ##UNITS                                ' increment duty1 cycle value
            wypin     duty, ##LED1
            wypin     duty1, ##LED2
            tjnz      duty,#dnloop                                  ' jump to dnloop while duty not zero
            jmp       #uploop                                       ' jump to uploop
    
    duty    long      0
    duty1   long      UNITS
    
    leds    long      (LED1 & $3F) | (1 & $1F) << 6                 ' equivalent to addpins Spin command
    
  • Do you have the "asmclk" instruction in your PASM2 ?
    Comment that out...?

  • VonSzarvasVonSzarvas Posts: 3,448
    edited 2024-11-13 07:12

    I had to ask myself .,... why ?? !! :)

    Found little information about asmclk, except this:

    PASM-only programs which use non-RCFAST clock modes now get prepended with a 16-long clock-setter program which >sets the clock mode, moves the PASM program down into position, and then executes it. This means that the ASMCLK >instruction is no longer needed at the start of PASM-only programs. This harmonizes with the PASM-level debugger's >operation, where the clock is automatically set.

    If that's the whole story, seems it's no longer required ?

  • maccamacca Posts: 779

    @"Francis Bauer" said:
    The "object address not set" error appears to be related to the coginit of the PASM routine @pwm_led.
    The same code runs fine in both the latest versions of PNut and FlexProp.

    I don't know why Spin Tools IDE is unhappy, please advise...
    org

    pwm_led asmclk
    nop

    It doesn't like the label on the same line as asmclk, maybe because it is a pseudo-instruction that expands to 4 other instructions, need to investigate.
    Put the label on a line by itself, or remove the asmclk instruction at all, AFAIK, it isn't needed in that context (with a spin front-end).

  • maccamacca Posts: 779

    @VonSzarvas said:
    I had to ask myself .,... why ?? !! :)

    Found little information about asmclk, except this:

    PASM-only programs which use non-RCFAST clock modes now get prepended with a 16-long clock-setter program which >sets the clock mode, moves the PASM program down into position, and then executes it. This means that the ASMCLK >instruction is no longer needed at the start of PASM-only programs. This harmonizes with the PASM-level debugger's >operation, where the clock is automatically set.

    If that's the whole story, seems it's no longer required ?

    -- Maybe a future update of Spin Tools compiler could ignore that instruction, or flag it as unsupported / unimplemented? Might be best to ask Chip tonight about it, P2LF.

    Spin Tools supports both asmclk and clock-setter program, to maintain compatibility with existing programs.
    In the preferences there is a flag for that:

    However this flag has effect for PASM-only programs, progams with Spin code sets the clock from the Spin interpreter.

  • @macca said:

    @VonSzarvas said:
    I had to ask myself .,... why ?? !! :)

    Found little information about asmclk, except this:

    PASM-only programs which use non-RCFAST clock modes now get prepended with a 16-long clock-setter program which >sets the clock mode, moves the PASM program down into position, and then executes it. This means that the ASMCLK >instruction is no longer needed at the start of PASM-only programs. This harmonizes with the PASM-level debugger's >operation, where the clock is automatically set.

    If that's the whole story, seems it's no longer required ?

    -- Maybe a future update of Spin Tools compiler could ignore that instruction, or flag it as unsupported / unimplemented? Might be best to ask Chip tonight about it, P2LF.

    Spin Tools supports both asmclk and clock-setter program, to maintain compatibility with existing programs.
    In the preferences there is a flag for that:

    However this flag has effect for PASM-only programs, progams with Spin code sets the clock from the Spin interpreter.

    Thanks for the info guys. I moved the 'asmclk' command to another line and the error goes away.
    As to whether or not I(we) even need to use 'asmclk' anymore, I guess it depends...

  • Thanks @macca

    @"Francis Bauer" A good question for P2LF later !! Glad you could move forward for now.

  • Hi @macca

    Have you got WiFi loading integrated (or planned) ? I guess via proploader.exe ?

    If not- I can see Jon has some examples a few posts back on adding external tools, so maybe that would work. I'll try if it's not already an existing feature! The F7 "detect" feature doesn't include wireless, right ?

    I'm writing an article on programming certain P1 modules over WiFi, so it would be neat if I can do that from SpinTools!

  • maccamacca Posts: 779

    @VonSzarvas said:

    Have you got WiFi loading integrated (or planned) ? I guess via proploader.exe ?

    No, I can look into proploader sources if can be integrated, however I don't have wifi-enabled devices so don't know how to test.

    If not- I can see Jon has some examples a few posts back on adding external tools, so maybe that would work. I'll try if it's not already an existing feature! The F7 "detect" feature doesn't include wireless, right ?

    External tools should work in this case. The device detect uses only standard-named serial devices so, unless there is a WiFi driver that emulates a serial port, it won't work (but in that case also the regular upload will work).

  • VonSzarvasVonSzarvas Posts: 3,448
    edited 2024-11-20 06:56

    @macca said:
    No, I can look into proploader sources if can be integrated, however I don't have wifi-enabled devices so don't know how to test.

    Can I send you a WiFi module- would that help? Or I'm ready to test anything, or send more details or a demo video/zoom meet-look-test/etc...,

    I think having built-in WiFi programming would be very cool - I use it often, and would like to promote it more.

    If not- I can see Jon has some examples a few posts back on adding external tools, so maybe that would work. I'll try if it's not already an existing feature! The F7 "detect" feature doesn't include wireless, right ?

    External tools should work in this case. The device detect uses only standard-named serial devices so, unless there is a WiFi driver that emulates a serial port, it won't work (but in that case also the regular upload will work).

    You're right- they don't emulate serial naming.

    For example, cmd and reply:

    proploader.exe -W
    Name: 'wx-f9eddd', IP: 192.168.1.189, MAC: 18:fe:34:f9:ed:dd
    Name: 'wx-e24c1d', IP: 192.168.1.42,  MAC: 18:fe:34:f9:ed:d4
    Name: 'mtest0016', IP: 192.168.1.127, MAC: 18:fe:34:f9:ec:c2
    

    You might also see multiple IP's for the same module, if the module has client/s attached (in STAtion mode):

    proploader.exe -W
    Name: 'wx-f9eddd', IP: 192.168.4.1,   MAC: 1a:fe:34:f9:ed:dd
    Name: 'wx-f9eddd', IP: 192.168.1.189, MAC: 18:fe:34:f9:ed:dd
    

    These are all the options:

    proploader.exe
    PropLoader v1.0-37 (2017-09-29 14:49:00 gc4205c0)
    
    usage: proploader.exe [options] [<file>]
    options:
        -b <type>       select target board and subtype (default is 'default:default')
        -c              display numeric message codes
        -D var=value    define a board configuration variable
        -e              program eeprom (and halt, unless combined with -r)
        -f <file>       write a file to the SD card
        -i <ip-addr>    IP address of the Parallax Wi-Fi module
        -I <path>       add a directory to the include path
        -n <name>       set the name of a Parallax Wi-Fi module
        -p <port>       serial port
        -P              show all serial ports
        -r              run program after downloading (useful with -e)
        -R              reset the Propeller
        -s              do a serial download
        -t              enter terminal mode after the load is complete
        -T              enter pst-compatible terminal mode after the load is complete
        -v              enable verbose debugging output
        -W              show all discovered wifi modules
        -?              display a usage message and exit
    
    file:               binary file to load (.elf or .binary)
    
    Target board type can be either a single identifier like 'propboe' in which case the subtype
    defaults to 'default' or it can be of the form <type>:<subtype> like 'c3:ram'.
    
    Module names should only include the characters A-Z, a-z, 0-9, or '-' and should not begin or
    end with a '-'. They must also be less than 32 characters long.
    
    Variables that can be set with -D are:
      clkfreq clkmode reset baudrate rxpin txpin tvpin
      loader-baud-rate fast-loader-baud-rate program-baud-rate
      sdspi-do sdspi-clk sdspi-di sdspi-cs
      sdspi-clr sdspi-inc sdspi-start sdspi-width spdspi-addr
      sdspi-config1 sdspi-config2
    
    Value expressions for -D can include:
      rcfast rcslow xinput xtal1 xtal2 xtal3 pll1x pll2x pll4x pll8x pll16x k m mhz true false
      an integer or two operands with a binary operator + - * / % & | or unary + or -
      or a parenthesized expression.
    
    
  • If it helps to look "how they did it", SimpleIDE has WiFi programming built-in.

  • Also to round out the instructions on proploader.exe

    To run code on a single WiFi module on your network, it's enough to do proploader.exe <binary_filename>

    With multiple WiFi modules you'd probably want to use detect first: proploader.exe -W
    And then use the IP to target a specific module proploader.exe -i <ip-addr> <binary_filename>

    To save to EEPROM and run, add couple tags: proploader.exe -e -r <binary_filename>

    That's about all I ever use. Many of the other proploader options are related to programming devices connected via a serial port.

Sign In or Register to comment.