Shop OBEX P1 Docs P2 Docs Learn Events
OpenSpin Spin/PASM compiler in C/C++ - Page 10 — Parallax Forums

OpenSpin Spin/PASM compiler in C/C++

178101213

Comments

  • kuronekokuroneko Posts: 3,623
    edited 2013-08-24 16:58
    Roy Eltham wrote: »
    If BSTC compiles that and still only outputs 6 bytes with the -c option, then I think BSTC might be in error, because the fit directive should cause the label on the line with it to point to a long aligned address.
    Looks like bstc simply ignores the alignment introduced by fit (but gets the label index right). The PropTool flags the DAT section as size 8 (expected) which is also what the compiled binary tells me. The previous size issue I was talking about (1022 bytes) is reached in a different way and openspin does that correctly now. Thanks for the quick fix.
  • Roy ElthamRoy Eltham Posts: 3,000
    edited 2013-08-24 18:26
    Ok, thanks for your excellent testing (as usual)! I think I'll leave the -c option as is then.
  • Bill HenningBill Henning Posts: 6,445
    edited 2013-09-20 11:56
    Minor issue in latest version available for download

    #define PATH_MAX 256

    needs to be moved outside of the '#if defined(WIN32)' to build under Ubuntu in openspin.cpp
  • Roy ElthamRoy Eltham Posts: 3,000
    edited 2013-09-20 15:10
    Bill,
    I have an update coming soon (maybe this weekend) that changes that. It handles it in a different way that should work across more platforms.

    Others,
    Just a heads up, this next update is going to do a lot of rearranging of the code (including splitting some stuff out into it's own files). It's something that's been needed for a while, and I finally got sick of the state it was in.

    Also, it will *not* include the @@@ feature yet. That one turned out to be a more significant nut to crack because of how the compiler works, so I've shelved it for a bit in order to get some stuff done that Parallax requested. It'll get in there eventually.
  • davidsaundersdavidsaunders Posts: 1,559
    edited 2013-09-28 14:31
    Ok I realy missed something somewhere.

    When did Chip release the source for the Spin compiler? And where is it?
  • Heater.Heater. Posts: 21,230
    edited 2013-09-28 15:18
    He didn't. As far as I know the source was given to Roy so that he could reverse engineer it into to C++ which is then open sourced.
  • davidsaundersdavidsaunders Posts: 1,559
    edited 2013-09-28 15:56
    @Heater:
    Ah ok. Thank you I almost thought that I was loosing it.

    That makes sense.




    Darned Rasbian uses a UK keyboard layout after selecting US 104 key keyboard.
  • davidsaundersdavidsaunders Posts: 1,559
    edited 2013-09-29 20:04
    Darn a sock with needle stone egg and thread.

    After spending a little time attempting to at least get this thing to compile on Linux ARMv6 I am having zero luck. It does not help that it is C++ not C.

    G++ (GCC C++ Compiler) keeps telling me that identifiers that are global to the source module are not declared in the current scope. Five languages that I really hate: C++, Java, VB, D, and C#, they are impossible to understand unless you are the programmer of origin and you commented the source well, and it has been less than 1 week since you created the source files.

    OO in pure C is easier than mixed OO and procedural in C++.

    I will attempt to translate these into C89 and compile that, a lot easier then attempting to figure what G++ is actually complaining about with these sources.

    I was hoping to get something useful going quickly, no such luck.
  • Heater.Heater. Posts: 21,230
    edited 2013-09-30 00:20
    The open source Spin compiler is very easy to build. Never failed for me on x86 or Pi.
    $ svn checkout [URL]http://open-source-spin-compiler.googlecode.com/svn/[/URL] open-source-spin-compiler-read-only
    $ cd open-source-spin-compiler-read-only/
    $ make
    

    It takes less time to build than writing this post.
  • dgatelydgately Posts: 1,630
    edited 2013-09-30 00:24
    David,

    (Looks like Heater answered while I was typing)...

    Do these steps work (I assume on your Raspberry Pi)?
    1. If you need to run subversion (svn) on the Raspberry Pi to get the sources do "sudo apt-get install -y subversion"
    2. To get the latest sources checkout to you local source directory with "svn checkout http://open-source-spin-compiler.googlecode.com/svn/ open-source-spin-compiler-read-only"
    3. cd to the new directory: "open-source-spin-compiler-read-only"
    4. Then, run: "make all"
    5. Step #4 should have created the executable: "openspin". You can test it with the command "./openspin". That should show you openspin's options...
    6. Copy the openspin executable to "/opt/parallax/bin/"
    7. In SImple IDE, mod the Spin Compiler option in the Properties window to "/opt/parallax/bin/openspin" (see attached image)
    8 Create a new .spin file or open an existing one
    RESULT: should be able to compile with openspin compiler
    

    Props.jpg


    dgately
    552 x 344 - 61K
  • davidsaundersdavidsaunders Posts: 1,559
    edited 2013-09-30 12:46
    Ok interesting. The SVN copy works with out any problem. I originally attempted with the zipped copy from the google code page, as I have found that many projects have a easier to compile source in there distrobution archives than they have in there subversion/cvs/git repos.

    I now know to use the subversion copy of OpenSpin. Does any one know what the issue is with the download page source archive?
  • Heater.Heater. Posts: 21,230
    edited 2013-09-30 12:52
    No. No idea. Maybe it's very old or something.

    Nobody cares. This is an open source world, we grab the latest code and compile it. That way if there is an issue we can report it straight away against the latest code updates in the repo and everyone knows what we are talking about.
  • dgatelydgately Posts: 1,630
    edited 2013-09-30 20:46
    I originally attempted with the zipped copy from the google code page, as I have found that many projects have a easier to compile source in there distribution archives than they have in there subversion/cvs/git repos.

    Probably true for some cases, but I've found propgcc, SimpleIDE and openspin sources archives to be trivial to compile. Folks behind these projects have done a great job!

    dgately
  • Heater.Heater. Posts: 21,230
    edited 2013-10-01 00:30
    Except in this case davidsauders is right. The source code ZIP file available on Google code does not compile (sourcecode-r53.zip). Exactly as he describes.

    It is missing a definition of PATH_MAX.

    I added
    #include <limits.h>
    
    to openspin.cpp and then it compiled fine.

    Probably a quicker solution than rewriting it all C89:)
  • dgatelydgately Posts: 1,630
    edited 2013-10-01 09:55
    Heater. wrote: »
    Except in this case davidsauders is right.

    That was my point... The source archive (i.e. code repository, NOT the ZIP) does compile!


    My comment was to davidsauder's post where he stated "Ok interesting. The SVN copy works with out any problem... I originally attempted with the zipped copy from the google code page, as I have found that many projects have a easier to compile source in there distribution archives than they have in there subversion/cvs/git repos", not to yours :innocent:


    dgately
  • Heater.Heater. Posts: 21,230
    edited 2013-10-01 10:09
    Quite so. Fetching from subversion works just fine.

    Problem is that David was originally annoyed because the zip package does not compile out of the box.

    I was surprised so I had to check it for myself.

    That zip must be really old because I have not had a problem with the svn check out for a year or so.

    Ah well.
  • dgatelydgately Posts: 1,630
    edited 2013-10-01 10:14
    To: Roy

    Is it possible to get a more-recent version of the sources in a ZIP distro? Or, is this something that you've got in-progress and we should jut wait for? :cool:


    Thanks,

    dgately
  • Roy ElthamRoy Eltham Posts: 3,000
    edited 2013-10-01 10:56
    The zip of the source is not that old and it does compile on some platforms. The PATH_MAX issue is because, sadly and annoyingly, some platforms/compilers define it differently and in different places. I had updated source in svn but not made a new zip (I have to do that manually). I'll update the zip when I do my next update which isn't ready yet.

    Also, fair warning, google is going to stop allowing us to put new downloads on google code in the future. It'll just be the source and no build exes or source zips. We'll have to work out some other arrangement for providing build exe's and source zips.

    Roy
  • Heater.Heater. Posts: 21,230
    edited 2013-10-01 11:23
    Move the whole show to github. Altogether a much nicer experience.

    Just a suggestion:)
  • davidsaundersdavidsaunders Posts: 1,559
    edited 2013-10-01 11:30
    Now that I am able to compile it with no trouble would there be any objection to me making some modifications to allow it to be compiled as a RISC OS module that exports the *commands? The changes should be fairly miner and could be done without breaking its compatability with Linux and windows.

    Mostly redifine the Path seperater and the file extension handling, I did not see anything else that is OS Specific in there.
  • Heater.Heater. Posts: 21,230
    edited 2013-10-01 11:41
    It's "open source". It's published under the MIT license. You can do whatever you like with it.
    If the changes are sensible and don't impact other platforms Roy might even like to fold them into his repository.
  • davidsaundersdavidsaunders Posts: 1,559
    edited 2013-10-01 11:46
    Ok I just wanted to make sure that no one would be opposed to the idea. I am aware that there is no issue as far as the license goes.

    I will probably have to use the RISC OS version of GCC as I do not think that it will compile correctly with Norcroft with out significant modification, though If I can get it to compile with Norcroft with out breaking it on other platforms I will.
  • dgatelydgately Posts: 1,630
    edited 2013-10-01 11:54
    Thanks Roy!

    dgately
  • jazzedjazzed Posts: 11,803
    edited 2013-10-01 15:19
    I will probably have to use the RISC OS version of GCC as I do not think that it will compile correctly with Norcroft with out significant modification, though If I can get it to compile with Norcroft with out breaking it on other platforms I will.

    Fewer the changes, the better.

    Once you make significant modifications to code, it is difficult to merge back if at all possible. If there are updates, you get to resolve any merge conflicts in your repository.
  • Heater.Heater. Posts: 21,230
    edited 2013-10-02 06:39
    openspin only uses only standard libraries judging by the header files it includes:

    math.h
    string.h
    stdlib.h
    stdio.h
    errno.h

    So if Norcroft is reasonably up to the C++ standards it should compile out of the box with no changes.

    There may be issues with those weird file paths in RISC OS but I suspect that is no big deal.
  • davidsaundersdavidsaunders Posts: 1,559
    edited 2013-10-02 14:14
    Yes it does compile with Norcroft. Though it is not yet running.

    I was surprised that it even compiled with Norcroft, as the C++ compiler is not as up to date as the C compiler by a long shot. I am still sorting out the problems. I think that the C++ compiler in Norcroft uses a CFront implementation so there is a noticable limit to what can be compiled that way. I do know that most C++ programs are a pain to port, even if they only use the standard libraries due to the limitations of the C++ compiler.

    Though it will be very nice to end up with a good working Spin + PASM compiler + assembler that will run on RISC OS. And knowing that it is 100% compatible with Chips makes it that much better.
  • Heater.Heater. Posts: 21,230
    edited 2013-10-02 14:43
    That's great.

    If you can get that working then you will need a loader. There is a loader in C in the propgcc package. It should only need a new serial port interface module to be written for RISCOS.
  • davidsaundersdavidsaunders Posts: 1,559
    edited 2013-10-02 14:53
    Heater. wrote: »
    That's great.

    If you can get that working then you will need a loader. There is a loader in C in the propgcc package. It should only need a new serial port interface module to be written for RISCOS.

    As long as it is easy enough to do with the FTDI serial module in RISC OS. I am using the serial pins for other things.
  • Heater.Heater. Posts: 21,230
    edited 2013-10-02 15:05
    As long as it shows up as a serial port in the OS you can use normal OS API functionality to drive it. There is nothing special about the way the loader uses serial.
  • jazzedjazzed Posts: 11,803
    edited 2013-10-21 19:22
    Adventures in openspin ....

    This is for anyone entertaining openspin as a replacement for bstc.

    1. It is necessary to spell out the .dat file in the -o output even if -c was specified.
    2. It is necessary to spell out the .binary file in the -o output even if -b was specified.
    3. I can only guess at this point that the same is true for .eeprom with -e specified.

    The bstc program will do those things for you.

    I'm building propeller-gcc linux release packages at the moment with openspin.
    Code is not committed yet.
Sign In or Register to comment.