Project compiling with both PlatformIO and native idf.py ESP-IDF tooling?

brainstorm
Posts: 27
Joined: Mon Dec 12, 2016 12:22 pm

Project compiling with both PlatformIO and native idf.py ESP-IDF tooling?

Postby brainstorm » Fri Oct 14, 2022 5:03 am

Hi,

I'm trying to refresh a ModBus+Power metering+Rainmaker/PVOutput hobby project of mine:

https://github.com/brainstorm/esp-modbus-power-meter/

The refresh I was thinking about consists on leaving PlatformIO part of it working with ESP-IDF 4.4 while transitioning to ESP-IDF 5.x SDK series. My main issue at the time of writing this is tweaking the CMakeLists.txt so that they include what's needed to run idf.py build **while also keeping PlatformIO's build system from breaking**.

After a few roadblocks, I've managed to have the top level CMakeLists.txt and src/CMakeLists.txt like this:

https://github.com/brainstorm/esp-modbu ... eLists.txt
https://github.com/brainstorm/esp-modbu ... eLists.txt

While this works for PlatformIO, this yields several missing headers on both esp-idf's esp_event.h and my own headers under include/ folder when running idf.py build:

Code: Select all

(esp) rvalls@m1 esp-modbus-power-meter % idf.py build
Executing action: all (aliases: build)
Running ninja in directory /Users/rvalls/dev/personal/esp-modbus-power-meter/build
Executing "ninja all"...
[1/19] Building C object esp-idf/src/CMakeFiles/__idf_src.dir/app_rmaker.c.objFAILED: esp-idf/src/CMakeFiles/__idf_src.dir/app_rmaker.c.obj 
/Users/rvalls/.espressif/tools/xtensa-esp32s2-elf/esp-2022r1-11.2.0/xtensa-esp32s2-elf/bin/xtensa-esp32s2-elf-gcc -DESP_PLATFORM -DIDF_VER=\"v5.1-dev-1195-gfa5d0a3513\" -D_GNU_SOURCE -D_POSIX_READER_WRITER_LOCKS -I/Users/rvalls/dev/personal/esp-modbus-power-meter/build/config -I/Users/rvalls/dev/personal/esp-modbus-power-meter/src -I/Users/rvalls/dev/personal/esp-modbus-power-meter/include -I/Users/rvalls/dev/personal/esp-modbus-power-meter/lib/esp-rainmaker/components/esp_rainmaker/include -I/Users/rvalls/dev/personal/esp-modbus-power-meter/lib/esp-rainmaker/components/rmaker_common/include -I/Users/rvalls/esp/esp-idf/components/newlib/platform_include -I/Users/rvalls/esp/esp-idf/components/freertos/FreeRTOS-Kernel/include -I/Users/rvalls/esp/esp-idf/components/freertos/esp_additions/include/freertos -I/Users/rvalls/esp/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/include -I/Users/rvalls/esp/esp-idf/components/freertos/esp_additions/include -I/Users/rvalls/esp/esp-idf/components/esp_hw_support/include -I/Users/rvalls/esp/esp-idf/components/esp_hw_support/include/soc -I/Users/rvalls/esp/esp-idf/components/esp_hw_support/include/soc/esp32s2 -I/Users/rvalls/esp/esp-idf/components/esp_hw_support/port/esp32s2/. -I/Users/rvalls/esp/esp-idf/components/esp_hw_support/port/esp32s2/private_include -I/Users/rvalls/esp/esp-idf/components/heap/include -I/Users/rvalls/esp/esp-idf/components/log/include -I/Users/rvalls/esp/esp-idf/components/soc/include -I/Users/rvalls/esp/esp-idf/components/soc/esp32s2/. -I/Users/rvalls/esp/esp-idf/components/soc/esp32s2/include -I/Users/rvalls/esp/esp-idf/components/hal/esp32s2/include -I/Users/rvalls/esp/esp-idf/components/hal/include -I/Users/rvalls/esp/esp-idf/components/hal/platform_port/include -I/Users/rvalls/esp/esp-idf/components/esp_rom/include -I/Users/rvalls/esp/esp-idf/components/esp_rom/include/esp32s2 -I/Users/rvalls/esp/esp-idf/components/esp_rom/esp32s2 -I/Users/rvalls/esp/esp-idf/components/esp_common/include -I/Users/rvalls/esp/esp-idf/components/esp_system/include -I/Users/rvalls/esp/esp-idf/components/esp_system/port/soc -I/Users/rvalls/esp/esp-idf/components/esp_system/port/include/private -I/Users/rvalls/esp/esp-idf/components/xtensa/include -I/Users/rvalls/esp/esp-idf/components/xtensa/esp32s2/include -I/Users/rvalls/esp/esp-idf/components/lwip/include -I/Users/rvalls/esp/esp-idf/components/lwip/include/apps -I/Users/rvalls/esp/esp-idf/components/lwip/include/apps/sntp -I/Users/rvalls/esp/esp-idf/components/lwip/lwip/src/include -I/Users/rvalls/esp/esp-idf/components/lwip/port/esp32/include -I/Users/rvalls/esp/esp-idf/components/lwip/port/esp32/include/arch -I/Users/rvalls/esp/esp-idf/components/nvs_flash/include -I/Users/rvalls/esp/esp-idf/components/spi_flash/include -mlongcalls  -ffunction-sections -fdata-sections -Wall -Werror=all -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wextra -Wno-unused-parameter -Wno-sign-compare -Wno-enum-conversion -gdwarf-4 -ggdb -Os -freorder-blocks -fstack-protector -fmacro-prefix-map=/Users/rvalls/dev/personal/esp-modbus-power-meter=. -fmacro-prefix-map=/Users/rvalls/esp/esp-idf=/IDF -fstrict-volatile-bitfields -Wno-error=unused-but-set-variable -fno-jump-tables -fno-tree-switch-conversion -DconfigENABLE_FREERTOS_DEBUG_OCDAWARE=1 -std=gnu17 -Wno-old-style-declaration -MD -MT esp-idf/src/CMakeFiles/__idf_src.dir/app_rmaker.c.obj -MF esp-idf/src/CMakeFiles/__idf_src.dir/app_rmaker.c.obj.d -o esp-idf/src/CMakeFiles/__idf_src.dir/app_rmaker.c.obj -c /Users/rvalls/dev/personal/esp-modbus-power-meter/src/app_rmaker.c
In file included from /Users/rvalls/dev/personal/esp-modbus-power-meter/include/app_rmaker.h:8,
                 from /Users/rvalls/dev/personal/esp-modbus-power-meter/src/app_rmaker.c:1:
/Users/rvalls/dev/personal/esp-modbus-power-meter/lib/esp-rainmaker/components/esp_rainmaker/include/esp_rmaker_core.h:18:10: fatal error: esp_event.h: No such file or directory
   18 | #include <esp_event.h>
      |          ^~~~~~~~~~~~~
compilation terminated.
[2/19] Building C object esp-idf/src/CMakeFiles/__idf_src.dir/app_rgbled.c.objFAILED: esp-idf/src/CMakeFiles/__idf_src.dir/app_rgbled.c.obj 
/Users/rvalls/.espressif/tools/xtensa-esp32s2-elf/esp-2022r1-11.2.0/xtensa-esp32s2-elf/bin/xtensa-esp32s2-elf-gcc -DESP_PLATFORM -DIDF_VER=\"v5.1-dev-1195-gfa5d0a3513\" -D_GNU_SOURCE -D_POSIX_READER_WRITER_LOCKS -I/Users/rvalls/dev/personal/esp-modbus-power-meter/build/config -I/Users/rvalls/dev/personal/esp-modbus-power-meter/src -I/Users/rvalls/dev/personal/esp-modbus-power-meter/include -I/Users/rvalls/dev/personal/esp-modbus-power-meter/lib/esp-rainmaker/components/esp_rainmaker/include -I/Users/rvalls/dev/personal/esp-modbus-power-meter/lib/esp-rainmaker/components/rmaker_common/include -I/Users/rvalls/esp/esp-idf/components/newlib/platform_include -I/Users/rvalls/esp/esp-idf/components/freertos/FreeRTOS-Kernel/include -I/Users/rvalls/esp/esp-idf/components/freertos/esp_additions/include/freertos -I/Users/rvalls/esp/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/include -I/Users/rvalls/esp/esp-idf/components/freertos/esp_additions/include -I/Users/rvalls/esp/esp-idf/components/esp_hw_support/include -I/Users/rvalls/esp/esp-idf/components/esp_hw_support/include/soc -I/Users/rvalls/esp/esp-idf/components/esp_hw_support/include/soc/esp32s2 -I/Users/rvalls/esp/esp-idf/components/esp_hw_support/port/esp32s2/. -I/Users/rvalls/esp/esp-idf/components/esp_hw_support/port/esp32s2/private_include -I/Users/rvalls/esp/esp-idf/components/heap/include -I/Users/rvalls/esp/esp-idf/components/log/include -I/Users/rvalls/esp/esp-idf/components/soc/include -I/Users/rvalls/esp/esp-idf/components/soc/esp32s2/. -I/Users/rvalls/esp/esp-idf/components/soc/esp32s2/include -I/Users/rvalls/esp/esp-idf/components/hal/esp32s2/include -I/Users/rvalls/esp/esp-idf/components/hal/include -I/Users/rvalls/esp/esp-idf/components/hal/platform_port/include -I/Users/rvalls/esp/esp-idf/components/esp_rom/include -I/Users/rvalls/esp/esp-idf/components/esp_rom/include/esp32s2 -I/Users/rvalls/esp/esp-idf/components/esp_rom/esp32s2 -I/Users/rvalls/esp/esp-idf/components/esp_common/include -I/Users/rvalls/esp/esp-idf/components/esp_system/include -I/Users/rvalls/esp/esp-idf/components/esp_system/port/soc -I/Users/rvalls/esp/esp-idf/components/esp_system/port/include/private -I/Users/rvalls/esp/esp-idf/components/xtensa/include -I/Users/rvalls/esp/esp-idf/components/xtensa/esp32s2/include -I/Users/rvalls/esp/esp-idf/components/lwip/include -I/Users/rvalls/esp/esp-idf/components/lwip/include/apps -I/Users/rvalls/esp/esp-idf/components/lwip/include/apps/sntp -I/Users/rvalls/esp/esp-idf/components/lwip/lwip/src/include -I/Users/rvalls/esp/esp-idf/components/lwip/port/esp32/include -I/Users/rvalls/esp/esp-idf/components/lwip/port/esp32/include/arch -I/Users/rvalls/esp/esp-idf/components/nvs_flash/include -I/Users/rvalls/esp/esp-idf/components/spi_flash/include -mlongcalls  -ffunction-sections -fdata-sections -Wall -Werror=all -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wextra -Wno-unused-parameter -Wno-sign-compare -Wno-enum-conversion -gdwarf-4 -ggdb -Os -freorder-blocks -fstack-protector -fmacro-prefix-map=/Users/rvalls/dev/personal/esp-modbus-power-meter=. -fmacro-prefix-map=/Users/rvalls/esp/esp-idf=/IDF -fstrict-volatile-bitfields -Wno-error=unused-but-set-variable -fno-jump-tables -fno-tree-switch-conversion -DconfigENABLE_FREERTOS_DEBUG_OCDAWARE=1 -std=gnu17 -Wno-old-style-declaration -MD -MT esp-idf/src/CMakeFiles/__idf_src.dir/app_rgbled.c.obj -MF esp-idf/src/CMakeFiles/__idf_src.dir/app_rgbled.c.obj.d -o esp-idf/src/CMakeFiles/__idf_src.dir/app_rgbled.c.obj -c /Users/rvalls/dev/personal/esp-modbus-power-meter/src/app_rgbled.c
/Users/rvalls/dev/personal/esp-modbus-power-meter/src/app_rgbled.c:5:10: fatal error: app_reset.h: No such file or directory
    5 | #include <app_reset.h>
      |          ^~~~~~~~~~~~~
compilation terminated.
[3/19] Building C object esp-idf/src/CMakeFiles/__idf_src.dir/app_modbus.c.objFAILED: esp-idf/src/CMakeFiles/__idf_src.dir/app_modbus.c.obj 
/Users/rvalls/.espressif/tools/xtensa-esp32s2-elf/esp-2022r1-11.2.0/xtensa-esp32s2-elf/bin/xtensa-esp32s2-elf-gcc -DESP_PLATFORM -DIDF_VER=\"v5.1-dev-1195-gfa5d0a3513\" -D_GNU_SOURCE -D_POSIX_READER_WRITER_LOCKS -I/Users/rvalls/dev/personal/esp-modbus-power-meter/build/config -I/Users/rvalls/dev/personal/esp-modbus-power-meter/src -I/Users/rvalls/dev/personal/esp-modbus-power-meter/include -I/Users/rvalls/dev/personal/esp-modbus-power-meter/lib/esp-rainmaker/components/esp_rainmaker/include -I/Users/rvalls/dev/personal/esp-modbus-power-meter/lib/esp-rainmaker/components/rmaker_common/include -I/Users/rvalls/esp/esp-idf/components/newlib/platform_include -I/Users/rvalls/esp/esp-idf/components/freertos/FreeRTOS-Kernel/include -I/Users/rvalls/esp/esp-idf/components/freertos/esp_additions/include/freertos -I/Users/rvalls/esp/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/include -I/Users/rvalls/esp/esp-idf/components/freertos/esp_additions/include -I/Users/rvalls/esp/esp-idf/components/esp_hw_support/include -I/Users/rvalls/esp/esp-idf/components/esp_hw_support/include/soc -I/Users/rvalls/esp/esp-idf/components/esp_hw_support/include/soc/esp32s2 -I/Users/rvalls/esp/esp-idf/components/esp_hw_support/port/esp32s2/. -I/Users/rvalls/esp/esp-idf/components/esp_hw_support/port/esp32s2/private_include -I/Users/rvalls/esp/esp-idf/components/heap/include -I/Users/rvalls/esp/esp-idf/components/log/include -I/Users/rvalls/esp/esp-idf/components/soc/include -I/Users/rvalls/esp/esp-idf/components/soc/esp32s2/. -I/Users/rvalls/esp/esp-idf/components/soc/esp32s2/include -I/Users/rvalls/esp/esp-idf/components/hal/esp32s2/include -I/Users/rvalls/esp/esp-idf/components/hal/include -I/Users/rvalls/esp/esp-idf/components/hal/platform_port/include -I/Users/rvalls/esp/esp-idf/components/esp_rom/include -I/Users/rvalls/esp/esp-idf/components/esp_rom/include/esp32s2 -I/Users/rvalls/esp/esp-idf/components/esp_rom/esp32s2 -I/Users/rvalls/esp/esp-idf/components/esp_common/include -I/Users/rvalls/esp/esp-idf/components/esp_system/include -I/Users/rvalls/esp/esp-idf/components/esp_system/port/soc -I/Users/rvalls/esp/esp-idf/components/esp_system/port/include/private -I/Users/rvalls/esp/esp-idf/components/xtensa/include -I/Users/rvalls/esp/esp-idf/components/xtensa/esp32s2/include -I/Users/rvalls/esp/esp-idf/components/lwip/include -I/Users/rvalls/esp/esp-idf/components/lwip/include/apps -I/Users/rvalls/esp/esp-idf/components/lwip/include/apps/sntp -I/Users/rvalls/esp/esp-idf/components/lwip/lwip/src/include -I/Users/rvalls/esp/esp-idf/components/lwip/port/esp32/include -I/Users/rvalls/esp/esp-idf/components/lwip/port/esp32/include/arch -I/Users/rvalls/esp/esp-idf/components/nvs_flash/include -I/Users/rvalls/esp/esp-idf/components/spi_flash/include -mlongcalls  -ffunction-sections -fdata-sections -Wall -Werror=all -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wextra -Wno-unused-parameter -Wno-sign-compare -Wno-enum-conversion -gdwarf-4 -ggdb -Os -freorder-blocks -fstack-protector -fmacro-prefix-map=/Users/rvalls/dev/personal/esp-modbus-power-meter=. -fmacro-prefix-map=/Users/rvalls/esp/esp-idf=/IDF -fstrict-volatile-bitfields -Wno-error=unused-but-set-variable -fno-jump-tables -fno-tree-switch-conversion -DconfigENABLE_FREERTOS_DEBUG_OCDAWARE=1 -std=gnu17 -Wno-old-style-declaration -MD -MT esp-idf/src/CMakeFiles/__idf_src.dir/app_modbus.c.obj -MF esp-idf/src/CMakeFiles/__idf_src.dir/app_modbus.c.obj.d -o esp-idf/src/CMakeFiles/__idf_src.dir/app_modbus.c.obj -c /Users/rvalls/dev/personal/esp-modbus-power-meter/src/app_modbus.c
In file included from /Users/rvalls/dev/personal/esp-modbus-power-meter/src/app_modbus.c:13:
/Users/rvalls/dev/personal/esp-modbus-power-meter/include/cid_tables.h:1:10: fatal error: mbcontroller.h: No such file or directory
    1 | #include "mbcontroller.h"       // for mbcontroller defines and api
      |          ^~~~~~~~~~~~~~~~
compilation terminated.
[4/19] Building C object esp-idf/src/CMakeFiles/__idf_src.dir/main.c.objFAILED: esp-idf/src/CMakeFiles/__idf_src.dir/main.c.obj 
/Users/rvalls/.espressif/tools/xtensa-esp32s2-elf/esp-2022r1-11.2.0/xtensa-esp32s2-elf/bin/xtensa-esp32s2-elf-gcc -DESP_PLATFORM -DIDF_VER=\"v5.1-dev-1195-gfa5d0a3513\" -D_GNU_SOURCE -D_POSIX_READER_WRITER_LOCKS -I/Users/rvalls/dev/personal/esp-modbus-power-meter/build/config -I/Users/rvalls/dev/personal/esp-modbus-power-meter/src -I/Users/rvalls/dev/personal/esp-modbus-power-meter/include -I/Users/rvalls/dev/personal/esp-modbus-power-meter/lib/esp-rainmaker/components/esp_rainmaker/include -I/Users/rvalls/dev/personal/esp-modbus-power-meter/lib/esp-rainmaker/components/rmaker_common/include -I/Users/rvalls/esp/esp-idf/components/newlib/platform_include -I/Users/rvalls/esp/esp-idf/components/freertos/FreeRTOS-Kernel/include -I/Users/rvalls/esp/esp-idf/components/freertos/esp_additions/include/freertos -I/Users/rvalls/esp/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/include -I/Users/rvalls/esp/esp-idf/components/freertos/esp_additions/include -I/Users/rvalls/esp/esp-idf/components/esp_hw_support/include -I/Users/rvalls/esp/esp-idf/components/esp_hw_support/include/soc -I/Users/rvalls/esp/esp-idf/components/esp_hw_support/include/soc/esp32s2 -I/Users/rvalls/esp/esp-idf/components/esp_hw_support/port/esp32s2/. -I/Users/rvalls/esp/esp-idf/components/esp_hw_support/port/esp32s2/private_include -I/Users/rvalls/esp/esp-idf/components/heap/include -I/Users/rvalls/esp/esp-idf/components/log/include -I/Users/rvalls/esp/esp-idf/components/soc/include -I/Users/rvalls/esp/esp-idf/components/soc/esp32s2/. -I/Users/rvalls/esp/esp-idf/components/soc/esp32s2/include -I/Users/rvalls/esp/esp-idf/components/hal/esp32s2/include -I/Users/rvalls/esp/esp-idf/components/hal/include -I/Users/rvalls/esp/esp-idf/components/hal/platform_port/include -I/Users/rvalls/esp/esp-idf/components/esp_rom/include -I/Users/rvalls/esp/esp-idf/components/esp_rom/include/esp32s2 -I/Users/rvalls/esp/esp-idf/components/esp_rom/esp32s2 -I/Users/rvalls/esp/esp-idf/components/esp_common/include -I/Users/rvalls/esp/esp-idf/components/esp_system/include -I/Users/rvalls/esp/esp-idf/components/esp_system/port/soc -I/Users/rvalls/esp/esp-idf/components/esp_system/port/include/private -I/Users/rvalls/esp/esp-idf/components/xtensa/include -I/Users/rvalls/esp/esp-idf/components/xtensa/esp32s2/include -I/Users/rvalls/esp/esp-idf/components/lwip/include -I/Users/rvalls/esp/esp-idf/components/lwip/include/apps -I/Users/rvalls/esp/esp-idf/components/lwip/include/apps/sntp -I/Users/rvalls/esp/esp-idf/components/lwip/lwip/src/include -I/Users/rvalls/esp/esp-idf/components/lwip/port/esp32/include -I/Users/rvalls/esp/esp-idf/components/lwip/port/esp32/include/arch -I/Users/rvalls/esp/esp-idf/components/nvs_flash/include -I/Users/rvalls/esp/esp-idf/components/spi_flash/include -mlongcalls  -ffunction-sections -fdata-sections -Wall -Werror=all -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wextra -Wno-unused-parameter -Wno-sign-compare -Wno-enum-conversion -gdwarf-4 -ggdb -Os -freorder-blocks -fstack-protector -fmacro-prefix-map=/Users/rvalls/dev/personal/esp-modbus-power-meter=. -fmacro-prefix-map=/Users/rvalls/esp/esp-idf=/IDF -fstrict-volatile-bitfields -Wno-error=unused-but-set-variable -fno-jump-tables -fno-tree-switch-conversion -DconfigENABLE_FREERTOS_DEBUG_OCDAWARE=1 -std=gnu17 -Wno-old-style-declaration -MD -MT esp-idf/src/CMakeFiles/__idf_src.dir/main.c.obj -MF esp-idf/src/CMakeFiles/__idf_src.dir/main.c.obj.d -o esp-idf/src/CMakeFiles/__idf_src.dir/main.c.obj -c /Users/rvalls/dev/personal/esp-modbus-power-meter/src/main.c
In file included from /Users/rvalls/dev/personal/esp-modbus-power-meter/include/app_rmaker.h:8,
                 from /Users/rvalls/dev/personal/esp-modbus-power-meter/src/main.c:8:
/Users/rvalls/dev/personal/esp-modbus-power-meter/lib/esp-rainmaker/components/esp_rainmaker/include/esp_rmaker_core.h:18:10: fatal error: esp_event.h: No such file or directory
   18 | #include <esp_event.h>
      |          ^~~~~~~~~~~~~
compilation terminated.
[5/19] Building C object esp-idf/src/CMakeFiles/__idf_src.dir/app_pvoutput_org.c.objFAILED: esp-idf/src/CMakeFiles/__idf_src.dir/app_pvoutput_org.c.obj 
/Users/rvalls/.espressif/tools/xtensa-esp32s2-elf/esp-2022r1-11.2.0/xtensa-esp32s2-elf/bin/xtensa-esp32s2-elf-gcc -DESP_PLATFORM -DIDF_VER=\"v5.1-dev-1195-gfa5d0a3513\" -D_GNU_SOURCE -D_POSIX_READER_WRITER_LOCKS -I/Users/rvalls/dev/personal/esp-modbus-power-meter/build/config -I/Users/rvalls/dev/personal/esp-modbus-power-meter/src -I/Users/rvalls/dev/personal/esp-modbus-power-meter/include -I/Users/rvalls/dev/personal/esp-modbus-power-meter/lib/esp-rainmaker/components/esp_rainmaker/include -I/Users/rvalls/dev/personal/esp-modbus-power-meter/lib/esp-rainmaker/components/rmaker_common/include -I/Users/rvalls/esp/esp-idf/components/newlib/platform_include -I/Users/rvalls/esp/esp-idf/components/freertos/FreeRTOS-Kernel/include -I/Users/rvalls/esp/esp-idf/components/freertos/esp_additions/include/freertos -I/Users/rvalls/esp/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/include -I/Users/rvalls/esp/esp-idf/components/freertos/esp_additions/include -I/Users/rvalls/esp/esp-idf/components/esp_hw_support/include -I/Users/rvalls/esp/esp-idf/components/esp_hw_support/include/soc -I/Users/rvalls/esp/esp-idf/components/esp_hw_support/include/soc/esp32s2 -I/Users/rvalls/esp/esp-idf/components/esp_hw_support/port/esp32s2/. -I/Users/rvalls/esp/esp-idf/components/esp_hw_support/port/esp32s2/private_include -I/Users/rvalls/esp/esp-idf/components/heap/include -I/Users/rvalls/esp/esp-idf/components/log/include -I/Users/rvalls/esp/esp-idf/components/soc/include -I/Users/rvalls/esp/esp-idf/components/soc/esp32s2/. -I/Users/rvalls/esp/esp-idf/components/soc/esp32s2/include -I/Users/rvalls/esp/esp-idf/components/hal/esp32s2/include -I/Users/rvalls/esp/esp-idf/components/hal/include -I/Users/rvalls/esp/esp-idf/components/hal/platform_port/include -I/Users/rvalls/esp/esp-idf/components/esp_rom/include -I/Users/rvalls/esp/esp-idf/components/esp_rom/include/esp32s2 -I/Users/rvalls/esp/esp-idf/components/esp_rom/esp32s2 -I/Users/rvalls/esp/esp-idf/components/esp_common/include -I/Users/rvalls/esp/esp-idf/components/esp_system/include -I/Users/rvalls/esp/esp-idf/components/esp_system/port/soc -I/Users/rvalls/esp/esp-idf/components/esp_system/port/include/private -I/Users/rvalls/esp/esp-idf/components/xtensa/include -I/Users/rvalls/esp/esp-idf/components/xtensa/esp32s2/include -I/Users/rvalls/esp/esp-idf/components/lwip/include -I/Users/rvalls/esp/esp-idf/components/lwip/include/apps -I/Users/rvalls/esp/esp-idf/components/lwip/include/apps/sntp -I/Users/rvalls/esp/esp-idf/components/lwip/lwip/src/include -I/Users/rvalls/esp/esp-idf/components/lwip/port/esp32/include -I/Users/rvalls/esp/esp-idf/components/lwip/port/esp32/include/arch -I/Users/rvalls/esp/esp-idf/components/nvs_flash/include -I/Users/rvalls/esp/esp-idf/components/spi_flash/include -mlongcalls  -ffunction-sections -fdata-sections -Wall -Werror=all -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wextra -Wno-unused-parameter -Wno-sign-compare -Wno-enum-conversion -gdwarf-4 -ggdb -Os -freorder-blocks -fstack-protector -fmacro-prefix-map=/Users/rvalls/dev/personal/esp-modbus-power-meter=. -fmacro-prefix-map=/Users/rvalls/esp/esp-idf=/IDF -fstrict-volatile-bitfields -Wno-error=unused-but-set-variable -fno-jump-tables -fno-tree-switch-conversion -DconfigENABLE_FREERTOS_DEBUG_OCDAWARE=1 -std=gnu17 -Wno-old-style-declaration -MD -MT esp-idf/src/CMakeFiles/__idf_src.dir/app_pvoutput_org.c.obj -MF esp-idf/src/CMakeFiles/__idf_src.dir/app_pvoutput_org.c.obj.d -o esp-idf/src/CMakeFiles/__idf_src.dir/app_pvoutput_org.c.obj -c /Users/rvalls/dev/personal/esp-modbus-power-meter/src/app_pvoutput_org.c
In file included from /Users/rvalls/dev/personal/esp-modbus-power-meter/src/app_pvoutput_org.c:5:
/Users/rvalls/dev/personal/esp-modbus-power-meter/include/app_pvoutput_org.h:9:10: fatal error: esp_event.h: No such file or directory
    9 | #include "esp_event.h"
      |          ^~~~~~~~~~~~~
compilation terminated.
[1/1] cd /Users/rvalls/dev/personal/esp-mo...ower-meter/build/bootloader/bootloader.binBootloader binary size 0x4f70 bytes. 0x2090 bytes (29%) free.
[8/17] Building C object esp-idf/esp_insig...df_esp_insights.dir/src/esp_insights.c.objninja: build stopped: subcommand failed.
ninja failed with exit code 1, output of the command is in the /Users/rvalls/dev/personal/esp-modbus-power-meter/build/log/idf_py_stderr_output_23344 and /Users/rvalls/dev/personal/esp-modbus-power-meter/build/log/idf_py_stdout_output_23344
I'm sure there's an easy CMake way of doing this but I explored different documentation/issues, perhaps one of the closest and more recent related ones is:

https://github.com/espressif/esp-idf/issues/9760

ESP_igrr
Posts: 2072
Joined: Tue Dec 01, 2015 8:37 am

Re: Project compiling with both PlatformIO and native idf.py ESP-IDF tooling?

Postby ESP_igrr » Fri Oct 14, 2022 9:29 pm

Hi brainstorm,

I can't give you complete instructions for porting the project to IDF v5.0 since some of the code (in esp-insights) doesn't compile successfully with IDF v5.0 yet.

It might be slightly easier if you split this task into two parts:
  • make the project buildable with IDF build system in v4.4.x release — this should only require CMake level changes
  • port the code to IDF v5.0
For the first part, I can recommend several changes.

1. IDF build system works with components. Typically if you have some top-level application code, it still resides in some component. The usual way in IDF example projects is to have the 'main' component. Since your platformio project is set up with separate 'src' and 'include' directories, we can use the 'src' directory as your main component. (Plus, you already have the component CMakeLists.txt file there!)

Here is your "src" component CMakeLists.txt file after my changes:

Code: Select all

# removed PROJECT_VER — it's not relevant since this is a component (library) CMake file, not the project (application) CMake file

FILE(GLOB_RECURSE app_sources ${CMAKE_SOURCE_DIR}/src/*.*)
idf_component_register(SRCS ${app_sources}
                       INCLUDE_DIRS "."
                       # Since some of the header files in the top-level include directory, add that directory here:
                       ${CMAKE_SOURCE_DIR}/include

                       # If the source code of this component uses header files from other components, add them to this list:
                       PRIV_REQUIRES nvs_flash esp_rainmaker rmaker_common esp_insights
                       
                       # If have removed esp_rainmaker's include directories from the list of INCLUDE_DIRS.
                       # In CMake, you never have to "steal" another library's include directories. They will be added automatically
                       # once you specify library dependencies (PRIV_REQUIRES or REQUIRES)
                       )
2. The component manifest (idf_component.yml) needs to be in a component directory. Since we have started using "src" as the component directory, we should move the file there. Also you need to remove cbor and mdns from the list of requirements since you have already added mdns as a submodule and cbor is present under esp-insights/components.

3. In your project CMakeLists.txt file, you shouldn't add "${CMAKE_CURRENT_LIST_DIR}/include" to EXTRA_COMPONENT_DIRS, since "include" is not a component directory — it doesn't contain a component CMakeLists.txt file. The rest of the EXTRA_COMPONENT_DIRS look okay.

Overall, once rainmaker and esp-insights are available via the IDF component manager and are compatible with IDF v5.0, it will get easier to set up the project — you won't have to deal with adding these libraries as submodules.

brainstorm
Posts: 27
Joined: Mon Dec 12, 2016 12:22 pm

Re: Project compiling with both PlatformIO and native idf.py ESP-IDF tooling?

Postby brainstorm » Sat Oct 15, 2022 7:10 am

Ivan, first of all, thanks for your invaluable help!

A couple of days ago, I reported the esp-insights error you mention and Vikram got it fixed and pushed upstream for me:

https://github.com/espressif/esp-insights/issues/12

I should have merged those changes before asking in here, my bad. Now they are on my project's master branch, those esp-insights errors shouldn't get in the way of what I'm trying to achieve here...

Overall, once rainmaker and esp-insights are available via the IDF component manager and are compatible with IDF v5.0, it will get easier to set up the project — you won't have to deal with adding these libraries as submodules.

Well, unfortunately not quite (yet).

The reason why I'm keeping rainmaker & co under submodules is because I'm working on my own esp-rainmaker "Power Metering" branch where I introduce types to deal with Watts, Amps, Voltages, etc... see the following issue:

https://github.com/espressif/esp-rainmaker/pull/121

But in any case, after applying the CMake recommendations, the header errors seem to persist, although they seem to be limited to esp-insight's app-wifi.h and app-reset.h headers only now, after your suggested changes:

Code: Select all

Executing action: all (aliases: build)
Running ninja in directory /Users/rvalls/dev/personal/esp-modbus-power-meter/build
Executing "ninja all"...
[1/18] Linking C static library esp-idf/esp_rainmaker/libesp_rainmaker.a
[2/18] Building C object esp-idf/src/CMakeFiles/__idf_src.dir/app_rgbled.c.obj
FAILED: esp-idf/src/CMakeFiles/__idf_src.dir/app_rgbled.c.obj 
/Users/rvalls/.espressif/tools/xtensa-esp32s2-elf/esp-2022r1-11.2.0/xtensa-esp32s2-elf/bin/xtensa-esp32s2-elf-gcc -DESP_PLATFORM -DIDF_VER=\"v5.1-dev-1264-g1c84cfde14\" -DMBEDTLS_CONFIG_FILE=\"mbedtls/esp_config.h\" -D_GNU_SOURCE -D_POSIX_READER_WRITER_LOCKS -I/Users/rvalls/dev/personal/esp-modbus-power-meter/build/config -I/Users/rvalls/dev/personal/esp-modbus-power-meter/src -I/Users/rvalls/dev/personal/esp-modbus-power-meter/include -I/Users/rvalls/esp/esp-idf/components/newlib/platform_include -I/Users/rvalls/esp/esp-idf/components/freertos/FreeRTOS-Kernel/include -I/Users/rvalls/esp/esp-idf/components/freertos/esp_additions/include/freertos -I/Users/rvalls/esp/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/include -I/Users/rvalls/esp/esp-idf/components/freertos/esp_additions/include -I/Users/rvalls/esp/esp-idf/components/esp_hw_support/include -I/Users/rvalls/esp/esp-idf/components/esp_hw_support/include/soc -I/Users/rvalls/esp/esp-idf/components/esp_hw_support/include/soc/esp32s2 -I/Users/rvalls/esp/esp-idf/components/esp_hw_support/port/esp32s2/. -I/Users/rvalls/esp/esp-idf/components/esp_hw_support/port/esp32s2/private_include -I/Users/rvalls/esp/esp-idf/components/heap/include -I/Users/rvalls/esp/esp-idf/components/log/include -I/Users/rvalls/esp/esp-idf/components/soc/include -I/Users/rvalls/esp/esp-idf/components/soc/esp32s2/. -I/Users/rvalls/esp/esp-idf/components/soc/esp32s2/include -I/Users/rvalls/esp/esp-idf/components/hal/esp32s2/include -I/Users/rvalls/esp/esp-idf/components/hal/include -I/Users/rvalls/esp/esp-idf/components/hal/platform_port/include -I/Users/rvalls/esp/esp-idf/components/esp_rom/include -I/Users/rvalls/esp/esp-idf/components/esp_rom/include/esp32s2 -I/Users/rvalls/esp/esp-idf/components/esp_rom/esp32s2 -I/Users/rvalls/esp/esp-idf/components/esp_common/include -I/Users/rvalls/esp/esp-idf/components/esp_system/include -I/Users/rvalls/esp/esp-idf/components/esp_system/port/soc -I/Users/rvalls/esp/esp-idf/components/esp_system/port/include/private -I/Users/rvalls/esp/esp-idf/components/xtensa/include -I/Users/rvalls/esp/esp-idf/components/xtensa/esp32s2/include -I/Users/rvalls/esp/esp-idf/components/lwip/include -I/Users/rvalls/esp/esp-idf/components/lwip/include/apps -I/Users/rvalls/esp/esp-idf/components/lwip/include/apps/sntp -I/Users/rvalls/esp/esp-idf/components/lwip/lwip/src/include -I/Users/rvalls/esp/esp-idf/components/lwip/port/esp32/include -I/Users/rvalls/esp/esp-idf/components/lwip/port/esp32/include/arch -I/Users/rvalls/dev/personal/esp-modbus-power-meter/managed_components/espressif__mdns/include -I/Users/rvalls/esp/esp-idf/components/console -I/Users/rvalls/esp/esp-idf/components/vfs/include -I/Users/rvalls/esp/esp-idf/components/esp_netif/include -I/Users/rvalls/esp/esp-idf/components/esp_event/include -I/Users/rvalls/esp/esp-idf/components/esp_http_client/include -I/Users/rvalls/esp/esp-idf/components/esp-tls -I/Users/rvalls/esp/esp-idf/components/esp-tls/esp-tls-crypto -I/Users/rvalls/esp/esp-idf/components/mbedtls/port/include -I/Users/rvalls/esp/esp-idf/components/mbedtls/mbedtls/include -I/Users/rvalls/esp/esp-idf/components/mbedtls/mbedtls/library -I/Users/rvalls/esp/esp-idf/components/mbedtls/esp_crt_bundle/include -I/Users/rvalls/esp/esp-idf/components/nvs_flash/include -I/Users/rvalls/esp/esp-idf/components/spi_flash/include -I/Users/rvalls/dev/personal/esp-modbus-power-meter/lib/esp-rainmaker/components/esp_rainmaker/include -I/Users/rvalls/dev/personal/esp-modbus-power-meter/lib/esp-rainmaker/components/esp-insights/components/rmaker_common/include -I/Users/rvalls/dev/personal/esp-modbus-power-meter/lib/esp-rainmaker/components/esp-insights/components/esp_insights/include -I/Users/rvalls/dev/personal/esp-modbus-power-meter/lib/esp-rainmaker/components/esp-insights/components/esp_diagnostics/include -I/Users/rvalls/dev/personal/esp-modbus-power-meter/managed_components/espressif__esp-modbus/freemodbus/common/include -I/Users/rvalls/esp/esp-idf/components/driver/include -I/Users/rvalls/esp/esp-idf/components/driver/deprecated -I/Users/rvalls/esp/esp-idf/components/driver/esp32s2/include -I/Users/rvalls/esp/esp-idf/components/esp_pm/include -I/Users/rvalls/esp/esp-idf/components/esp_ringbuf/include -I/Users/rvalls/esp/esp-idf/components/esp_timer/include -mlongcalls  -ffunction-sections -fdata-sections -Wall -Werror=all -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wextra -Wno-unused-parameter -Wno-sign-compare -Wno-enum-conversion -gdwarf-4 -ggdb -Os -freorder-blocks -fstack-protector -fmacro-prefix-map=/Users/rvalls/dev/personal/esp-modbus-power-meter=. -fmacro-prefix-map=/Users/rvalls/esp/esp-idf=/IDF -fstrict-volatile-bitfields -Wno-error=unused-but-set-variable -fno-jump-tables -fno-tree-switch-conversion -DconfigENABLE_FREERTOS_DEBUG_OCDAWARE=1 -std=gnu17 -Wno-old-style-declaration -MD -MT esp-idf/src/CMakeFiles/__idf_src.dir/app_rgbled.c.obj -MF esp-idf/src/CMakeFiles/__idf_src.dir/app_rgbled.c.obj.d -o esp-idf/src/CMakeFiles/__idf_src.dir/app_rgbled.c.obj -c /Users/rvalls/dev/personal/esp-modbus-power-meter/src/app_rgbled.c
/Users/rvalls/dev/personal/esp-modbus-power-meter/src/app_rgbled.c:5:10: fatal error: app_reset.h: No such file or directory
    5 | #include <app_reset.h>
      |          ^~~~~~~~~~~~~
compilation terminated.
[3/18] Building C object esp-idf/src/CMakeFiles/__idf_src.dir/app_modbus.c.obj
FAILED: esp-idf/src/CMakeFiles/__idf_src.dir/app_modbus.c.obj 
/Users/rvalls/.espressif/tools/xtensa-esp32s2-elf/esp-2022r1-11.2.0/xtensa-esp32s2-elf/bin/xtensa-esp32s2-elf-gcc -DESP_PLATFORM -DIDF_VER=\"v5.1-dev-1264-g1c84cfde14\" -DMBEDTLS_CONFIG_FILE=\"mbedtls/esp_config.h\" -D_GNU_SOURCE -D_POSIX_READER_WRITER_LOCKS -I/Users/rvalls/dev/personal/esp-modbus-power-meter/build/config -I/Users/rvalls/dev/personal/esp-modbus-power-meter/src -I/Users/rvalls/dev/personal/esp-modbus-power-meter/include -I/Users/rvalls/esp/esp-idf/components/newlib/platform_include -I/Users/rvalls/esp/esp-idf/components/freertos/FreeRTOS-Kernel/include -I/Users/rvalls/esp/esp-idf/components/freertos/esp_additions/include/freertos -I/Users/rvalls/esp/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/include -I/Users/rvalls/esp/esp-idf/components/freertos/esp_additions/include -I/Users/rvalls/esp/esp-idf/components/esp_hw_support/include -I/Users/rvalls/esp/esp-idf/components/esp_hw_support/include/soc -I/Users/rvalls/esp/esp-idf/components/esp_hw_support/include/soc/esp32s2 -I/Users/rvalls/esp/esp-idf/components/esp_hw_support/port/esp32s2/. -I/Users/rvalls/esp/esp-idf/components/esp_hw_support/port/esp32s2/private_include -I/Users/rvalls/esp/esp-idf/components/heap/include -I/Users/rvalls/esp/esp-idf/components/log/include -I/Users/rvalls/esp/esp-idf/components/soc/include -I/Users/rvalls/esp/esp-idf/components/soc/esp32s2/. -I/Users/rvalls/esp/esp-idf/components/soc/esp32s2/include -I/Users/rvalls/esp/esp-idf/components/hal/esp32s2/include -I/Users/rvalls/esp/esp-idf/components/hal/include -I/Users/rvalls/esp/esp-idf/components/hal/platform_port/include -I/Users/rvalls/esp/esp-idf/components/esp_rom/include -I/Users/rvalls/esp/esp-idf/components/esp_rom/include/esp32s2 -I/Users/rvalls/esp/esp-idf/components/esp_rom/esp32s2 -I/Users/rvalls/esp/esp-idf/components/esp_common/include -I/Users/rvalls/esp/esp-idf/components/esp_system/include -I/Users/rvalls/esp/esp-idf/components/esp_system/port/soc -I/Users/rvalls/esp/esp-idf/components/esp_system/port/include/private -I/Users/rvalls/esp/esp-idf/components/xtensa/include -I/Users/rvalls/esp/esp-idf/components/xtensa/esp32s2/include -I/Users/rvalls/esp/esp-idf/components/lwip/include -I/Users/rvalls/esp/esp-idf/components/lwip/include/apps -I/Users/rvalls/esp/esp-idf/components/lwip/include/apps/sntp -I/Users/rvalls/esp/esp-idf/components/lwip/lwip/src/include -I/Users/rvalls/esp/esp-idf/components/lwip/port/esp32/include -I/Users/rvalls/esp/esp-idf/components/lwip/port/esp32/include/arch -I/Users/rvalls/dev/personal/esp-modbus-power-meter/managed_components/espressif__mdns/include -I/Users/rvalls/esp/esp-idf/components/console -I/Users/rvalls/esp/esp-idf/components/vfs/include -I/Users/rvalls/esp/esp-idf/components/esp_netif/include -I/Users/rvalls/esp/esp-idf/components/esp_event/include -I/Users/rvalls/esp/esp-idf/components/esp_http_client/include -I/Users/rvalls/esp/esp-idf/components/esp-tls -I/Users/rvalls/esp/esp-idf/components/esp-tls/esp-tls-crypto -I/Users/rvalls/esp/esp-idf/components/mbedtls/port/include -I/Users/rvalls/esp/esp-idf/components/mbedtls/mbedtls/include -I/Users/rvalls/esp/esp-idf/components/mbedtls/mbedtls/library -I/Users/rvalls/esp/esp-idf/components/mbedtls/esp_crt_bundle/include -I/Users/rvalls/esp/esp-idf/components/nvs_flash/include -I/Users/rvalls/esp/esp-idf/components/spi_flash/include -I/Users/rvalls/dev/personal/esp-modbus-power-meter/lib/esp-rainmaker/components/esp_rainmaker/include -I/Users/rvalls/dev/personal/esp-modbus-power-meter/lib/esp-rainmaker/components/esp-insights/components/rmaker_common/include -I/Users/rvalls/dev/personal/esp-modbus-power-meter/lib/esp-rainmaker/components/esp-insights/components/esp_insights/include -I/Users/rvalls/dev/personal/esp-modbus-power-meter/lib/esp-rainmaker/components/esp-insights/components/esp_diagnostics/include -I/Users/rvalls/dev/personal/esp-modbus-power-meter/managed_components/espressif__esp-modbus/freemodbus/common/include -I/Users/rvalls/esp/esp-idf/components/driver/include -I/Users/rvalls/esp/esp-idf/components/driver/deprecated -I/Users/rvalls/esp/esp-idf/components/driver/esp32s2/include -I/Users/rvalls/esp/esp-idf/components/esp_pm/include -I/Users/rvalls/esp/esp-idf/components/esp_ringbuf/include -I/Users/rvalls/esp/esp-idf/components/esp_timer/include -mlongcalls  -ffunction-sections -fdata-sections -Wall -Werror=all -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wextra -Wno-unused-parameter -Wno-sign-compare -Wno-enum-conversion -gdwarf-4 -ggdb -Os -freorder-blocks -fstack-protector -fmacro-prefix-map=/Users/rvalls/dev/personal/esp-modbus-power-meter=. -fmacro-prefix-map=/Users/rvalls/esp/esp-idf=/IDF -fstrict-volatile-bitfields -Wno-error=unused-but-set-variable -fno-jump-tables -fno-tree-switch-conversion -DconfigENABLE_FREERTOS_DEBUG_OCDAWARE=1 -std=gnu17 -Wno-old-style-declaration -MD -MT esp-idf/src/CMakeFiles/__idf_src.dir/app_modbus.c.obj -MF esp-idf/src/CMakeFiles/__idf_src.dir/app_modbus.c.obj.d -o esp-idf/src/CMakeFiles/__idf_src.dir/app_modbus.c.obj -c /Users/rvalls/dev/personal/esp-modbus-power-meter/src/app_modbus.c
In file included from /Users/rvalls/dev/personal/esp-modbus-power-meter/src/app_modbus.c:22:
/Users/rvalls/dev/personal/esp-modbus-power-meter/include/app_rmaker.h:14:10: fatal error: app_wifi.h: No such file or directory
   14 | #include <app_wifi.h>
      |          ^~~~~~~~~~~~
compilation terminated.
[4/18] Building C object esp-idf/src/CMakeFiles/__idf_src.dir/app_rmaker.c.obj
FAILED: esp-idf/src/CMakeFiles/__idf_src.dir/app_rmaker.c.obj 
/Users/rvalls/.espressif/tools/xtensa-esp32s2-elf/esp-2022r1-11.2.0/xtensa-esp32s2-elf/bin/xtensa-esp32s2-elf-gcc -DESP_PLATFORM -DIDF_VER=\"v5.1-dev-1264-g1c84cfde14\" -DMBEDTLS_CONFIG_FILE=\"mbedtls/esp_config.h\" -D_GNU_SOURCE -D_POSIX_READER_WRITER_LOCKS -I/Users/rvalls/dev/personal/esp-modbus-power-meter/build/config -I/Users/rvalls/dev/personal/esp-modbus-power-meter/src -I/Users/rvalls/dev/personal/esp-modbus-power-meter/include -I/Users/rvalls/esp/esp-idf/components/newlib/platform_include -I/Users/rvalls/esp/esp-idf/components/freertos/FreeRTOS-Kernel/include -I/Users/rvalls/esp/esp-idf/components/freertos/esp_additions/include/freertos -I/Users/rvalls/esp/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/include -I/Users/rvalls/esp/esp-idf/components/freertos/esp_additions/include -I/Users/rvalls/esp/esp-idf/components/esp_hw_support/include -I/Users/rvalls/esp/esp-idf/components/esp_hw_support/include/soc -I/Users/rvalls/esp/esp-idf/components/esp_hw_support/include/soc/esp32s2 -I/Users/rvalls/esp/esp-idf/components/esp_hw_support/port/esp32s2/. -I/Users/rvalls/esp/esp-idf/components/esp_hw_support/port/esp32s2/private_include -I/Users/rvalls/esp/esp-idf/components/heap/include -I/Users/rvalls/esp/esp-idf/components/log/include -I/Users/rvalls/esp/esp-idf/components/soc/include -I/Users/rvalls/esp/esp-idf/components/soc/esp32s2/. -I/Users/rvalls/esp/esp-idf/components/soc/esp32s2/include -I/Users/rvalls/esp/esp-idf/components/hal/esp32s2/include -I/Users/rvalls/esp/esp-idf/components/hal/include -I/Users/rvalls/esp/esp-idf/components/hal/platform_port/include -I/Users/rvalls/esp/esp-idf/components/esp_rom/include -I/Users/rvalls/esp/esp-idf/components/esp_rom/include/esp32s2 -I/Users/rvalls/esp/esp-idf/components/esp_rom/esp32s2 -I/Users/rvalls/esp/esp-idf/components/esp_common/include -I/Users/rvalls/esp/esp-idf/components/esp_system/include -I/Users/rvalls/esp/esp-idf/components/esp_system/port/soc -I/Users/rvalls/esp/esp-idf/components/esp_system/port/include/private -I/Users/rvalls/esp/esp-idf/components/xtensa/include -I/Users/rvalls/esp/esp-idf/components/xtensa/esp32s2/include -I/Users/rvalls/esp/esp-idf/components/lwip/include -I/Users/rvalls/esp/esp-idf/components/lwip/include/apps -I/Users/rvalls/esp/esp-idf/components/lwip/include/apps/sntp -I/Users/rvalls/esp/esp-idf/components/lwip/lwip/src/include -I/Users/rvalls/esp/esp-idf/components/lwip/port/esp32/include -I/Users/rvalls/esp/esp-idf/components/lwip/port/esp32/include/arch -I/Users/rvalls/dev/personal/esp-modbus-power-meter/managed_components/espressif__mdns/include -I/Users/rvalls/esp/esp-idf/components/console -I/Users/rvalls/esp/esp-idf/components/vfs/include -I/Users/rvalls/esp/esp-idf/components/esp_netif/include -I/Users/rvalls/esp/esp-idf/components/esp_event/include -I/Users/rvalls/esp/esp-idf/components/esp_http_client/include -I/Users/rvalls/esp/esp-idf/components/esp-tls -I/Users/rvalls/esp/esp-idf/components/esp-tls/esp-tls-crypto -I/Users/rvalls/esp/esp-idf/components/mbedtls/port/include -I/Users/rvalls/esp/esp-idf/components/mbedtls/mbedtls/include -I/Users/rvalls/esp/esp-idf/components/mbedtls/mbedtls/library -I/Users/rvalls/esp/esp-idf/components/mbedtls/esp_crt_bundle/include -I/Users/rvalls/esp/esp-idf/components/nvs_flash/include -I/Users/rvalls/esp/esp-idf/components/spi_flash/include -I/Users/rvalls/dev/personal/esp-modbus-power-meter/lib/esp-rainmaker/components/esp_rainmaker/include -I/Users/rvalls/dev/personal/esp-modbus-power-meter/lib/esp-rainmaker/components/esp-insights/components/rmaker_common/include -I/Users/rvalls/dev/personal/esp-modbus-power-meter/lib/esp-rainmaker/components/esp-insights/components/esp_insights/include -I/Users/rvalls/dev/personal/esp-modbus-power-meter/lib/esp-rainmaker/components/esp-insights/components/esp_diagnostics/include -I/Users/rvalls/dev/personal/esp-modbus-power-meter/managed_components/espressif__esp-modbus/freemodbus/common/include -I/Users/rvalls/esp/esp-idf/components/driver/include -I/Users/rvalls/esp/esp-idf/components/driver/deprecated -I/Users/rvalls/esp/esp-idf/components/driver/esp32s2/include -I/Users/rvalls/esp/esp-idf/components/esp_pm/include -I/Users/rvalls/esp/esp-idf/components/esp_ringbuf/include -I/Users/rvalls/esp/esp-idf/components/esp_timer/include -mlongcalls  -ffunction-sections -fdata-sections -Wall -Werror=all -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wextra -Wno-unused-parameter -Wno-sign-compare -Wno-enum-conversion -gdwarf-4 -ggdb -Os -freorder-blocks -fstack-protector -fmacro-prefix-map=/Users/rvalls/dev/personal/esp-modbus-power-meter=. -fmacro-prefix-map=/Users/rvalls/esp/esp-idf=/IDF -fstrict-volatile-bitfields -Wno-error=unused-but-set-variable -fno-jump-tables -fno-tree-switch-conversion -DconfigENABLE_FREERTOS_DEBUG_OCDAWARE=1 -std=gnu17 -Wno-old-style-declaration -MD -MT esp-idf/src/CMakeFiles/__idf_src.dir/app_rmaker.c.obj -MF esp-idf/src/CMakeFiles/__idf_src.dir/app_rmaker.c.obj.d -o esp-idf/src/CMakeFiles/__idf_src.dir/app_rmaker.c.obj -c /Users/rvalls/dev/personal/esp-modbus-power-meter/src/app_rmaker.c
In file included from /Users/rvalls/dev/personal/esp-modbus-power-meter/src/app_rmaker.c:1:
/Users/rvalls/dev/personal/esp-modbus-power-meter/include/app_rmaker.h:14:10: fatal error: app_wifi.h: No such file or directory
   14 | #include <app_wifi.h>
      |          ^~~~~~~~~~~~
compilation terminated.
[5/18] Building C object esp-idf/app_insights/CMakeFiles/__idf_app_insights.dir/app_insights.c.obj
[6/18] Building C object esp-idf/src/CMakeFiles/__idf_src.dir/main.c.obj
FAILED: esp-idf/src/CMakeFiles/__idf_src.dir/main.c.obj 
/Users/rvalls/.espressif/tools/xtensa-esp32s2-elf/esp-2022r1-11.2.0/xtensa-esp32s2-elf/bin/xtensa-esp32s2-elf-gcc -DESP_PLATFORM -DIDF_VER=\"v5.1-dev-1264-g1c84cfde14\" -DMBEDTLS_CONFIG_FILE=\"mbedtls/esp_config.h\" -D_GNU_SOURCE -D_POSIX_READER_WRITER_LOCKS -I/Users/rvalls/dev/personal/esp-modbus-power-meter/build/config -I/Users/rvalls/dev/personal/esp-modbus-power-meter/src -I/Users/rvalls/dev/personal/esp-modbus-power-meter/include -I/Users/rvalls/esp/esp-idf/components/newlib/platform_include -I/Users/rvalls/esp/esp-idf/components/freertos/FreeRTOS-Kernel/include -I/Users/rvalls/esp/esp-idf/components/freertos/esp_additions/include/freertos -I/Users/rvalls/esp/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/include -I/Users/rvalls/esp/esp-idf/components/freertos/esp_additions/include -I/Users/rvalls/esp/esp-idf/components/esp_hw_support/include -I/Users/rvalls/esp/esp-idf/components/esp_hw_support/include/soc -I/Users/rvalls/esp/esp-idf/components/esp_hw_support/include/soc/esp32s2 -I/Users/rvalls/esp/esp-idf/components/esp_hw_support/port/esp32s2/. -I/Users/rvalls/esp/esp-idf/components/esp_hw_support/port/esp32s2/private_include -I/Users/rvalls/esp/esp-idf/components/heap/include -I/Users/rvalls/esp/esp-idf/components/log/include -I/Users/rvalls/esp/esp-idf/components/soc/include -I/Users/rvalls/esp/esp-idf/components/soc/esp32s2/. -I/Users/rvalls/esp/esp-idf/components/soc/esp32s2/include -I/Users/rvalls/esp/esp-idf/components/hal/esp32s2/include -I/Users/rvalls/esp/esp-idf/components/hal/include -I/Users/rvalls/esp/esp-idf/components/hal/platform_port/include -I/Users/rvalls/esp/esp-idf/components/esp_rom/include -I/Users/rvalls/esp/esp-idf/components/esp_rom/include/esp32s2 -I/Users/rvalls/esp/esp-idf/components/esp_rom/esp32s2 -I/Users/rvalls/esp/esp-idf/components/esp_common/include -I/Users/rvalls/esp/esp-idf/components/esp_system/include -I/Users/rvalls/esp/esp-idf/components/esp_system/port/soc -I/Users/rvalls/esp/esp-idf/components/esp_system/port/include/private -I/Users/rvalls/esp/esp-idf/components/xtensa/include -I/Users/rvalls/esp/esp-idf/components/xtensa/esp32s2/include -I/Users/rvalls/esp/esp-idf/components/lwip/include -I/Users/rvalls/esp/esp-idf/components/lwip/include/apps -I/Users/rvalls/esp/esp-idf/components/lwip/include/apps/sntp -I/Users/rvalls/esp/esp-idf/components/lwip/lwip/src/include -I/Users/rvalls/esp/esp-idf/components/lwip/port/esp32/include -I/Users/rvalls/esp/esp-idf/components/lwip/port/esp32/include/arch -I/Users/rvalls/dev/personal/esp-modbus-power-meter/managed_components/espressif__mdns/include -I/Users/rvalls/esp/esp-idf/components/console -I/Users/rvalls/esp/esp-idf/components/vfs/include -I/Users/rvalls/esp/esp-idf/components/esp_netif/include -I/Users/rvalls/esp/esp-idf/components/esp_event/include -I/Users/rvalls/esp/esp-idf/components/esp_http_client/include -I/Users/rvalls/esp/esp-idf/components/esp-tls -I/Users/rvalls/esp/esp-idf/components/esp-tls/esp-tls-crypto -I/Users/rvalls/esp/esp-idf/components/mbedtls/port/include -I/Users/rvalls/esp/esp-idf/components/mbedtls/mbedtls/include -I/Users/rvalls/esp/esp-idf/components/mbedtls/mbedtls/library -I/Users/rvalls/esp/esp-idf/components/mbedtls/esp_crt_bundle/include -I/Users/rvalls/esp/esp-idf/components/nvs_flash/include -I/Users/rvalls/esp/esp-idf/components/spi_flash/include -I/Users/rvalls/dev/personal/esp-modbus-power-meter/lib/esp-rainmaker/components/esp_rainmaker/include -I/Users/rvalls/dev/personal/esp-modbus-power-meter/lib/esp-rainmaker/components/esp-insights/components/rmaker_common/include -I/Users/rvalls/dev/personal/esp-modbus-power-meter/lib/esp-rainmaker/components/esp-insights/components/esp_insights/include -I/Users/rvalls/dev/personal/esp-modbus-power-meter/lib/esp-rainmaker/components/esp-insights/components/esp_diagnostics/include -I/Users/rvalls/dev/personal/esp-modbus-power-meter/managed_components/espressif__esp-modbus/freemodbus/common/include -I/Users/rvalls/esp/esp-idf/components/driver/include -I/Users/rvalls/esp/esp-idf/components/driver/deprecated -I/Users/rvalls/esp/esp-idf/components/driver/esp32s2/include -I/Users/rvalls/esp/esp-idf/components/esp_pm/include -I/Users/rvalls/esp/esp-idf/components/esp_ringbuf/include -I/Users/rvalls/esp/esp-idf/components/esp_timer/include -mlongcalls  -ffunction-sections -fdata-sections -Wall -Werror=all -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wextra -Wno-unused-parameter -Wno-sign-compare -Wno-enum-conversion -gdwarf-4 -ggdb -Os -freorder-blocks -fstack-protector -fmacro-prefix-map=/Users/rvalls/dev/personal/esp-modbus-power-meter=. -fmacro-prefix-map=/Users/rvalls/esp/esp-idf=/IDF -fstrict-volatile-bitfields -Wno-error=unused-but-set-variable -fno-jump-tables -fno-tree-switch-conversion -DconfigENABLE_FREERTOS_DEBUG_OCDAWARE=1 -std=gnu17 -Wno-old-style-declaration -MD -MT esp-idf/src/CMakeFiles/__idf_src.dir/main.c.obj -MF esp-idf/src/CMakeFiles/__idf_src.dir/main.c.obj.d -o esp-idf/src/CMakeFiles/__idf_src.dir/main.c.obj -c /Users/rvalls/dev/personal/esp-modbus-power-meter/src/main.c
In file included from /Users/rvalls/dev/personal/esp-modbus-power-meter/src/main.c:8:
/Users/rvalls/dev/personal/esp-modbus-power-meter/include/app_rmaker.h:14:10: fatal error: app_wifi.h: No such file or directory
   14 | #include <app_wifi.h>
      |          ^~~~~~~~~~~~
compilation terminated.
[7/18] Performing build step for 'bootloader'
[1/1] cd /Users/rvalls/dev/personal/esp-modbus-power-meter/build/bootloader/esp-idf/esptool_py && /Users/rvalls/.espressif/python_env/idf5.1_py3.10_env/bin/python /Users/rvalls/esp/esp-idf/components/partition_table/check_sizes.py --offset 0x8000 bootloader 0x1000 /Users/rvalls/dev/personal/esp-modbus-power-meter/build/bootloader/bootloader.bin
Bootloader binary size 0x4f70 bytes. 0x2090 bytes (29%) free.
[8/16] Building C object esp-idf/src/CMakeFiles/__idf_src.dir/app_pvoutput_org.c.obj
FAILED: esp-idf/src/CMakeFiles/__idf_src.dir/app_pvoutput_org.c.obj 
/Users/rvalls/.espressif/tools/xtensa-esp32s2-elf/esp-2022r1-11.2.0/xtensa-esp32s2-elf/bin/xtensa-esp32s2-elf-gcc -DESP_PLATFORM -DIDF_VER=\"v5.1-dev-1264-g1c84cfde14\" -DMBEDTLS_CONFIG_FILE=\"mbedtls/esp_config.h\" -D_GNU_SOURCE -D_POSIX_READER_WRITER_LOCKS -I/Users/rvalls/dev/personal/esp-modbus-power-meter/build/config -I/Users/rvalls/dev/personal/esp-modbus-power-meter/src -I/Users/rvalls/dev/personal/esp-modbus-power-meter/include -I/Users/rvalls/esp/esp-idf/components/newlib/platform_include -I/Users/rvalls/esp/esp-idf/components/freertos/FreeRTOS-Kernel/include -I/Users/rvalls/esp/esp-idf/components/freertos/esp_additions/include/freertos -I/Users/rvalls/esp/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/include -I/Users/rvalls/esp/esp-idf/components/freertos/esp_additions/include -I/Users/rvalls/esp/esp-idf/components/esp_hw_support/include -I/Users/rvalls/esp/esp-idf/components/esp_hw_support/include/soc -I/Users/rvalls/esp/esp-idf/components/esp_hw_support/include/soc/esp32s2 -I/Users/rvalls/esp/esp-idf/components/esp_hw_support/port/esp32s2/. -I/Users/rvalls/esp/esp-idf/components/esp_hw_support/port/esp32s2/private_include -I/Users/rvalls/esp/esp-idf/components/heap/include -I/Users/rvalls/esp/esp-idf/components/log/include -I/Users/rvalls/esp/esp-idf/components/soc/include -I/Users/rvalls/esp/esp-idf/components/soc/esp32s2/. -I/Users/rvalls/esp/esp-idf/components/soc/esp32s2/include -I/Users/rvalls/esp/esp-idf/components/hal/esp32s2/include -I/Users/rvalls/esp/esp-idf/components/hal/include -I/Users/rvalls/esp/esp-idf/components/hal/platform_port/include -I/Users/rvalls/esp/esp-idf/components/esp_rom/include -I/Users/rvalls/esp/esp-idf/components/esp_rom/include/esp32s2 -I/Users/rvalls/esp/esp-idf/components/esp_rom/esp32s2 -I/Users/rvalls/esp/esp-idf/components/esp_common/include -I/Users/rvalls/esp/esp-idf/components/esp_system/include -I/Users/rvalls/esp/esp-idf/components/esp_system/port/soc -I/Users/rvalls/esp/esp-idf/components/esp_system/port/include/private -I/Users/rvalls/esp/esp-idf/components/xtensa/include -I/Users/rvalls/esp/esp-idf/components/xtensa/esp32s2/include -I/Users/rvalls/esp/esp-idf/components/lwip/include -I/Users/rvalls/esp/esp-idf/components/lwip/include/apps -I/Users/rvalls/esp/esp-idf/components/lwip/include/apps/sntp -I/Users/rvalls/esp/esp-idf/components/lwip/lwip/src/include -I/Users/rvalls/esp/esp-idf/components/lwip/port/esp32/include -I/Users/rvalls/esp/esp-idf/components/lwip/port/esp32/include/arch -I/Users/rvalls/dev/personal/esp-modbus-power-meter/managed_components/espressif__mdns/include -I/Users/rvalls/esp/esp-idf/components/console -I/Users/rvalls/esp/esp-idf/components/vfs/include -I/Users/rvalls/esp/esp-idf/components/esp_netif/include -I/Users/rvalls/esp/esp-idf/components/esp_event/include -I/Users/rvalls/esp/esp-idf/components/esp_http_client/include -I/Users/rvalls/esp/esp-idf/components/esp-tls -I/Users/rvalls/esp/esp-idf/components/esp-tls/esp-tls-crypto -I/Users/rvalls/esp/esp-idf/components/mbedtls/port/include -I/Users/rvalls/esp/esp-idf/components/mbedtls/mbedtls/include -I/Users/rvalls/esp/esp-idf/components/mbedtls/mbedtls/library -I/Users/rvalls/esp/esp-idf/components/mbedtls/esp_crt_bundle/include -I/Users/rvalls/esp/esp-idf/components/nvs_flash/include -I/Users/rvalls/esp/esp-idf/components/spi_flash/include -I/Users/rvalls/dev/personal/esp-modbus-power-meter/lib/esp-rainmaker/components/esp_rainmaker/include -I/Users/rvalls/dev/personal/esp-modbus-power-meter/lib/esp-rainmaker/components/esp-insights/components/rmaker_common/include -I/Users/rvalls/dev/personal/esp-modbus-power-meter/lib/esp-rainmaker/components/esp-insights/components/esp_insights/include -I/Users/rvalls/dev/personal/esp-modbus-power-meter/lib/esp-rainmaker/components/esp-insights/components/esp_diagnostics/include -I/Users/rvalls/dev/personal/esp-modbus-power-meter/managed_components/espressif__esp-modbus/freemodbus/common/include -I/Users/rvalls/esp/esp-idf/components/driver/include -I/Users/rvalls/esp/esp-idf/components/driver/deprecated -I/Users/rvalls/esp/esp-idf/components/driver/esp32s2/include -I/Users/rvalls/esp/esp-idf/components/esp_pm/include -I/Users/rvalls/esp/esp-idf/components/esp_ringbuf/include -I/Users/rvalls/esp/esp-idf/components/esp_timer/include -mlongcalls  -ffunction-sections -fdata-sections -Wall -Werror=all -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wextra -Wno-unused-parameter -Wno-sign-compare -Wno-enum-conversion -gdwarf-4 -ggdb -Os -freorder-blocks -fstack-protector -fmacro-prefix-map=/Users/rvalls/dev/personal/esp-modbus-power-meter=. -fmacro-prefix-map=/Users/rvalls/esp/esp-idf=/IDF -fstrict-volatile-bitfields -Wno-error=unused-but-set-variable -fno-jump-tables -fno-tree-switch-conversion -DconfigENABLE_FREERTOS_DEBUG_OCDAWARE=1 -std=gnu17 -Wno-old-style-declaration -MD -MT esp-idf/src/CMakeFiles/__idf_src.dir/app_pvoutput_org.c.obj -MF esp-idf/src/CMakeFiles/__idf_src.dir/app_pvoutput_org.c.obj.d -o esp-idf/src/CMakeFiles/__idf_src.dir/app_pvoutput_org.c.obj -c /Users/rvalls/dev/personal/esp-modbus-power-meter/src/app_pvoutput_org.c
/Users/rvalls/dev/personal/esp-modbus-power-meter/src/app_pvoutput_org.c:6:10: fatal error: app_wifi.h: No such file or directory
    6 | #include "app_wifi.h"
      |          ^~~~~~~~~~~~
compilation terminated.
ninja: build stopped: subcommand failed.
Tangential thought: the hobby work I'm doing here could potentially inform post-1.0 Matter spec in the future since it doesn't seem to include power metering yet.

brainstorm
Posts: 27
Joined: Mon Dec 12, 2016 12:22 pm

Re: Project compiling with both PlatformIO and native idf.py ESP-IDF tooling?

Postby brainstorm » Sat Oct 15, 2022 11:06 am

EDIT: All fixed in https://github.com/brainstorm/esp-modbu ... f888515441, thanks Ivan! :)

Fixed all the remaining issues on this range of commits!: https://github.com/brainstorm/esp-modbu ... f312707fa7

... for ESP-IDF 5.x on master only though.

Now, PlatformIO (ESP-IDF 4.4) breaks because there are some differences on ESP_LOG types, which should be easy to fix with temporary #ifdefs I guess? Or perhaps there's a neater/cleaner alternative?:

Code: Select all

Reading CMake configuration...
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 1 compatible libraries
Scanning dependencies...
No dependencies
Building in debug mode
Compiling .pio/build/esp32-s2-saola-1/src/app_pvoutput_org.o
Compiling .pio/build/esp32-s2-saola-1/app_update/esp_app_desc.o
src/app_pvoutput_org.c: In function '_http_event_handler':
src/app_pvoutput_org.c:31:14: error: 'HTTP_EVENT_REDIRECT' undeclared (first use in this function); did you mean 'HTTP_EVENT_HEADER_SENT'?
         case HTTP_EVENT_REDIRECT:
              ^~~~~~~~~~~~~~~~~~~
              HTTP_EVENT_HEADER_SENT
src/app_pvoutput_org.c:31:14: note: each undeclared identifier is reported only once for each function it appears in
In file included from include/app_pvoutput_org.h:6,
                 from src/app_pvoutput_org.c:5:
src/app_pvoutput_org.c: In function 'pvoutput_update':
/Users/rvalls/.platformio/packages/framework-espidf/components/log/include/esp_log.h:276:27: error: format '%lli' expects argument of type 'long long int', but argument 7 has type 'int' [-Werror=format=]
 #define LOG_COLOR(COLOR)  "\033[0;" COLOR "m"
                           ^~~~~~~~~
/Users/rvalls/.platformio/packages/framework-espidf/components/log/include/esp_log.h:279:27: note: in expansion of macro 'LOG_COLOR'
 #define LOG_COLOR_E       LOG_COLOR(LOG_COLOR_RED)
                           ^~~~~~~~~
/Users/rvalls/.platformio/packages/framework-espidf/components/log/include/esp_log.h:293:37: note: in expansion of macro 'LOG_COLOR_E'
 #define LOG_FORMAT(letter, format)  LOG_COLOR_ ## letter #letter " (%u) %s: " format LOG_RESET_COLOR "\n"
                                     ^~~~~~~~~~
/Users/rvalls/.platformio/packages/framework-espidf/components/log/include/esp_log.h:421: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__); } \
                                                                                      ^~~~~~~~~~
/Users/rvalls/.platformio/packages/framework-espidf/components/log/include/esp_log.h:443:41: note: in expansion of macro 'ESP_LOG_LEVEL'
         if ( LOG_LOCAL_LEVEL >= level ) ESP_LOG_LEVEL(level, tag, format, ##__VA_ARGS__); \
                                         ^~~~~~~~~~~~~
/Users/rvalls/.platformio/packages/framework-espidf/components/log/include/esp_log.h:353: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__)
                                      ^~~~~~~~~~~~~~~~~~~
src/app_pvoutput_org.c:124:9: note: in expansion of macro 'ESP_LOGI'
         ESP_LOGI(TAG, "HTTP POST Status = %d, content_length = %"PRIi64,
         ^~~~~~~~
/Users/rvalls/.platformio/packages/framework-espidf/components/log/include/esp_log.h:276:27: error: format '%lli' expects argument of type 'long long int', but argument 7 has type 'int' [-Werror=format=]
 #define LOG_COLOR(COLOR)  "\033[0;" COLOR "m"
                           ^~~~~~~~~
/Users/rvalls/.platformio/packages/framework-espidf/components/log/include/esp_log.h:280:27: note: in expansion of macro 'LOG_COLOR'
 #define LOG_COLOR_W       LOG_COLOR(LOG_COLOR_BROWN)
                           ^~~~~~~~~
/Users/rvalls/.platformio/packages/framework-espidf/components/log/include/esp_log.h:293:37: note: in expansion of macro 'LOG_COLOR_W'
 #define LOG_FORMAT(letter, format)  LOG_COLOR_ ## letter #letter " (%u) %s: " format LOG_RESET_COLOR "\n"
                                     ^~~~~~~~~~
/Users/rvalls/.platformio/packages/framework-espidf/components/log/include/esp_log.h:422: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__); } \
                                                                                      ^~~~~~~~~~
/Users/rvalls/.platformio/packages/framework-espidf/components/log/include/esp_log.h:443:41: note: in expansion of macro 'ESP_LOG_LEVEL'
         if ( LOG_LOCAL_LEVEL >= level ) ESP_LOG_LEVEL(level, tag, format, ##__VA_ARGS__); \
                                         ^~~~~~~~~~~~~
/Users/rvalls/.platformio/packages/framework-espidf/components/log/include/esp_log.h:353: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__)
                                      ^~~~~~~~~~~~~~~~~~~
src/app_pvoutput_org.c:124:9: note: in expansion of macro 'ESP_LOGI'
         ESP_LOGI(TAG, "HTTP POST Status = %d, content_length = %"PRIi64,
         ^~~~~~~~
src/app_pvoutput_org.c:126:1: error: format '%lli' expects argument of type 'long long int', but argument 7 has type 'int' [-Werror=format=]
                 esp_http_client_get_content_length(client));
 ^          
/Users/rvalls/.platformio/packages/framework-espidf/components/log/include/esp_log.h:293:59: note: in definition of macro 'LOG_FORMAT'
 #define LOG_FORMAT(letter, format)  LOG_COLOR_ ## letter #letter " (%u) %s: " format LOG_RESET_COLOR "\n"
                                                           ^~~~~~
/Users/rvalls/.platformio/packages/framework-espidf/components/log/include/esp_log.h:443:41: note: in expansion of macro 'ESP_LOG_LEVEL'
         if ( LOG_LOCAL_LEVEL >= level ) ESP_LOG_LEVEL(level, tag, format, ##__VA_ARGS__); \
                                         ^~~~~~~~~~~~~
/Users/rvalls/.platformio/packages/framework-espidf/components/log/include/esp_log.h:353: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__)
                                      ^~~~~~~~~~~~~~~~~~~
src/app_pvoutput_org.c:124:9: note: in expansion of macro 'ESP_LOGI'
         ESP_LOGI(TAG, "HTTP POST Status = %d, content_length = %"PRIi64,
         ^~~~~~~~
src/app_pvoutput_org.c:126:1: error: format '%lli' expects argument of type 'long long int', but argument 7 has type 'int' [-Werror=format=]
                 esp_http_client_get_content_length(client));
 ^          
/Users/rvalls/.platformio/packages/framework-espidf/components/log/include/esp_log.h:293:59: note: in definition of macro 'LOG_FORMAT'
 #define LOG_FORMAT(letter, format)  LOG_COLOR_ ## letter #letter " (%u) %s: " format LOG_RESET_COLOR "\n"
                                                           ^~~~~~
/Users/rvalls/.platformio/packages/framework-espidf/components/log/include/esp_log.h:443:41: note: in expansion of macro 'ESP_LOG_LEVEL'
         if ( LOG_LOCAL_LEVEL >= level ) ESP_LOG_LEVEL(level, tag, format, ##__VA_ARGS__); \
                                         ^~~~~~~~~~~~~
/Users/rvalls/.platformio/packages/framework-espidf/components/log/include/esp_log.h:353: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__)
                                      ^~~~~~~~~~~~~~~~~~~
src/app_pvoutput_org.c:124:9: note: in expansion of macro 'ESP_LOGI'
         ESP_LOGI(TAG, "HTTP POST Status = %d, content_length = %"PRIi64,
         ^~~~~~~~
/Users/rvalls/.platformio/packages/framework-espidf/components/log/include/esp_log.h:276:27: error: format '%lli' expects argument of type 'long long int', but argument 7 has type 'int' [-Werror=format=]
 #define LOG_COLOR(COLOR)  "\033[0;" COLOR "m"
                           ^~~~~~~~~
/Users/rvalls/.platformio/packages/framework-espidf/components/log/include/esp_log.h:281:27: note: in expansion of macro 'LOG_COLOR'
 #define LOG_COLOR_I       LOG_COLOR(LOG_COLOR_GREEN)
                           ^~~~~~~~~
/Users/rvalls/.platformio/packages/framework-espidf/components/log/include/esp_log.h:293:37: note: in expansion of macro 'LOG_COLOR_I'
 #define LOG_FORMAT(letter, format)  LOG_COLOR_ ## letter #letter " (%u) %s: " format LOG_RESET_COLOR "\n"
                                     ^~~~~~~~~~
/Users/rvalls/.platformio/packages/framework-espidf/components/log/include/esp_log.h:425:86: note: in expansion of macro 'LOG_FORMAT'
         else                                { esp_log_write(ESP_LOG_INFO,       tag, LOG_FORMAT(I, format), esp_log_timestamp(), tag, ##__VA_ARGS__); } \
                                                                                      ^~~~~~~~~~
/Users/rvalls/.platformio/packages/framework-espidf/components/log/include/esp_log.h:443:41: note: in expansion of macro 'ESP_LOG_LEVEL'
         if ( LOG_LOCAL_LEVEL >= level ) ESP_LOG_LEVEL(level, tag, format, ##__VA_ARGS__); \
                                         ^~~~~~~~~~~~~
/Users/rvalls/.platformio/packages/framework-espidf/components/log/include/esp_log.h:353: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__)
                                      ^~~~~~~~~~~~~~~~~~~
src/app_pvoutput_org.c:124:9: note: in expansion of macro 'ESP_LOGI'
         ESP_LOGI(TAG, "HTTP POST Status = %d, content_length = %"PRIi64,
         ^~~~~~~~
cc1: some warnings being treated as errors
*** [.pio/build/esp32-s2-saola-1/src/app_pvoutput_org.o] Error 1
==================== [FAILED] Took 12.49 seconds ====================

ESP_igrr
Posts: 2072
Joined: Tue Dec 01, 2015 8:37 am

Re: Project compiling with both PlatformIO and native idf.py ESP-IDF tooling?

Postby ESP_igrr » Sat Oct 15, 2022 6:15 pm

If the format string issue is related to the mismatch of uint32_t types ("unsigned int" in IDF<5, "unsigned long" in IDF>=5) then the recommended way to fix that is using PRIu32, PRIx32 macros in the format strings. Please see https://en.cppreference.com/w/c/types/integer, near the end of the page.
These macros will work in all IDF versions.

Who is online

Users browsing this forum: Teh2024 and 367 guests