Shop OBEX P1 Docs P2 Docs Learn Events
flexspin compiler for P2: Assembly, Spin, BASIC, and C in one compiler - Page 128 — Parallax Forums

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

1122123124125126128»

Comments

  • JonnyMacJonnyMac Posts: 9,440

    Version 7.3.0 doesn't understand a PNut constant (this works in Propeller Tool and Spin Tools).

  • ersmithersmith Posts: 6,205

    @JonnyMac said:
    Version 7.3.0 doesn't understand a PNut constant (this works in Propeller Tool and Spin Tools).

    Thanks for catching this Jon. Chip added p_invert_out as an alias for p_invert_output, but I didn't notice that change (the table in flexspin was created based on an older version of the docs, I guess). I've added that and p_true_out to github and they'll be in the next release.

  • RaymanRayman Posts: 15,570

    @ersmith The "shell.c" example doesn't seem to compile in FlexProp IDE...

  • ersmithersmith Posts: 6,205

    @Rayman said:
    @ersmith The "shell.c" example doesn't seem to compile in FlexProp IDE...

    In which version of FlexProp, and on which OS? It works for me with 7.4.2 on Linux. I seem to recall that there was a bug in shell.c in an earlier version (7.4.0 perhaps?)

  • RaymanRayman Posts: 15,570

    Thanks @ersmith Guess just having a hard time keeping up to date... Think that was 7.3...

  • __deets____deets__ Posts: 204
    edited 2025-08-31 14:20

    I'm trying to the this driver working: https://github.com/libdriver/sx1268

    It makes use of a variadic function for debug prints. See

    typedef struct sx1268_handle_s
    {
    ...
        void (*debug_print)(const char *const fmt, ...);                      /**< point to a debug_print function address */
    }
    

    When trying to compile with flexcc, I get

    /tmp/test.c:33: error: Bad number of parameters in call to debug_print: expected 2 found 1
    

    if the function is called without any argument beyond the format part for a simple print-statement without any actual string interpolation.

    GCC eats this just fine.

    I'm on the latest and greatest release I'd say:

    Propeller Spin/PASM Compiler 'FlexSpin' (c) 2011-2025 Total Spectrum Software Inc. and contributors
    Version 7.4.2-HEAD-v7.4.2 Compiled on: Aug 31 2025
    

    Any suggestions welcome.

    Edit: I just saw that there's no actual string interpolation used, so for some immediate progress I just redefined the debug function to be non-variadic. I still think this is a bug (and would prefer to use the driver unaltered of obvious reasons).

  • ersmithersmith Posts: 6,205

    @deets thanks for the bug report. It is fixed in github in version 7.4.4.

  • Hi Eric,

    I was playing with flexspin and think I found a problem with the P1 converter.

    This spin code:

            if phsa > 15
              adjust := -(phsa >> 2)      ' /4
            elseif phsb > 15
              adjust := +(phsb >> 2)      ' /4
    
    

    Produced this pasm code:

            cmps phsa, #16 wc
     if_b   jmp #LR__0002
            mov arg04, phsa
            shr arg04, #2
            neg _var05, arg04
            jmp #LR__0003
    LR__0002
            cmps phsb, #16 wc
     if_ae  mov _var05, phsb
     if_ae  shr _var05, #2
    LR__0003
    

    But the cmps phsx, #16 wc isn't right because phsx used in the destination field gets the shadow register value, not the count.

    Changing to this works:

        mov   temp, phsa
        cmps  temp, #16 wc
    

    I though you might want to know about this.

    Interestingly, this spin code:

            long[pa] := phsa
            long[pb] := phsb
    

    Produced this pasm code:

        mov     arg04, phsa
        wrlong  arg04, arg07
        mov     arg04, phsb
        wrlong  arg04, arg08
    
    

    Which is expected and correct.

Sign In or Register to comment.