Trouble embedding binary files in ESP-IDF ( using PlatformIO


Hi, Using the ESP-IDF framework in PlatformIO, I’m trying to get binary files to be linked in to objects using the directive: COMPONENT_EMBED_FILES. But it seems that PlatformIO is ignoring files in my project hierarchy.

The structure of my project is:

| |->
| |->sound.wav
| |->main.c
| |->sdkconfig.h

The contents of is simply: COMPONENT_EMBED_FILES := sound.wav

The main.c files references the binary object as by creating an external reference to it as shown below:
extern const uint8_t sound_wav_start[] asm("_binary_sound_wav_start");
extern const uint8_t sound_wav_end[] asm("_binary_sound_wav_end");

Has anyone had success including binary files in their project under PlatformIO using the ESP-IDF framework?



You need


@wrox have you figured out how? ivankravets’ response is rather vague


Which flag exactly? does not contain COMPONENT_EMBED_FILES. Works in ESP-IDF but not in PlatformIO for me.


Could you provide full output from ESP-IDF without PIO how does it work? Need to understand how do they handle COMPONENT_EMBED_FILES


I’m trying to use an ESP-IDF library which has a containing a list of files to be embedded in the build as follows:

COMPONENT_EMBED_FILES := style.css jquery.gz code.js index.html

I’m getting compile errors when trying to include this library in my project:

.pioenvs/esp32dev/src/http_server.o:(.literal.http_server_netconn_serve+0x4c): undefined reference to `_binary_style_css_start’
collect2: error: ld returned 1 exit status
*** [.pioenvs/esp32dev/firmware.elf] Error 1

How to tell the compiler, tell PlatformIO to link these assests?


I am new to this forum, but the troubles with PlatformIO to treat the “” Files has forced to register me

I build the project with esp-idf @janoist1 refers to:
Building with PlatformIO gives the errors of the previous post

here are the relevant lines i greped out
$ make > make.txt 2>&1
$ grep -C 7 index.html make.txt
CC build/main/http_server.o
CC build/main/wifi_manager.o
CC build/main/main.o
CC build/main/json.o
EMBED build/main/style.css.bin.o
EMBED build/main/jquery.gz.bin.o
EMBED build/main/code.js.bin.o
EMBED build/main/index.html.bin.o
AR build/main/libmain.a
CC build/mbedtls/library/ecp_curves.o
CC build/mbedtls/library/sha512.o
CC build/mbedtls/library/pkcs12.o
CC build/mbedtls/library/ccm.o
CC build/mbedtls/library/pkcs5.o
CC build/mbedtls/library/pk.o

@ivankravets Watever you need to fix the issue with the File you get it
beacause the espidf-framework in PlatformIO is useless for Projects with embedded Files (like picures, json.js, certs …)

Excuse my bad english
Best regards


Hello again

I have trouble with a Link in my post (maximum 2 Links per post)

So here is the complete make run at pastebin of the Project janoist1 refers to
on pastebin -->

There is another post with a simular Problem

Best regards