This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Overlapping Memory areas in ARM

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)));

Parents Reply Children
  • 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;

  • "array2 was declared as a global variable (but it is not visible on my module"

    So why is it not visible "on your module" ?

    Why don't you just make it visible?

    "it is not really used by the other modules"

    So why is it there if it's not used??!

    Sounds like you have basic design flaws, and should be addressing them - rather than introducing further kludges!