COMPONENT_EMBED_FILES & Cmake
COMPONENT_EMBED_FILES & Cmake
Anyone have any clear information on how to embed files using cmake?
Re: COMPONENT_EMBED_FILES & Cmake
Please check the docs: https://docs.espressif.com/projects/esp ... inary-data
And an example: https://github.com/espressif/esp-idf/bl ... sts.txt#L6
And an example: https://github.com/espressif/esp-idf/bl ... sts.txt#L6
Re: COMPONENT_EMBED_FILES & Cmake
Thank you. Though i have read those before and it was clear as mud to me.
For instance, they say:
But the example they give does not add up:
Should it not read.
I tried both ways none the less, and it still did not work giving "undefined reference to `_binary_less_min_js_end' "
The default CMakeLists.txt file before I made any changes is:
Using the old make way i just simply added this in component.mk file.
I need to mimic this for the Cmake way.
For instance, they say:
You can specify argument COMPONENT_EMBED_FILES in the component registration, giving space-delimited names of the files to embed:
But the example they give does not add up:
idf_component_register(...
EMBED_FILES server_root_cert.der)
Should it not read.
idf_component_register(...
COMPONENT_EMBED_FILES server_root_cert.der)
I tried both ways none the less, and it still did not work giving "undefined reference to `_binary_less_min_js_end' "
The default CMakeLists.txt file before I made any changes is:
Code: Select all
set(COMPONENT_SRCS main.c myTools.c MyWiFi.c nvs_storage.c ota_server.c Task_ClockMonitor.c Task_plantControl.c updateTime.c WebServer.c)
set(COMPONENT_ADD_INCLUDEDIRS ".")
register_component()
Code: Select all
COMPONENT_SRCDIRS += WebsiteFiles
COMPONENT_EMBED_FILES := WebsiteFiles/index.html WebsiteFiles/favicon.ico WebsiteFiles/timepicker.less WebsiteFiles/less.min.js
Re: COMPONENT_EMBED_FILES & Cmake
Sorry, with recent changes it indeed became not clear: the snippet shows the new component registration approach based on arguments, while the text describes the older approach based on component variables.
Which version of IDF are you using? The snippet in the documentation will work with latest IDF, but not with 3.3 or 3.2.
Which version of IDF are you using? The snippet in the documentation will work with latest IDF, but not with 3.3 or 3.2.
Re: COMPONENT_EMBED_FILES & Cmake
Thanks for clearing that all up. I am using v3.2-rc
So knowing this, what should the CMakeLists.txt file look like to embed those files using 3.2 or 3.3 ?
So knowing this, what should the CMakeLists.txt file look like to embed those files using 3.2 or 3.3 ?
Re: COMPONENT_EMBED_FILES & Cmake
Here's the documentation page for v3.2: https://docs.espressif.com/projects/esp ... inary-data
and an example: https://github.com/espressif/esp-idf/bl ... sts.txt#L8
and an example: https://github.com/espressif/esp-idf/bl ... sts.txt#L8
Re: COMPONENT_EMBED_FILES & Cmake
Here is the complete file. CMakeLists.txt file
Using set(COMPONENT_EMBED_TXTFILES index.html favicon.ico timepicker.less less.min.js)
or
set(COMPONENT_EMBED_FILES index.html favicon.ico timepicker.less less.min.js)
Compiles to the following errors.
Code: Select all
set(COMPONENT_SRCS main.c myTools.c MyWiFi.c nvs_storage.c ota_server.c Task_ClockMonitor.c Task_plantControl.c updateTime.c WebServer.c)
set(COMPONENT_ADD_INCLUDEDIRS ".")
set(COMPONENT_EMBED_FILES index.html favicon.ico timepicker.less less.min.js)
register_component()
Using set(COMPONENT_EMBED_TXTFILES index.html favicon.ico timepicker.less less.min.js)
or
set(COMPONENT_EMBED_FILES index.html favicon.ico timepicker.less less.min.js)
Compiles to the following errors.
Code: Select all
main/libmain.a(index.html.S.obj): In function `index_html':
(.rodata.embedded+0x0): multiple definition of `index_html'
main/libmain.a(WebServer.c.obj):(.data.index_html+0x0): first defined here
main/libmain.a(timepicker.less.S.obj): In function `timepicker_less':
(.rodata.embedded+0x0): multiple definition of `timepicker_less'
main/libmain.a(WebServer.c.obj):(.data.timepicker_less+0x0): first defined here
main/libmain.a(less.min.js.S.obj): In function `less_min_js':
(.rodata.embedded+0x0): multiple definition of `less_min_js'
main/libmain.a(WebServer.c.obj):(.data.less_min_js+0x0): first defined here
collect2.exe: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
-------------------------------------------------------------
Command exited with code 1
Executable: C:\PROGRA~2\Sysprogs\VISUAL~1/ninja.exe
Arguments:
Directory: C:\Users\Jim\source\repos\PlantLightCmake/VisualGDB/Release
VisualGDB: Error: Command-line action failed
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Re: COMPONENT_EMBED_FILES & Cmake
In Webserver.c, do you have a variable 'index_html' defined? The linker says that this variable is defined in two places: the embedded file and Webserver.c.
Re: COMPONENT_EMBED_FILES & Cmake
Yes, in WebServer.c I have the following.
Code: Select all
extern const uint8_t index_html_start[] asm("_binary_index_html_start");
extern const uint8_t index_html_end[] asm("_binary_index_html_end");
extern const uint8_t favicon_ico_start[] asm("_binary_favicon_ico_start");
extern const uint8_t favicon_ico_end[] asm("_binary_favicon_ico_end");
extern const uint8_t timepicker_less_start[] asm("_binary_timepicker_less_start");
extern const uint8_t timepicker_less_end[] asm("_binary_timepicker_less_end");
extern const uint8_t less_min_js_start[] asm("_binary_less_min_js_start");
extern const uint8_t less_min_js_end[] asm("_binary_less_min_js_end");
Re: COMPONENT_EMBED_FILES & Cmake
@ESP_igrr, any more suggestions ?
Who is online
Users browsing this forum: No registered users and 111 guests