mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
examples: Move idf_as_lib sdkconfig file to the project directory
Also add some explanation about configuring the project in the README Previously with the default build-esp32.sh script, the build directory was deleted and recreated so the project would always be built with default config.
This commit is contained in:
parent
80f993bf31
commit
c90d6ae9af
@ -14,7 +14,7 @@ if("${TARGET}" STREQUAL "esp32")
|
||||
# processing the component is needed for flashing related
|
||||
# targets and file generation
|
||||
COMPONENTS esp32 freertos esptool_py
|
||||
SDKCONFIG ${CMAKE_BINARY_DIR}/sdkconfig
|
||||
SDKCONFIG ${CMAKE_CURRENT_LIST_DIR}/sdkconfig
|
||||
BUILD_DIR ${CMAKE_BINARY_DIR})
|
||||
else()
|
||||
# Create stubs for esp32 and freertos, stub::esp32 and stub::freertos
|
||||
|
@ -44,6 +44,8 @@ or run [build.sh](./build.sh) to build for the host:
|
||||
./build-esp32.sh
|
||||
```
|
||||
|
||||
Note: To build for a different target SoC, copy the `build-esp32.sh` file and change the `-DTARGET=esp32` clause on the second line.
|
||||
|
||||
or
|
||||
|
||||
```bash
|
||||
@ -68,6 +70,24 @@ or
|
||||
./run.sh
|
||||
```
|
||||
|
||||
## Configuring this Example
|
||||
|
||||
To modify the example ESP-IDF project configuration, first create the CMake build directory. This can be done by running `build-esp32.sh` or by running only the first two lines in `build-esp32.sh` (which won't build the actual project yet).
|
||||
|
||||
Then execute the menuconfig build target in the build directory:
|
||||
|
||||
```bash
|
||||
cmake --build build -- menuconfig
|
||||
```
|
||||
|
||||
If using ninja directly:
|
||||
|
||||
```bash
|
||||
ninja -C build menuconfig
|
||||
```
|
||||
|
||||
Note: ESP-IDF project configuration isn't used by the host CMake builds, the config is only read when the project is built using the ESP-IDF build system.
|
||||
|
||||
---
|
||||
|
||||
There is a discussion on using ESP-IDF in custom CMake projects in the programming guide under `API Guides` -> `Build System` -> `Using ESP-IDF in Custom CMake Projects`
|
||||
|
@ -455,35 +455,36 @@ function run_tests()
|
||||
|
||||
print_status "Building a project with CMake library imported and PSRAM workaround, all files compile with workaround"
|
||||
# Test for libraries compiled within ESP-IDF
|
||||
rm -rf build
|
||||
rm -r build sdkconfig
|
||||
echo "CONFIG_ESP32_SPIRAM_SUPPORT=y" >> sdkconfig.defaults
|
||||
echo "CONFIG_SPIRAM_CACHE_WORKAROUND=y" >> sdkconfig.defaults
|
||||
# note: we do 'reconfigure' here, as we just need to run cmake
|
||||
idf.py -C $IDF_PATH/examples/build_system/cmake/import_lib -B `pwd`/build -D SDKCONFIG_DEFAULTS="`pwd`/sdkconfig.defaults" reconfigure
|
||||
grep -q '"command"' build/compile_commands.json || failure "compile_commands.json missing or has no no 'commands' in it"
|
||||
(grep '"command"' build/compile_commands.json | grep -v mfix-esp32-psram-cache-issue) && failure "All commands in compile_commands.json should use PSRAM cache workaround"
|
||||
rm -r sdkconfig.defaults build
|
||||
# Test for external libraries in custom CMake projects with ESP-IDF components linked
|
||||
mkdir build && touch build/sdkconfig
|
||||
echo "CONFIG_ESP32_SPIRAM_SUPPORT=y" >> build/sdkconfig
|
||||
echo "CONFIG_SPIRAM_CACHE_WORKAROUND=y" >> build/sdkconfig
|
||||
rm -r build sdkconfig sdkconfig.defaults
|
||||
|
||||
print_status "Test for external libraries in custom CMake projects with ESP-IDF components linked"
|
||||
mkdir build
|
||||
IDF_AS_LIB=$IDF_PATH/examples/build_system/cmake/idf_as_lib
|
||||
echo "CONFIG_ESP32_SPIRAM_SUPPORT=y" > $IDF_AS_LIB/sdkconfig
|
||||
echo "CONFIG_SPIRAM_CACHE_WORKAROUND=y" >> $IDF_AS_LIB/sdkconfig
|
||||
# note: we just need to run cmake
|
||||
(cd build && cmake $IDF_PATH/examples/build_system/cmake/idf_as_lib -DCMAKE_TOOLCHAIN_FILE=$IDF_PATH/tools/cmake/toolchain-esp32.cmake -DTARGET=esp32)
|
||||
(cd build && cmake $IDF_AS_LIB -DCMAKE_TOOLCHAIN_FILE=$IDF_PATH/tools/cmake/toolchain-esp32.cmake -DTARGET=esp32)
|
||||
grep -q '"command"' build/compile_commands.json || failure "compile_commands.json missing or has no no 'commands' in it"
|
||||
(grep '"command"' build/compile_commands.json | grep -v mfix-esp32-psram-cache-issue) && failure "All commands in compile_commands.json should use PSRAM cache workaround"
|
||||
rm -r build
|
||||
#Test for various strategies
|
||||
|
||||
for strat in MEMW NOPS DUPLDST; do
|
||||
rm -r build sdkconfig.defaults sdkconfig sdkconfig.defaults.esp32
|
||||
print_status "Test for external libraries in custom CMake projects with PSRAM strategy $strat"
|
||||
rm -r build sdkconfig sdkconfig.defaults sdkconfig.defaults.esp32
|
||||
stratlc=`echo $strat | tr A-Z a-z`
|
||||
mkdir build && touch build/sdkconfig
|
||||
echo "CONFIG_ESP32_SPIRAM_SUPPORT=y" > sdkconfig.defaults
|
||||
echo "CONFIG_SPIRAM_CACHE_WORKAROUND_STRATEGY_$strat=y" >> sdkconfig.defaults
|
||||
echo "CONFIG_SPIRAM_CACHE_WORKAROUND=y" >> sdkconfig.defaults
|
||||
# note: we do 'reconfigure' here, as we just need to run cmake
|
||||
idf.py reconfigure
|
||||
grep -q '"command"' build/compile_commands.json || failure "compile_commands.json missing or has no no 'commands' in it"
|
||||
(grep '"command"' build/compile_commands.json | grep -v mfix-esp32-psram-cache-strategy=$stratlc) && failure "All commands in compile_commands.json should use PSRAM cache workaround strategy $strat when selected"
|
||||
(grep '"command"' build/compile_commands.json | grep -v mfix-esp32-psram-cache-strategy=$stratlc) && failure "All commands in compile_commands.json should use PSRAM cache workaround strategy"
|
||||
echo ${PWD}
|
||||
rm -r sdkconfig.defaults build
|
||||
done
|
||||
|
Loading…
Reference in New Issue
Block a user