• Welcome to Proton BASIC Community. Please login or sign up.
 
Oct 18, 2021, 03:37 AM

News:

PROTON pic BASIC Compilers for PIC, PIC24, dsPIC33


FAT16/32 file system

Started by JimDrew, Apr 06, 2021, 09:07 PM

Previous topic - Next topic

JimDrew

Apr 06, 2021, 09:07 PM Last Edit: Apr 07, 2021, 09:15 AM by JimDrew
Now that the dust seems to have settled from the Crownhill debacle, any chance of getting a new FAT16/32 file system handler for the PIC24/33 that has working directory options and long filename support?  This is something that I am still willing to help fund.



JimDrew

Anyone interested in getting paid to do this?

Gamboa

JimDrew,

There is a library called FileSys24.INC, I have never used it. But you can make a list of things you need and pass it on to Les for a quote.

Do you have an exact specification of the things that should be added or modified?

Regards,
Gamboa
Long live for you

top204

Unfortunately, I don't have the time to study the FAT, long filename, mechanism and alter the firmware, or find out what in the firmware I created is not quite working.

It would take a few weeks to accomplish, and I cannot afford to do it as a side-line. All my time is now spent, trying to make a living. :-(

I created the firmware quite a few years ago, hoping, some users would get into it and make it better and correct any possible anomalies.

Gamboa

Long live for you

pjdenyer

I got the File system to work, it's a while ago now, it would not let me create folders and only had 8.3 file name from memory. I will dig it out tonight when I get home and post it.

JimDrew

Quote from: Gamboa on Jun 29, 2021, 05:36 AMJimDrew,

There is a library called FileSys24.INC, I have never used it. But you can make a list of things you need and pass it on to Les for a quote.

Do you have an exact specification of the things that should be added or modified?

Regards,
Gamboa

:)  I am well aware of the filesystem because that is what I am referring to here.  The problem is that none of the directory functions work (mkdir, etc.)  I need long filename support in order to use this.  Actually, I will be just taking the assembly code and completely re-working it to be a module that I can plug into other all-assembly code.   If you have something that fixes the various directory issues, please let me know.  Maybe I can cobble through the LFN stuff.


@les, I am aware of your situation and I did not think you had the time or I would have pestered you long ago.  :)

@pjdener, the filesystem works, but as you noticed it won't create directories (folders) and work on anything folder related.  The 8.3 is the biggest issue of course as that requires a change so that all of the filename entries are parsed and the LFN created from the multiple entires.  That's a bit of work, and I understand how that all work actually - I just don't understand the BASIC code well enough to adapt it directly.

pjdenyer

The FileSys program and inc file posted does work for all the options on the demo menu.

The only problem is that when you use change directory to move back up the directory tree it does not seem to recognise the "." or ".." directories and hence does not work, so the only thing I have done so far is to do a FATINIT() to reset the card which starts back at the root directory.

pjdenyer

I put the files in the Sub DIR \ Proton24 directory

JimDrew

Sep 05, 2021, 04:42 AM #9 Last Edit: Sep 05, 2021, 05:26 AM by JimDrew
Thanks for sharing the files.  Comparing the original and your code in all cases your version has RETURN instead of ExitProc.  I am not sure just how interchangeable these two functions are for Proton24's BASIC.  If they both do the exact same thing, then there is no issue - otherwise, some of the routines definitely behave differently as they would fall through in some cases instead of flat exiting the procedure.

There are some definite differences, like the compare for a directory vs. a file is backwards from each other, and some of the defines are quite a bit different.  I am going to merge what I have with some of the changes in yours and see if I can get everything to work correctly.

By the way, you should be able to just pass a new path/filename to "backup" a directory level.  There is nothing I see in Les' code that specifically handles the filename of . or .. which would be required in order to go backwards one directory level.  I have always just maintained a path and truncated to the previous / character and passed that.


Thanks!

JimDrew

Sep 05, 2021, 06:32 AM #10 Last Edit: Sep 05, 2021, 07:40 AM by JimDrew
Well, here is a weird one.  I tried to compile your code (in pieces first, and then finally an exact copy) and it won't compile... and neither will my code now.

Every "Select" commmand fails when attempted to be compiled!  I am not sure what happened.  I uninstalled the Proton24 package and reinstalled it.. old version, new version, nothing works.  Has anyone else experienced this?

JimDrew

Sep 05, 2021, 07:03 AM #11 Last Edit: Sep 05, 2021, 07:40 AM by JimDrew
My code errors out on a different "Select" command.

I am not sure what to think.  I pulled the code from my backup drive and get the same results.


JimDrew

Sep 05, 2021, 09:25 AM #12 Last Edit: Sep 05, 2021, 12:47 PM by JimDrew
OK, well... I download the latest version (which I didn't even know about) and now everything compiles.  Weird.

I discovered one thing which is rather confusing!  Some commands return true/false, and others return an actual error code.  I think that everything should return an error code, because cErrOK is considered "no error" and that is always available.  It would make a lot more sense than trying to figure out which command requires what!

I was able to make the directory functions work now, so thanks for that.


JimDrew

Sep 05, 2021, 10:41 PM #13 Last Edit: Sep 05, 2021, 10:53 PM by JimDrew
@pjdenyer - I solved the mystery of resetting the directory back to the root level.  Add this to the FileSystem24.inc code, right after the FAT_Init proc:


'--------------------------------------------------------------------------------------------------------------------------
' Set the directory start to the root.

Proc FAT_ResetRoot()
    Disk_dDirectoryStartSector = Disk_dRootDirectory                    ' reset to root directory
EndProc


Then in the section of the defines for File vs. FAT add this line after the define for File_Init():

$define File_ResetRoot()                   FAT_ResetRoot()


Anytime you want to go back to the root directory, you just call File_ResetRoot().  This goes back to the actual root.  You would need code specifically to handle going backwards just one directory level.  This is a LOT faster than having to do the SD initialization process all over again like you are doing in your code.

I tested with the ChangeDir() function and it definitely works.