I use Keil uVision4 to build my project.
Here is my test C code:
void func(void)
{
//do something
printf("I hope to be recognized as RO-DATA!\n");
}
But assembler code is below. As u see, the string was put into RO-CODE section as inline data!
I realllllllllllllly want to know How to place a "short string" into [RO-DATA] section, but not in [RO-CODE(inc. data)] section?
Thanks!
------------------------------------------------------------------------------------------------------------------
func
0x00002c44: b510 .. PUSH {r4,lr}
0x00002c46: a013 .. ADR r0,{pc}+0x4e ; 0x2c94
0x00002c48: f000fc9a .... BL printf ; 0x3580
;; some other codes for RO-CODE section
$d
;; the string is here !
0x00002c94: 6f682049 I ** DCD 1869094985
0x00002c98: 74206570 pe t DCD 1948280176
0x00002c9c: 6562206f o be DCD 1700929647
0x00002ca0: 63657220 rec DCD 1667592736
0x00002ca4: 696e676f ogni DCD 1768843119
0x00002ca8: 2064657a zed DCD 543450490
0x00002cac: 52207361 as R DCD 1377858401
0x00002cb0: 41442d4f O-DA DCD 1094987087
0x00002cb4: 0a214154 TA!. DCD 169951572
0x00002cb8: 00000000 .... DCD 0
I don't know of a way to do that, but you do realize if if did do that it would be less efficient code as t would need to load a full address?
If you're wanting to share the strings between modules then I'd advise just having a message file which declares the strings as global const char msg_XYZ[]="x yy zzz"; No special pragmas or compiler options and it'll all go in the ro_data. Internationalization will also do it but normally via extra calls or an array, but then you're targeting more customers which is good.
well, this method is not what i need, but really thank you very much!