Skip to content

Commit

Permalink
ESP32: Fix for CMake build failure for M5Stack and rebuild. (project-…
Browse files Browse the repository at this point in the history
…chip#5834)

* ESP32: Fix for idf.py build failure for M5Stack

* ESP32: Fix for rebuild using idf.py (CMake).

* ESP32: Minor fixes in README.md w.r.t the CMake support added to the examples
  • Loading branch information
sweetymhaiske authored and jimlyall-q committed Apr 12, 2021
1 parent 116578d commit 7c27ad8
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
15 changes: 7 additions & 8 deletions config/esp32/components/chip/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,20 @@ endif()

set(GN_ROOT_TARGET ${CHIP_ROOT}/config/esp32)

set(chip_libraries "${CMAKE_CURRENT_BINARY_DIR}/lib/libCHIP.a")

if(CONFIG_ENABLE_PW_RPC)
list(APPEND chip_libraries "${CMAKE_CURRENT_BINARY_DIR}/lib/libPwRpc.a")
endif()

externalproject_add(
chip_gn
SOURCE_DIR ${CHIP_ROOT}
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}
CONFIGURE_COMMAND ${GN_EXECUTABLE} --root=${GN_ROOT_TARGET} gen --check --fail-on-unused-args ${CMAKE_CURRENT_BINARY_DIR}
BUILD_COMMAND ninja "esp32"
INSTALL_COMMAND ""
BUILD_BYPRODUCTS ${CHIP_LIBRARIES}
BUILD_BYPRODUCTS ${chip_libraries}
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
DEPENDS args_gn
BUILD_ALWAYS 1
Expand Down Expand Up @@ -140,12 +146,6 @@ target_include_directories(${COMPONENT_LIB} INTERFACE

idf_component_get_property(esp32_mbedtls_lib esp32_mbedtls COMPONENT_LIB)

set(chip_libraries "-lCHIP")

if(CONFIG_ENABLE_PW_RPC)
list(APPEND chip_libraries "-lPwRpc")
endif()

if(CONFIG_BT_ENABLED)
idf_component_get_property(bt_lib bt COMPONENT_LIB)
list(APPEND chip_libraries $<TARGET_FILE:${bt_lib}> -lbtdm_app)
Expand All @@ -156,7 +156,6 @@ if(NOT CONFIG_USE_MINIMAL_MDNS)
list(APPEND chip_libraries $<TARGET_FILE:${mdns_lib}>)
endif()

target_link_libraries(${COMPONENT_LIB} INTERFACE "-L${CMAKE_CURRENT_BINARY_DIR}/lib")
target_link_libraries(${COMPONENT_LIB} INTERFACE -Wl,--start-group
${chip_libraries}
$<TARGET_FILE:mbedcrypto> $<TARGET_FILE:${esp32_mbedtls_lib}>
Expand Down
4 changes: 2 additions & 2 deletions examples/all-clusters-app/esp32/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ There are two ways to use the Echo Server running on the device.
2. Now flash the device with the same command as before. (Use the right `/dev`
device)

$ idf make flash monitor ESPPORT=/dev/tty.SLAB_USBtoUART
$ idf.py flash monitor ESPPORT=/dev/tty.SLAB_USBtoUART

3. The device should boot up and connect to your network. When that happens you
will see a log like this in the monitor.
Expand All @@ -152,7 +152,7 @@ There are two ways to use the Echo Server running on the device.
Note: The ESP32 does not support 5GHz networks. Also, the Device will persist
your network configuration. To erase it, simply run.

$ idf make erase_flash ESPPORT=/dev/tty.SLAB_USBtoUART
$ idf.py erase_flash ESPPORT=/dev/tty.SLAB_USBtoUART

### Use the ESP32's Network

Expand Down
3 changes: 2 additions & 1 deletion examples/common/screen-framework/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ idf_component_register(SRCS "Display.cpp"
"ScreenManager.cpp"
"Screen.cpp"
"ListScreen.cpp"
INCLUDE_DIRS "include")
INCLUDE_DIRS "include"
PRIV_REQUIRES tft chip)
4 changes: 2 additions & 2 deletions examples/lock-app/esp32/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ If packages are already installed then simply activate it.
2. Now flash the device with the same command as before. (Use the right `/dev`
device)

$ idf make flash monitor ESPPORT=/dev/ttyUSB0
$ idf.py flash monitor ESPPORT=/dev/ttyUSB0

3. The device should boot up and connect to your network. When that happens you
will see a log like this in the monitor.
Expand All @@ -125,6 +125,6 @@ If packages are already installed then simply activate it.
Note: The ESP32 does not support 5GHz networks. Also, the Device will persist
your network configuration. To erase it, simply run.

$ idf make erase_flash ESPPORT=/dev/ttyUSB0
$ idf.py erase_flash ESPPORT=/dev/ttyUSB0

The demo application supports on-off cluster.
4 changes: 2 additions & 2 deletions examples/temperature-measurement-app/esp32/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ If packages are already installed then simply activate it.
2. Now flash the device with the same command as before. (Use the right `/dev`
device)

$ idf make flash monitor ESPPORT=/dev/ttyUSB0
$ idf.py flash monitor ESPPORT=/dev/ttyUSB0

3. The device should boot up and connect to your network. When that happens you
will see a log like this in the monitor.
Expand All @@ -125,7 +125,7 @@ If packages are already installed then simply activate it.
Note: The ESP32 does not support 5GHz networks. Also, the Device will persist
your network configuration. To erase it, simply run.

$ idf make erase_flash ESPPORT=/dev/ttyUSB0
$ idf.py erase_flash ESPPORT=/dev/ttyUSB0

The demo application supports temperaturemeasurement and basic cluster.

Expand Down

0 comments on commit 7c27ad8

Please sign in to comment.