Named regions with zero_init attribute

Hi,

I've some confusion with named regions and their attributes. In my case, I've a named region as below:

#define SHARED_DATA_ZI  __attribute__((section("data_shared_zi"),zero_init)

and then in the linker scatter file, I have:

SHARED_DATA_REGION_LOAD 0x40000000 0x100000
{
    SHARED_USER 0x40000000
    {
        * (data_shared)
    }

    SHARED_USER_ZI +0
    {
        * (data_shared_zi_first, +first)
        * (data_shared_zi)
        * (data_shared_zi_last, +last)
    }
}

Now, let's say I declare a global variable as below in some .c file:

SHARED_DATA_ZI uint32_t testVariable;

Now according to the information here, my understanding is that as 'testVariable' is a Read/write variable and as I've 'zero_init' attribute also mentioned, here, 'testVariable' will be zero initialized (i.e. testVariable = 0) and will be placed in this named region 'data_shared_zi'. Please confirm and also, please let me know, how i can verify this. (I know, at the runtime, i can at least check if 'testVariable' is indeed set to zero, but i think, it should be somehow possible to verify the placement of 'testVariable' and it's initial value by some tools before running the program as well.

P.S.
I've some more follow up question on named regions :-)

Parents Reply Children
No data
More questions in this forum