Page 1 of 1

I want to load a bin file into memory. Is it necessary to declare a partition?

Posted: Mon Nov 27, 2023 6:48 am
by natee.th
I want to load a bin file used to store audio data (raw PCM) and be able to program it by partition in a csv file. What declarations do I need in partitions, spiffs or other types? What directories do I need?




I learned it through this video https://www.youtube.com/watch?v=V9-cgXag4Ko
What should I do next?

Re: I want to load a bin file into memory. Is it necessary to declare a partition?

Posted: Tue Nov 28, 2023 4:56 pm
by ESP_adokitkat
Hello.

you can use SPIFFS or FATFS or LittleFS filesystem to achieve this. I do not recommend using SPIFFS since it's no longer maintained by its author.

These are our examples which achieve your goal for each filesystem:
https://github.com/espressif/esp-idf/tr ... /spiffsgen
https://github.com/espressif/esp-idf/tr ... e/fatfsgen
https://github.com/espressif/esp-idf/tr ... e/littlefs

In each example project, there is `main/CMakeLists.txt` file calling a function, which generates the filesystem binary from a folder on your computer specified in `main/CMakeLists.txt`. You can put your audio file there and then it will be included in the generated binary and flashed to you ESP device with `idf.py flash` command. You can access this partition and file in your C code.