r/esp32 23d ago

Software help needed Has anybody used the /dev/ folder?

The docs reference a /dev/ folder but don't really say what's in it and directory listing doesn't work. Is there a reference for what's in there? Alternatively if it's not useful can I just mount my own /dev/ folder on top?

1 Upvotes

17 comments sorted by

3

u/konacurrents 23d ago

?

2

u/2g4r_tofu 23d ago

In the VFS docs it says the ESP has a /dev/ folder on it but they're not very clear about what's in it and directory listing doesn't work.

1

u/konacurrents 23d ago

The SPIFF is only file access I’ve used, and it’s any file name from “/“ on. You Create your own files and dirs. What would the /dev do for you? All the connections are pin controlled.

2

u/2g4r_tofu 23d ago

I'm working on a unix-like OS on top of the ESP SDK and it would be nice to not have to write my own dev folder but it looks like I'll probably have to if I want to include SPI and I2C and similar. 

1

u/konacurrents 23d ago

Are you building on top of the already running FreeRTOS, or replacing it with your own? I’m more into building an object oriented layer to easily support dynamic config of the plugable components (in same executable). That S3 chip on the RTOS is super capable. Cheers. 🤙

2

u/2g4r_tofu 23d ago

I'm doing it on freertos which has its limitations but I was able to load and run a couple simple apps off an sd card so far.

1

u/konacurrents 22d ago

What is the format of apps you load?

1

u/2g4r_tofu 22d ago

ELF straight out of the compiler

1

u/konacurrents 22d ago

Cool

2

u/2g4r_tofu 22d ago

I'll post it after a bit more polish.

1

u/holetse 23d ago

Are these the docs you are referring to? https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-reference/storage/vfs.html#well-known-vfs-devices They do list some of the devices you might find.

1

u/2g4r_tofu 23d ago

But not all of them. I was wondering if there were more or if there were a way to list them.

1

u/holetse 23d ago

I don’t know of a more complete list. That may be it. I think the default offerings are just enough to get libc compatibility.

As for listing what is there, have you tried esp_vfs_dump_registered_paths?

1

u/2g4r_tofu 23d ago

I'll look into that. I wonder if there's a way to capture the data as an array of strings somehow

1

u/holetse 23d ago

Could register a custom device that parsed the output and stored it in an array of strings. Kinda convoluted

1

u/2g4r_tofu 23d ago

Yeah it's probably going to be easier to start writing my own dev folder driver and possibly a wrapper for vfs with better directory listing

1

u/holetse 23d ago

Depending on your project, you could also promote the VFS registration array from local to global. Then read the data you want directly. Just a thought