I'm having an interesting problem initialising an array within my header.
I have:
static u32 TxBuffer_Data[MAX_PKT_LEN_WORDS] = { 10 };
static u32 RxBuffer_Data[MAX_DMA_RX_FIFOMODE_WORDS] = { 0 };
Now, I want both to be within the .data section of an embedded processor, i.e. allocated at compile time and initialised, ideally to zeros.
Now, the syntax here is correct as per How to initialize all members of an array to the same value?.
When I run my code, I grab the addresses of these two buffers, the Txbuffer is indeed within the .data region, however the RxBuffer is within .bss which is reserved for non-initialised compile time allocated variables. If I change that { 0 } to { 10 } the RxBuffer is put into the .data section correctly.
Why can't I initialise data to zeros and still have it defined as initialised?
Thanks. Ed