From 684d2e09649fb97785733279c130c21e7ebe3a3b Mon Sep 17 00:00:00 2001 From: FReenen Date: Fri, 19 Jul 2024 22:32:21 +0200 Subject: [PATCH] move to esp-idf instad of platformio --- rx_esp32/.gitignore | 3 +- rx_esp32/.vscode/extensions.json | 10 ---- rx_esp32/CMakeLists.txt | 3 ++ rx_esp32/lib/README | 46 ------------------- rx_esp32/platformio.ini | 14 ------ ...sdkconfig.esp32-c6-devkitc-1 => sdkconfig} | 23 +++++++--- rx_esp32/src/CMakeLists.txt | 16 +++++-- rx_esp32/src/commands.c | 14 +++--- rx_esp32/src/config.h | 2 +- rx_esp32/src/main.c | 4 +- rx_esp32/src/wifi_scan.c | 2 - 11 files changed, 45 insertions(+), 92 deletions(-) delete mode 100644 rx_esp32/.vscode/extensions.json delete mode 100644 rx_esp32/lib/README delete mode 100644 rx_esp32/platformio.ini rename rx_esp32/{sdkconfig.esp32-c6-devkitc-1 => sdkconfig} (98%) diff --git a/rx_esp32/.gitignore b/rx_esp32/.gitignore index 57c8cfa..eb4153b 100644 --- a/rx_esp32/.gitignore +++ b/rx_esp32/.gitignore @@ -4,4 +4,5 @@ .vscode/launch.json .vscode/ipch -build \ No newline at end of file +build +.cache \ No newline at end of file diff --git a/rx_esp32/.vscode/extensions.json b/rx_esp32/.vscode/extensions.json deleted file mode 100644 index 080e70d..0000000 --- a/rx_esp32/.vscode/extensions.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - // See http://go.microsoft.com/fwlink/?LinkId=827846 - // for the documentation about the extensions.json format - "recommendations": [ - "platformio.platformio-ide" - ], - "unwantedRecommendations": [ - "ms-vscode.cpptools-extension-pack" - ] -} diff --git a/rx_esp32/CMakeLists.txt b/rx_esp32/CMakeLists.txt index 15c4ae3..b35ba0d 100644 --- a/rx_esp32/CMakeLists.txt +++ b/rx_esp32/CMakeLists.txt @@ -1,3 +1,6 @@ cmake_minimum_required(VERSION 3.16.0) + +set(COMPONENT_DIRS $ENV{IDF_PATH}/components ./lib ./src) + include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(rx_esp32) diff --git a/rx_esp32/lib/README b/rx_esp32/lib/README deleted file mode 100644 index 2593a33..0000000 --- a/rx_esp32/lib/README +++ /dev/null @@ -1,46 +0,0 @@ - -This directory is intended for project specific (private) libraries. -PlatformIO will compile them to static libraries and link into executable file. - -The source code of each library should be placed in an own separate directory -("lib/your_library_name/[here are source files]"). - -For example, see a structure of the following two libraries `Foo` and `Bar`: - -|--lib -| | -| |--Bar -| | |--docs -| | |--examples -| | |--src -| | |- Bar.c -| | |- Bar.h -| | |- library.json (optional, custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html -| | -| |--Foo -| | |- Foo.c -| | |- Foo.h -| | -| |- README --> THIS FILE -| -|- platformio.ini -|--src - |- main.c - -and a contents of `src/main.c`: -``` -#include -#include - -int main (void) -{ - ... -} - -``` - -PlatformIO Library Dependency Finder will find automatically dependent -libraries scanning project source files. - -More information about PlatformIO Library Dependency Finder -- https://docs.platformio.org/page/librarymanager/ldf.html diff --git a/rx_esp32/platformio.ini b/rx_esp32/platformio.ini deleted file mode 100644 index ca6e8e2..0000000 --- a/rx_esp32/platformio.ini +++ /dev/null @@ -1,14 +0,0 @@ -; PlatformIO Project Configuration File -; -; Build options: build flags, source filter -; Upload options: custom upload port, speed and extra flags -; Library options: dependencies, extra library storages -; Advanced options: extra scripting -; -; Please visit documentation for the other options and examples -; https://docs.platformio.org/page/projectconf.html - -[env:esp32-c6-devkitc-1] -platform = espressif32 -board = esp32-c6-devkitc-1 -framework = espidf diff --git a/rx_esp32/sdkconfig.esp32-c6-devkitc-1 b/rx_esp32/sdkconfig similarity index 98% rename from rx_esp32/sdkconfig.esp32-c6-devkitc-1 rename to rx_esp32/sdkconfig index 1d64293..296e553 100644 --- a/rx_esp32/sdkconfig.esp32-c6-devkitc-1 +++ b/rx_esp32/sdkconfig @@ -1,6 +1,6 @@ # # Automatically generated file. DO NOT EDIT. -# Espressif IoT Development Framework (ESP-IDF) 5.2.1 Project Configuration +# Espressif IoT Development Framework (ESP-IDF) 5.2.2 Project Configuration # CONFIG_SOC_ADC_SUPPORTED=y CONFIG_SOC_DEDICATED_GPIO_SUPPORTED=y @@ -111,8 +111,6 @@ CONFIG_SOC_GPIO_PIN_COUNT=31 CONFIG_SOC_GPIO_SUPPORT_PIN_GLITCH_FILTER=y CONFIG_SOC_GPIO_FLEX_GLITCH_FILTER_NUM=8 CONFIG_SOC_GPIO_SUPPORT_ETM=y -CONFIG_SOC_GPIO_ETM_EVENTS_PER_GROUP=8 -CONFIG_SOC_GPIO_ETM_TASKS_PER_GROUP=8 CONFIG_SOC_GPIO_SUPPORT_RTC_INDEPENDENT=y CONFIG_SOC_GPIO_SUPPORT_DEEPSLEEP_WAKEUP=y CONFIG_SOC_GPIO_IN_RANGE_MAX=30 @@ -133,6 +131,7 @@ CONFIG_SOC_I2C_NUM=1 CONFIG_SOC_I2C_FIFO_LEN=32 CONFIG_SOC_I2C_CMD_REG_NUM=8 CONFIG_SOC_I2C_SUPPORT_SLAVE=y +CONFIG_SOC_I2C_SUPPORT_HW_FSM_RST=y CONFIG_SOC_I2C_SUPPORT_HW_CLR_BUS=y CONFIG_SOC_I2C_SUPPORT_XTAL=y CONFIG_SOC_I2C_SUPPORT_RTC=y @@ -291,6 +290,7 @@ CONFIG_SOC_UART_SUPPORT_PLL_F80M_CLK=y CONFIG_SOC_UART_SUPPORT_RTC_CLK=y CONFIG_SOC_UART_SUPPORT_XTAL_CLK=y CONFIG_SOC_UART_SUPPORT_WAKEUP_INT=y +CONFIG_SOC_UART_HAS_LP_UART=y CONFIG_SOC_UART_SUPPORT_FSM_TX_WAIT_SEND=y CONFIG_SOC_COEX_HW_PTI=y CONFIG_SOC_EXTERNAL_COEX_ADVANCE=y @@ -327,6 +327,7 @@ CONFIG_SOC_TEMPERATURE_SENSOR_SUPPORT_FAST_RC=y CONFIG_SOC_TEMPERATURE_SENSOR_SUPPORT_XTAL=y CONFIG_SOC_TEMPERATURE_SENSOR_INTR_SUPPORT=y CONFIG_SOC_WIFI_HW_TSF=y +CONFIG_SOC_WIFI_FTM_SUPPORT=y CONFIG_SOC_WIFI_GCMP_SUPPORT=y CONFIG_SOC_WIFI_WAPI_SUPPORT=y CONFIG_SOC_WIFI_CSI_SUPPORT=y @@ -349,7 +350,7 @@ CONFIG_IDF_TOOLCHAIN="gcc" CONFIG_IDF_TARGET_ARCH_RISCV=y CONFIG_IDF_TARGET_ARCH="riscv" CONFIG_IDF_TARGET="esp32c6" -CONFIG_IDF_INIT_VERSION="5.2.1" +CONFIG_IDF_INIT_VERSION="5.2.2" CONFIG_IDF_TARGET_ESP32C6=y CONFIG_IDF_FIRMWARE_CHIP_ID=0x000D @@ -558,6 +559,7 @@ CONFIG_APPTRACE_LOCK_ENABLE=y # Bluetooth # # CONFIG_BT_ENABLED is not set +CONFIG_BT_ALARM_MAX_NUM=50 # end of Bluetooth # @@ -752,7 +754,10 @@ CONFIG_ESP_EVENT_POST_FROM_IRAM_ISR=y # # GDB Stub # +CONFIG_ESP_GDBSTUB_ENABLED=y # CONFIG_ESP_SYSTEM_GDBSTUB_RUNTIME is not set +CONFIG_ESP_GDBSTUB_SUPPORT_TASKS=y +CONFIG_ESP_GDBSTUB_MAX_TASKS=32 # end of GDB Stub # @@ -924,11 +929,11 @@ CONFIG_ESP_PHY_CALIBRATION_AND_DATA_STORAGE=y CONFIG_ESP_PHY_MAX_WIFI_TX_POWER=20 CONFIG_ESP_PHY_MAX_TX_POWER=20 # CONFIG_ESP_PHY_REDUCE_TX_POWER is not set -# CONFIG_ESP_PHY_ENABLE_USB is not set CONFIG_ESP_PHY_RF_CAL_PARTIAL=y # CONFIG_ESP_PHY_RF_CAL_NONE is not set # CONFIG_ESP_PHY_RF_CAL_FULL is not set CONFIG_ESP_PHY_CALIBRATION_MODE=0 +# CONFIG_ESP_PHY_PLL_TRACK_DEBUG is not set # end of PHY # @@ -1072,6 +1077,7 @@ CONFIG_ESP_WIFI_ENABLE_SAE_PK=y CONFIG_ESP_WIFI_SOFTAP_SAE_SUPPORT=y CONFIG_ESP_WIFI_ENABLE_WPA3_OWE_STA=y # CONFIG_ESP_WIFI_SLP_IRAM_OPT is not set +# CONFIG_ESP_WIFI_FTM_ENABLE is not set CONFIG_ESP_WIFI_STA_DISCONNECTED_PM_ENABLE=y # CONFIG_ESP_WIFI_GCMP_SUPPORT is not set # CONFIG_ESP_WIFI_GMAC_SUPPORT is not set @@ -1180,6 +1186,7 @@ CONFIG_FREERTOS_QUEUE_REGISTRY_SIZE=0 CONFIG_FREERTOS_TASK_NOTIFICATION_ARRAY_ENTRIES=1 # CONFIG_FREERTOS_USE_TRACE_FACILITY is not set # CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS is not set +# CONFIG_FREERTOS_USE_APPLICATION_TASK_TAG is not set # end of Kernel # @@ -1484,7 +1491,9 @@ CONFIG_MBEDTLS_CMAC_C=y CONFIG_MBEDTLS_HARDWARE_AES=y CONFIG_MBEDTLS_AES_USE_INTERRUPT=y CONFIG_MBEDTLS_AES_INTERRUPT_LEVEL=0 +# CONFIG_MBEDTLS_GCM_SUPPORT_NON_AES_CIPHER is not set CONFIG_MBEDTLS_HARDWARE_MPI=y +CONFIG_MBEDTLS_LARGE_KEY_SOFTWARE_MPI=y CONFIG_MBEDTLS_MPI_USE_INTERRUPT=y CONFIG_MBEDTLS_MPI_INTERRUPT_LEVEL=0 CONFIG_MBEDTLS_HARDWARE_SHA=y @@ -1573,7 +1582,7 @@ CONFIG_MBEDTLS_ECP_FIXED_POINT_OPTIM=y # CONFIG_MBEDTLS_CHACHA20_C is not set # CONFIG_MBEDTLS_HKDF_C is not set # CONFIG_MBEDTLS_THREADING_C is not set -CONFIG_MBEDTLS_LARGE_KEY_SOFTWARE_MPI=y +CONFIG_MBEDTLS_ERROR_STRINGS=y # end of mbedTLS # @@ -1874,6 +1883,8 @@ CONFIG_ESP_WIFI_SW_COEXIST_ENABLE=y # CONFIG_EVENT_LOOP_PROFILING is not set CONFIG_POST_EVENTS_FROM_ISR=y CONFIG_POST_EVENTS_FROM_IRAM_ISR=y +CONFIG_GDBSTUB_SUPPORT_TASKS=y +CONFIG_GDBSTUB_MAX_TASKS=32 # CONFIG_OTA_ALLOW_HTTP is not set # CONFIG_ESP_SYSTEM_PD_FLASH is not set CONFIG_ESP32_PHY_CALIBRATION_AND_DATA_STORAGE=y diff --git a/rx_esp32/src/CMakeLists.txt b/rx_esp32/src/CMakeLists.txt index d8744f5..39b41cf 100644 --- a/rx_esp32/src/CMakeLists.txt +++ b/rx_esp32/src/CMakeLists.txt @@ -1,6 +1,16 @@ # This file was automatically generated for projects # without default 'CMakeLists.txt' file. -FILE(GLOB_RECURSE app_sources ${CMAKE_SOURCE_DIR}/src/*.c) - -idf_component_register(SRCS ${app_sources}) +idf_component_register( + SRCS + ./main.c + ./utils.c + ./wifi.c + ./wifi_scan.c + ./led.c + ./commands.c + INCLUDE_DIRS "./" + PRIV_REQUIRES + cli + spi_flash driver nvs_flash esp_wifi +) diff --git a/rx_esp32/src/commands.c b/rx_esp32/src/commands.c index ee964c5..34ac845 100644 --- a/rx_esp32/src/commands.c +++ b/rx_esp32/src/commands.c @@ -26,12 +26,12 @@ int cmd_contrl(char* line, void* cli) extern volatile bool running; int cmd_shutdown(char* line, void* cli) { - CLI_stringOut(cli, "goodby.\n"); + CLI_stringOut((CLI_t*)cli, "goodby.\n"); running = false; return INT_MIN; } -int cmd_status(char* line, CLI_t* cli) +int cmd_status(char* line, void* cli) { char* arg = getNextArg(line, ':'); int ret = 0; @@ -60,15 +60,15 @@ int cmd_status(char* line, CLI_t* cli) { case BOAT_AVAILABLE: snprintf(&str[0], 20, "status:available\n"); - CLI_stringOut(cli, &str[0]); + CLI_stringOut((CLI_t*)cli, &str[0]); break; case BOAT_INCTRL: snprintf(&str[0], 20, "status:inctrl\n"); - CLI_stringOut(cli, &str[0]); + CLI_stringOut((CLI_t*)cli, &str[0]); break; case BOAT_LOCKED: snprintf(&str[0], 20, "status:locked\n"); - CLI_stringOut(cli, &str[0]); + CLI_stringOut((CLI_t*)cli, &str[0]); break; } @@ -87,7 +87,7 @@ char* readInt(char* str, int* out) return str; } -int setLed(char* line, CLI_t* cli) +int setLed(char* line, void* cli) { int r, g, b; @@ -102,7 +102,7 @@ int setLed(char* line, CLI_t* cli) char msg[30]; snprintf(&msg[0], 30, "led: r%d g%d n%d\n", r, g, b); - CLI_stringOut(cli, &msg[0]); + CLI_stringOut((CLI_t*)cli, &msg[0]); return 0; } diff --git a/rx_esp32/src/config.h b/rx_esp32/src/config.h index 4a88a4d..ad7fdce 100644 --- a/rx_esp32/src/config.h +++ b/rx_esp32/src/config.h @@ -12,7 +12,7 @@ #define UDP_PORT 1234 -static uint8_t BoatId = 1; +// static uint8_t BoatId = 1; // cli config #define HISTORY diff --git a/rx_esp32/src/main.c b/rx_esp32/src/main.c index 56f488d..9e1abf9 100644 --- a/rx_esp32/src/main.c +++ b/rx_esp32/src/main.c @@ -7,8 +7,8 @@ #include "esp_event.h" #include "esp_task_wdt.h" -#include "CLI/CLI.h" -#include "CMDList/CMDList.h" +#include +#include #include "config.h" #include "utils.h" diff --git a/rx_esp32/src/wifi_scan.c b/rx_esp32/src/wifi_scan.c index a93a24c..ee45bcb 100644 --- a/rx_esp32/src/wifi_scan.c +++ b/rx_esp32/src/wifi_scan.c @@ -18,8 +18,6 @@ static uint8_t channel_list[CHANNEL_LIST_SIZE] = {1, 6, 11}; wifi_ap_record_t ap_info[SCAN_LIST_SIZE]; -static const char *TAG_SCAN = "scan"; - static void print_auth_mode(int authmode) { switch (authmode) {