We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi, I have a question about shared memory...
I have a bootloader and a program running on a 8051 (different projects,burnt together on the chip at different locations) and I need them to share a variable (which needs fast access)
I declared at the bootloader: static UINT8 data xxx _at_ YYY;
and I tried to protect (only virtual...) the same memory at the other program
static const UINT8 data *xxx _at_ YYY;
I also erased any startup code of STARTUP.A51 and INIT.A51 (and included the empty ones in the program project...still exist in the bootloader).
Now the problem is that the bootloader initializes the YYY byte to value: 'C' or 'D' but no matter the circumstances I read 'D' in the program. Any ideas? Is there any reason for the data to be overridden?
Thanks a lot in advance.
I don't know what you mean by that.
You can't really play with these two data types and expect them to represent the same variable.
Your second application will never be able to pick up the byte value, since it instead will try to load an address from the location where the first application stores a byte.
If the second application uses a pointer, then it does not need any "absolute" - it is enough to initialize the pointer to the specific address.
I somehow think you have missed what it mean to locate the pointer at a specific address, and to initialize the pointer to a specific address - two completely different things.