On Sun, 2024-02-11 at 13:32 +0800, Sadeep Madurange wrote: > Hello, > > Has anyone set up the ESP-IDF for programming ESP32 MCUs? > > Should I install dependencies like libmpc using pkg_add, and then > install the ESP-IDF from their GitHub or put things together using > xtensa-esp32-elf/* ports and use CMake without the ESP-IDF? >
Hi, OpenBSD ports team did a great job building xtensa-/riscv32- toolchains in the tree. You can use it as-is to build an image file an ESP32 MCU, but just like that you'll end up with bare metal code and have to write lot of things to do basic things, but it's doable. Unfortunately the version of these toolchains in the tree are not compatible with esp-idf 5.1.2, in fact espressif provide toolchains that are versioned against specific version of their idf environment. Example: 5.1.2 requires 12.2.0_20230208, you can try building some code from 5.1.2 with the toolchain in the ports tree, most of the parts work but some don't. Also if you want to use esp-idf, you also have to install various python packages that are listed in tools/requirements/requirements.core.txt, some of them are packaged, some aren't so use pip3 --user if needed. Then setup some environment variables: export IDF_PATH=path/to/esp-idf-repo export IDF_PYTHON_CHECK_CONSTRAINTS=no And add the desired toolchain in your PATH, e.g. /usr/local/xtensa- esp32s3-elf/bin. Finally, you can try to build an example project: cmake -S examples/get-started/blink -B build -DPYTHON=python3 - DIDF_TARGET=esp32s3 -DPYTHON_DEPS_CHECKED=On There are some effort to use LLVM/clang at some point, but it's not ready nor officially supported AFAIK. Officially, the only way to get a compatible mixed version of their toolchains is to use their fork of crosstool-ng and as I can tell it's near to impossible of using it on OpenBSD, it uses large number of hardcoded GNUisms. HTH, -- David > Appreciate some pointers in the right direction by someone doing > ESP32 > dev on OpenBSD. >