I have been following along with great interest as @phoddie and @ralphwetzel develop bridges between Node-RED flows and MCU programming -- one of the most exciting new areas for me to extend my smart-home skills. As someone who has never worked this close to printed circuits and sensors, I am so grateful for the commitment you have to this community... and to @BartButenaers for his detailed tutorials, especially this one, which has put me very close to having my own ESP32 development environment.
Similar to Bart, I chose to install node-red-mcu-plugin on my RPi 4 (although mine is NOT headless). The MCU I'm using is the Espressif-WRover-E, and my O/S is Ubuntu Jammy Jellyfish:
$ cat /etc/os-release
PRETTY_NAME="Ubuntu 22.04.3 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.3 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy
After many attempts to get ESP-IDF installed and running, I am finally able to initiate a Build
from the MCU Plugin sidebar --
which cannot complete due to these errors:
Starting build process...
Host system check: #41-Ubuntu SMP PREEMPT Fri Sep 8 12:38:39 UTC 2023
MCU Build system check: p1.4.1-beta.1 + #548dc37 @ m4.2.1-11-gcdcab49
HOME directory check: /home/srickus
Creating build environment for platform esp32.
Working directory: /home/srickus/.node-red/mcu-plugin-cache/sqd9j8rnmna
$IDF_PATH is defined: /home/srickus/develop/esp32/esp-idf
$IDF_PYTHON_ENV_PATH is defined: /home/srickus/develop/esp32/esp-idf/python_env/idf5.1_py3.10_env
> cd /home/srickus/.node-red/mcu-plugin-cache/sqd9j8rnmna
UPLOAD_PORT = /dev/ttyUSB1
Creating build script file...
> /bin/bash ./build.sh
>> source /home/srickus/develop/esp32/esp-idf/export.sh
Detecting the Python interpreter
Checking "python3" ...
Python 3.10.12
"python3" has been detected
Checking Python compatibility
Checking other ESP-IDF version.
WARNING: No IDF variables to remove from environment found. Deactivation of previous esp-idf version was not successful.
Adding ESP-IDF tools to PATH...
ERROR: tool xtensa-esp32-elf has no installed versions. Please run '/home/srickus/develop/esp32/esp-idf/install.sh' to install it.
ERROR: tool xtensa-esp32s2-elf has no installed versions. Please run '/home/srickus/develop/esp32/esp-idf/install.sh' to install it.
ERROR: tool xtensa-esp32s3-elf has no installed versions. Please run '/home/srickus/develop/esp32/esp-idf/install.sh' to install it.
ERROR: tool riscv32-esp-elf has no installed versions. Please run '/home/srickus/develop/esp32/esp-idf/install.sh' to install it.
ERROR: tool openocd-esp32 has no installed versions. Please run '/home/srickus/develop/esp32/esp-idf/install.sh' to install it.
ERROR: tool esp-rom-elfs has no installed versions. Please run '/home/srickus/develop/esp32/esp-idf/install.sh' to install it.
>> IDF_PYTHON_ENV_PATH: /home/srickus/develop/esp32/esp-idf/python_env/idf5.1_py3.10_env
>> mcconfig -d -x localhost:5004 -l -m -p esp32
# warning: -l deprecated. use -dl instead.!
Detecting the Python interpreter
Checking "python3" ...
Python 3.10.12
"python3" has been detected
Checking Python compatibility
WARNING: No IDF variables to remove from environment found. Deactivation of previous esp-idf version was not successful.
ERROR: tool xtensa-esp32-elf has no installed versions. Please run '/home/srickus/develop/esp32/esp-idf/install.sh' to install it.
ERROR: tool xtensa-esp32s2-elf has no installed versions. Please run '/home/srickus/develop/esp32/esp-idf/install.sh' to install it.
ERROR: tool xtensa-esp32s3-elf has no installed versions. Please run '/home/srickus/develop/esp32/esp-idf/install.sh' to install it.
ERROR: tool riscv32-esp-elf has no installed versions. Please run '/home/srickus/develop/esp32/esp-idf/install.sh' to install it.
ERROR: tool openocd-esp32 has no installed versions. Please run '/home/srickus/develop/esp32/esp-idf/install.sh' to install it.
ERROR: tool esp-rom-elfs has no installed versions. Please run '/home/srickus/develop/esp32/esp-idf/install.sh' to install it.
And yes, I have run that install.sh script many times... The strange thing is that this build.sh script does work when I invoke it from a shell:
srickus@ shrpi4: ~/.node-red/mcu-plugin-cache/sqd9j8rnmna
$ /bin/bash ./build.sh
>> source /home/srickus/develop/esp32/esp-idf/export.sh
Detecting the Python interpreter
Checking "python3" ...
Python 3.10.12
"python3" has been detected
Checking Python compatibility
Checking other ESP-IDF version.
Adding ESP-IDF tools to PATH...
Checking if Python packages are up to date...
Constraint file: /home/srickus/develop/esp32/esp-idf/espidf.constraints.v5.1.txt
Requirement files:
- /home/srickus/develop/esp32/esp-idf/tools/requirements/requirements.core.txt
Python being checked: /home/srickus/develop/esp32/esp-idf/python_env/idf5.1_py3.10_env/bin/python
Python requirements are satisfied.
Added the following directories to PATH:
/home/srickus/develop/esp32/esp-idf/components/espcoredump
/home/srickus/develop/esp32/esp-idf/components/partition_table
/home/srickus/develop/esp32/esp-idf/components/app_update
Detected installed tools that are not currently used by active ESP-IDF version.
For removing old versions of test_mkdfu, catch, docker, ci, test_idf_py, test_apps, gen_soc_caps_kconfig, unit-test-app, esp_prov, templates, test_sbom, __pycache__, mocks, esp_app_trace, ldgen, test_build_system, test_idf_tools, idf_py_actions, mass_mfg, cmake, kconfig_new, ble, requirements, test_mkuf2 use command 'python /home/srickus/develop/esp32/esp-idf/tools/idf_tools.py uninstall'
To free up even more space, remove installation packages of those tools. Use option 'python3 /home/srickus/develop/esp32/esp-idf/tools/idf_tools.py uninstall --remove-archives'.
Done! You can now compile ESP-IDF projects.
Go to the project directory and run:
idf.py build
>> IDF_PYTHON_ENV_PATH: /home/srickus/develop/esp32/esp-idf/python_env/idf5.1_py3.10_env
>> mcconfig -d -x localhost:5004 -l -m -p esp32
# warning: -l deprecated. use -dl instead.!
/home/srickus/develop/esp32/esp-idf/tools/idf.py
Using recommended ESP-IDF v5.1.1
# nodered2mcu flows
# xsc Resource.xsb
# xsc time.xsb
# xsc timer.xsb
# xsc deepEqual.xsb
...
# xsc flows.xsb
# Reconfiguring ESP-IDF...
Executing action: reconfigure
Running cmake in directory /home/srickus/develop/moddable/build/tmp/esp32/debug/sqd9j8rnmna/xsProj-esp32/build
Executing "cmake -G Ninja -DPYTHON_DEPS_CHECKED=1 -DPYTHON=/home/srickus/develop/esp32/esp-idf/python_env/idf5.1_py3.10_env/bin/python -DESP_PLATFORM=1 -DSDKCONFIG_DEFAULTS=/home/srickus/develop/moddable/build/tmp/esp32//debug/sqd9j8rnmna/xsProj-esp32/sdkconfig.mc -DSDKCONFIG_HEADER=/home/srickus/develop/moddable/build/tmp/esp32/debug/sqd9j8rnmna/xsProj-esp32/build/config/sdkconfig.h -DCMAKE_MESSAGE_LOG_LEVEL=ERROR -DDEBUGGER_SPEED=460800 -DIDF_TARGET=esp32 -DESP32_SUBCLASS=esp32 -DCCACHE_ENABLE=0 /home/srickus/develop/moddable/build/tmp/esp32/debug/sqd9j8rnmna/xsProj-esp32"...
Loading defaults file /home/srickus/develop/moddable/build/tmp/esp32/debug/sqd9j8rnmna/xsProj-esp32/sdkconfig.mc...
-- Configuring done
-- Generating done
-- Build files have been written to: /home/srickus/develop/moddable/build/tmp/esp32/debug/sqd9j8rnmna/xsProj-esp32/build
# cc xsAll.c (strings in flash)
# cc xsAPI.c (strings in flash)
...
# cc xsDebug.c (strings in flash)
# cc xsDate.c (strings in flash)
# cc xsDataView.c (strings in flash)
# ld xs_esp32.bin
Executing action: all (aliases: build)
Running cmake in directory /home/srickus/develop/moddable/build/tmp/esp32/debug/sqd9j8rnmna/xsProj-esp32/build
Executing "cmake -G Ninja -DPYTHON_DEPS_CHECKED=1 -DPYTHON=/home/srickus/develop/esp32/esp-idf/python_env/idf5.1_py3.10_env/bin/python -DESP_PLATFORM=1 -DmxDebug=1 -DINSTRUMENT=1 -DTMP_DIR=/home/srickus/develop/moddable/build/tmp/esp32/debug/sqd9j8rnmna -DCMAKE_MESSAGE_LOG_LEVEL=ERROR -DDEBUGGER_SPEED=460800 -DESP32_SUBCLASS=esp32 -DSDKCONFIG_DEFAULTS=/home/srickus/develop/moddable/build/tmp/esp32//debug/sqd9j8rnmna/xsProj-esp32/sdkconfig.mc -DSDKCONFIG_HEADER=/home/srickus/develop/moddable/build/tmp/esp32/debug/sqd9j8rnmna/xsProj-esp32/build/config/sdkconfig.h -DCCACHE_ENABLE=0 /home/srickus/develop/moddable/build/tmp/esp32/debug/sqd9j8rnmna/xsProj-esp32"...
Loading defaults file /home/srickus/develop/moddable/build/tmp/esp32/debug/sqd9j8rnmna/xsProj-esp32/sdkconfig.mc...
-- Configuring done
-- Generating done
-- Build files have been written to: /home/srickus/develop/moddable/build/tmp/esp32/debug/sqd9j8rnmna/xsProj-esp32/build
Running ninja in directory /home/srickus/develop/moddable/build/tmp/esp32/debug/sqd9j8rnmna/xsProj-esp32/build
Executing "ninja all"...
[5/887] Generating ../../partition_table/partition-table.binPartition table binary generated. Contents:
*******************************************************************************
# ESP-IDF Partition Table
# Name, Type, SubType, Offset, Size, Flags
nvs,data,nvs,0x9000,24K,
phy_init,data,phy,0xf000,4K,
factory,app,factory,0x10000,4032K,
*******************************************************************************
[250/887] Performing configure step for 'bootloader'-- Found Git: /usr/bin/git (found version "2.34.1")
-- The C compiler identification is GNU 12.2.0
-- The CXX compiler identification is GNU 12.2.0
-- The ASM compiler identification is GNU
-- Found assembler: /home/srickus/develop/esp32/esp-idf/tools/xtensa-esp32-elf/esp-12.2.0_20230208/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /home/srickus/develop/esp32/esp-idf/tools/xtensa-esp32-elf/esp-12.2.0_20230208/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /home/srickus/develop/esp32/esp-idf/tools/xtensa-esp32-elf/esp-12.2.0_20230208/xtensa-esp32-elf/bin/xtensa-esp32-elf-g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Building ESP-IDF components for target esp32
-- Project sdkconfig file /home/srickus/develop/moddable/build/tmp/esp32/debug/sqd9j8rnmna/xsProj-esp32/sdkconfig
Compiler supported targets: xtensa-esp32-elf
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of time_t
-- Check size of time_t - done
-- Adding linker script /home/srickus/develop/esp32/esp-idf/components/soc/esp32/ld/esp32.peripherals.ld
-- App "bootloader" version: v5.1.1
-- Adding linker script /home/srickus/develop/esp32/esp-idf/components/esp_rom/esp32/ld/esp32.rom.ld
-- Adding linker script /home/srickus/develop/esp32/esp-idf/components/esp_rom/esp32/ld/esp32.rom.api.ld
-- Adding linker script /home/srickus/develop/esp32/esp-idf/components/esp_rom/esp32/ld/esp32.rom.libgcc.ld
-- Adding linker script /home/srickus/develop/esp32/esp-idf/components/esp_rom/esp32/ld/esp32.rom.newlib-funcs.ld
-- Adding linker script /home/srickus/develop/esp32/esp-idf/components/bootloader/subproject/main/ld/esp32/bootloader.ld
-- Adding linker script /home/srickus/develop/esp32/esp-idf/components/bootloader/subproject/main/ld/esp32/bootloader.rom.ld
-- Components: bootloader bootloader_support efuse esp_app_format esp_common esp_hw_support esp_rom esp_system esptool_py freertos hal log main micro-ecc newlib partition_table soc spi_flash xtensa
-- Component paths: /home/srickus/develop/esp32/esp-idf/components/bootloader /home/srickus/develop/esp32/esp-idf/components/bootloader_support /home/srickus/develop/esp32/esp-idf/components/efuse /home/srickus/develop/esp32/esp-idf/components/esp_app_format /home/srickus/develop/esp32/esp-idf/components/esp_common /home/srickus/develop/esp32/esp-idf/components/esp_hw_support /home/srickus/develop/esp32/esp-idf/components/esp_rom /home/srickus/develop/esp32/esp-idf/components/esp_system /home/srickus/develop/esp32/esp-idf/components/esptool_py /home/srickus/develop/esp32/esp-idf/components/freertos /home/srickus/develop/esp32/esp-idf/components/hal /home/srickus/develop/esp32/esp-idf/components/log /home/srickus/develop/esp32/esp-idf/components/bootloader/subproject/main /home/srickus/develop/esp32/esp-idf/components/bootloader/subproject/components/micro-ecc /home/srickus/develop/esp32/esp-idf/components/newlib /home/srickus/develop/esp32/esp-idf/components/partition_table /home/srickus/develop/esp32/esp-idf/components/soc /home/srickus/develop/esp32/esp-idf/components/spi_flash /home/srickus/develop/esp32/esp-idf/components/xtensa
-- Configuring done
-- Generating done
-- Build files have been written to: /home/srickus/develop/moddable/build/tmp/esp32/debug/sqd9j8rnmna/xsProj-esp32/build/bootloader
[103/104] Generating binary image from built executableesptool.py v4.7.dev2
Creating esp32 image...
Merged 1 ELF section
Successfully created esp32 image.
Generated /home/srickus/develop/moddable/build/tmp/esp32/debug/sqd9j8rnmna/xsProj-esp32/build/bootloader/bootloader.bin
[104/104] cd /home/srickus/develop/moddable/build/tmp/esp32/debug/sqd9j8rnmna/x.../build/tmp/esp32/debug/sqd9j8rnmna/xsProj-esp32/build/bootloader/bootloader.binBootloader binary size 0x46f0 bytes. 0x2910 bytes (37%) free.
[763/887] Building C object esp-idf/console/CMakeFiles/__idf_console.dir/esp_console_repl.c.obj/home/srickus/develop/esp32/esp-idf/components/console/esp_console_repl.c:479:13: warning: 'esp_console_repl_task' defined but not used [-Wunused-function]
479 | static void esp_console_repl_task(void *args)
| ^~~~~~~~~~~~~~~~~~~~~
/home/srickus/develop/esp32/esp-idf/components/console/esp_console_repl.c:375:18: warning: 'esp_console_common_init' defined but not used [-Wunused-function]
375 | static esp_err_t esp_console_common_init(size_t max_cmdline_length, esp_console_repl_com_t *repl_com)
| ^~~~~~~~~~~~~~~~~~~~~~~
/home/srickus/develop/esp32/esp-idf/components/console/esp_console_repl.c:354:18: warning: 'esp_console_setup_history' defined but not used [-Wunused-function]
354 | static esp_err_t esp_console_setup_history(const char *history_path, uint32_t max_history_len, esp_console_repl_com_t *repl_com)
| ^~~~~~~~~~~~~~~~~~~~~~~~~
/home/srickus/develop/esp32/esp-idf/components/console/esp_console_repl.c:329:18: warning: 'esp_console_setup_prompt' defined but not used [-Wunused-function]
329 | static esp_err_t esp_console_setup_prompt(const char *prompt, esp_console_repl_com_t *repl_com)
| ^~~~~~~~~~~~~~~~~~~~~~~~
[886/887] Generating binary image from built executableesptool.py v4.7.dev2
Creating esp32 image...
Merged 25 ELF sections
Successfully created esp32 image.
Generated /home/srickus/develop/moddable/build/tmp/esp32/debug/sqd9j8rnmna/xsProj-esp32/build/xs_esp32.bin
[887/887] cd /home/srickus/develop/moddable/build/tmp/esp32/debug/sqd9j8rnmna/x...elop/moddable/build/tmp/esp32/debug/sqd9j8rnmna/xsProj-esp32/build/xs_esp32.binxs_esp32.bin binary size 0x11e730 bytes. Smallest app partition is 0x3f0000 bytes. 0x2d18d0 bytes (72%) free.
Project build complete. To flash, run this command:
/home/srickus/develop/esp32/esp-idf/python_env/idf5.1_py3.10_env/bin/python ../../../../../../../esp32/esp-idf/components/esptool_py/esptool/esptool.py -p (PORT) -b 460800 --before default_reset --after hard_reset --chip esp32 write_flash --flash_mode dio --flash_size 4MB --flash_freq 80m 0x1000 build/bootloader/bootloader.bin 0x8000 build/partition_table/partition-table.bin 0x10000 build/xs_esp32.bin
or run 'idf.py -p (PORT) flash'
Executing action: flash
Serial port /dev/ttyUSB1
Connecting.....
Detecting chip type... Unsupported detection protocol, switching and trying again...
Connecting....
Detecting chip type... ESP32
Running ninja in directory /home/srickus/develop/moddable/build/tmp/esp32/debug/sqd9j8rnmna/xsProj-esp32/build
Executing "ninja flash"...
[1/5] cd /home/srickus/develop/moddable/build/tmp/esp32/debug/sqd9j8rnmna/xsProj-esp32/build/esp-idf/esptool_py && /home/srickus/develop/esp32/esp-idf/python_env/idf5.1_py3.10_env/bin/python /home/srickus/develop/esp32/esp-idf/components/partition_table/check_sizes.py --offset 0x8000 partition --type app /home/srickus/develop/moddable/build/tmp/esp32/debug/sqd9j8rnmna/xsProj-esp32/build/partition_table/partition-table.bin /home/srickus/develop/moddable/build/tmp/esp32/debug/sqd9j8rnmna/xsProj-esp32/build/xs_esp32.bin
xs_esp32.bin binary size 0x11e730 bytes. Smallest app partition is 0x3f0000 bytes. 0x2d18d0 bytes (72%) free.
[2/5] Performing build step for 'bootloader'
[1/1] cd /home/srickus/develop/moddable/build/tmp/esp32/debug/sqd9j8rnmna/xsProj-esp32/build/bootloader/esp-idf/esptool_py && /home/srickus/develop/esp32/esp-idf/python_env/idf5.1_py3.10_env/bin/python /home/srickus/develop/esp32/esp-idf/components/partition_table/check_sizes.py --offset 0x8000 bootloader 0x1000 /home/srickus/develop/moddable/build/tmp/esp32/debug/sqd9j8rnmna/xsProj-esp32/build/bootloader/bootloader.bin
Bootloader binary size 0x46f0 bytes. 0x2910 bytes (37%) free.
[2/3] cd /home/srickus/develop/esp32/esp-idf/components/esptool_py && /usr/bin/cmake -D IDF_PATH=/home/srickus/develop/esp32/esp-idf -D "SERIAL_TOOL=/home/srickus/develop/esp32/esp-idf/python_env/idf5.1_py3.10_env/bin/python;;/home/srickus/develop/esp32/esp-idf/components/esptool_py/esptool/esptool.py;--chip;esp32" -D "SERIAL_TOOL_ARGS=--before=default_reset;--after=hard_reset;write_flash;@flash_args" -D WORKING_DIRECTORY=/home/srickus/develop/moddable/build/tmp/esp32/debug/sqd9j8rnmna/xsProj-esp32/build -P /home/srickus/develop/esp32/esp-idf/components/esptool_py/run_serial_tool.cmake
esptool.py --chip esp32 -p /dev/ttyUSB1 -b 115200 --before=default_reset --after=hard_reset write_flash --flash_mode dio --flash_freq 80m --flash_size 4MB 0x1000 bootloader/bootloader.bin 0x10000 xs_esp32.bin 0x8000 partition_table/partition-table.bin
esptool.py v4.7.dev2
Serial port /dev/ttyUSB1
Connecting....
Chip is ESP32-D0WD-V3 (revision v3.0)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: 54:43:b2:dc:8d:1c
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Flash will be erased from 0x00001000 to 0x00005fff...
Flash will be erased from 0x00010000 to 0x0012efff...
Flash will be erased from 0x00008000 to 0x00008fff...
Compressed 18160 bytes to 12653...
Writing at 0x00001000... (100 %)
Wrote 18160 bytes (12653 compressed) at 0x00001000 in 1.4 seconds (effective 106.4 kbit/s)...
Hash of data verified.
Compressed 1173296 bytes to 753124...
Writing at 0x00010000... (2 %)
Writing at 0x0001a24a... (4 %)
Writing at 0x000223b7... (6 %)
Writing at 0x0002bac6... (8 %)
Writing at 0x000355b9... (10 %)
...
Writing at 0x0011e32d... (95 %)
Writing at 0x00123a46... (97 %)
Writing at 0x00128c12... (100 %)
Wrote 1173296 bytes (753124 compressed) at 0x00010000 in 66.6 seconds (effective 141.0 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 83...
Writing at 0x00008000... (100 %)
Wrote 3072 bytes (83 compressed) at 0x00008000 in 0.1 seconds (effective 400.9 kbit/s)...
Hash of data verified.
Leaving...
Hard resetting via RTS pin...
Done
Sorry for the lengthy post, but I'm hoping someone has seen this error, maybe?
__
Steve