Hello
I am using the iMXRT1064 processor on a custom board with an eMMC card fitted
MCUXpresso is the development environment.
I am using the file fsl_mmc.c from the SDK for library functions to access the eMMC card.
The eMMC card descriptor is a C struct allocated at a certain memory address.
mmc_card_t g_mmc;
The descriptor is initialised by calling the library function, MMC_Init(mmc_card_t *card) passing a pointer to the struct.
After the return from MMC_Init, the fields of the struct have "bad" values, eg blockSize is 17017344 instead of 512.
Inside MMC_Init, when the struct is accessed directly (as a test), most of the fields show different values than when it is accessed via the pointer; so that the initialisation done via the pointer is placing bad values into the actual struct in memory.
The attached file g_mmc.docx shows two screenshots taken just before the return from MMC_Init. This shows the "good" values via the pointer, but "bad" values in the actual memory locations.
( In successive executions, the "bad" values are always the same.)
NOTE. For those familiar with mmc_card_t, I experimented by moving one field to the end of the struct.
I have tried various alignments of g_mmc but without success.
Can anyone suggest how accessing the same struct directly and via a pointer can yield different values?
Thank you in anticipation.
Damien