Dear all, I have one question about DATA memory usage.
Original situation:(quoted from .m51 file)
... fno = 0x00;iflag=arg2; // C-code and below is machine code C:0x0E38 78A1 MOV R0,#fno(0xA1) C:0x0E3A F6 MOV @R0,A C:0x0E3B 78AF MOV R0,#arg2(0xAF) C:0x0E3D E6 MOV A,@R0 C:0x0E3E F534 MOV iflag(0x34),A
From above we can see: value in arg2(idata) is copied to DATA memory offset 0x34...
BUT after code merge I got the followings:(quoted from .m51 file)
... fno = 0x00;iflag=arg2; // C-code and below is machine code C:0x0E38 78A1 MOV R0,#fno(0xA1) C:0x0E3A F6 MOV @R0,A C:0x0E3B 78AF MOV R0,#arg2(0xAF) C:0x0E3D E6 MOV A,@R0 C:0x0E3E F53E MOV 0x3E,A
The difference is: value in arg2(idata) is copied to DATA memory 0x3F ! (unfortunately I was asked to not to change this after code-merge...)
Can anyone give comments/breakthrough-point about this ? How can I got the same result as original case after code merge ?
... then you must explicitly set the addresses of those variables!
Keil C51 provides a specific language extension to do this, or you can use Linker directives to do it - full details are in the manuals.
"Can m51 file help to solve this kind of problem?"
The M51 file shows you what the Linker has done - so, yes, it can help by letting you confirm that the Linker has done what you required!