propeller-gcc integration into PlatformIO

propeller-gcc integration into PlatformIO

I've been working on something that may be of interestest to some people in this forum which is the integration of the propeller-gcc tools into the PlatformIO ecosystem.
Even if it's still experimental, I already got a minimum functional system that can compile and upload the firmware to a propeller board, nonetheless, I would like to know your opinions and ideas about how to improve it.

To this point, only the support for Linux was tested, but making it work on windows or OSX should be as easy as just packaging and uploading the binaries to the correct place. I couldn't compile the source code from the official repository, so I ended using this another one, yet some of the examples that come with SimpleIDE didn't work.
Probably that's due to the big difference in the version of the tools, SimpleIDE has version 1.0 meanwhile this adaptation uses version 1.9, however, as PlatformIO can use specific version of the tools under demand, I would like to add the older versions in the future, for which I will also need the source code or at least the binaries.

To use just follow this README and feel free ask anything or suggest a possible improvement.


  • PublisonPublison Posts: 11,430
    edited 2020-06-05 - 21:09:51
    Welcome to the forums and the interest in developing software fore the Propeller! Please ask questions. We have a great group here.
  • msquirogacmsquirogac Posts: 7
    edited 2020-06-06 - 02:02:19
    Thank you for such a fast response.
    I've updated the readme with better instructions and a TODO in case someone is willing to give a hand.
    Right now what I need the most are the following two things:
    1) Beta testers
    2) Binaries for the Windows and macOS version of the GCC compiler

    The port already works and to help the testing process a python script called side2pio was added. Said tool can convert SimpleIDE project files to Platformio's format. Even more, the examples in the repository were some of the ones that come with SimpleIDE itself.

    About the binaries I already found @DavidZemon repository which already has all the binaries needed, however, they are all mixed into an only tarball and I need them to be classified into toolchain, upload and debug tools. I really would appreciate it if someone would give me a hand with getting said binaries sorted that way.

    Besides that, I would like to know if there is a known place where I can get the same version of the GCC compiler that SimpleIDE uses, so I can get the almost perfect compatibility with said tool.
  • Update here,
    I got the binaries!!
    Looks like it isn't necessary but just advisable to divide the tools into the toolchain, upload and debug categories, so in the end I just used @DavidZemon repository.
    About the 1.0 version, I got the binaries that come from the SimpleIDE tool and configured them to be used by default. To change between versions of the compiler just add the following line into the platformio.ini file
    platform_packages = toolchain-propeller@=1.9.0
    That way you can have multiple versions of the propeller-gcc tools without having to reinstall anything, and also without having to worry if changing your version will affect your other projects because that configuration is local to the project itself.

    The only thing required for now is beta testers, especially for the Windows and macOS version.
  • msquirogacmsquirogac Posts: 7
    edited 2020-06-08 - 03:40:50
    Another update,
    I've tested some of the examples from this repository and as it worked without much of a problem I decided to continue adding new features.
    The next thing in the list is GDB integration. The biggest piece of information that I found about the debugging tools, was this comment from years ago, but it worked!!!
    I was able to start a GDB session and use platformio+vscode to set breakpoints and watch memory.
    It was just an experiment, but at least now I know its possible and got a better idea of the procedure.
    1365 x 713 - 140K
  • Debug works and it's fully integrated.
    Now, I've been thinking whether not only c/c++ source code should be supported but also spin ones, and after researching what's available I found the openspin and spin2cpp projects.

    I managed to add some support for openspin but not sure if I should continue that path considering it is a stalled project. On the other hand, the spin2cpp command is quite interesting as it allows to convert spin to c/c++ code and it wouldn't be too hard to include.

    With the last one the workflow would be something like this:
    (spin) ---spin2cpp--> (c/c++) ---gcc--> (elf)

    Which one is recommended by the community?
  • Spin2Cpp doesn't work on all Spin source though (and compiling converted source with GCC gives a lot bigger binaries than a real Spin compiler).

    I myself mostly use homespun when I need a command-line spin compiler, but I don't completely recall why. I think the preprocessor in openspin is kinda busted.

    The best Spin compiler is BSTC, but annoyingly, it is closed-source abandonware.
  • Wuerfel_21 wrote: »
    Spin2Cpp doesn't work on all Spin source though
    Do you have some examples of code it doesn't work on? spin2cpp is based on the same code as fastspin, so in theory it should support the same code. In practice the C/C++ backend hasn't received as much attention lately, but I'm always happy to get bug reports.
  • @ersmith
    Correct me if I'm wrong, but I've seen somewhere that fastspin supports other languages besides spin, like "Basic" or "C".
    How does it compare to propeller-gcc?
    Do you think it would be reasonable to use it as a replacement of GCC?

    Asking because I got full support for propeller-gcc into PlatformIO, but as the propeller wasn't really meant to be used with that language but with "spin" then it would be good to have some support for that language too.

    PlatformIO can pretty much support any tool, but at least for now, I would like to keep only the most used and promising ones, and having one tool that can rule all languages sounds tempting.
  • Yes, fastspin supports Spin, BASIC, and C. It's a native code compiler, so somewhat similar to propeller-gcc. For C it's nowhere near as mature as propeller-gcc but it is at the point where people can use it. I think the BASIC and Spin support is pretty good now.

    One major difference it has from propeller-gcc is that it's designed to compile the whole program at once; there's no linker. I don't know how that would fit in with PlatformIO's model of compilation.
  • It can be done. PlatformIO is based on the [Scons]( building tools, therefore can be greatly customized.
    For example, there is this FPGA [platform]( which has nothing to do with the usual GCC tools, yet it works pretty fine.
    I've been using that implementation as a reference to add support for spin by using openspin, and it works but still kinda a very beta feature.

    Another thing I would like to know is if it's possible to "directly" use a C library into spin and the other way around too.
    My only bet would be spin2cpp, yet who knows, maybe there is something else.

    Besides that, I've recently found about the Catalina C Compiler. How would you compare Catalina to GCC?
    It would be pretty good if the P2 could also be supported by PlatformIO, but not sure which are the most promising tools in that field.

  • msquirogac wrote: »
    Another thing I would like to know is if it's possible to "directly" use a C library into spin and the other way around too.
    My only bet would be spin2cpp, yet who knows, maybe there is something else.
    With fastspin you certainly can use C in spin and vice-versa (the compiler can mix C, Spin, and BASIC files freely). The only restriction is that each language code must be in a different file; that is, you can't have C and Spin code in the same source code file, you'd need two files "foo.c" and "bar.spin", but either one could use the other as an object.
    Besides that, I've recently found about the Catalina C Compiler. How would you compare Catalina to GCC?
    Catalina is based on LCC, which is a much simpler compiler than GCC. I've used it a little bit, and it has many good points (it comes with a lot of documentation, some nice libraries, and it has an IDE and debugger). I think it also has a way to mix Spin and C code, although I haven't tried that. The main differences with GCC are that Catalina supports only C89 (a fairly old dialect of the language) and doesn't have very sophisticated optimization.
Sign In or Register to comment.