Skip to content

optimized code doesn't use cbi / sbi #2

@GoogleCodeExporter

Description

@GoogleCodeExporter
#define sclk 52
      digitalWriteFast(sclk, HIGH);
    12c6:   85 b1          in   r24, 0x05   ; 5
    12c8:   82 60          ori   r24, 0x02   ; 2
        asm volatile("nop \n\tnop \n\t");
    12ca:   00 00          nop
    12cc:   00 00          nop
      digitalWriteFast(sclk, LOW);   
    12ce:   8d 7f          andi   r24, 0xFD   ; 253
    12d0:   85 b9          out   0x05, r24   ; 5

after much research, this issue is that the __atomicWrite__ function is missing 
volatile casts on the first parameter to bitWrite which is causing the compiler 
to do various optimizations.  

Attached is a correct version of the code.  I've removed the (uint8_t*) casts 
in the digital macros and just placed them in the atomicWrite macro

Original issue reported on code.google.com by cr...@moonrock.com on 4 Aug 2011 at 6:08

Attachments:

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions