[Solved] Tiny-FatFS, f_unlink problem

Go To Last Post
5 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have noticed that in my implementation of Tiny-FatFS that one can not delete files on a MMC card, using the PC. So, I thought I'd make a small utility, running on an ATmega32, that I could use to clean the card up periodically.

// unlink files
   f_unlink("010908");

But I get this error:

Quote:
C:\WinAVR-20071221\My Projects\SD Card Deleter/sd_card_deleter.c:73: undefined reference to `f_unlink'

f_unlink is in tff.c, which is included in the project. Maybe I am not using f_unlink properly. "010908" is the file name, which I generate from RTC information. From the docs it appears that one only has to put the file name in quotes as the parameter to pass to f_unlink.

Has anyone used f_unlink successfully and can tell me what I am doing wrong?

Thanks.

Last Edited: Thu. Nov 13, 2008 - 09:45 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I don't know if it counts as success, but I just tried adding this line to my simple SD card test:

f_unlink("Hello world!");

It compiles just fine. If I remove tff.c from the Makefile, I get the same error as you did (for every call to a Tiny-FatFS function, of course). Are you certain that tff.c is included your makefile?

Michael

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes, tff.c is included.

However, I just relaised that I had set

#define _FS_MINIMIZE	1 

which removes f_unlink! :oops:

Thanks for doing your test.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Worked out well for me, too. One of my projects has bumped up against the program memory limits of my ATMega168. I've been considering going to a bigger chip, but had overlooked the _FS_MINIMIZE option. I tried it out, and it buys me another 4 kB. That should do 'er.

Michael

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yup, 4kB made a BIG difference for me as well. Tried

#define _FS_MINIMIZE   2

, but think that required a few changes that I wasn't prepared to tackle.