Error--undefined reference to `f_mount'

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

I trying to use FatFs file system and I add it in my project but when I try to compile it I get error 

 

Severity Code Description Project File Line Error undefined reference to `f_mount' 

 

This my code I think something is wrong in calling function  

 

#include <avr/io.h>

#include <util/delay.h>

#include <string.h>

#include <stdlib.h>

#include "ff.h"

#include "integer.h"

#include "timeout.h"

 

DWORD get_fattime (void)

{

// Returns current time packed into a DWORD variable

return   ((DWORD)(2013 - 1980) << 25) // Year 2013

| ((DWORD)8 << 21) // Month 7

| ((DWORD)2 << 16) // Mday 28

| ((DWORD)20 << 11) // Hour 0..24

| ((DWORD)30 << 5) // Min 0

| ((DWORD)0 >> 1); // Sec 0

}

 

 

FATFS FatFs; // FatFs work area

FIL *fp; // fpe object

 

int main(void)

{

UINT bw;

f_mount(0, &FatFs); // Give a work area to the FatFs module

    fp = (FIL *)malloc(sizeof (FIL));

 

 

    while (1) 

    {

     ;

    }

}

This topic has a solution.
Last Edited: Wed. Jun 20, 2018 - 05:56 AM
This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You need to add ff.c alongside the other sources in your project. It provides the implementation of f_mount and other f_* functions.