Page 1 of 1

Upgrade a project from IDF 3.3 to 4.2

Posted: Thu Dec 10, 2020 5:48 pm
by matheusmbg
The problem i'm having is to upgrade a project that i used on IDF v3.3 to v4.0. I adapted some differences on bluetooth lib and etc, i did a CMake.txt inside main folder describing my ".c" files, but i get an error of "ESP_LOGX" (i will show on the end of the post) and "cc1: some warnings being treated as errors". I had this errors once when i had IDF V3.3 and i solved by including "CFLAGS += -Wno-format" at component.mk . I tested my idf 4.0 right now and a hello-world example is compiled without any problems.

My CMakeLists.txt (inside main folder) is:

idf_component_register(SRCS "main_project.c" "timer.c" "bal_id.c" "bluetooth.c" "bovineid_ops.c" "conversions.c" "httpJson.c"
"leds.c" "nvs_handler.c" "ota_handler.c" "packageringbuffer.c" "personalbov_packages.c" "rfid_5f.c"
"rfid_antennachafon.c" "rfid_chafonmu904.c" "rfid_model_abstract.c" "spiffshandler.c" "wifi.c" "wifi_vars.c"
INCLUDE_DIRS "")

component.mk is:
#
# Main component makefile.
#
# This Makefile can be left empty. By default, it will take the sources in the
# src/ directory, compile them and link them into lib(subdirectory_name).a
# in the build directory. This behaviour is entirely configurable,
# please read the ESP-IDF documents if you need to do this.
#
CFLAGS += -Wno-format

CMakeLists.txt (project folder) is:

# The following 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)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(bt_spp_acceptor_demo)

Here is part of the error codes i'm receiving when idf.py build. Most of errors are LOGX related. I get some warnings from some lwip libs, but i think this warnings are not being treated as errors.

/home/matheus/esp/esp-idf/components/log/include/esp_log.h:255:27: error: format '%u' expects argument of type 'unsigned int', but argument 6 has type 'long int' [-Werror=format=]
#define LOG_COLOR(COLOR) "\033[0;" COLOR "m"
^~~~~~~~~
/home/matheus/esp/esp-idf/components/log/include/esp_log.h:258:27: note: in expansion of macro 'LOG_COLOR'
#define LOG_COLOR_E LOG_COLOR(LOG_COLOR_RED)
^~~~~~~~~
/home/matheus/esp/esp-idf/components/log/include/esp_log.h:272:37: note: in expansion of macro 'LOG_COLOR_E'
#define LOG_FORMAT(letter, format) LOG_COLOR_ ## letter #letter " (%d) %s: " format LOG_RESET_COLOR "\n"
^~~~~~~~~~
/home/matheus/esp/esp-idf/components/log/include/esp_log.h:329:86: note: in expansion of macro 'LOG_FORMAT'
if (level==ESP_LOG_ERROR ) { esp_log_write(ESP_LOG_ERROR, tag, LOG_FORMAT(E, format), esp_log_timestamp(), tag, ##__VA_ARGS__); } \
^~~~~~~~~~
/home/matheus/esp/esp-idf/components/log/include/esp_log.h:350:41: note: in expansion of macro 'ESP_LOG_LEVEL'
if ( LOG_LOCAL_LEVEL >= level ) ESP_LOG_LEVEL(level, tag, format, ##__VA_ARGS__); \
^~~~~~~~~~~~~
/home/matheus/esp/esp-idf/components/log/include/esp_log.h:296:38: note: in expansion of macro 'ESP_LOG_LEVEL_LOCAL'
#define ESP_LOGI( tag, format, ... ) ESP_LOG_LEVEL_LOCAL(ESP_LOG_INFO, tag, format, ##__VA_ARGS__)
^~~~~~~~~~~~~~~~~~~
../main/personalbov_packages.c:341:8: note: in expansion of macro 'ESP_LOGI'
ESP_LOGI("TaskSendServer", "MPRcv: %u MZRcv: %u Peso Rcv: %d", mpRcv, mzRcv, pesoCalibRcv);
^~~~~~~~
/home/matheus/esp/esp-idf/components/log/include/esp_log.h:255:27: error: format '%u' expects argument of type 'unsigned int', but argument 7 has type 'long int' [-Werror=format=]
#define LOG_COLOR(COLOR) "\033[0;" COLOR "m"
^~~~~~~~~
/home/matheus/esp/esp-idf/components/log/include/esp_log.h:258:27: note: in expansion of macro 'LOG_COLOR'
#define LOG_COLOR_E LOG_COLOR(LOG_COLOR_RED)
^~~~~~~~~
/home/matheus/esp/esp-idf/components/log/include/esp_log.h:272:37: note: in expansion of macro 'LOG_COLOR_E'
#define LOG_FORMAT(letter, format) LOG_COLOR_ ## letter #letter " (%d) %s: " format LOG_RESET_COLOR "\n"
^~~~~~~~~~
/home/matheus/esp/esp-idf/components/log/include/esp_log.h:329:86: note: in expansion of macro 'LOG_FORMAT'
if (level==ESP_LOG_ERROR ) { esp_log_write(ESP_LOG_ERROR, tag, LOG_FORMAT(E, format), esp_log_timestamp(), tag, ##__VA_ARGS__); } \
^~~~~~~~~~
/home/matheus/esp/esp-idf/components/log/include/esp_log.h:350:41: note: in expansion of macro 'ESP_LOG_LEVEL'
if ( LOG_LOCAL_LEVEL >= level ) ESP_LOG_LEVEL(level, tag, format, ##__VA_ARGS__); \
^~~~~~~~~~~~~
/home/matheus/esp/esp-idf/components/log/include/esp_log.h:296:38: note: in expansion of macro 'ESP_LOG_LEVEL_LOCAL'
#define ESP_LOGI( tag, format, ... ) ESP_LOG_LEVEL_LOCAL(ESP_LOG_INFO, tag, format, ##__VA_ARGS__)
^~~~~~~~~~~~~~~~~~~
../main/personalbov_packages.c:341:8: note: in expansion of macro 'ESP_LOGI'
ESP_LOGI("TaskSendServer", "MPRcv: %u MZRcv: %u Peso Rcv: %d", mpRcv, mzRcv, pesoCalibRcv);
^~~~~~~~
/home/matheus/esp/esp-idf/components/log/include/esp_log.h:255:27: error: format '%u' expects argument of type 'unsigned int', but argument 6 has type 'long int' [-Werror=format=]
#define LOG_COLOR(COLOR) "\033[0;" COLOR "m"
^~~~~~~~~
/home/matheus/esp/esp-idf/components/log/include/esp_log.h:259:27: note: in expansion of macro 'LOG_COLOR'
#define LOG_COLOR_W LOG_COLOR(LOG_COLOR_BROWN)
^~~~~~~~~
/home/matheus/esp/esp-idf/components/log/include/esp_log.h:272:37: note: in expansion of macro 'LOG_COLOR_W'
#define LOG_FORMAT(letter, format) LOG_COLOR_ ## letter #letter " (%d) %s: " format LOG_RESET_COLOR "\n"
^~~~~~~~~~
/home/matheus/esp/esp-idf/components/log/include/esp_log.h:330:86: note: in expansion of macro 'LOG_FORMAT'
else if (level==ESP_LOG_WARN ) { esp_log_write(ESP_LOG_WARN, tag, LOG_FORMAT(W, format), esp_log_timestamp(), tag, ##__VA_ARGS__); } \