Shop Learn
flexspin compiler for P2: Assembly, Spin, BASIC, and C in one compiler - Page 83 — Parallax Forums

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

1777879808183»

Comments

  • ersmithersmith Posts: 4,890

    At the moment there's probably not very much you can do to reduce COG usage. Breaking large functions/subroutines up into smaller ones might help, and of course if you have any code explicitly placed in COG you should move it to LUT or HUB. I'm working on making the COG space used selectable via the --fcache option, which will make it possible to tweak the space for your application.

  • ersmithersmith Posts: 4,890

    @JRoark : I've posted an updated beta on Patreon that has a smaller default for the FCACHE area (so more COG ram available) and also the ability to specify a different the FCACHE area size on the command line.

  • @ersmith said:
    @JRoark : I've posted an updated beta on Patreon that has a smaller default for the FCACHE area (so more COG ram available) and also the ability to specify a different the FCACHE area size on the command line.

    Awesome! I’ll see how she flies in a bit. Thanks, Eric.

  • @ersmith Live code testing will have to wait until tomorrow (the bleeping cat ate my USB cable), but I've been playing with the compiler today sans download capability and have some things to report:

    1. The problem I had with any/all optimization levels has been fixed. No more errors.
    2. The long-standing problem I had where -O2 (full optimization) broke the compiler when used on large .BAS files is cured! SWEET!!

    I also discovered some "hidden" gems that are not documented in the FlexBASIC doc, but appear to work are look to be deriviatives of functions found in the general compiler docs. They are:

    • WAITX(x) is an undocumented alias of WAITCNT(x)
    • WAITMS(x) is an undocumented alias of DELAYMS(x)
    • WAITUS(x) is an undocumented alias of DELAYUS(x)
    • COGCHK(x) is an undocumented alias of CPUCHK(x)
  • RS_JimRS_Jim Posts: 1,460

    @ersmith Live code testing will have to wait until tomorrow (the bleeping cat ate my USB cable), but I've been playing with the compiler today sans download capability and have some things to report:@ersmith Live code testing will have to wait until tomorrow (the bleeping cat ate my USB cable), but I've been playing with the compiler today sans download capability and have some things to report:

    Is that like the dog ate my homework?
    Jim

  • @RS_Jim said:
    Is that like the dog ate my homework?
    Jim

    Lol. Yep, pretty much. Except this is a 500 lb gully cat who answers to “Satan”.
    Warning: thread drift. :)

  • RaymanRayman Posts: 11,988
    edited 2021-04-24 14:49

    @ersmith Should C defines act line Spin2 constants in included .spin2 files?

    I tried this:
    #define VGA_BASEPIN 48

    But, it says unknown symbol, so I'm guessing this doesn't work... Should/Can it?

    Not a big deal either way. Just thought it would work...

  • ersmithersmith Posts: 4,890

    @Rayman said:
    @ersmith Should C defines act line Spin2 constants in included .spin2 files?

    I tried this:
    #define VGA_BASEPIN 48

    But, it says unknown symbol, so I'm guessing this doesn't work... Should/Can it?

    No, for several reasons:

    (1) Objects created in C with "struct __using" are like objects created with OBJ in Spin2. The constants in the top level file don't go down into the sub-objects; similarly, constants in the C file don't go into the objects either.

    (2) #define is actually even weaker than constants in CON. A #define creates a macro where every occurance of the symbol is replaced with the text after it. So after
    #define VGA_BASEPIN 48the result is literally as if you did a search-and-replace inside the .c file and replaced every instance of VGA_BASEPIN with 48. It's a text substitution only, and only works within that specific file.

  • @ersmith said:
    @deets : the version in github now has support for DEBUG_BAUD.

    Sorry for the delay, but I'm a bit too knackered under the week to get to my playtime stuff. But I just verified - works as advertised, thanks for the quick implementation! It seems the default is 230400, pnut allegedly uses 2_000_000. Just FYI if congruence is relevant to you here. Or the spin doc is wrong :)

  • @ersmith On the subject of suggestions, I have two for your consideration:

    1. The predefined symbol __FLEXBASIC__ is defined as the compiler version (currently "5"). Could we change this (or create a new symbol) that includes the major, minor, revision, (ie, "5.4.0")?
    2. Would it be possible to have another predefined symbol that contains the host date/time when the file was compiled? Something like Sun 25Aug2021 12:34:56 or whatever format the standard C language uses?
  • ersmithersmith Posts: 4,890
    edited 2021-04-26 12:58

    @JRoark : Those sound like good ideas, thanks. To get all 4 components of the version into the symbol it'll have to be a string rather than an integer, so I think I'll make a new symbol __FLEXBASIC_VERSION__ for that.

    EDIT: Looks like there's already a __VERSION__symbol defined. I guess I forgot to document that, I'll add it to the manual.

  • RaymanRayman Posts: 11,988

    Should things like _rnd() also be in the manual? Or, should there be Propeller2.h manual that is separate?

    I was also thinking about getting the time in there somehow... Maybe better with loadp2? Was thinking about an easy way to initialize a real time clock...

  • ersmithersmith Posts: 4,890

    Yes, _rnd() should be documented. There's probably quite a lot of stuff missing from the documentation, sorry. Although I'm always happy to accept pull requests :).

    As for time, not sure what the best approach to that is. Probably a new function call that communicates with the host via loadp2 to get the time, something like the existing file server. Is that the kind of thing you were thinking of?

  • RaymanRayman Posts: 11,988
    edited 2021-04-26 20:41

    Maybe Plan9 provides time already? If not directly, maybe I could create a new dummy file and then get the time from that file stats?

  • ersmithersmith Posts: 4,890

    @Rayman said:
    Maybe Plan9 provides time already? If not directly, maybe I could create a new dummy file and then get the time from that file stats?

    You're right, if you create a dummy file on the host and then do a stat() on it you could get the time that way. That's a nice idea, and saves having to add anything to loadp2.

  • TonyB_TonyB_ Posts: 1,718

    Could FlexSpin please support/tolerate a colon at the end of a label?

    One could then search for routine: without matching all the call #routine

  • ersmithersmith Posts: 4,890
    edited 2021-04-27 12:45

    @TonyB_ said:
    Could FlexSpin please support/tolerate a colon at the end of a label?

    One could then search for routine: without matching all the call #routine

    PNut doesn't support this though, does it? I'm reluctant to introduce more incompatibilities with PNut, especially in the assembly language.

    One work-around would be to use a capital letter in the actual label definition (like Routine) and lower case in the uses (call #routine). Spin is case insensitive, so this should work in all assemblers.

  • TonyB_TonyB_ Posts: 1,718
    edited 2021-05-01 10:32

    @ersmith said:

    @TonyB_ said:
    Could FlexSpin please support/tolerate a colon at the end of a label?

    One could then search for routine: without matching all the call #routine

    PNut doesn't support this though, does it? I'm reluctant to introduce more incompatibilities with PNut, especially in the assembly language.

    One work-around would be to use a capital letter in the actual label definition (like Routine) and lower case in the uses (call #routine). Spin is case insensitive, so this should work in all assemblers.

    Is colon a valid character in a PASM2 label, in either PNut or FlexSpin? I can't run PNut and I need to use FlexSpin anyway as #include is vital.

    Changing the subject, is it possible to concatenate binary constants? E.g. if a = %1011 and b = %0010 can I combine a and b to get %10110010? This would be very handy for skip pattern bits.

  • ersmithersmith Posts: 4,890

    @TonyB_ said:
    Changing the subject, is it possible to concatenate binary constants? E.g. if a = %1011 and b = %0010 can I combine a and b to get %10110010? This would be very handy for skip pattern bits.

    a and b are stored as 32 bit values internally, so leading 0's are lost. So no, you can't concatenate them, because once they're parsed there's no way to know how wide they're "supposed" to be.

Sign In or Register to comment.