I am using mmio to access an external unit from my at90s8515. To access this device easily I have an pointer that points to the start of the mmio area. The interesting parts og the code looks like this: volatile char *mmio =(char *)0x8300; ... { ... mmio[a] = val1; mmio[b] = val1 >> 8; mmio[c] = val2; ... } this is compiled with: avr-gcc -g -wall -O2 -mmcu=at90s8515 -Wl ... the disassembled output becommes like this: mmio[a] = val1; e0: e0 91 60 00 lds r30, 0x0060 e4: f0 91 61 00 lds r31, 0x0061 e8: 42 87 std Z+10, r20 ; 0x0a mmio[b] = val1 >> 8; ea: e0 91 60 00 lds r30, 0x0060 ee: f0 91 61 00 lds r31, 0x0061 f2: 85 2f mov r24, r21 f4: 99 27 eor r25, r25 f6: 83 87 std Z+11, r24 ; 0x0b mmio[c] = val2; f8: e0 91 60 00 lds r30, 0x0060 fc: f0 91 61 00 lds r31, 0x0061 100: 60 87 std Z+8, r22 ; 0x08 My problem is all these lds r30/r31. That makes me believe that the compiler treates the pointer as a volatile pointer not a pointer to a volatile area. Does anyone have any ideas how to optimize this?
Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
Log in with Google account
No account? Register here.