On Mon, May 27, 2024 at 4:00 AM Gregory Nutt <spudan...@gmail.com> wrote:
> There is some brief information about dhara here: > https://github.com/dlbeer/dhara . It is an FTL that provides many of the > features described previously: > > * Wear leveling, > * Hardware/software EEC > > It does not appear to do > > * Bad block detection > * Marking of bad blocks > > dhara and most nand file system requires mtd driver save ECC and mark bad block, that's why isbad/markbad are added to mtd_dev_s recently: https://github.com/apache/nuttx/blob/master/include/nuttx/mtd/mtd.h#L200-L203 beside the new callback, bwrite/bread need to extend too: - bwrite need compute and save ECC to spare region additionally - bread need correct bit error and return the correction status: 1. the number of block read in normal case 2. -EUCLEAN if the bit error is corrected but too many bit error happen 3. -EBADMSG if the bit error can't be corrected The nicest thing is the the license is very permissive and, I think, > Apache friendly. People do use dhara with LittleFS. > > We can use fatfs with dhara directly, which could avoid the double wear leaving in dhara and littlefs. > > The apps repo has some configurations to build with 3rd party projects, > > where we don't include the 3rd party sources in our repo. > > > > Instead, we only develop a build script and Kconfig. It's a sort of > "stub" > > (for lack of a better term). > > > > If that item is configured, our build script will download the sources > from > > the 3rd party (I think the URL is configured in Kconfig, so developers > can > > locally host all their dependencies) and then compile it with the rest of > > their build. > > > > See, for example, in the nuttx-apps repo: math/libtommath. > > For dhara, the corresponding build logic is at: > https://github.com/apache/nuttx/blob/master/drivers/mtd/Make.defs#L182 > > The single file in the NuttX repository, drivers/mtd/dhara.c, appears to > be a thin shim that provides a NuttX MTD interface on top of dhara. The > full flash translation layer consists of this shim, a NAND driver, and > the downloaded dhara logic >