This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

PDATA question

I have not used PDATA before, so this may be a silly question. Can I set up PDATA dynamically (within the code) to any 256-byte chunk of xdata? So I can change where the PDATA is "looking" in xdata on the fly, and subsequently have byte addressing (and hopefully faster writes within a loop) for any 256-byte section of xdata at a time?

Parents
  • I took some time out to explore the benefits of using P2 in memcpy() and sure enough, in cases of a copy from CODE to XDATA or XDATA to XDATA there is a very significant speed bonus.

    Futhermore, looking through my recent applications, I see that these transfers are very common. Also, the compiler frequently calls memcpy() even when it is not explicitly mentioned in the source. For example, memcpy() is used to copy or initialise structures.

    It seems to me that a byte to save a shadow of P2 and a couple of exta instructions in an interrupt such as:

            PUSH    P2_shadow
            ...
            POP     P2
    
    would be a small price to pay for the extra performance.

    The version of memcpy() and its siblings that use P2 could be made a compiler option as a tick box on the target tab.

Reply
  • I took some time out to explore the benefits of using P2 in memcpy() and sure enough, in cases of a copy from CODE to XDATA or XDATA to XDATA there is a very significant speed bonus.

    Futhermore, looking through my recent applications, I see that these transfers are very common. Also, the compiler frequently calls memcpy() even when it is not explicitly mentioned in the source. For example, memcpy() is used to copy or initialise structures.

    It seems to me that a byte to save a shadow of P2 and a couple of exta instructions in an interrupt such as:

            PUSH    P2_shadow
            ...
            POP     P2
    
    would be a small price to pay for the extra performance.

    The version of memcpy() and its siblings that use P2 could be made a compiler option as a tick box on the target tab.

Children
No data