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;
}
>>also if you don't mind would you explain to me why do i have to make sure that my main doesn't exit.
Where do you think the system goes after you leave? Have you provided any code in the startup.s to handle this expectation?
It is not like running a C application on Windows/Linux where it returns to the command console with a return code. In embedded unless you provide some defined behaviour it is going to crash, like exiting a tall building via an open upper floor window. It is not going anywhere good, best to stop in a loop where you can break with the debugger if required, and not start some random journey executing unknown/undefined code.
crystal clear thank you