Hi Simon,
We use arm-none-eabi- toolchain 2008q1 release compile eCos. The
compiler option -mcpu=cortex-a8 was used.
And we met a strange problem. The compiler/linker couldn't
calculate the right offset of the string pointer of function
diag_printf.
For example,
//some code
diag_printf("string_1");
diag_printf("string_2");
//some other diag_printf was called
diag_printf("string n"); //this function
string pointer will not point to it's "string_n", but it will return to
somewhere of "sting_1"
//other diag_printf was called
The following is the dump of the code.
2397c: e3040ffc movw r0, #20476 ; 0x4ffc
23980: e3400005 movt r0, #5 ; 0x5
23984: eb005229 bl 38230 <diag_printf>
//string pointer points(r0) to 0x54ffc
23988: e3040014 movw r0, #16404 ; 0x4014
2398c: e3400005 movt r0, #5 ; 0x5
23990: eb005226 bl 38230 <diag_printf>
//string pointer points(r0) to 0x54014, it returns to the origin address
of .rodata,where stores all the strings.
//actrually this pointer should point to an address behind 0x54ffc.
Disassembly of section .rodata:
00054008 <__func__.3237-0x18fc>:
54008: 636c6557
5400c: 20656d6f
54010: 46206f74
54014: 73656572
And arm-none-eabi- toolchain 2008q3 release could compile this code
correctly.
But we still want to know the reason of this problem. We hope you could
help us.