fastspin compiler for P2: Assembly, Spin, BASIC, and C in one compiler

1414244464761

Comments

  • In Fastspin for P2 can we be sure that the defined VAR section of each object will be cleared out initially? Or is it random data there?
  • ersmithersmith Posts: 4,315
    edited 2020-04-11 - 23:54:33
    rogloh wrote: »
    In Fastspin for P2 can we be sure that the defined VAR section of each object will be cleared out initially? Or is it random data there?

    If you compile with -O0 or -O1 then the memory is initialized to 0. If you compile with -O2 then it's initialized with whatever was left there by the boot loader; I'm not sure if that's 0 or not. The default is -O1, so by default the VAR section is initialized with 0.
  • RaymanRayman Posts: 11,106
    edited 2020-04-13 - 20:38:37
    Did something change with "AlignL" directive?

    I upgraded to latest version and now get error message about "changing hub value for symbol alignl"...

    Seems like my code works without it... But I think it's needed for streamer loops.
  • Rayman wrote: »
    Did something change with "AlignL" directive?

    I upgraded to latest version and now get error message about "changing hub value for symbol alignl"...

    Seems like my code works without it... But I think it's needed for streamer loops.

    "alignl" got moved to the .spin2 only set of symbols (so it won't be recognized if the file name ends in just ".spin"). I'm torn about what to do about it; it is useful, but it's not a reserved word in Spin1 so it could conflict with user symbols in existing Spin programs.

    I'll probably put it back in the common subset of Spin1 and Spin2 in the next release, but I am interested in what others think about this (and about how to handle reserved word conflicts in general).
  • RaymanRayman Posts: 11,106
    edited 2020-04-14 - 01:07:06
    These files are all .spin2

    It’s not the main file though, it’s an object file
  • I just posted source today in the 2bit GUI thread
    Had to comment these out in 1080p graphics driver
  • @ersmith: If you get a chance, this Femtobasic file gives strange errors when compiling...

  • Thanks @Rayman, I've responded on the FemtoBasic thread. I've also fixed the alignl problem you saw (the .spin2 extension wasn't being recognized by default in sub-objects; I think putting an explicit .spin2 extension on the file names in the OBJ will work around it for now, but it's fixed properly in github.
  • There was an occasion that alignl would have been useful for P1 code too. I can't remember exactly where though...
    I do recall having to make a buffer bigger than it needed to be in order the get all the lower address bits to zero at start of buffer...

    Anyway, maybe possible to have alignl for both P1 and P2? Just a thought...
  • Chip edited the Spin2/P2 version of FemtoBasic so that it would compile under PNut. When I tried to compile it under FastSpin (with -2b and -O2), it reported syntax errors in "SmartSerial.spin2" in the PUB statements for rxcheck and rx. These are parameterless methods that have an explicitly defined result value (lines 48 and 58). I'm sure if I leave off the "()", they'll compile under FastSpin, but not PNut. Is it possible for FastSpin to accept the PNut convention as well as the P1 Spin convention?

    The main program (FemtoDongle2.spin2) also has the "()" for parameterless methods, but didn't produce any error messages when compiled with FastSpin.
  • I think Eric said he's planning on supporting Pnut's spin2 as another language to the many that Fastspin already supports.

  • In the github for fastspin (spin2cpp), you can see that ersmith has already done some changes to make it handle Pnut Spin2 syntax/features.
    It's just a matter of time before things get there.
  • ersmithersmith Posts: 4,315
    edited 2020-04-17 - 10:55:59
    @Mike Green : if you've built fastspin from source, you can update it by going to where you checked it out and doing:
    git pull
    make
    
    The version currently in github is able to build those source files. The SmartSerial doesn't seem to work properly, but it's based on very old source code so I'm not really keen on debugging it. The SmartSerial.spin that comes with fastspin (in the include/spin directory) does work.
  • Thanks everyone. I'll update my copy. I've just started really learning the P2 tools and the P2. It's quite an uphill for now.
  • Mike Green wrote: »
    Thanks everyone. I'll update my copy. I've just started really learning the P2 tools and the P2. It's quite an uphill for now.
    Hi Mike. How are you planning to manage your FemtoBASIC code? I created a GitHub repository for the version I modified for handling the DEL key in the line editor but I imagine you want to setup your own repository. Do you plan to use GitHub or something else? I'd like to delete my temporary repository and start using yours.

  • GitHub for Femto might be a good idea... I think there were several versions for P1 and would be nice to have them all together...

    Might be nice to have several versions for P2 as well. One for console, one for VGA/kb, etc...
  • I guess it's time to learn GitHub. I see the P1 and P2 versions as different enough that they should be considered separate programs. The P1 version is very much space limited. With the P2, I should be able to add features like arrays and maybe bitfields.

    David, Feel free to delete your temporary repository. I may do some extensive changes to the existing code for the P2 and probably won't put it in a repository like GitHub until it's further along.
  • Mike Green wrote: »
    I guess it's time to learn GitHub. I see the P1 and P2 versions as different enough that they should be considered separate programs. The P1 version is very much space limited. With the P2, I should be able to add features like arrays and maybe bitfields.

    David, Feel free to delete your temporary repository. I may do some extensive changes to the existing code for the P2 and probably won't put it in a repository like GitHub until it's further along.
    I've deleted my repository. I look forward to seeing new versions of FemtoBASIC for P2 as you develop them.

  • Eric,
    I downloaded Spin2CPP from GitHub and extracted SmartSerial.spin and std_text_routines.spinh, then attempted to compile FemtoDongle2.spin2 with FastSpin 4.1.4 for MacOSX using FlexGUI. Here's what I got:

    "/Users/mgreen/Applications/flexgui/bin/fastspin.mac" -2 -l -D_BAUD=230400 -O1 -I "/Users/mgreen/Applications/flexgui/include" "/Users/mgreen/Desktop/FemtoDongle2/FemtoDongle2.spin2"
    Propeller Spin/PASM Compiler 'FastSpin' (c) 2011-2020 Total Spectrum Software Inc.
    Version 4.1.4 Compiled on: Apr 5 2020
    /Users/mgreen/Desktop/FemtoDongle2/SmartSerial.spin:74: error: syntax error, unexpected :=
    /Users/mgreen/Desktop/FemtoDongle2/SmartSerial.spin:81: error: syntax error, unexpected RETURN
    /Users/mgreen/Desktop/FemtoDongle2/SmartSerial.spin:84: error: syntax error, unexpected PUB
    /Users/mgreen/Desktop/FemtoDongle2/SmartSerial.spin:91: error: syntax error, unexpected PUB
    FemtoDongle2.spin2
    |-SmartSerial.spin
    child process exited abnormally
    Finished at Fri Apr 17 09:56:55 2020

    What am I doing wrong? I tried using femtoSerial.spin and that compiled fine.
  • ersmithersmith Posts: 4,315
    edited 2020-04-17 - 16:55:04
    @Mike Green : fastspin 4.1.4 doesn't handle ORG/END properly in .spin files. If you build a new fastspin yourself you'll get fastspin 4.1.5-beta, which has that fixed. Otherwise you could either (a) rename SmartSerial.spin to SmartSerial.spin2, or (b) change the ORG/END to ASM/ENDASM.

    Or, you could just remove all the autobaud code completely. I've attached a version which does that.
  • You should use the SmartSerial.spin located at: /Users/mgreen/Applications/flexgui/include/spin... If you are using flexgui, add that directory to the Library directories (The File, "Library directories..." option). If you are building in the Terminal app, remove your copied SmartSerial.spin and try:
    "/Users/mgreen/Applications/flexgui/bin/fastspin.mac" -2 -l -D_BAUD=230400 -O1 -I "/Users/mgreen/Applications/flexgui/include" -I "/Users/mgreen/Applications/flexgui/include/spin" "/Users/mgreen/Desktop/FemtoDongle2/FemtoDongle2.spin2"
    

    That fixed the above errors, but now, I do get a syntax error on line 549 of FemtoDongle2.spin2:
    /Users/myUserName/Library/Mobile Documents/com~apple~CloudDocs/Documents/P2ESCode/FemtoBASICP2/FemtoDongle2.spin2:549: error: syntax error, unexpected identifier `frac', expecting end of line or ','
    FemtoDongle2.spin2
    |-SmartSerial.spin2
    
             return (??rv >> 1) frac (factor() << 1)
    

    Perhaps my flexgui not being updated to the latest (an error in building flexgui's latest source) is why frat is unrecognized...

    dgately

  • "frac" support is new in 4.1.5-beta, I think.

    I'll make a new binary release of flexgui this weekend to try to get everyone onto the same page again.
  • ersmith wrote: »
    "frac" support is new in 4.1.5-beta, I think.

    I'll make a new binary release of flexgui this weekend to try to get everyone onto the same page again.

    I did write up a GitHub issue for the latest flexgui source build failure:
    gc:65: error: Unknown symbol _clkfreq_var
    gc:66: error: Unknown symbol _clkmode_var
    make[1]: *** [sdboot.binary] Error 1
    

    dgately


  • @dgately: that build error should be fixed now.
  • In his latest doc update for Spin2, Chip describes PINCLEAR, PINSETUP, and PINSTART methods. FastSpin 4.1.4 doesn't recognize these
  • Weird error:
    "/Users/mgreen/Applications/flexgui/bin/fastspin.mac" -2 -l -D_BAUD=230400 -O1 -I "/Users/mgreen/Applications/flexgui/include" "/Users/mgreen/Desktop/FemtoDongle2/FemtoDongle2.spin2"
    Propeller Spin/PASM Compiler 'FastSpin' (c) 2011-2020 Total Spectrum Software Inc.
    Version 4.1.4 Compiled on: Apr 5 2020
    _gc_:267: error: Undefined symbol q
    FemtoDongle2.spin2
    child process exited abnormally
    Finished at Fri Apr 17 17:10:20 2020
  • @Mike Green : I've released version 4.1.5 of flexgui and fastspin, which has much improved Spin2 compatibility and a whole bunch of bug fixes. Could you give that one a try, please? Links to the binary releases are in my signature.
  • I updated to 4.1.5 from Patreon, tried compiling the above source file and got the same error. Note: "||" is not acceptable for the "abs" operator using this fastspin.
  • || is Logical OR in Spin2.
  • Aargh, I missed that one, sorry. There's a typo in the internal implementation of rqpin(). It's fixed in github now, so if you're able to build from source you can get it. Otherwise, the work-around for now is not to use rqpin. I think rqpin is rarely used; generally one wants rdpin instead.

    I hope to make a new binary release in a few days.

    The meaning of || changed from ABS to OR between Spin 1 and Spin 2, so fastspin's interpretation of it depends on the extension: it'll treat it as ABS for a .spin file but as OR for a .spin2 file.

    Thanks for the bug report,
    Eric
Sign In or Register to comment.