Hello Neil,
You are getting errors because you are trying to combine two different driver's versions: KSDK 1.3 (or KSDK 1.2) and SDK 2.0. As i already told you, SDK 2.0 is quite different than previous versions, so the way you are trying to combine both versions will result in getting compilation errors (some driver APIs has changed).
If you look at fatfs files (integer.h, ffconf.h, ff.h, ff.c, diskio.h, diskio.c, syscall.c and unicode.c) the unique file that "depends" on driver's structure is diskio.c, in this function, disk initialization, disk status, disk read, disk write and more functions are re-directed to proper driver driver.
Depeding on the definition in ffconf.h
/*---------------------------------------------------------------------------/
/ Freescale adaptation configuration
/---------------------------------------------------------------------------*/
#define SD_DISK_ENABLE
/* Available options are:
/ RAM_DISK_ENABLE
/ USB_DISK_ENABLE
/ SD_DISK_ENABLE
/ MMC_DISK_ENABLE */
Your diskio.c file will use the proper function for SD disk, ram disk, usb disk, etc:
DSTATUS disk_initialize(BYTE pdrv /* Physical drive nmuber to identify the drive */
)
{
DSTATUS stat;
switch (pdrv)
{
#ifdef RAM_DISK_ENABLE
case RAMDISK:
stat = ram_disk_initialize(pdrv);
return stat;
#endif
#ifdef USB_DISK_ENABLE
case USBDISK:
stat = USB_HostMsdInitializeDisk(pdrv);
return stat;
#endif
#ifdef SD_DISK_ENABLE
case SDDISK:
stat = sd_disk_initialize(pdrv);
return stat;
#endif
#ifdef MMC_DISK_ENABLE
case MMCDISK:
stat = mmc_disk_initialize(pdrv);
return stat;
#endif
#ifdef SDSPI_DISK_ENABLE
case SDSPIDISK:
stat = sdspi_disk_initialize(pdrv);
return stat;
#endif
default:
break;
}
return STA_NOINIT;
}
However, if you look at diskio.c file from fatfs 0.09, these functions were different:
DSTATUS disk_initialize (
/* [IN] Physical drive number (0) */
uint8_t pdrv
)
{
DSTATUS stat = STA_NOINIT;
switch (pdrv)
{
#if USB_DISK_ENABLE
case USB:
return msd_disk_initialize(pdrv);
#endif
#if SD_DISK_ENABLE
case SD:
return sdcard_disk_initialize(pdrv);
#endif
// default:
// return STA_NOINIT;
}
return stat;
}
So, you will only need to replace the integer.h, ffconf.h, ff.h, ff.c, diskio.h, diskio.c, syscall.c and unicode.c from 0.09 verstion, for the ones in 0.11, and then: do the migration MANUALLY for diskio.c, in order to be compatile with your old driver structure, in other words, replace (for USB case)
case USBDISK:
stat = USB_HostMsdInitializeDisk(pdrv);
return stat;
for
case USB:
stat = msd_disk_initialize(pdrv);
return stat;
this way, you will AVOID to included paths from different versions (SDK 1.3 and SDK 2.0) and drivers
Does ti make sense to you?
Best Regards,
Isaac