From 3455992218cb02391d2c31a6405597d84163c88b Mon Sep 17 00:00:00 2001 From: Wang Qixiang <43193572+wqx6@users.noreply.github.com> Date: Tue, 16 Nov 2021 22:07:00 +0800 Subject: [PATCH] fix compilation errors for other esp examples on esp32c3 (#11716) --- examples/ipv6only-app/esp32/README.md | 4 ++++ examples/ipv6only-app/esp32/main/main.cpp | 2 +- examples/lock-app/esp32/README.md | 4 ++++ examples/lock-app/esp32/main/include/AppConfig.h | 8 +++++++- examples/pigweed-app/esp32/README.md | 4 ++++ examples/temperature-measurement-app/esp32/README.md | 4 ++++ .../GenericThreadStackManagerImpl_OpenThread.cpp | 2 +- 7 files changed, 25 insertions(+), 3 deletions(-) diff --git a/examples/ipv6only-app/esp32/README.md b/examples/ipv6only-app/esp32/README.md index e53262f096adcb..6f4e17cc7a1ffe 100644 --- a/examples/ipv6only-app/esp32/README.md +++ b/examples/ipv6only-app/esp32/README.md @@ -55,6 +55,10 @@ make sure the IDF_PATH has been exported(See the manual setup steps above). $ source ./scripts/activate.sh +- Select IDF Target + + $ idf.py set-target esp32(or esp32c3) + - Configuration Options To choose from the different configuration options, run menuconfig diff --git a/examples/ipv6only-app/esp32/main/main.cpp b/examples/ipv6only-app/esp32/main/main.cpp index 3c1bdf301d3f53..c6104e9da89b91 100644 --- a/examples/ipv6only-app/esp32/main/main.cpp +++ b/examples/ipv6only-app/esp32/main/main.cpp @@ -50,7 +50,7 @@ void UdpReceiver(void * pvParameters) int optval; // flag value for setsockopt int n; // message byte size int sockfd = 0; - unsigned int clientlen; // byte size of client's address + socklen_t clientlen; // byte size of client's address struct sockaddr_in6 clientaddr; // client addr while (1) diff --git a/examples/lock-app/esp32/README.md b/examples/lock-app/esp32/README.md index 8b3daffbac7009..eaab96db2f228b 100644 --- a/examples/lock-app/esp32/README.md +++ b/examples/lock-app/esp32/README.md @@ -57,6 +57,10 @@ make sure the IDF_PATH has been exported(See the manual setup steps above). $ source ./scripts/activate.sh +- Target Set + + $ idf.py set-target esp32(or esp32c3) + - Configuration Options This application uses `ESP32-DevKitC` as a default device type. To use other diff --git a/examples/lock-app/esp32/main/include/AppConfig.h b/examples/lock-app/esp32/main/include/AppConfig.h index 61256e16425716..ec883599d56627 100644 --- a/examples/lock-app/esp32/main/include/AppConfig.h +++ b/examples/lock-app/esp32/main/include/AppConfig.h @@ -22,13 +22,19 @@ // ---- Lock Example App Config ---- #define APP_TASK_NAME "LOCK-APP" - +#if CONFIG_IDF_TARGET_ESP32 #define SYSTEM_STATE_LED GPIO_NUM_25 #define LOCK_STATE_LED GPIO_NUM_26 #define APP_LOCK_BUTTON GPIO_NUM_34 #define APP_FUNCTION_BUTTON GPIO_NUM_35 +#elif CONFIG_IDF_TARGET_ESP32C3 +#define SYSTEM_STATE_LED GPIO_NUM_8 +#define LOCK_STATE_LED GPIO_NUM_9 +#define APP_LOCK_BUTTON GPIO_NUM_18 +#define APP_FUNCTION_BUTTON GPIO_NUM_19 +#endif #define APP_BUTTON_DEBOUNCE_PERIOD_MS 50 #define APP_BUTTON_PRESSED 0 diff --git a/examples/pigweed-app/esp32/README.md b/examples/pigweed-app/esp32/README.md index f9d8beea77f5f0..50d0a7bab0780d 100644 --- a/examples/pigweed-app/esp32/README.md +++ b/examples/pigweed-app/esp32/README.md @@ -71,6 +71,10 @@ To download and install packages. $ source ./scripts/activate.sh +- Target Select + + $ idf.py set-target esp32(or esp32c3) + - Configuration Options To choose from the different configuration options, run menuconfig. diff --git a/examples/temperature-measurement-app/esp32/README.md b/examples/temperature-measurement-app/esp32/README.md index e1f74180bb3d51..8d56feb11c5575 100644 --- a/examples/temperature-measurement-app/esp32/README.md +++ b/examples/temperature-measurement-app/esp32/README.md @@ -57,6 +57,10 @@ make sure the IDF_PATH has been exported(See the manual setup steps above). $ source ./scripts/activate.sh +- Target Select + + $ idf.py set-target esp32(or esp32c3) + - Configuration Options This application uses `ESP32-DevKitC` as a default device type. To use other diff --git a/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.cpp b/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.cpp index b762c2af1d09f1..92ea4cec28f0db 100644 --- a/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.cpp +++ b/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.cpp @@ -827,7 +827,7 @@ CHIP_ERROR GenericThreadStackManagerImpl_OpenThread::_WriteThreadNetw case ThreadNetworkDiagnostics::Attributes::RoutingRole::Id: { otDeviceRole role = otThreadGetDeviceRole(mOTInst); - err = encoder.Encode(role); + err = encoder.Encode(static_cast(role)); } break;