Trouble embedding binary files in ESP-IDF (component.mk) using PlatformIO


#1

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

The structure of my project is:

Project
|->components
| |->component.mk
| |->sound.wav
|->lib
|->src
| |->main.c
| |->sdkconfig.h
|
.
.

The contents of component.mk 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?

Thanks


#2

You need http://docs.platformio.org/en/latest/platforms/espressif32.html#uploading-files-to-file-system-spiffs


#3

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


#4

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


#5

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


#6

Hi,
I’m trying to use an ESP-IDF library which has a component.mk 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?


#7

Hallo
I am new to this forum, but the troubles with PlatformIO to treat the “component.mk” 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 component.mk 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
Michael


#8

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 --> https://pastebin.com/5SAhBVL9

There is another post with a simular Problem

Best regards
Michael