bouffalolab / bouffalo_sdk

BouffaloSDK is the IOT and MCU software development kit provided by the Bouffalo Lab Team, supports all the series of Bouffalo chips. Also it is the combination of bl_mcu_sdk and bl_iot_sdk
Apache License 2.0
349 stars 121 forks source link

Unable to format or mount Exfat on any version of sdk #155

Open davidawesome02 opened 1 year ago

davidawesome02 commented 1 year ago

Update for anyone looking at my previous two issues, which are still issues, You can use 6a4d89bfeb6d8237da3e63ac66a6207c8af1c7bf to run them still (if you wana clone read https://stackoverflow.com/questions/3489173/how-to-clone-git-repository-with-specific-revision-changeset)

Ok, so because 6a4d89bfeb6d8237da3e63ac66a6207c8af1c7bf is the latest really working one, I need help, I am not sure if I can ask here as it is not a real issue as right now only a outdated version works, so technically it coulda been fixed....

I cannot use exfat because of error 19: LEAVE_MKFS(FR_INVALID_PARAMETER); /* no-FAT? */ on https://github.com/bouffalolab/bouffalo_sdk/blob/96533598ec949647be9a74d22ed5851604265957/components/fs/fatfs/ff.c#L6727

gets called with config:

#define FF_FS_CONTINUOUS 1
#define FF_FS_READONLY 0
#define FF_FS_MINIMIZE 0
#define FF_USE_FIND 1
#define FF_USE_MKFS 1
#define FF_USE_FASTSEEK 1
#define FF_USE_EXPAND 0
#define FF_USE_CHMOD 0
#define FF_USE_LABEL 0
#define FF_USE_FORWARD 0
#define FF_USE_STRFUNC 0
#define FF_PRINT_LLI   1
#define FF_PRINT_FLOAT 1
#define FF_STRF_ENCODE 3
#define FF_CODE_PAGE 437
#define FF_USE_LFN 2
#define FF_MAX_LFN 255
#define FF_LFN_UNICODE 1
#define FF_LFN_BUF 255
#define FF_SFN_BUF 12
#define FF_FS_RPATH 0
#define FF_VOLUMES 5
#define FF_STR_VOLUME_ID 2
#define FF_VOLUME_STRS   "ram", "flash", "sd", "sd2", "usb"
#define FF_MULTI_PARTITION 0
#define FF_MIN_SS 512
#define FF_MAX_SS 512
#define FF_LBA64 1
#define FF_MIN_GPT 0x10000000
#define FF_USE_TRIM 0
#define FF_FS_TINY 0
#define FF_FS_EXFAT 1
#define FF_FS_NORTC   1
#define FF_NORTC_MON  1
#define FF_NORTC_MDAY 1
#define FF_NORTC_YEAR 2022
#define FF_FS_NOFSINFO 0
#define FF_FS_LOCK 0
#define FF_FS_REENTRANT 0
#define FF_FS_TIMEOUT   1000

---- above has comments explaining each option but I removed them with a regex :)

and only modified main.c to use the commented out FM_EXFAT

I cant format to exfat or mount to exfat as it just returns errors, thanks for anyone who can help, and just so you know im more active on the pine discord.

This is a problem with a partitioning and mounting and I cant see why right now, please help!

Thanks, and please fix your repo

davidawesome02 commented 1 year ago

UPDATE: I FIXED IT, this was a complex one, and this sucks; ok, so you have to modify the exfat in the main file in the components also, use the old version for support (or fix the broken parts (I think it might be loading the unicode option makes it too big and is now set by default after v2.0 but not testing rn)) then use in main the correct fs type, and add it to be 512*256 for it to work (above 128 and I didnt know what to put so deal with it)

THANK bro, and please fix this or add comments about what dose what, and add the if statement in the main config for EXFAT support not just everything relating to it.....

I will add a merge request if I figure out github eventualy :)

davidawesome02 commented 1 year ago

nvm I was too quick, it formated and can write and read but gparted still has seek errors now :))))))

davidawesome02 commented 1 year ago

ok, did more testing and diffed the files betwine versions, NOTHING SEAMED TO CHANGE, did yall even test this, because this partition table is invalid!

thanks, gonna now read the spec on how exfat works and gpt partition tables see ya later

davidawesome02 commented 1 year ago

cool, so its not gpt good to know!

https://en.wikipedia.org/wiki/GUID_Partition_Table


Offset | Length | Contents
-- | -- | --
0 (0x00) | 8 bytes | Signature ("EFI PART", 45h 46h 49h 20h 50h 41h 52h 54h or 0x5452415020494645ULL[a] on little-endian machines)
8 (0x08) | 4 bytes | Revision 1.0 (00h 00h 01h 00h) for UEFI 2.8

Offset  Length  Contents
0 (0x00)    8 bytes Signature ("EFI PART", 45h 46h 49h 20h 50h 41h 52h 54h or 0x5452415020494645ULL[[a]](https://en.wikipedia.org/wiki/GUID_Partition_Table#cite_note-13) on [little-endian](https://en.wikipedia.org/wiki/Little-endian) machines)
8 (0x08)    4 bytes Revision 1.0 (00h 00h 01h 00h) for UEFI 2.8

vs my first few:

00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
000001c0  02 00 ee fe ff 00 01 00  00 00 ff ff ff ff 00 00  |................|
000001d0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
000001f0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 55 aa  |..............U.|
00000200  45 46 49 20 50 41 52 54  00 00 01 00 5c 00 00 00  |EFI PART....\...|
00000210  74 01 fa 70 00 00 00 00  01 00 00 00 00 00 00 00  |t..p............|

nvm im a idiot, that offset is correct for uefi