2020-06-11 04:38 AM
#define RAM_Image 0x0300
xdata u8 DACT_A _at_ RAM_Image+0x0006;
xdata u8 DACT_B _at_ RAM_Image+0x0007;
DACT_A = 5;
DACT_B =6;
when DAC_A and DAC_B are global.
2020-06-11 05:40 AM
People don't usually code using such archaic/crude ways, try to use more regular C programming methods rather than trying to crowbar an 8051 mindset into 32-bit C environments.
Typically you'd use a struct to describe memory like this, and use a pointer to it, rather than try to manually micro-manage it.
That way you let the compiler/linker do the work, like they were designed, and it is actually somewhat portable.
You can describe memory regions in the Linker Script (.LD) and direct content with __attribute__
uint8_t foo[1024] __attribute__ ((section ("XDATA")));
https://gcc.gnu.org/onlinedocs/gcc-4.8.2/gcc/Variable-Attributes.html
One could also do this
uint8 *dact_a = (uint8_t *)(RAM_Image+0x0006);
#define DACT_A (*dact_a)