NuttX is evolving all the time and although I created a video tutorial at NuttX Channel explaining how to create a RAMDISK, that information is already outdated.

Let’s do it again using the current NuttX version (9.1)

First select the needed options at menuconfig:

Device Drivers  --->
    [*] RAM disk wrapper (mkrd)

Board Selection  --->
    [*] Enable boardctl() interface
    [*] Enable application space creation of RAM disks

File Systems --->
    [*] FAT file system

Compile it and run these commands when NuttX’s nsh show up on serial console:

NuttShell (NSH) NuttX-9.1.0
nsh> ?
help usage: help [-v] []
. cd echo hexdump mkrd pwd test usleep
[ cp exec kill mh rm time xd
? cmp exit ls mount rmdir true
basename dirname false mb mv set uname
break dd free mkdir mw sleep umount
cat df help mkfatfs ps source unset
Builtin Apps:
sh nsh

nsh> mkrd 64
nsh> ls /dev
/dev:
console
null
ram0 <---
ttyS0

nsh> mkfatfs /dev/ram0

nsh> mount -t vfat /dev/ram0 /mnt

nsh> echo "This is a file in RAMDISK" > /mnt/file.txt
nsh> cat /mnt/file.txt
This is a file in RAMDISK
nsh>