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 ?
"...And it didn't occur to you that people might need to know this right from the start, rather than 5 postings into the thread?"
I see...I will roughly describe the whole story when posting question.
"...You can't merge at the source or object file level here. You need to link your ROM part on its own, then link the other part independently..."
I will try the way you said later... *Before we compile/link the whole code together and then adjust for DATA MEMORY(xdata/idata/bdata) and CODE MEMORY to make ROM part the same as before. Honestly speaking it is really tough...
Embedded development is not a walk in the park!
Using fixed and updateable code at the same time is hard. Especially if the first release was built in the wrong way, and later updates then have to be based on strange work-arounds.
The fixed part should have been built stand-alone as a separate project.
On the other hand, the fixed part should have been given a fixed amount of RAM, and all functions and variables that the other part needs to access should have had a pre-defined mechanism how to figure out the addresses. Having a table of pointers would have allowed the fixed part to be recompiled without affecting the common interface.