here is what I am using : MQX 184.108.40.206 \ CW 10.2 \ Kinetis K60
I am trying to use the « fopen » on a SDCARD passing a hardcoded string for the filename. For some reason, It fails when I do so :
CfgFile = fopen ("a:\\config.txt", "r");
If I put the name into a ram buffer, then it works :
char FileName = "a:\\config.txt";
CfgFile = fopen (FileName, "r");
I traced into the fopen function and I am not exactly sure what happen, but the loop that scans for all available devices (“ttya:”, “gpio:”, …) doesn’t break at the same place. A difference I can see between the two calls is that the one using the hardcoded string uses a pointer that is not 32 bit aligned (address is “0x1fff0569”) while the second one uses a 32 bit aligned adresss (0x1fffb47c). I am thinking that maybe this does a difference when comparing the strings.
Although I have a workaround for that problem (using a ram buffer), I would very like to know why it does that and how I can avoid it.
Thanks for any advice.