Hello all, I am using a float variable named val which has a value 169.0 in my program .When I ran the program I got the following assembly code in my disassembly window.Now I want to know the memory location at which the value 169.0 has been stored.Is it possible to know it from the code below? Looking for your help.
49: val=169.0; 0x000002B8 E59F1024 LDR R1,[PC,#0x0024] 0x000002BC E28D0000 ADD R0,R13,#0x00000000 0x000002C0 E5801000 STR R1,[R0]
If u r using micro vision 2/3, u can see it in the symbol window.
Hi Neo, In the symbol window I couldnot see the address location where the variable val is getting stored.In the address coloumn its showing parameter. Hi Dan Henry, I couldnot see the variable getting stored in the nearby location in and around 9 words. looking for help.
Your subject is "constant storage location". Are you looking for 'val' or for the constant (169.0) assigned to 'val'?
I am looking for the constatant value 169.0 assigned to val.
Similar to how you provided the memory dump with disassembly in your original post of locations 0x000002B8-0x000002C0, please extract the dump of 0x000002B8-0x000002E8 and post it here.
"I couldnot see the variable getting stored in the nearby location in and around 9 words." Assuming CARM and 32-bit floats, at location 0x000002DC, you should see a word encoded with the value 169.0 encoded thusly: http://www.keil.com/support/man/docs/ca/ca_ap_float_format.htm It's just a raw value in memory that is read by the PC-relative load in your original post, not an instruction.
Hi Dan Henry, Here is the code from the disassembled window for my program. Thanks.
44: void main () 45: { 46: 47: float val,result; 48: 0x000002B0 E92D4000 STMDB R13!,{R14} 0x000002B4 E24DD008 SUB R13,R13,#0x00000008 49: val=144.0; 50: 51: 0x000002B8 E59F1024 LDR R1,[PC,#0x0024] 0x000002BC E28D0000 ADD R0,R13,#0x00000000 0x000002C0 E5801000 STR R1,[R0] 52: result=sqrt(val); 0x000002C4 E28D0000 ADD R0,R13,#0x00000000 0x000002C8 E5900000 LDR R0,[R0] 0x000002CC EB00014D BL ?C?CASTF?A(0x00000808) 0x000002D0 EBFFFF7B BL sqrt(0x000000C4) 0x000002D4 E28D1004 ADD R1,R13,#0x00000004 0x000002D8 E5810000 STR R0,[R1] 53: } 0x000002DC E28DD008 ADD R13,R13,#0x00000008 0x000002E0 E8BD8000 LDMIA R13!,{PC} 0x000002E4 43100000 DDIA 0x43100000 0x000002E8 E59FC000 LDR R12,[PC] 0x000002EC E12FFF1C BX R12 0x000002F0 000002F5 DD 0x000002F5 fabs:
You almost got me there for a second, having changed 169.0 to 144.0, but anyhow, the constant is here:
0x000002E4 43100000 DDIA 0x43100000
Oh, my! The preview looked just fine. You almost got me there for a second, having changed 169.0 to 144.0, but anyhow, the constant is here:
0x000002E4 43100000 DDIA 0x43100000 0x43100000 = 0b01000011000100000000000000000000 Working through the floating point format: http://www.keil.com/support/man/docs/ca/ca_ap_float_format.htm S EEEEEEEE MMMMMMMMMMMMMMMMMMMMMMM 0 10000110 00100000000000000000000 Exponent: 134 - 127 = 7 Mantissa with leading 1-bit: 1.00100000000000000000000 After adjusting binary point: 10010000.0000000000000000 0b10010000 = 144
Hi Dan Henry, Thanks for all your help and replies and clearing my doubt. During my search I got a link where we can convert the our float values into hex value...hope you know the link http://babbage.cs.qc.edu/courses/cs341/IEEE-754.html Thanks again for your help.