Shop OBEX P1 Docs P2 Docs Learn Events
Hack of PropellerIDE — Parallax Forums

Hack of PropellerIDE

Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
edited 2021-12-08 03:17 in Propeller 1

As I mentioned in another thread, PropellerIDE has a couple issues that prevent it from compiling and loading Spin code containing preprocessor directives:

  1. The version of OpenSpin that comes with it does not include the preprocessor.
  2. When using OpenSpin as the compiler, there's not a way to load the program into the Propeller: F10 and F11 do not work.

The first issue is easy to solve: just download the latest openspin.exe and copy it to PropellerIDE's Program Files directory, replacing the old version.

The second issue is a bit more complicated. Since the only way to get loader access is to use bstc as the compiler, I wrote a Perl script to replace bstc.exe and compiled it with perl2exe into an exe wrapper. The resulting bstc.exe replaces the version in PropellerIDE's Program Files directory (sorry, Brad). When invoked, it intercepts the arguments to bstc, massages them to conform to those required by openspin, then invokes openspin.exe with the new argument list. Because PropellerIDE thinks it's using bstc, the loader can be invoked as usual.

Here's the Perl script:

use strict;
use File::Spec;

my $self = $0;
$self =~ s/\\/\//g;
$self =~ s/(.*)\/[^\/]*/$1/;
my $INIT_DIR = File::Spec->canonpath($self);

my $cmd = "$INIT_DIR/openspin.exe";

my $arg = '';
foreach (@ARGV) {
    $arg .= "\"$_\" ";
}

$arg =~ s/Oucrg/u/;

my $return = `"$cmd" $arg`;
print $return;
exit $return =~ m/: error :/ ? 1 : 0

You can access both the Perl script and the resulting exe file here:

http://www.phipi.com/bstc

Frankly, I'd rather be using the Propeller Tool. But until it supports a choice of compilers, this satisfies an urgent need.

-Phil

Comments

  • flexspin actually has a feature for that exact issue - when you rename it to bstc.exe, it will accept BSTC-style arguments. But that defaults to the PASM backend, so it's probably not terribly useful in your case here.

    I agree that PropTool is pretty much the best Spin editor. I've tried to replicate some of its features with VSC extensions, but the API is just too limited to do align editing quite properly and block highlighting kinda worked but had stupid layering issues (also I have no idea where the code for that went)... sigh...

  • RaymanRayman Posts: 13,851

    I've pretty much abandoned SpinEdit since the new Prop Tool came out.

    But, I think it might do what you want a little easier: https://forums.parallax.com/discussion/169259/

Sign In or Register to comment.