COMPONENT_EMBED_FILES & Cmake
Posted: Thu Jun 27, 2019 4:43 pm
Anyone have any clear information on how to embed files using cmake?
You can specify argument COMPONENT_EMBED_FILES in the component registration, giving space-delimited names of the files to embed:
idf_component_register(...
EMBED_FILES server_root_cert.der)
idf_component_register(...
COMPONENT_EMBED_FILES server_root_cert.der)
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
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()
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 ==========
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");