diff --git a/CMakeLists.txt b/CMakeLists.txt index 12cf50a..8d22af1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,6 +7,12 @@ add_compile_options("-Werror") option(VE_BUILD_WEB "Build the Vigilant UI with npm when the embedded HTML is missing" ON) set(VE_VIGILANT_HTML "" CACHE FILEPATH "Path to a prebuilt vigilant.html file for firmware builds") +if(NOT DEFINED ENV{IDF_PATH} OR "$ENV{IDF_PATH}" STREQUAL "") + message(FATAL_ERROR + "IDF_PATH is not set. Open the project from an exported ESP-IDF shell or use the VS Code ESP-IDF extension. " + "Generic CMake Tools launches do not load the ESP-IDF environment automatically.") +endif() + include($ENV{IDF_PATH}/tools/cmake/project.cmake) # "Trim" the build. Include the minimal set of components, main, and anything it depends on. diff --git a/docs/partitions.md b/docs/partitions.md index 01c6a7f..026ab5b 100644 --- a/docs/partitions.md +++ b/docs/partitions.md @@ -4,8 +4,8 @@ The project uses a custom partition layout defined in `partitions.csv`. ## Primary partitions -- `factory`: Recovery firmware (1 MB at `0x10000`) -- `ota_0`: Main firmware (~2.94 MB at `0x110000`) +- `factory`: Recovery firmware (1.1875 MB at `0x10000`) +- `ota_0`: Main firmware (2.75 MB at `0x140000`) - `otadata`: OTA selection data The `factory` partition is intended as a stable fallback and should not be overwritten during diff --git a/docs/troubleshooting.md b/docs/troubleshooting.md index e66dedc..68baed3 100644 --- a/docs/troubleshooting.md +++ b/docs/troubleshooting.md @@ -6,6 +6,8 @@ You are not in an ESP-IDF exported shell. - Windows: open ESP-IDF PowerShell - Linux/macOS: source `export.sh` +- In VS Code, prefer the ESP-IDF extension over generic `CMake Tools` +- If `CMake Tools` logs an include failure for `/tools/cmake/project.cmake`, it launched without the ESP-IDF environment ## `BIN not found` diff --git a/partitions.csv b/partitions.csv index b4e43e3..719efae 100644 --- a/partitions.csv +++ b/partitions.csv @@ -2,7 +2,7 @@ nvs, data, nvs, 0x9000, 0x4000, otadata, data, ota, 0xD000, 0x2000, phy_init, data, phy, 0xF000, 0x1000, -factory, app, factory, 0x10000, 0x100000, -ota_0, app, ota_0, 0x110000, 0x2F0000, +factory, app, factory, 0x10000, 0x130000, +ota_0, app, ota_0, 0x140000, 0x2C0000, -# esptool.py write_flash 0x110000 build/vigilant-engine.bin \ No newline at end of file +# esptool.py write_flash 0x140000 build/vigilant-engine.bin diff --git a/vigilant-engine-recovery/CMakeLists.txt b/vigilant-engine-recovery/CMakeLists.txt index 3a114e1..bac0625 100644 --- a/vigilant-engine-recovery/CMakeLists.txt +++ b/vigilant-engine-recovery/CMakeLists.txt @@ -2,6 +2,16 @@ # CMakeLists in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.16) +if(NOT DEFINED ENV{IDF_PATH} OR "$ENV{IDF_PATH}" STREQUAL "") + message(FATAL_ERROR + "IDF_PATH is not set. Open the recovery firmware from an exported ESP-IDF shell or use the VS Code ESP-IDF extension. " + "Generic CMake Tools launches do not load the ESP-IDF environment automatically.") +endif() + +if(NOT DEFINED IDF_TARGET AND NOT DEFINED ENV{IDF_TARGET}) + set(IDF_TARGET "esp32c6") +endif() + include($ENV{IDF_PATH}/tools/cmake/project.cmake) # "Trim" the build. Include the minimal set of components, main, and anything it depends on. idf_build_set_property(MINIMAL_BUILD ON) @@ -20,7 +30,7 @@ if(VE_BUILD_WEB) set(VE_NODE_ROOT_DIR "${VE_REPO_ROOT}") set(VE_WEB_DIR "${VE_REPO_ROOT}/vigilant-engine-frontend") - set(VE_OUT_RECOVERY "${CMAKE_SOURCE_DIR}/main/static/index.html") + set(VE_OUT_RECOVERY "${VE_REPO_ROOT}/build/static/recovery/index.html") set(VE_WEB_STAMP "${CMAKE_BINARY_DIR}/ve_web_build.stamp") file(GLOB_RECURSE VE_WEB_SOURCES CONFIGURE_DEPENDS diff --git a/vigilant-engine-recovery/main/CMakeLists.txt b/vigilant-engine-recovery/main/CMakeLists.txt index b4a25bd..63b9651 100644 --- a/vigilant-engine-recovery/main/CMakeLists.txt +++ b/vigilant-engine-recovery/main/CMakeLists.txt @@ -1,8 +1,11 @@ +get_filename_component(VE_REPO_ROOT "${CMAKE_CURRENT_LIST_DIR}/../.." ABSOLUTE) +set(VE_RECOVERY_HTML "${VE_REPO_ROOT}/build/static/recovery/index.html") + idf_component_register( SRCS "recovery_app.c" INCLUDE_DIRS "." EMBED_FILES - "static/index.html" + "${VE_RECOVERY_HTML}" REQUIRES esp_wifi esp_netif esp_event nvs_flash esp_http_server app_update esp_partition )