Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VolToPart use const in fatfs. (IDFGH-13211) #14148

Open
3 tasks done
qwx opened this issue Jul 8, 2024 · 2 comments
Open
3 tasks done

VolToPart use const in fatfs. (IDFGH-13211) #14148

qwx opened this issue Jul 8, 2024 · 2 comments
Assignees
Labels
Status: In Progress Work is in progress

Comments

@qwx
Copy link

qwx commented Jul 8, 2024

Answers checklist.

  • I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
  • I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

General issue report

When I want to use two partition in one emmc, I have to change the code in diskio.c like this.

const PARTITION VolToPart[FF_VOLUMES] = {
    {0, 0},    /* Logical drive 0 ==> Physical drive 0, auto detection */
#if FF_VOLUMES > 1
    {1, 0},    /* Logical drive 1 ==> Physical drive 1, auto detection */
#endif

change to:

const PARTITION VolToPart[FF_VOLUMES] = {
    {0, 1},    /* Logical drive 0 ==> Physical drive 0, Partition 1 */
#if FF_VOLUMES > 1
    {0, 2},    /* Logical drive 1 ==> Physical drive 0, Partition 2 */
#endif

Everyone coding with me have to change them too.
So is there a way not change the code in esp-idf but in user code?
Like make VolToPart not const or other beautiful way to do this?

@github-actions github-actions bot changed the title VolToPart use const in fatfs. VolToPart use const in fatfs. (IDFGH-13211) Jul 8, 2024
@adokitkat
Copy link
Collaborator

Yes, this is something which can be improved. Right now creating more partitions on the same storage device is not trivial. Will look into this. Thank you for your comment.

@qwx
Copy link
Author

qwx commented Jul 15, 2024

Thank you for your reply. I use the code below to create more than one partition on emmc:

    BYTE work[FF_MAX_SS];         /* Working buffer */
    LBA_t plist[] = {90, 10, 0}; 

    FRESULT fres = f_fdisk(0, plist, work);            /* Divide the physical drive 0 */
    if (fres != FR_OK)
    {
        printf("fdisk error");
    }
    fres = f_mkfs("0:", 0, work, sizeof work); /* Create FAT volume on the logical drive 0 */
    if (fres != FR_OK)
    {
        printf("fdisk1 error");
    }
    fres = f_mkfs("1:", 0, work, sizeof work); /* Create FAT volume on the logical drive 1 */
    if (fres != FR_OK)
    {
        printf("fdisk2 error");
    }

I also create a pull request(#14150) to do this change. I can provide infomation if you need. Thanks a lot.

@espressif-bot espressif-bot added the Status: Selected for Development Issue is selected for development label Jul 18, 2024
@espressif-bot espressif-bot added Status: In Progress Work is in progress and removed Status: Selected for Development Issue is selected for development labels Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: In Progress Work is in progress
Projects
None yet
Development

No branches or pull requests

3 participants