Hi,
Is there a way to allow memory overlapping in MDK-ARM?
I have tried to use the "__attribute__((at(address)))" but it does not work.
Ex.
unsigned char array1[20] __attribute__((at(0x20002000))); unsigned char array2[10] __attribute__((at(0x2000200A)));
And what do you think you can do with pointers?
Such as:
typedef struct { .... } my_strange_thing_1; typedef struct { .... } my_strange_thing_2; typedef struct { .... } my_strange_thing_3; uint8_t bulk[BULK_SIZE]; my_strange_thing_1 *strange_ref1; my_strange_thing_2 *strange_ref2; my_strange_thing_3 *strange_ref3; void map_strange1(void) { assert(BULK_SIZE >= sizeof(my_strange_thing_1); strange_ref1 = my_strange_thing_1; strange_ref2 = NULL; strange_ref3 = NULL; } void map_strange2(void) { assert(BULK_SIZE >= sizeof(my_strange_thing_2); strange_ref1 = NULL; strange_ref2 = my_strange_thing_2; strange_ref3 = NULL; } void map_strange3(void) { assert(BULK_SIZE >= sizeof(my_strange_thing_3); strange_ref1 = NULL; strange_ref2 = NULL; strange_ref3 = my_strange_thing_2; }
or
enum Strange { STRANGE_FREE, STRANGE_1, STRANGE_2, STRANGE_3 }; struct { Strange mapped; union { my_strange_thing_1 strange1; my_strange_thing_2 strange2; my_strange_thing_3 strange3; } } strange_overlapping_data;