Hi All!
I would like to know if it is possible to have one main folder with code in VS CODE, but to target to different processor types with different *.bin names. To give an example:
I have written some code primarily for the ESP32-WROOM module. Now, I would like to target an ESP32C6 module from the same code base, but with different target binary files: e.g. esp32wroom.bin and esp32c6.bin.
What must I do within the solution folder in VS CODE to address both?
Any hints?
Thanks in advance
Chris
VS CODE: use one source code for different devices (e.g. ESP32 WROOM, ESP32C6)
Re: VS CODE: use one source code for different devices (e.g. ESP32 WROOM, ESP32C6)
If anybody is interested: solved my problem by adding some cmake custom commands to the CMakeList.txt file in the project root folder.
Greetings
Christoph
Greetings
Christoph
-
- Posts: 167
- Joined: Sun May 22, 2022 2:42 pm
Re: VS CODE: use one source code for different devices (e.g. ESP32 WROOM, ESP32C6)
Care to elaborate? I'm always curious about ways to solve this problem.
Conceptually, I like how platformio solves it, however I don't like the additional non-standard abstractions it comes with.
I'm using different board directories where each of it has a dedicated `sdkconfig`, while the code directories are embedded via softlinks.
Conceptually, I like how platformio solves it, however I don't like the additional non-standard abstractions it comes with.
I'm using different board directories where each of it has a dedicated `sdkconfig`, while the code directories are embedded via softlinks.
Re: VS CODE: use one source code for different devices (e.g. ESP32 WROOM, ESP32C6)
No problem It cost me several days to figure out. But this is my (quite simple) solution and it works fine.
In my project structure on disk I added a "Binaries" folder where cmake copies the required files.
Additionally, I saved a "sdkconfig.defaults.xxx" for each target architecture I use (here: "esp32" & "esp32c6").
I added the following commands right after the "project()" command in the main CMakeList.txt file:
In case of trying to decode a core dump you need all these three files. Each time you compile these files are replaced or even created if they dont exist before.
Hope this helps!
Greetings
Christoph
In my project structure on disk I added a "Binaries" folder where cmake copies the required files.
Additionally, I saved a "sdkconfig.defaults.xxx" for each target architecture I use (here: "esp32" & "esp32c6").
I added the following commands right after the "project()" command in the main CMakeList.txt file:
Code: Select all
set(CPU_BIN "Binaries/${PROJECT_NAME}_${IDF_TARGET}.bin")
set(CPU_ELF "Binaries/${PROJECT_NAME}_${IDF_TARGET}.elf")
set(CPU_JSON "Binaries/project_description_${IDF_TARGET}.json")
#file(REMOVE ${PROJECT_DIR}/${CPU_BIN})
#file(REMOVE ${PROJECT_DIR}/${CPU_ELF})
#file(REMOVE ${PROJECT_DIR}/${CPU_JSON})
add_custom_command(
TARGET app
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
${PROJECT_DIR}/build/${PROJECT_NAME}.bin
${PROJECT_DIR}/${CPU_BIN}
VERBATIM
)
add_custom_command(
TARGET app
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
${PROJECT_DIR}/build/${PROJECT_NAME}.elf
${PROJECT_DIR}/${CPU_ELF}
)
add_custom_command(
TARGET app
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
${PROJECT_DIR}/build/project_description.json
${PROJECT_DIR}/${CPU_JSON}
)
Hope this helps!
Greetings
Christoph
Who is online
Users browsing this forum: Orange_Murker and 67 guests