Hey there ! I had been trying to write a code for mmc interface with stm32f103c8 and i'm getting some error.
.\Objects\main.axf: Error: L6200E: Symbol disk_initialize multiply defined (by code.o and sd_spi_stm32.o). .\Objects\main.axf: Error: L6200E: Symbol disk_ioctl multiply defined (by code.o and sd_spi_stm32.o). .\Objects\main.axf: Error: L6200E: Symbol disk_read multiply defined (by code.o and sd_spi_stm32.o). .\Objects\main.axf: Error: L6200E: Symbol disk_status multiply defined (by code.o and sd_spi_stm32.o). .\Objects\main.axf: Error: L6200E: Symbol disk_write multiply defined (by code.o and sd_spi_stm32.o). .\Objects\main.axf: Error: L6200E: Symbol disk_timerproc multiply defined (by code.o and sd_spi_stm32.o).
I know that Error L6200E means my function definition is repeated somewhere in the given two object files but I can't guess why i'm getting this error when i haven't defined it twice. Here's my code and the C file (sd_spi_stm32.c):
#include <stm32f10x.h> #include <stm32f10x_gpio.h> #include <stm32f10x_rcc.h> #include <ff.h> #include <sd_spi_stm32.c> //the objective is to read from a file and copy it to another one. int main(void) { FATFS *Fatfs; FIL *file; FRESULT fp; int buf[8]; UINT *nbr; nbr = 0; //initialized it to null f_mount(0, Fatfs); fp= f_open(file, "First.txt", FA_OPEN_EXISTING); if(!fp) //now !fp=1 { fp= f_read(file, &buf, sizeof buf, nbr); f_close(file); } fp= f_open(file, "New.txt", FA_CREATE_NEW ); //here, the fp will give FR_OK=0 only if the file is OK otherwise some const. if(!fp) //now !fp=1 { fp= f_write(file, buf, sizeof buf, nbr); f_close(file); } }
and c file sd_spi_stm32.c is actually quite big so will post it in another message.
You're including a .c file. Are you also compiling and linking in that .c file separately?
#include <sd_spi_stm32.c> // NO! this needs the be a .H header file not the code file