On Wed, Oct 30, 2024 at 2:00 AM Tim Hardisty <timhardist...@gmail.com> wrote:
> Whilst FAT on a NOR flash may generally be seen a not such a great > idea...please ignore that and confirm if... > > ...I am right in deducing that I can't simply make a FAT file system on > (say) the third mtd partition (with 512 byte sector emulation) > (partitions 0, 1 and 2 are "raw" data) since FAT will treat the entire > flash devices as a "volume" and so fail to find a partition table at the > bottom end of the flash device? The partition is different from the file system. A file system can mount on either a block/mtd device, or a partition. FAT can work only with the block device, so you can't mount FAT on a flash(mtd) device, only the special designed file system(e.g. littlefs, smartfs, spiffs) can work with mtd device directly. The traditional block based file system need FTL(flash translation layer) to work with mtd device, so you can try dhara if you really want to use FAT on flash device: https://github.com/apache/nuttx/blob/master/drivers/mtd/dhara.c If so, it no doubt explains why I can > format a FAT FS but not mount it. > > Which command do you use to format the device or partition? I could - perhaps should - re-jig my partitions so partition 0 is used > for FAT, rather than partition 3, but before I do that are there any FAT > FA/NuttX gurus who can let me know if there is a way to do this (and > save me the hassle of reworking my bootstrap and MCUboot locations etc. > for now)? You can format the device with GPT/MBR partition by: https://github.com/apache/nuttx-apps/tree/master/fsutils/mkgpt https://github.com/apache/nuttx-apps/tree/master/fsutils/mkmbr But, the raw flash device normally doesn't use GPT/MBR partition, instead hardcode the partition in the code directly since CPU normally could run firmware directly on flash devices which normally define a proprietary partition scheme. For this case, you can use PTABLE/TXTABLE: https://github.com/apache/nuttx/blob/master/fs/partition/fs_ptable.c https://github.com/apache/nuttx/blob/master/fs/partition/fs_txtable.c