I have very tight memory constraints with my ARM device. (It is an M0 device, but I think that this question would apply to any ARM device.) I have the need to create a table of addresses to variables. I know because of my small amount of memory that there is a small address space – less than 16 bit. So, I would like to save memory and only put the bottom 16 bits of the address in the table. I am running into compiler problems though.
It basically boils down to getting some form of this to compile…
unsigned short x;
unsigned short y = (unsigned long)&x;
unsigned short x;
unsigned short y = (unsigned short)((unsigned long)&x);
unsigned short x;
unsigned short y = ((unsigned long)&x) & 0xFFFF;
Or is there another approach?
Thanks,
Bill Waters
_____________________
USB Power Delivery (PD)
Power Interface
Texas Instruments