Using MCUXpresso with NXP MKL02Z16VFM4 for reference.
When I declare a struct like so
typedef struct {
uint8_t DATA :8;
} myStruct;
myStruct xxx __attribute__ ((section ("xyz")));
the position in memory is filled with random characters. The processor is little endian so when I try to access this address, I get those random characters and the data I have written to the struct.
//At address 0x1FFFFE84 : BD84D1E4
xxx.DATA = 0xAA; //Assign some numbers to struct
//Now, 0x1FFFFE84 : BD84D1AA
I can use memset to clear the memory, but I'd like to know why the memory is filled with these random characters when declaring a struct.