Hello, im running on git master branch ESP-IDF v4.2-dev-1660-g7d7521367
I have a little POC to play with a lora library. There is two C files : sender.c and receiver.c
I would like to be able to produce 2 bin files : sender.bin and receiver.bin from the same project and same build.
Is it possible ? If yes, how ?
one project to produce two bins
Re: one project to produce two bins
Unfortunately, there is no easy way to do this at the moment - however this is a use case we are looking into. If you're comfortable with CMake and duplicating code in some components, it is possible to do so. For example:
The snippet above creates a 2nd executable, links against ESP-IDF components, and generates a binary file for the 2nd executable. The binary generation in particular is derived from `esptool_py/project_include.cmake`.
In your case the main project (hello-world in example above) could be the sender or reciever , and the other one becomes the 2nd executable (exe2).
Code: Select all
...
project(hello-world)
add_executable(exe2 other_main.c) # other_main.c has the same contents as hello_world_main.c
target_link_libraries(exe2 idf::newlib idf::freertos idf::spi_flash idf::esp_system)
add_dependencies(exe2 hello-world.elf)
idf_build_get_property(build_dir BUILD_DIR)
add_custom_command(
TARGET exe2 POST_BUILD
COMMAND ${ESPTOOLPY} elf2image ${ESPTOOLPY_FLASH_OPTIONS} ${esptool_elf2image_args}
-o "exe2.bin" "$<TARGET_FILE:exe2>"
VERBATIM
WORKING_DIRECTORY ${build_dir}
)
The snippet above creates a 2nd executable, links against ESP-IDF components, and generates a binary file for the 2nd executable. The binary generation in particular is derived from `esptool_py/project_include.cmake`.
In your case the main project (hello-world in example above) could be the sender or reciever , and the other one becomes the 2nd executable (exe2).
Who is online
Users browsing this forum: No registered users and 244 guests