Hi,
I have started evaluating the GNUARM tools for a LPC210x target (little-endian) and come across the following which is odd to me.
With ul defined as: unsigned long *ul;
The function function1 returns a pointer to void. For the following line, ul = ( unsigned long * ) function1();
GCC uses R0 to return the function1() result which is 0x40000625, the instruction: STR R0, [R4,#0x0004]
stores the result to RAM. Inspecting the RAM location [R4, #0x0004] shows the value stored correctly in little endian form as 25 06 00 40.
So far so good...
Now I have another function that takes ul as an argument. GCC uses R0 to pass the argument to the function. The code generated to load R0 is: LDR R0, [R2,#0004] where R2 in this case has the same value as R4 in the previous case - but the value loaded into R0 is 0x25400006 - which is all the correct digits but in the wrong order!
I am using a simulator to run the code - both Insight and the Keil simulators behave exactly the same, so I am assuming I have done something stupid in the setup of the mpu.
Any ideas what???
Thanks.