Menu

#689 [pdk] attribute for bit and word addressable variables

open
nobody
pdk (2)
5
2020-07-05
2020-07-05
kaweksl
No

PDK has instructions that can address individual bit if it is placed in ~first part of memory, it has also instructions that can address word (2 bytes) but that word must be aligned.

Problem is that we don't have possibility to force/suggest placment of declared variables.
So my proposal is to add some variable attribute (like volotile) that whould suggest linker to place variables with this attribute in proper place. Also whould be nice if compiler whould add some prefix so they could be targeted by peephole rules

Discussion

  • Philipp Klaus Krause

    The mcs51 backend has __bit. One option would be to extend support for this to pdk.

    For word alignment, I this is a duplicate of RFE [#604], which has more details.

     

    Related

    Feature Requests: #604

  • kaweksl

    kaweksl - 2020-07-05

    On mcs51 that __bit can also be accessed like byte ? I mean for example clear all bit's in variable . I like to have fexibilty in accessing individual bit in variable as whole byte .
    Maybe something more like __sfr and __sbit but for variables

    Example:

    uint8_t Flags;
    __bit (Flags,0) fStart //decalre bit 0 in variable Flags as fStart
    fStart = 1; // Whould set Flags to 1 also
    Flags = 0; //Clear all bit's
    
     

Log in to post a comment.

MongoDB Logo MongoDB