Help 89c5131a with mmc card interface (SPI)!
you asked about these errors:
compiling tff.c...
TFF.C(176): warning C206: 'LD_WORD': missing function-prototype
TFF.C(176): error C267: 'LD_WORD': requires ANSI-style prototype
These are macros from Chan's library, and they are located in the header files. If you are using TFF.C, have a look in TFF.H... if you are using FF.C, have a look in FF.H...
They are used to load a word in small endian format from your sector buffer when you read it...
Hope this helps,
Thank you for your anwer , i have already taken a look , but it seems impossible to find the solution , because as you have said , these files are in tff.c and tff.h , and the header seems to be correct , but it doesn't work , and i don't know what can i change to make them work .... could you send your program , or at least the tff files that you use ? , and the other problem that i have is to name the variable Stat in diskio.c . Thanks!!
We can use chat forum for this...
Build target 'Target 1'
assembling STARTUP.A51...
compiling diskio.c...
DISKIO.C(34): error C202: 'Stat': undefined identifier
DISKIO.C(38): error C202: 'Stat': undefined identifier
DISKIO.C(53): error C202: 'Stat': undefined identifier
DISKIO.C(68): error C202: 'Stat': undefined identifier
DISKIO.C(91): error C202: 'Stat': undefined identifier
DISKIO.C(118): error C202: 'Stat': undefined identifier
compiling tff.c...
TFF.C(176): warning C206: 'LD_WORD': missing function-prototype
TFF.C(176): error C267: 'LD_WORD': requires ANSI-style prototype
compiling SPI.c...
Target not created
If you erase the content of all of the functions, you will get this:
/*-----------------------------------------------------------------------*/ /* Low level disk I/O module skeleton for FatFs (C)ChaN, 2007 */ /*-----------------------------------------------------------------------*/ /* This is a stub disk I/O module that acts as front end of the existing */ /* disk I/O modules and attach it to FatFs module with common interface. */ /*-----------------------------------------------------------------------*/ #include "diskio.h" /*-----------------------------------------------------------------------*/ /* Inidialize a Drive */ DSTATUS disk_initialize ( BYTE drv /* Physical drive nmuber (0..) */ ) { } /*-----------------------------------------------------------------------*/ /* Return Disk Status */ DSTATUS disk_status ( BYTE drv /* Physical drive nmuber (0..) */ ) { } /*-----------------------------------------------------------------------*/ /* Read Sector(s) */ DRESULT disk_read ( BYTE drv, /* Physical drive nmuber (0..) */ BYTE *buff, /* Data buffer to store read data */ DWORD sector, /* Sector address (LBA) */ BYTE count /* Number of sectors to read (1..255) */ ) { } /*-----------------------------------------------------------------------*/ /* Write Sector(s) */ #if _READONLY == 0 DRESULT disk_write ( BYTE drv, /* Physical drive nmuber (0..) */ const BYTE *buff, /* Data to be written */ DWORD sector, /* Sector address (LBA) */ BYTE count /* Number of sectors to write (1..255) */ ) { } #endif /* _READONLY */ /*-----------------------------------------------------------------------*/ /* Miscellaneous Functions */ DRESULT disk_ioctl ( BYTE drv, /* Physical drive nmuber (0..) */ BYTE ctrl, /* Control code */ void *buff /* Buffer to send/receive control data */ ) { }
Now when you compile the project (remember to set the NOOVERLAY option within the linker setup), you will get the following compiler summary:
Build target 'Target 1'
assembling STARTUP.A51...
compiling MAIN.C...
compiling tff.c...
compiling diskio.c...
DISKIO.C(17): warning C173: missing return-expression
DISKIO.C(14): warning C280: 'drv': unreferenced local variable
DISKIO.C(26): warning C173: missing return-expression
DISKIO.C(23): warning C280: 'drv': unreferenced local variable
DISKIO.C(38): warning C173: missing return-expression
DISKIO.C(32): warning C280: 'drv': unreferenced local variable
DISKIO.C(33): warning C280: 'buff': unreferenced local variable
DISKIO.C(34): warning C280: 'sector': unreferenced local variable
DISKIO.C(35): warning C280: 'count': unreferenced local variable
DISKIO.C(51): warning C173: missing return-expression
DISKIO.C(45): warning C280: 'drv': unreferenced local variable
DISKIO.C(46): warning C280: 'buff': unreferenced local variable
DISKIO.C(47): warning C280: 'sector': unreferenced local variable
DISKIO.C(48): warning C280: 'count': unreferenced local variable
DISKIO.C(63): warning C173: missing return-expression
DISKIO.C(58): warning C280: 'drv': unreferenced local variable
DISKIO.C(59): warning C280: 'ctrl': unreferenced local variable
DISKIO.C(60): warning C280: 'buff': unreferenced local variable
DISKIO.C(17): warning C290: missing return value
DISKIO.C(26): warning C290: missing return value
DISKIO.C(38): warning C290: missing return value
DISKIO.C(51): warning C290: missing return value
DISKIO.C(63): warning C290: missing return value
linking...
*** ERROR L127: UNRESOLVED EXTERNAL SYMBOL
SYMBOL: get_fattime
MODULE: tff.obj (TFF)
*** ERROR L128: REFERENCE MADE TO UNRESOLVED EXTERNAL
SYMBOL: get_fattime
MODULE: tff.obj (TFF)
ADDRESS: 1001D7DH
*** ERROR L128: REFERENCE MADE TO UNRESOLVED EXTERNAL
SYMBOL: get_fattime
MODULE: tff.obj (TFF)
ADDRESS: 1002E24H
*** ERROR L128: REFERENCE MADE TO UNRESOLVED EXTERNAL
SYMBOL: get_fattime
MODULE: tff.obj (TFF)
ADDRESS: 10025FAH
Program Size: data=9.0 xdata=642 const=0 code=18442
Target not created
Select Project, then select Options, then select LX51 Misc, then in the box titled "Misc controls", enter the word NOOVERLAY
Build target 'Target 1'
assembling STARTUP.A51...
compiling diskio.c...
DISKIO.C(17): warning C173: missing return-expression
DISKIO.C(14): warning C280: 'drv': unreferenced local variable
DISKIO.C(26): warning C173: missing return-expression
DISKIO.C(23): warning C280: 'drv': unreferenced local variable
DISKIO.C(38): warning C173: missing return-expression
DISKIO.C(32): warning C280: 'drv': unreferenced local variable
DISKIO.C(33): warning C280: 'buff': unreferenced local variable
DISKIO.C(34): warning C280: 'sector': unreferenced local variable
DISKIO.C(35): warning C280: 'count': unreferenced local variable
DISKIO.C(51): warning C173: missing return-expression
DISKIO.C(45): warning C280: 'drv': unreferenced local variable
DISKIO.C(46): warning C280: 'buff': unreferenced local variable
DISKIO.C(47): warning C280: 'sector': unreferenced local variable
DISKIO.C(48): warning C280: 'count': unreferenced local variable
DISKIO.C(63): warning C173: missing return-expression
DISKIO.C(58): warning C280: 'drv': unreferenced local variable
DISKIO.C(59): warning C280: 'ctrl': unreferenced local variable
DISKIO.C(60): warning C280: 'buff': unreferenced local variable
compiling tff.c...
tff.h(300): error C320: Do not forget to set _MCU_ENDIAN properly!
compiling MAIN.c...
tff.h(300): error C320: Do not forget to set _MCU_ENDIAN properly!
Target not created