Hi,

What flash are you using out of interest?

But, the basic approach (in or called from your board bringup for example) is:


spi_flash= sam_spibus_initialize(PORT); /* this call is arch dependent */
if(!spi_flash)
{
/* Do something */
}
#ifdefined(CONFIG_MTD_M25P)
mtd = m25p_initialize(spi_flash, MINOR);
#elifdefined(CONFIG_MTD_GD25)
mtd = gd25_initialize(spi_flash, MINOR);
#elif defined(CONFIG_MTD_YOURFLASHTYPE)
/* etc */
#endif
if(!mtd)
{
/* Do something */
}
#ifdefined(CONFIG_FS_LITTLEFS)
/* Mount the LittleFS file system */
ret = register_mtddriver("/dev/flash", mtd, 0755, NULL);
if(ret < 0)
{
/* Do something */
}
ret = nx_mount("/dev/flash", "/mnt/flash", "littlefs", 0, "autoformat");
if(ret < 0)
{
/* Do something */
}

That was a copy/paste/edit or my own code so please forgive any typo errors!

On 28/12/2023 11:19, Janardhan Silwal wrote:
Hi community,

I am trying to get littlefs running on a NOR flash memory using the MTD driver, 
on a STM32F4 chip.

I had some bottlenecks in the implementation as I am an out-and-out novice when 
it comes to Nuttx.
I have written a custom driver for the flash, which is working with MTD, as  I 
couldn't find the exact driver for the flash installed on my system.

Now I need some guidance on where to start for linking LittleFS to MTD and the 
rest..

Best Regards,
Janardhan Silwal

Reply via email to