Propeller 1 Spin on a Mac?

Hello Spin programmers:

We have a customer who needs to edit/code Spin1 on a Mac, using the latest operating system upgrades.

What are the options for her?

Thanks,

Ken Gracey
«1

Comments

  • Not sure if BST still works or if the MacOS eggheads have broken the APIs enough that it doesn't. Worth a try I guess.

    Other than that, I guess there's openspin or homespun? Either of these should work, but there's no GUI, which may be a dealbreaker to her. Would also need a separate loader, not sure what the MacOS situation is with those.
  • FlexProp works on a Mac and can compile Spin 1 to P1 binary.
  • BST has not worked on any Intel Macs & most likely will not work on the new Apple silicon Macs either. Use FlexProp, as ersmith stated!
  • Wuerfel_21Wuerfel_21 Posts: 1,099
    edited 2020-12-17 (12:53 AM)
    Thing is, flexspin on P1 is a little ehhh. Fast, but unless you know what you're doing (or are writing a very simple program) you run out of memory really quick.
  • Greg LaPollaGreg LaPolla Posts: 232
    edited 2020-12-17 (4:22 AM)
    Propeller IDE runs fine. I am running Big Sur 11.1.

    I am running Propeller IDE version 0.37.5. There is a nasty bug in .38 on mac.
  • You can also use SimpleIDE for programming in Spin on MacOS 11.1. You have to create a <name>.side file though. It's pretty easy though. You simply create a text file with the file name of the main program file and extension of ".side". In the file, the first line has the name of the main program file with an extension of ".spin". The second line is just "compiler=SPIN" (without the quotes). If there are any objects referenced from the main program file, SimpleIDE will add their file names after the first line when the program is compiled.
  • Will Simple IDE support the P2 also, or just P1? I'm thinking of getting a P2 board but I want to make sure I can program it in C or C++ first (also interested in Python). I've fired up the flexprop system today and tried various things, so I have that working, but a nicer IDE would be good. I just fired up Simple IDE 1.1.0 on a new M1 Mac and Big Sur and it seems to work so far in brief testing but I remember it seemed buggy a year ago on my older Intel Mac. I have a very nice Mac IDE called CodeRunner that I use for other languages (it supports lots of them), and I'm trying to get the scripts and commands loaded into that so it will work with Propeller chips. I'm making progress but I'm a little over my head on some of it. I wonder if one of you with more experience would take a look at CodeRunner and see if you can plug in the appropriate settings to work with Parallax products. That would be a REALLY good thing for Parallax and Mac users. A proper inexpensive Mac program with up to date support and a really nice IDE experience.
    Thanks for any help on this or tips on where else to look.
  • SimpleIDE just supports P1. It does let you program in C or Spin. I use a combination of BBEdit and FlexProp for programming in Spin for the P2. I also have used PNut with CrossOver (a commercial Wine version).

    Other choices include HomeSpun and OpenSpin which compile Spin and PASM for the P1.
  • I use VSCode to edit my P1 and P2 code and then compile with flexprop. I’m on an Intel pc but I believe theses work on macs. VSC has an ARM version so I would expect to see native M1 support soon if not already.
  • Thanks. I'll look at those. I use BBEdit sometimes, too. I can also copy and paste from the IDE I like over to the flexprop window to compile and run. Easy to do but you end up with a pile of apps and windows open:-) Not like that bothers these new machines.

    At the moment I'm working on copying the compiling and running scripts from FlexProp into a "new language" in the list of languages in CodeRunner. I seem to be getting there, but now the Mac OS doesn't want to let me run flexspin.mac, complaining mightily about it being able to damage my system, etc. It lets FlexProp run it, though ?? Looking at the OS security preferences window where I can give permissions to files and stuff I don't see a way to add this one. I'm now going to try a Python program to read the file byte by byte and write it to a new file created by me. I wonder if I'll be able to run that one. Any tips from someone more experienced would be appreciated. I ordered a P2 eval board from DigiKey in hopes that I'll be able to work with it to my satisfaction. It sure would be nice if Parallax could support their chips nicely cross-platform like the Arduino does. Seems like it would be a great marketing boost.
  • No need to copy/paste with vsc. Just save and can even leave open. I use a bat file to compile and download with flexprop and loadp2. Not sure if this will work on a mac.
  • Cluso99 wrote: »
    No need to copy/paste with vsc. Just save and can even leave open. I use a bat file to compile and download with flexprop and loadp2. Not sure if this will work on a mac.

    You can also set up a task such that you only have to hit a key combination and it will automatically save all unsaved files, spawn a terminal and run a command of choice.
  • My idea of byte copying over to another file didn't seem to get around the permissions problem even though I seemed to get a perfect byte for byte copy. I didn't dig into permissions and extended attributes or whatever, though. I did find the place where I could tell my system to accept the .mac file it was complaining about, so I'm past that part, with the compiler working now I think. Now to get the loader happy:-) Nice looking website Cluso99.
  • @jlastofka
    Thanks, but IMHO my website looks terrible. I haven't done anything to it in years.

    Stephen was trying to get a button in VSC to do the compile and possible download. Don;t think that's done yet tho.
  • @Cluso99 - Actually I didn't mean it "looked" good:-) I meant I liked that it was full of technical content and you made some interesting and clever products, and it seems like you're a capable software/hardware engineer. That's what I meant.

    I learned a lot by getting the FlexProp commands connected into the CodeRunner IDE I like so much, but there are still a couple things in my process that aren't what they should be, and the commands still pull up Wish in the background, so really copy/pasting into FlexProp and running from there is a decent workaround, all things considered.

    I installed VSC and will look into running the P1/P2 from there with your tips. However, it appears huge and overly cluttered for running Python and C/C++, compared to the ultra clean interface and operation of CodeRunner on the Mac. I see there's a program called Code Runner in their listing of add-ons but that's not the Mac program I like. Plus I see that (typical Microsoft) they don't support the perfectly good Python already installed on the Mac, but want you to download another installation. I didn't look at what they do with C++ yet. Really I'm just interested in it for potential FlexProp automation. I'll gladly avoid Microsoft meddling whenever possible, but I'll use it when practical for me.

    Thanks for the helpful information:-)
  • Cluso99Cluso99 Posts: 17,176
    edited 2021-01-06 (4:12 PM)
    I use VSC to write python code in my day job. Highlights code, provides tool tips and syntax errors. You just need to install the python add on. One thing it does not do well is printing as the add on is rather a kludge. There are C and C++ add ons too. I believe it’s the most used code editor, cross platform and open source. There is updates every couple of weeks with extra features (not really bug fixes as it’s stable). It’s definitely not the usual MS crap.
  • Thanks for the conversation and some advice/help. I've learned a LOT in the last couple days and now have my preferred IDE loaded with the FlexProp commands and it's working cleanly. I learned I could disable the Wish component that was popping up from the FlexProp mac_terminal.sh file. I guess that's an editor they think you're using, so it kept bringing it to the foreground for "convenience" :-) Only two remaining things: I have to paste a filename in one spot for any new project I start instead of it being automatic, but that's only a one time deal, and my output pops up in a terminal window instead of in my IDE window, but that's pretty minor. And - I can continue my Microsoft-free existence a while longer.
    I know this was more detail than you needed, but it's a lonely world now, hiding in our rooms away from people:-) Nice to have contact with someone interested in a related topic. I suppose I'll be back in the P2 forums after that arrives in a couple days from DigiKey. I looked to be sure it was rev C. At least now I'm pretty sure I'll be able to talk to it. Thinking about a robot project, medium size, able to wander around the house and have capabilities added from time to time. Maybe a cog for control logic, a cog for mobility control, a cog or two for sensor interfacing, things like that. Also an excuse to machine things, 3D print things, and do some electronics.

    If you're still reading this far, I can't find what these -r -t -k switches are. I've been reading through documentation files for FlexProp and other things I can identify but haven't come across thee yet. This is the command string that loads and runs the compiled program:

    /Users/jefflastofka/flexprop/bin/mac_terminal.sh "/Users/jefflastofka/flexprop/bin/proploader.mac" -Dbaudrate=115200 -p /dev/cu.usbserial-2120 "/Users/jefflastofka/flexprop/samples/HelloWorldPropC.binary" -r -t -k
  • -t indicates that a terminal emulator should be started on the normal I/O pins used for communication with a PC. (-T indicates that the terminal emulator has to follow the conventions for PST (Propeller Serial Terminal).

    -k indicates that loadp2 should wait for user input before exiting (typically from -t or -T)

    -r don't know what that is for
  • Thanks. I didn't see that loadp2 was part of my chain for working with the P1 but I guess that was a silly assumption. It probably works for both chips. I'll just try deleting the mysterious -r and see what breaks.
  • Dave HeinDave Hein Posts: 6,264
    edited 2021-01-07 (1:53 PM)
    The command line from your previous post shows that it is running proploader.mac, which is the loader used for P1. I ran proploader.exe from the command line without any parameters, and it printed out the following info:
    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
        -k              prompt before exiting due to an error
        -n <name>       set the name of a Parallax Wi-Fi module
        -p <port>       serial port
        -P              show all serial ports
        -q              during terminal display check for exit status from Propeller
        -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
    
    I assume that the proploader on a Mac has the same options.
  • Thank you. That's a more complete list than what I saw.

    I also played around with VSC as Cluso99 was recommending and I now see how easy it is to have the UNIX terminal (Mac Terminal app) running in the window in VSC, so I can put a shell script in there and (probably) program it to do what I want. This is probably going to be my best overall approach to running the Propeller programming tools.

    I've added so much to my knowledge of this level of tinkering just in the last two days of poking around and then asking a few questions here. I'd feel bad about hijacking the thread except I'm sure the original intent of it was satisfied long ago anyway:-)
  • There is a spin add on now being done by Stephen which will do syntax highlighting. This is available with instructions in a P2 thread so search for VS Code for spin. I’ll post a link when I’m on my pc.
  • I should go join a VSC forum I guess, but you guys were helpful on this before:-) I have a question about doing a save/build/run cycle from one command or key binding or ? For each iteration through the building and testing cycle I need to Save the file, Switch to terminal, and then Run a compile/run script. That's three steps, every time. I assume other people do something similar. I've looked at Key Bindings but it seems they only accept one command (how lame is that?) and I found Tasks, but it said they only apply to multi-file projects and not a single file program. I must be missing something obvious. Surely there's a clean way to link the steps together. The IDE I use for other programming does it all with one button or a keystroke. As I have it now in VSC I have to manually save the file, then hit ^` to switch to the terminal, then hit the up arrow key to recall my last run command, and then Enter to make it go. I guess I could open a second dummy file so I can use the group Task feature...? And, when it's all done I have to hit ESC to end terminal mode. Seems lame. My other IDE doesn't make me do that, but it's running the output in its own "terminal" window so I guess that's why it can work easier for the user.
  • Wuerfel_21Wuerfel_21 Posts: 1,099
    edited 2021-01-08 (1:40 AM)
    Create a .vscode/tasks.json in your project and make it look like this:
    {
        // See https://go.microsoft.com/fwlink/?LinkId=733558
        // for the documentation about the tasks.json format
        "version": "2.0.0",
        "tasks": [
            {
                "label": "Run game",
                "type": "shell",
                "command": "rake run fastbuild=true",
                "presentation": {
                    "echo": true,
                    "reveal": "always",
                    "focus": false,
                    "panel": "shared",
                    "showReuseMessage": true,
                    "clear": true
                },
                "problemMatcher": []
            },
        ]
    }
    
    Change "label" to whatever and "command" to your desired command.


    Then, go into the settings, find the "Task: Save Before Run" setting and make sure it is set to prompt or always.
    Then, go into the keyboard shortcut editor and set "Tasks: Run Task" the combination of your choice.
    Now, pressing that combination will bring up a menu that will let you select your task (it defaults to the last used command, so you can just press enter after the first time) and if you select the task, it will switch to new terminal and run your command inside.
  • Thank you for the idea. It got me a result, even though I had to learn several things getting it set up:-) On my system, there's no Task: Run to bind to keys, but there is a Tasks: Rerun Last Task, and I used that. After using Run Task.... in the Terminal menu (no key shortcut shown) to run the first time I use a key binding on the Rerun Last Task and it runs straight away with no extra menus or clicks. I played around with focus: true/false and panel: shared but I don't see any effect. Same for showReuseMessage true/false. I get the message regardless. I also tried it without problemMatcher and didn't notice a difference. AND .. the comma below problemMatcher is an error on my system. I attached a screenshot of the choices I got for Run in the key binding menu.
    However - I really appreciate the tip and I learned a lot. And it works:-) I think I'll like it.
    {
        // See https://go.microsoft.com/fwlink/?LinkId=733558
        // for the documentation about the tasks.json format
        "version": "2.0.0",
        "tasks": [
            {
                "label": "RunCode",
                "type": "shell",
                "command": "flexrun.sh VStrial",
                "presentation": {
                    "echo": true,
                    "reveal": "always",
                    "focus": true,
                    "panel": "shared",
                    "showReuseMessage": false,
                    "clear": false
                },
                "problemMatcher": []
            }
        ]
    }
    
    615 x 328 - 44K
  • I have it working perfectly now, if anyone's interested, or is finding this to learn about the Mac version.
    I used the Mac keyboard preferences to add a keyboard shortcut to the Run Task... item in the Terminal menu, which is a missing capability in at least the Mac version of VSCode.
    I need that the first time to get the default accepted. After that I use the Rerun Last Task that VSCode does allow a keybinding for, and it works instantly with no follow up clicks or keys.
    I also found ${fileBasenameNoExtension} to put in my json file to bring in the working file name.
    AND - I discovered I can just click the delete (trash) icon to kill the resulting terminal output window after I view my results, which is quicker than the usual keystroke replies to end things there.
    So, thanks for your help and patience with my (probably) too much conversation about this:-)
  • dgatelydgately Posts: 1,373
    edited 2021-01-08 (6:54 PM)
    For macOS: I created a tasks.json for my spin2 efforts in Visual Studio Code. It has tasks for building & running spin2 files (maybe it will work with .bas?), using flexprop's flexspin & loadp2 without launching flexprop itself...
    It can only build & run spin2 files, but could easily be modified for P1 spin (I'm sure some enterprising individuals could mod it for flexcc as well). The following is set up for flexprop's libraries as well as a set of libraries that I culled from the propeller github (mostly, JonnyMac's drivers). There are comments to help defining your paths:
    {
    // Visual Studio Code tasks.json to compile a spin2 file with flexprop
      "version": "2.0.0",
      "tasks": [
        {
          "label": "Run shell",
          "type": "shell",
          "osx": {
            "command": "${HOME}/flexprop/bin/mac_terminal.sh"
          },
          "group": "test",
          "presentation": {
            "reveal": "always",
            "panel": "new"
          }
        },
        {
          "label": "Run Build",
          "type": "shell",
          "osx": {
    // replace the following with the path to flexspin
            "command": "${HOME}/flexprop/bin/flexspin",
            "args": [
              "-2",
              "-l",
              "-D_BAUD=230400",
              "-O1",
              "-Wall",
    // add your spin & spin2 library paths here:
              "-I ${HOME}/flexprop/include",
              "-I ${HOME}/flexprop/include/spin",
              "-I ${HOME}/Documents/P2ESCode/p2_library",
              "'${file}'"
            ],
          },
          "group": "build",
          "presentation": {
            "reveal": "always",
            "panel": "new"
          },
          "problemMatcher": []
        },
        {
          "label": "Run",
          "dependsOn": [
            "Run Build"
          ],
          "type": "shell",
          "osx": {
    // replace the followoing with the path to loadp2
            "command": "${HOME}/flexprop/bin/loadp2",
            "args": [
              "-b230400",
              "'${fileBasenameNoExtension}.binary'",
              "-k",
              "-T"
            ],
          },
          "group": "build",
          "presentation": {
            "reveal": "always",
            "panel": "new"
          },
          "problemMatcher": []
        }
      ]
    }
    
    Probably will work on Linux as well...
    You may need to run the flexprop GUI at least once to set up the port(s) where your P2s show up!

    Build:
    Build%20task.jpg
    Run (will build & run the file):
    Run%20task.jpg
    dgately
    634 x 623 - 119K
    633 x 623 - 106K
  • dgatelydgately Posts: 1,373
    edited 2021-01-08 (7:36 PM)
    An update to the last post that adds P1Build & P1Run tasks for P1. You will need to add your path to the P1 USB device:
    {
      // Visual Studio Code tasks.json to compile spin & spin2 files with flexprop
        "version": "2.0.0",
        "tasks": [
          {
            "label": "Run shell",
            "type": "shell",
            "osx": {
              "command": "${HOME}/flexprop/bin/mac_terminal.sh"
            },
            "group": "test",
            "presentation": {
              "reveal": "always",
              "panel": "new"
            }
          },
          {
            "label": "Run Build",
            "type": "shell",
            "osx": {
      // replace the following with the path to flexspin
              "command": "${HOME}/flexprop/bin/flexspin",
              "args": [
                "-2",
                "-l",
                "-D_BAUD=230400",
                "-O1",
                "-Wall",
      // add your spin2 library paths here:
                "-I ${HOME}/flexprop/include",
                "-I ${HOME}/flexprop/include/spin",
                "-I ${HOME}/Documents/P2ESCode/p2_library",
                "'${file}'"
              ],
            },
            "group": "build",
            "presentation": {
              "reveal": "always",
              "panel": "new"
            },
            "problemMatcher": []
          },
          {
            "label": "Run",
            "dependsOn": [
              "Run Build"
            ],
            "type": "shell",
            "osx": {
      // replace the followoing with the path to loadp2
              "command": "${HOME}/flexprop/bin/loadp2",
              "args": [
                "-b230400",
                "'${fileBasenameNoExtension}.binary'",
                "-k",
                "-T"
              ],
            },
            "group": "build",
            "presentation": {
              "reveal": "always",
              "panel": "new"
            },
            "problemMatcher": []
          },
          {
            "label": "Run P1Build",
            "type": "shell",
            "osx": {
      // replace the following with the path to flexspin
              "command": "${HOME}/flexprop/bin/flexspin",
              "args": [
                "-D_BAUD=115200",
                "-l",
                "-O1",
                "-Wall",
      // add your spin library paths here:
                "-I ${HOME}/flexprop/include",
                "-I ${HOME}/flexprop/include/spin",
                "'${file}'"
              ],
            },
            "group": "build",
            "presentation": {
              "reveal": "always",
              "panel": "new"
            },
            "problemMatcher": []
          },
          {
            "label": "P1Run",
            "dependsOn": [
              "Run P1Build"
            ],
            "type": "shell",
            "osx": {
      // replace the followoing with the path to proploader
              "command": "${HOME}/flexprop/bin/proploader",
              "args": [
                "-Dbaudrate=115200",
                "-r",
                "-T",
                "-k",
                "-p",
    // replace below with the path to your P1 USBSerial device
                "/dev/cu.usbserial-MY_DEVICE_ID",
                "${fileBasenameNoExtension}.binary",
              ],
            },
            "group": "build",
            "presentation": {
              "reveal": "always",
              "panel": "new"
            },
            "problemMatcher": []
          }
        ]
      }
    
  • Thanks for posting those. When I get my P2 I may try that a bit. I think C is my main interest for this and Arduino, etc but I'm open to trying some new things.

    I wonder if the Windows and Linux VSCodes are missing the ability to key bind to the Task Run command or if it's just the Mac version. Fortunately it's easy to add it from system keyboard preferences, and I only need to run it once at the beginning of the project so I might be silly for bothering to add it anyway (I was in a learning mode and trying to customize everything...) After that, Rerun Last Task every time. At least that's how this is playing out for me. Perhaps others do it differently.
  • Thanks for the VSC info for running tasks using the VSC terminal window. I’ll pass this info on to Stephen who is now looking after the VSC for spin and spin2.
Sign In or Register to comment.