ff_findfirst fails compile

oldcoder wrote on Tuesday, March 06, 2018:

Hi all,

I managed to get the latest version running on an Atmel Sam4e board. the example out of the box would not compile and link correctly…

anyway,Ii was trying to add some file functions, using ff_findfirst. As soon as i included this function, compile blows up with numerous header include errors the make no sense, clearly the headers that have items(mostly typedefs) are included.

So the question is why is this failing?
I also see multiple references in some header files to plusfat.h ??? this file is no where to be found in the distributions so why is this here?


rtel wrote on Tuesday, March 06, 2018:

Please say where you got the files (from one of the labs downloads?), if
you created the project yourself or used one of our references, if you
created the project - what did you do, and post the output from the
compiler…then we may be able to provide a more directed answer.

I managed to get the latest version running on an Atmel Sam4e board. the
example out of the box would not compile and link correctly…

Also, if you know there is an issue, then please don’t just imply you
fixed it without saying what it was you did to fix it - otherwise we are
not going to know and can’t fix the master copy.

oldcoder wrote on Tuesday, March 06, 2018:

Sorry for not being more explicit.

I used the current download from the RTOS example for Atmel Sam4e.
It appears to have been last used on a SAM4e-EK board, not a SAM4E-xplanied pro which is what I am using. Yes I know the Atmel naming system is quite a pain…I’ve been using their stuff for some time and have a pretty good connection to them directly.

When I first tried, I just extracted it put it in a folder as is and opened it with Studio 6.2…yes I know it was done in 7.0, a slight edit in the project file will make it compatible.

It did not compile at all, all errors due to not finding headers, apparently the nesting was off.

Moved it to studio 7 with the same results…So I conclude the setup it was made for had a slightly different folder setup.

Started a new project, pulled everything in, manually added all the directories to the project.
Eventually got the headers straight, but still complaints. Turned out the issue was the Phy driver.
The newer Phy driver ASF 3.24.1 or above has a different structure than previous…
Also the phy on an EK board is not the same as an pro board.

I started the project as an ASF project and tried to pull in more updated drivers for some peripherals…I think this is what caused some of the failure.

Anyway, got it all fixed up to satisfy the damn ASF…
The header issue was when I added a # include for ff_file.h to get it’s types, then it totaly wacked out, but if i just ad d<asf.h> + ff_headers and a few more it’s ok.
Even though the typedefs needed were clearly in that file, compiler still would not recognize them.

Past experience with this Atmel compiler tells me the problem is that the compiler does recurse headers correctly, i believe there was a bugzilla on this. It goes down a path ok, but won’t search back up, hence the order of includes becomes critical.

At this point, the web server, cli interface are working.
i added a command to do basically a ‘dir’ command using examples found and can’t get this to quite work. Since the demo web files do get made correctly, there is no issue with the SD card so it must be me.

Right now failing on FF_SDiskInit()…not quite sure why since after examples built/checked it is unmounted?
I also have not been successful at getting the FreeRTOS_Printf() to work… I have my own routine that uses the same debug port as the cli, which is working fine. Looks like the va_list is broken…

I really appreciate all the work you have put in on this, I know how much work it is.

FYI most all of the Atmel samples were built with FatFS + FreeRTOS, only the very latest cpu samples have been upgraded. Factory tells me they will migrate over to this over time, but that make take a year or 2… I started with this because I had some code using their ‘navigator.c’ which handled file navigation and FatFS did not support this, FreeRTOS has almost all that is needed except a complete posix interface, which I know you are working on.

As a suggestion for future, I would add some documentation that explicitly shows the folder setup that is needed for the examples and something saying what files can be left out.
They seem also for Atmel to be made with ASF 3.20, so you can’t mix and match versions in studio very well should someone want to add something to it.

I know it’s attractive to make 1 file with a million # defines in it, but having managed many large software projects I can tell you from experience this will quickly become un-manageable
Maybe making (1) main.c for each example might make it easier to follow. Just my 2C