Hi John,
I've created a short example to reproduce the problem.
I'm using CW for MCU v10.6 with all updated installed.
I've disassembled the code at .c and at .elf level.
I got the following
from main.c file:
+++++++++++++++++++
float test;
int main(void)
{
0: b580 push {r7, lr}
...
counter++;
c: 687b ldr r3, [r7, #4]
e: f103 0301 add.w r3, r3, #1
12: 607b str r3, [r7, #4]
test=counter;
14: 6878 ldr r0, [r7, #4]
16: f7ff fffe bl 0 <__aeabi_i2f>
16: R_ARM_THM_CALL __aeabi_i2f
1a: 4602 mov r2, r0
1c: f240 0300 movw r3, #0
1c: R_ARM_THM_MOVW_ABS_NC test
20: f2c0 0300 movt r3, #0
20: R_ARM_THM_MOVT_ABS test
24: 601a str r2, [r3, #0]
}
+++++++++++++++++++
from test.elf file:
+++++++++++++++++++
| for(;;) { |
| | counter++; |
| 1fffc49c: 687b | | ldr r3, [r7, #4] |
1fffc49e: f103 0301 add.w r3, r3, #1
| 1fffc4a2: 607b | | str r3, [r7, #4] |
| | test=counter; |
| 1fffc4a4: 6878 | | ldr r0, [r7, #4] |
1fffc4a6: f7ff ff43 bl 1fffc330 <__aeabi_i2f>
1fffc4ac: f240 031c movw r3, #28
1fffc4b0: f2c2 0300 movt r3, #8192 ; 0x2000
| 1fffc4b4: 601a | | str r2, [r3, #0] |
}
...
1fffc330 <__aeabi_i2f>:
1fffc330: f010 4300 ands.w r3, r0, #2147483648 ; 0x80000000
1fffc334: bf48 it mi
1fffc336: 4240 negmi r0, r0
...
+++++++++++++++++++
Have a great day,
Pascal
Freescale Technical Support
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------