Memory mapped register bit manipulation

Comments

3 comments

  • Avatar
    Mark Boyce

    Further investigation found:

    My U32 was defined as follows

    typedef unsigned long U32;

    When I define my U32 as

    typedef unsigned long U32;

    The problem goes away and produced this code

       4A06        ldr r2, 0x000011B4
        4B06        ldr r3, 0x000011B4
        681B        ldr r3, [r3]
        F0430380    orr r3, r3, #0x80
        6013        str r3, [r2]

    As you can see r2 is now initialised with a correct value and the function works

    Are not Unsigned Longs the same as Unsigned Ints with the GCC compiler?

    0
    Comment actions Permalink
  • Avatar
    Mark Boyce

    Comment above should have read

    My U32 was defined as follows

    typedef unsigned int U32;

    When I define my U32 as

    typedef unsigned long U32;

    The problem goes away and produced this code

       4A06        ldr r2, 0x000011B4
       4B06        ldr r3, 0x000011B4
       681B        ldr r3, [r3]
       F0430380    orr r3, r3, #0x80
       6013        str r3, [r2]

    As you can see r2 is now initialised with a correct value and the function works

    Are not unsigned longs the same as unsigned ints with the GCC compiler?

    0
    Comment actions Permalink
  • Avatar
    Michael Johnson

    I can't reproduce this I get

     

        4A06        ldr r2, 0x10000328
        4B06        ldr r3, 0x10000328
        681B        ldr r3, [r3]
        F0430380    orr r3, r3, #0x80
        6013        str r3, [r2]

    for both int and long.

    0
    Comment actions Permalink

Please sign in to leave a comment.