Okay , I've played a bit more .
I'm now using gcc 8 in my full case I still get the output I posted, but it turns out the critical line which I had simplified was
uint8_t data = gpio & 0x3FC>>2;
My current test case :
#include <stdint.h> static uint8_t * ram; static uint8_t * Memory; static unsigned int ram_addr;
void test(unsigned int gpio) { uint8_t data = gpio & 0x3FC>>2; ram[ram_addr] = data; Memory[3] = data; }
void main() { ram_addr= 3; Memory = (uint8_t *) 0x8000000; ram = (uint8_t *) 0x9000000;
test(0x7745); ram_addr= 4; test(0x7712); while(1); }
void _exit(unsigned int fred) { while(1); }
gives :
00008230 <test>: 8230: e59f3010 ldr r3, [pc, #16] ; 8248 <test+0x18> 8234: e6ef0070 uxtb r0, r0 8238: e893000e ldm r3, {r1, r2, r3} 823c: e7c10002 strb r0, [r1, r2] 8240: e5c30003 strb r0, [r3, #3] 8244: e12fff1e bx lr 8248: 00018af0 .word 0x00018af0
Okay , I've played a bit more .
I'm now using gcc 8 in my full case I still get the output I posted, but it turns out the critical line which I had simplified was
uint8_t data = gpio & 0x3FC>>2;
My current test case :
#include <stdint.h>
static uint8_t * ram;
static uint8_t * Memory;
static unsigned int ram_addr;
void test(unsigned int gpio)
{
uint8_t data = gpio & 0x3FC>>2;
ram[ram_addr] = data;
Memory[3] = data;
}
void main()
{
ram_addr= 3;
Memory = (uint8_t *) 0x8000000;
ram = (uint8_t *) 0x9000000;
test(0x7745);
ram_addr= 4;
test(0x7712);
while(1);
}
void _exit(unsigned int fred)
{
while(1);
}
gives :
00008230 <test>:
8230: e59f3010 ldr r3, [pc, #16] ; 8248 <test+0x18>
8234: e6ef0070 uxtb r0, r0
8238: e893000e ldm r3, {r1, r2, r3}
823c: e7c10002 strb r0, [r1, r2]
8240: e5c30003 strb r0, [r3, #3]
8244: e12fff1e bx lr
8248: 00018af0 .word 0x00018af0