Initializing a struct in SDRAM and then reading the values when the application runs, does not return the same values as initially set.
The struct is defined as:
typedef struct _cf_full_t {
uint8_t cf_bnb[160+40+50];
uint16_t cf_word[10];
uint32_t cf_dword[10];
} cf_full_t;
The global variable of this struct type is initialized as:
__DATA(RAM5) const cf_full_t cf_default = // have tried with and w/o const
{
0, 1, 1, 0, 0, 0, 0, 0, 0, 0, // 0 - 9
1, 1, 1, 1, 1, 1, 1, 1, 0, 1, // 10 - 19
..
3, 0, 0, 0, 4, 0, 0, 0, 0, 0, // 190 - 199
3, 1, 25, 8, 40, 0, 65, 4, 65, 25, // 200 - 209
5, 5, 2, 1, 75, 1, 40, 20, 40, 50, // 210 - 219
..
2, 5, 50, 6, 4, 30, 30, 14, 30, 25, // 240 - 249
1571,2050,12200,0, 0,300, 10, 4, 40, 0, // 250 - 259
0, 0, 4, 140, 0, 0, 0, 0, 0, 0 // 260 - 269
};
Memory definition for i.MX RT1024
Skærmbillede 2025-03-12 160402.png
Does SDRAM need to specified in linker script as well? (tried it but it didn't help). SRAM blocks are additionally specified in ResetISR.
Skærmbillede 2025-03-12 160843.png
When reading the struct variable the first 200 bytes are rubbish, but from then on everything is correct.! (i.e. the last 50 bytes in cf_bnb as well as cf_word and cf_dword.
Any explanation or just a guide to using SDRAM will be highly appreciated. I have read the User Guide at found the __DATA, __BBS, __NOINIT keywords. Is that all there is to it?