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

accessing memory-mapped peripherals with C

hi i defined a peripheral at 0x59000000 address and am trying to send a value to that register with my c code
i succeeded to send a value with assembly

AGAIN LDR R1, =0x59000000 LDR R0, =0x00000022 STR R0, [R1]

but i failed to do that with my c code

#define accelerator 0x59000000
int main() {
unsigned int volatile *regdistance =(unsigned int *) accelerator ;

*regdistance =22;

}

Parents Reply Children