LittleFS Implementation using MTD for NOR flash
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
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
Re: LittleFS Implementation using MTD for NOR flash
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 Sent: Thursday, December 28, 2023 17:31 To: 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 >
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 Sent: Thursday, December 28, 2023 17:31 To: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
Re: LittleFS Implementation using MTD for NOR flash
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 Sent: Thursday, December 28, 2023 19:15 To: 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 > Sent: Thursday, December 28, 2023 17:31 > To: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 >>
Re: LittleFS Implementation using MTD for NOR flash
Device Drivers -> Memory Technology Device (MTD) Support -> SPI-based M25P/MT25Q 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 Sent: Thursday, December 28, 2023 19:15 To: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 Sent: Thursday, December 28, 2023 17:31 To: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
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 Sent: Thursday, December 28, 2023 19:15 To: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 Sent: Thursday, December 28, 2023 17:31 To: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
Re: LittleFS Implementation using MTD for NOR flash
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 Sent: Thursday, December 28, 2023 20:36 To: 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 > Sent: Thursday, December 28, 2023 19:15 > To: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 >> Sent: Thursday, December 28, 2023 17:31 >> To: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 >>>
Re: LittleFS Implementation using MTD for NOR flash
Oh!! So that is the one you used. I did see that on the menu config, but wasn't sure if it was the one. and I was halfway through completing the driver when I noticed that option in menu config anyway, so I went ahead and completed the driver. Anyway it is working, so no worries there. Thanks though. Best Regards, Janardhan From: Tim Hardisty Sent: Thursday, December 28, 2023 20:18 To: dev@nuttx.apache.org Subject: Re: LittleFS Implementation using MTD for NOR flash Device Drivers -> Memory Technology Device (MTD) Support -> SPI-based M25P/MT25Q 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 > Sent: Thursday, December 28, 2023 19:15 > To: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 >> Sent: Thursday, December 28, 2023 17:31 >> To: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 >>>
Re: LittleFS Implementation using MTD for NOR flash
On Thu, Dec 28, 2023 at 04:46:08PM +, Janardhan Silwal wrote: > Oh!! > So that is the one you used. > I did see that on the menu config, but wasn't sure if it was the one. and I > was halfway through completing the driver when I noticed that option in menu > config anyway, so I went ahead and completed the driver. > Anyway it is working, so no worries there. > Thanks though. I really wonder why the are so many *25 NOR-flash drivers to begin with. Aren't they supposed to be similar and autoprobing? > > From: Tim Hardisty > Sent: Thursday, December 28, 2023 20:18 > To: dev@nuttx.apache.org > Subject: Re: LittleFS Implementation using MTD for NOR flash > > Device Drivers -> Memory Technology Device (MTD) Support -> SPI-based > M25P/MT25Q > > 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 > > Sent: Thursday, December 28, 2023 19:15 > > To: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 > >> Sent: Thursday, December 28, 2023 17:31 > >> To: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 > >>> -- B.Walter https://www.bwct.de Modbus/TCP Ethernet I/O Baugruppen, ARM basierte FreeBSD Rechner uvm.
Re: LittleFS Implementation using MTD for NOR flash
Code size? > On 28 Dec 2023, at 17:11, Bernd Walter wrote: > > On Thu, Dec 28, 2023 at 04:46:08PM +, Janardhan Silwal wrote: >> Oh!! >> So that is the one you used. >> I did see that on the menu config, but wasn't sure if it was the one. and I >> was halfway through completing the driver when I noticed that option in menu >> config anyway, so I went ahead and completed the driver. >> Anyway it is working, so no worries there. >> Thanks though. > > I really wonder why the are so many *25 NOR-flash drivers to begin with. > Aren't they supposed to be similar and autoprobing? > >> >> From: Tim Hardisty >> Sent: Thursday, December 28, 2023 20:18 >> To: dev@nuttx.apache.org >> Subject: Re: LittleFS Implementation using MTD for NOR flash >> >> Device Drivers -> Memory Technology Device (MTD) Support -> SPI-based >> M25P/MT25Q >> >>> 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 >>> Sent: Thursday, December 28, 2023 19:15 >>> To: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 Sent: Thursday, December 28, 2023 17:31 To: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 > > > -- > B.Walter https://www.bwct.de > Modbus/TCP Ethernet I/O Baugruppen, ARM basierte FreeBSD Rechner uvm.
Re: LittleFS Implementation using MTD for NOR flash
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 > 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 > Sent: Thursday, December 28, 2023 20:36 > To: 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 >> Sent: Thursday, December 28, 2023 19:15 >> To: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 >>> Sent: Thursday, December 28, 2023 17:31 >>> To: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
Re: LittleFS Implementation using MTD for NOR flash
On Thu, Dec 28, 2023 at 06:22:05PM +, Tim Hardisty wrote: > Code size? Hardly an argument when the basic read and write is the same code and the remaining could be under #ifdef. On the other hand there is a lot of bloated code if a board could be populated with two a more different chips. > > On 28 Dec 2023, at 17:11, Bernd Walter wrote: > > > > On Thu, Dec 28, 2023 at 04:46:08PM +, Janardhan Silwal wrote: > >> Oh!! > >> So that is the one you used. > >> I did see that on the menu config, but wasn't sure if it was the one. and > >> I was halfway through completing the driver when I noticed that option in > >> menu config anyway, so I went ahead and completed the driver. > >> Anyway it is working, so no worries there. > >> Thanks though. > > > > I really wonder why the are so many *25 NOR-flash drivers to begin with. > > Aren't they supposed to be similar and autoprobing? > > > >> > >> From: Tim Hardisty > >> Sent: Thursday, December 28, 2023 20:18 > >> To: dev@nuttx.apache.org > >> Subject: Re: LittleFS Implementation using MTD for NOR flash > >> > >> Device Drivers -> Memory Technology Device (MTD) Support -> SPI-based > >> M25P/MT25Q > >> > >>> 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 > >>> Sent: Thursday, December 28, 2023 19:15 > >>> To: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 > Sent: Thursday, December 28, 2023 17:31 > To: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 > > > > > > -- > > B.Walter https://www.bwct.de > > Modbus/TCP Ethernet I/O Baugruppen, ARM basierte FreeBSD Rechner uvm. -- B.Walter https://www.bwct.de Modbus/TCP Ethernet I/O Baugruppen, ARM basierte FreeBSD Rechner uvm.
NuttX on i486?
Has anyone tried to run NuttX on a physical x86 i486 machine? (I haven't tried yet. Asking first. :-) Cheers, Nathan
Re: NuttX on i486?
There is a QEMU port to the i486 under boards/x86/qemu-i486 I am not sure of the state that was left in. I don't think that has been touched for a while so I would also expect some bit rot. That port was tested on a retro hardware board. The person that developed that board reported that it worked fine. But I don't have any definitive information on that so that is not helpful. On 12/28/2023 4:58 PM, Nathan Hartman wrote: Has anyone tried to run NuttX on a physical x86 i486 machine? (I haven't tried yet. Asking first. :-) Cheers, Nathan