Hello,
Your hard effort is highly appreciated, so I will give you here all inormations:
Host system is Linux 64 Bit (Linux Mint)
Output of the export script
Code: Select all
Adding ESP-IDF tools to PATH...
Checking if Python packages are up to date...
Python requirements from /home/reiner/esp/esp-idf/requirements.txt are satisfied.
Added the following directories to PATH:
/home/reiner/esp/esp-idf/components/esptool_py/esptool
/home/reiner/esp/esp-idf/components/espcoredump
/home/reiner/esp/esp-idf/components/partition_table/
/home/reiner/esp/tools/xtensa-esp32-elf/esp-2019r2-8.2.0/xtensa-esp32-elf/bin
/home/reiner/esp/tools/xtensa-esp32s2-elf/esp-2019r2-8.2.0/xtensa-esp32s2-elf/bin
/home/reiner/esp/tools/esp32ulp-elf/2.28.51.20170517/esp32ulp-elf-binutils/bin
/home/reiner/esp/tools/openocd-esp32/v0.10.0-esp32-20190708/openocd-esp32/bin
/home/reiner/esp/python_env/idf4.1_py2.7_env/bin
/home/reiner/esp/esp-idf/tools
Done! You can now compile ESP-IDF projects.
Go to the project directory and run:
idf.py build
IDF_PATH is
Directory Layout:
is the root of all my projects.
Code: Select all
├── esp-idf
├── mycomponents
├── time-switch
Inside the
mycomponents directory it looks like this
Code: Select all
.
└── components
├── am2302_helper.c
├── bh1750_helper.c
├── bmx80_helper.c
├── component.mk
├── esp_helper.c
├── file_helper.c
├── http_helper.c
├── i2c_helper.c
├── include
│ ├── am2302_helper.h
│ ├── bh1750_helper.h
│ ├── bmx80_helper.h
│ ├── esp_helper.h
│ ├── file_helper.h
│ ├── http_helper.h
│ ├── http_status.h
│ ├── i2c_helper.h
│ ├── ledc_helper.h
│ ├── list_helper.h
│ ├── log_buffer.h
│ ├── myboard.h
│ ├── myhttp_server.h
│ ├── noip_helper.h
│ ├── nvs_helper.h
│ ├── ota_helper.h
│ ├── partition_helper.h
│ ├── pbank_helper.h
│ ├── sd_helper.h
│ ├── sd_log.h
│ ├── sensor_helper.h
│ ├── sht3x_helper.h
│ ├── str_helper.h
│ ├── terminal_helper.h
│ ├── tsl2561_helper.h
│ ├── tsl2591_helper.h
│ ├── uv_index.h
│ ├── veml6040_helper.h
│ ├── veml6070_helper.h
│ ├── veml6075_helper.h
│ └── wifi_helper.h
├── ledc_helper.c
├── list_helper.c
├── log_buffer.c
├── myhttp_server.c
├── noip_helper.c
├── nvs_helper.c
├── ota_helper.c
├── partition_helper.c
├── pbank_helper.c
├── sd_helper.c
├── sd_log.c
├── sensor_helper.c
├── sht3x_helper.c
├── str_helper.c
├── terminal_helper.c
├── tsl2561_helper.c
├── tsl2591_helper.c
├── veml6040_helper.c
├── veml6070_helper.c
├── veml6075_helper.c
└── wifi_helper.c
The
components.mk here is empty and there is no
CMakeLists.txt - should be there one - and if yes with which content ?
Now lets go inside the
time_switch project
Code: Select all
.
├── build
├── CMakeLists.txt
├── Makefile
├── sdkconfig
├── sdkconfig.defaults
├── sdkconfig.old
└── src
├── CMakeLists.txt
├── component.mk
├── config.html
├── index.html
├── Kconfig.projbuild
├── led_green_off.png
├── led_green_on.png
├── led_x_on.png
├── main.c
├── reset.css
├── timeswitch.css
├── timeswitch.js
├── update.html
└── update.js
The
CMakeLists.txt in the project root looks like this
Code: Select all
# The following five lines of boilerplate have to be in your project's
# CMakeLists in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.5)
set(EXTRA_COMPONENT_DIRS "src" "$ENV{IDF_PATH}/../mycomponents")
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(time_switch)
The Makefile looks like this
Code: Select all
#
# This is a project Makefile. It is assumed the directory this Makefile resides in is a
# project subdirectory.
#
PROJECT_NAME := time-switch
EXTRA_COMPONENT_DIRS += src $(abspath ../mycomponents)
include $(IDF_PATH)/make/project.mk
Now lets go into the
src subfolder:
The
component.mk looks like this
Code: Select all
#
# "main" pseudo-component makefile.
#
# (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.)
COMPONENT_EMBED_FILES := index.html update.html timeswitch.css reset.css timeswitch.js update.js config.html \
led_green_on.png led_green_off.png led_x_on.png
The
CMakeLists.txt looks like this:
Code: Select all
idf_component_register(SRCS "main.c"
INCLUDE_DIRS "."
EMBED_FILES "index.html" "update.html" "timeswitch.css" "reset.css" "timeswitch.js" "update.js" "config.html" "led_green_on.png" "led_green_off.png" "led_x_on.png"
PRIV_REQUIRES "mbedtls" "nvs_flash" "nvs_helper"
)
I include headers like this (from the
main.c file:
Code: Select all
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <dirent.h>
#include <math.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp32/sha.h"
#include "esp_log.h"
#include "nvs_flash.h"
#include "esp_task_wdt.h"
#include "nvs_helper.h"
#include "wifi_helper.h"
#include "myhttp_server.h"
#include "http_helper.h"
#include "file_helper.h"
#include "ota_helper.h"
#include "list_helper.h"
#include "str_helper.h"
#include "http_status.h"
#include "bmx80_helper.h"
#include "sensor_helper.h"
#include "noip_helper.h"
#include "log_buffer.h"
#include "cJSON.h"
#include "mdns.h"
#include "sdkconfig.h"
In the components I include (e.g.
nvs_helper.h
Code: Select all
#ifndef _NVS_HELPER_H
#define _NVS_HELPER_H
#include "nvs_flash.h"
#ifdef __cplusplus
extern "C" {
#endif
// Read
void nvs_read_uint8(nvs_handle nvs, const char* key, uint8_t* value, const uint8_t def_value);
void nvs_read_int8(nvs_handle nvs, const char* key, int8_t* value, const int8_t def_value);
void nvs_read_uint16(nvs_handle nvs, const char* key, uint16_t* value, const uint16_t def_value);
void nvs_read_int16(nvs_handle nvs, const char* key, int16_t* value, const int16_t def_value);
void nvs_read_uint32(nvs_handle nvs, const char* key, uint32_t* value, const uint32_t def_value);
void nvs_read_int32(nvs_handle nvs, const char* key, int32_t* value, const int32_t def_value);
void nvs_read_uint64(nvs_handle nvs, const char* key, uint64_t* value, const uint64_t def_value);
void nvs_read_int64(nvs_handle nvs, const char* key, int64_t* value, const int64_t def_value);
void nvs_read_string(nvs_handle nvs, const char* key, char* str, size_t size, const char* def_str);
esp_err_t nvs_read_float(nvs_handle nvs, const char* key, float* value, const float def_value);
esp_err_t nvs_read_blob(nvs_handle nvs, const char* key, void** data, size_t* size);
// Write
esp_err_t nvs_write_uint8(nvs_handle nvs, const char* key, const uint8_t value);
esp_err_t nvs_write_int8(nvs_handle nvs, const char* key, const int8_t value);
esp_err_t nvs_write_uint16(nvs_handle nvs, const char* key, const uint16_t value);
esp_err_t nvs_write_int16(nvs_handle nvs, const char* key, const int16_t value);
esp_err_t nvs_write_uint32(nvs_handle nvs, const char* key, const uint32_t value);
esp_err_t nvs_write_int32(nvs_handle nvs, const char* key, const int32_t value);
esp_err_t nvs_write_uint64(nvs_handle nvs, const char* key, const uint64_t value);
esp_err_t nvs_write_int64(nvs_handle nvs, const char* key, const int64_t value);
esp_err_t nvs_write_string(nvs_handle nvs, const char* key, char* str);
esp_err_t nvs_write_float(nvs_handle nvs, const char* key, const float value);
esp_err_t nvs_write_blob(nvs_handle nvs, const char* key, const void* data, size_t size);
// Other
esp_err_t nvs_smart_init(void);
#ifdef __cplusplus
}
#endif
#endif // _NVS_HELPER_H
in the
nvs_helper.c I use:
Code: Select all
#include "esp_err.h"
#include "esp_log.h"
#include "nvs_flash.h"
#include "str_helper.h"
static const char* tag = "nvs_helper";
// Read
// 8
void nvs_read_uint8(nvs_handle nvs, const char* key, uint8_t* value, const uint8_t def_value)
{
esp_err_t err;
if ((err = nvs_get_u8(nvs, key, value)) != ESP_OK)
{
ESP_LOGE(tag, "nvs_get_u8 failed with '%s (%d)'", esp_err_to_name(err), err);
*value = def_value;
}
}
....
Now I deleted all from the
build directory and
idf.py reconfigure gives an error:
Code: Select all
Executing action: reconfigure
Running cmake in directory /home/reiner/esp/time-switch/build
Executing "cmake -G Ninja -DPYTHON_DEPS_CHECKED=1 -DESP_PLATFORM=1 --warn-uninitialized -DCCACHE_ENABLE=0 /home/reiner/esp/time-switch"...
Warn about uninitialized values.
-- Found Git: /usr/bin/git (found version "2.17.1")
-- IDF_TARGET not set, using default target: esp32
-- The C compiler identification is GNU 8.2.0
-- The CXX compiler identification is GNU 8.2.0
-- The ASM compiler identification is GNU
-- Found assembler: /home/reiner/esp/tools/xtensa-esp32-elf/esp-2019r2-8.2.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc
-- Check for working C compiler: /home/reiner/esp/tools/xtensa-esp32-elf/esp-2019r2-8.2.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc
-- Check for working C compiler: /home/reiner/esp/tools/xtensa-esp32-elf/esp-2019r2-8.2.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /home/reiner/esp/tools/xtensa-esp32-elf/esp-2019r2-8.2.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-g++
-- Check for working CXX compiler: /home/reiner/esp/tools/xtensa-esp32-elf/esp-2019r2-8.2.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Project is not inside a git repository, or git repository has no commits; will not use 'git describe' to determine PROJECT_VER.
-- Project version: 1
-- Building ESP-IDF components for target esp32
CMake Error at /home/reiner/esp/esp-idf/tools/cmake/build.cmake:185 (message):
Failed to resolve component 'nvs_helper'.
Call Stack (most recent call first):
/home/reiner/esp/esp-idf/tools/cmake/build.cmake:216 (__build_resolve_and_add_req)
/home/reiner/esp/esp-idf/tools/cmake/build.cmake:425 (__build_expand_requirements)
/home/reiner/esp/esp-idf/tools/cmake/project.cmake:357 (idf_build_process)
CMakeLists.txt:8 (project)
-- Configuring incomplete, errors occurred!
See also "/home/reiner/esp/time-switch/build/CMakeFiles/CMakeOutput.log".
cmake failed with exit code 1
I have attatched the output of the log file