Standard POSIX file opens etc. Look at the various offerings in nuttx-apps to 
get the idea.

> On 28 Dec 2023, at 16:44, Janardhan Silwal <janardhansil...@outlook.com> 
> wrote:
> 
> Hi,
> 
> I tried using the template that you provied.
> 
> I have gotten the mtd partition blocks mounted using littefs. And tried 
> creating and writing a test message to the file via nsh shell.
> The file seems to have been created, and the test message does exist even 
> after power cycling.
> 
> So, now how do I go about creating application which creates, write to and 
> read from file on the mounted partition?
> 
> Best Regards,
> 
> Janardhan
> ________________________________
> From: Tim Hardisty <timhardist...@gmail.com>
> Sent: Thursday, December 28, 2023 20:36
> To: dev@nuttx.apache.org <dev@nuttx.apache.org>
> Subject: Re: LittleFS Implementation using MTD for NOR flash
> 
> FYI - if you type the / character in menuconfig it will allow you to
> search for things (e.g. /MT25 will show two entries relating to MT25
> memory - the MTD settings and the actual flash ID of the device you're
> using (which will need to exist in the relevant driver code of course -
> so with your code editor search all files in the project for MT25Q
> related data and you'll find the data in m25px.c I think)
> 
>> On 28/12/2023 14:28, Janardhan Silwal wrote:
>> which driver did you use?
>> I didn't see MT25QL SPI flash in menu config so I went ahead and wrote one!
>> 
>> Best regards,
>> Janardhan
>> ________________________________
>> From: Tim Hardisty<timhardist...@gmail.com>
>> Sent: Thursday, December 28, 2023 19:15
>> To:dev@nuttx.apache.org  <dev@nuttx.apache.org>
>> Subject: Re: LittleFS Implementation using MTD for NOR flash
>> 
>> I have only ever used NuttX "directly" with my apps running over it
>> rather than any other middleware or anything, so I can't answer that.
>> 
>> My board has been fitted with a MT25QL01GBBB8ESF, and has worked fine,
>> so your flash is most likely supported already?
>> 
>>> On 28/12/2023 12:12, Janardhan Silwal wrote:
>>> Hi,
>>> 
>>> I am using MT25QL, 1Gbit series flash memory.
>>> 
>>> Thanks for the template.
>>> Would running in this format over the middleware running over nuttx also 
>>> follow the same approach?
>>> 
>>> Best Regards,
>>> Janardhan
>>> ________________________________
>>> From: Tim Hardisty<timhardist...@gmail.com>
>>> Sent: Thursday, December 28, 2023 17:31
>>> To:dev@nuttx.apache.org   <dev@nuttx.apache.org>
>>> Subject: Re: LittleFS Implementation using MTD for NOR flash
>>> 
>>> 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