Please, remove the #if def ... Em qua., 25 de ago. de 2021 às 14:44, Sara da Cunha Monteiro de Souza < saramonteirosouz...@gmail.com> escreveu:
> You won't have the block drive unless you do what Greg suggested. > But for mounting nxffs on an MTD partition you don't need the block driver. > The snippet you pasted are with some typos. > Try it: > > > /**************************************************************************** > * Name: format_nxffs > * > * Description: > * Register a mtd driver and mount a Little FS over it. > * > * Parameters: > * mtd - Pointer to a pre-allocated mtd partition. > * mnt_pt - Mount point > * > * Returned Value: > * Zero on success; a negated errno value on failure. > * > > ****************************************************************************/ > > #if defined (CONFIG_ESP32_SPIFLASH_NXFFS) > static int format_nxffs(FAR struct mtd_dev_s *mtd, const char *mnt_pt) > { > int ret = OK; > > ret = nxffs_initialize(mtd); > if (ret < 0) > { > ferr("ERROR: NXFFS init failed: %d\n", ret); > return ret; > } > > if (mnt_pt != NULL) > { > ret = nx_mount(NULL, mnt_pt, "nxffs", 0, NULL); > if (ret < 0) > { > ferr("ERROR: Failed to mount the FS volume: %d\n", ret); > return ret; > } > } > > return ret; > } > > #endif > > > > Em qua., 25 de ago. de 2021 às 14:14, Gregory Nutt <spudan...@gmail.com> > escreveu: > >> m25p_initialize() does not generate a block driver. I creates an MTD >> driver. To get a block driver, you have to wrap the MTD driver >> instances in an FTL (FLASH Translation Layer) instance. These should be >> examples: >> >> $ find . -name "*.c" | xargs grep -l ftl_initialize | xargs grep -l >> nxffs_initialize >> ./arm/cxd56xx/common/src/cxd56_flash.c >> ./arm/lpc43xx/bambino-200e/src/lpc43_appinit.c >> ./arm/lpc43xx/lpc4330-xplorer/src/lpc43_appinit.c >> ./arm/lpc43xx/lpc4357-evb/src/lpc43_appinit.c >> ./arm/sam34/sam4e-ek/src/sam_at25.c >> ./arm/sam34/sam4s-xplained-pro/src/sam_nandflash.c >> ./arm/sama5/sama5d2-xult/src/sam_at25.c >> ./arm/sama5/sama5d2-xult/src/sam_nandflash.c >> ./arm/sama5/sama5d3-xplained/src/sam_at25.c >> ./arm/sama5/sama5d3-xplained/src/sam_nandflash.c >> ./arm/sama5/sama5d3x-ek/src/sam_at24.c >> ./arm/sama5/sama5d3x-ek/src/sam_at25.c >> ./arm/sama5/sama5d3x-ek/src/sam_nandflash.c >> ./arm/sama5/sama5d4-ek/src/sam_at25.c >> ./arm/sama5/sama5d4-ek/src/sam_nandflash.c >> ./arm/samd5e5/metro-m4/src/sam_at24.c >> ./arm/samv7/samv71-xult/src/sam_bringup.c >> ./arm/stm32/cloudctrl/src/stm32_w25.c >> ./arm/stm32/fire-stm32v2/src/stm32_w25.c >> ./arm/stm32/shenzhou/src/stm32_w25.c >> ./arm/stm32/stm32f103-minimum/src/stm32_at24.c >> ./arm/stm32l4/stm32l476vg-disco/src/stm32_appinit.c >> ./arm/tiva/tm4c123g-launchpad/src/tm4c_at24.c >> ./mips/pic32mx/mirtoo/src/pic32_appinit.c >> ./xtensa/esp32/esp32-devkitc/src/esp32_spiflash.c >> ./xtensa/esp32/esp32-ethernet-kit/src/esp32_spiflash.c >> ./xtensa/esp32/esp32-wrover-kit/src/esp32_spiflash.c >> >> The block driver should be called /dev/mtdblockN where N is the minor >> device number passed as the first argument to ftl_initialize(). >> >> On 8/25/2021 11:04 AM, Tim wrote: >> > I seem to have got over most of my SPI flash and EEPROM issues now and >> my >> > 256Mb SPI flash is properly recognised. >> > >> > >> > >> > I think I am at the last hurdle. Here is the console output, along with >> my >> > question of the day :) >> > >> > >> > >> > Successfully initialized M25P SPI >> > >> > m25p_initialize: dev: 0x2005b970 >> > >> > m25p_readid: priv: 0x2005b990 >> > >> > m25p_readid: manufacturer: 20 memory: ba capacity: 19 >> > >> > m25p_initialize: Return 0x2005b990 >> > >> > Successfully bound SPI0 CS1 to the SPI FLASH driver >> > >> > m25p_ioctl: cmd: 1537 >> > >> > m25p_ioctl: blocksize: 256 erasesize: 4096 neraseblocks: 8192 >> > >> > m25p_ioctl: return 0 >> > >> > m25p_bread: startblock: 00000000 nblocks: 1 >> > >> > m25p_read: offset: 00000000 nbytes: 256 >> > >> > m25p_waitwritecomplete: Complete >> > >> > m25p_read: return nbytes: 256 >> > >> > nxffs_nextentry: No entry found >> > >> > nxffs_limits: No inodes found >> > >> > nxffs_limits: Free FLASH region begins at offset: 5 >> > >> > nxffs_limits: First inode at offset 5 >> > >> > Succesfully initialised NXFSS >> > >> > nx_mount: ERROR: Failed to find block driver (null) >> > >> > Failed to mount the NXFSS volume -15 >> > >> > >> > >> > I believe the block driver would be "/dev/M25P" (M25P, for example) but >> > there is no code I have found that specifies the block driver location. >> I >> > have: >> > >> > >> > >> > ret = nxfss_initialize(mtd); >> > >> > >> > >> > then >> > >> > >> > >> > ret = nx_mount("NULL, "/mnt/M25P", 0, NUL); >> > >> > >> > >> > and that seems to be in common with other "bringup" code; using NULL >> rather >> > than "/dev/something". >> > >> > >> > >> > Just need the last piece of this jigsaw if anyone could be so kind :) >> > >> >>