Skip to content

lfs_mkdir fails after fresh format + mount ... and works after a reset #68

@jacquessamoun

Description

@jacquessamoun

Hello,

starting off from a fully erased Flash (64 Mb), one of my very first application tasks is to create a directoty hierarchy.
So i am doing:
if ((status = lfs_mount(&pctx->lfs, &local_cfg)) != LFS_ERR_OK)
{
// Format it first
status = lfs_format(&pctx->lfs, &local_cfg);
status += lfs_mount(&pctx->lfs, &local_cfg);
}
Then:
int errno = lfs_mkdir(&pctx->lfs, "files");
if (errno != LFS_ERR_EXIST && errno != LFS_ERR_OK) {
return PLATFORM_ERROR_OPEN;
}

At the very first run of the app, i will invariably get an errno == LFS_ERR_IO, then the code is exiting.
However, after a reset, the lfs_mkdir would always succeed ....

Is there anything elase i should do after format/mount so that my lfs_mkdir would succeed first place ?
Thanks
Jacques

PS: my platform is iMXRT1176 based, the flashs are QSPI interfaced, and the code itself is running out of the same flash (different location, XIP)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions