9 years, 11 months ago.

ST Nucleo L152RE SDCard

I wrote this program for St Nucleo L152RE. (tested on LPC1768 and everything is ok)

 #include "mbed.h"
#include <fstream>
#include "SDFileSystem.h"
 
SDFileSystem sd(PB_15, PB_14, PB_13, PC_4, "sd"); // the pinout on the mbed Cool Components workshop board
 
int n1,n2; 
 
 
 
int main() {
    n1=-12;  
       
    printf("test program write -12\n");
    
    mkdir("/sd/system",0777);
    
    fstream file;
    file.open("/sd/system/number.txt",ios::binary|ios::out);
    if (!file){
        error("can't write\n");
    }
    file.write(reinterpret_cast<char*>(&n1),sizeof(int));
    file.close();
    
    file.open("/sd/system/number.txt",ios::binary|ios::in);
    if (!file){
        error("can't read\n");
    }
    //file.seekg(sizeof(int),ios::beg);
    file.read(reinterpret_cast<char*>(&n2),sizeof(int));
    file.close();
    
    printf("number -> %d\n",n2);
}

Unfortunately I always have the same errors: Error: Undefined symbol fread_bytes_avail (referred from main.cpp.NUCLEO_L152RE.o). Error: Undefined symbol mbsinit (referred from main.cpp.NUCLEO_L152RE.o). Error: Undefined symbol wmemmove (referred from ios.o).

Anyone solved it?

I'm running into the same problem while porting code from LPC1768 to the NUCLEO-F401RE. Were you ever able to find a solution?

posted by Andy Lustig 08 Feb 2016

when i try to implement sd card library in L152RE, my program stops running and nothing comes on the screen. what is the problem.

posted by jayendra mishra 07 May 2016

1 Answer

9 years, 11 months ago.

Hello,

I would say it's because Nucleo targets have set microARM which does not implement full set of features as ARM library (C standard library). there's somewhere the diff what uARM lacks from standard. I can't find it at the moment, will add it or someone might be faster. This would explain why it does not fail for 1768 target.

Regards,
0xc0170