Show pageOld revisionsBacklinksBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. This page presents a workaround that allows working with ESP32 devices with current Arduino port. It was presented on the [[https://forums.freebsd.org/threads/a-guide-for-installing-esp32-board-for-arduino-on-freebsd12.78408/|FreeBSD Forum]] by Raffeale. Hopefully it will get into the upstream one day and provide out of the box experience on %%FreeBSD%% :-) **NOTE: THIS IS A DIRTY UGLY HACK! NEVER WORK LIKE THIS ON %%FreeBSD%%! YOU CAN BREAK YOUR SYSTEM!** ====== Intructions ====== Perform these steps **as root** (yuck!): 1. Install arduino18 from ports [[https://www.freshports.org/devel/arduino18/|devel/arduino18]]. 2. Install "ESP32 for Arduino" package into the Arduino's local hardware database (as root). <code> cd /usr/local/arduino/hardware mkdir -p espressif cd /usr/local/arduino/hardware/espressif git clone https://github.com/espressif/arduino-esp32.git esp32 cd esp32 git submodule update --init --recursive </code> 3. Modify scripts to fetch Linux 64-bit version of the toolchain, or use [[https://www.freshports.org/devel/xtensa-esp32-elf|evel/xtensa-esp32-elf]] toolchain that is already present in the port tree (second way preferred and presented here): <code> pkg install xtensa-esp32-elf cd /usr/local/arduino/hardware/espressif/esp32/tools ln -s /usr/local/xtensa-esp32-elf . </code> 4. Update ''%%esptool%%'' that is used to convert ELF to BIN for ESP32: <code> cd /usr/local/arduino/hardware/espressif/esp32/tools git clone https://github.com/espressif/esptool.git esptool </code> 5. Create a wrapper script that will launch ''%%esptool%%'' from Arduino build system: <code> cd /usr/local/arduino/hardware/espressif/esp32/tools/esptool printf '#\!/bin/sh\n/usr/bin/env python /usr/local/arduino/hardware/espressif/esp32/tools/esptool.py $@' > esptool chmod +x esptool </code> 6. Create a patch for [[https://www.freshports.org/devel/arduino-builder|devel/arduino-builder]] - just place a a text file in ''%%/usr/ports/devel/arduino-builder/files%%'': <code> --- src/arduino.cc/builder/utils/utils.go.orig 2021-01-13 22:48:24.097459000 +0800 +++ src/arduino.cc/builder/utils/utils.go 2021-01-13 22:49:18.264758000 +0800 @@ -404,7 +404,7 @@ func NULLFile() string { if runtime.GOOS == "windows" { return "nul" } - return "/dev/null" + return "/tmp/null" } func MD5Sum(data []byte) string { </code> 7. Rebuild and Reinstall a patch for [[https://www.freshports.org/devel/arduino-builder|devel/arduino-builder]]: <code> cd /usr/ports/devel/arduino-builder make clean reinstall </code> 8. For use serial port to download program to esp board , you need add serial port driver into kernel put these into ''%%/boot/loader.conf%%'': <code> uftdi_load="YES" uchcom_load="YES" uslcom_load="YES" uarduno_load="YES" </code> 9. Install python serial library <code> pkg install py37-pyserial </code> Now the part **as normal user** that will use Arduino. Because most of the scripts are written for Linux we need to provide default ''%%python%%'' executable in the path: <code> mkdir -p $HOME/.local/bin ln -s /usr/local/bin/python3.7 $HOME/.local/bin/python echo "PATH=$HOME/.local/bin/:$PATH" >> $HOME/.profile </code> Reboot you machine, login as user, run ''%%arduino%%'', you will see new ''%%ESP32%%'' in the ''%%Tools / Board menu%%'', run ''%%Verify%%'' to build the example empty template, if no problems are found that means you have installed the toolchain and utilities successfully! :-) In case you need help ask [[https://forums.freebsd.org/threads/a-guide-for-installing-esp32-board-for-arduino-on-freebsd12.78408/|at the Forum Thread]]. ===== Notes ===== 1. There are some Arduino libraries which conflict with the esp32 library. You have to move /usr/local/arduino/libraries/Wifi and SD modules to /usr/local/arduino/hardware/arduino/avr/libraries 2. upload is ok , bug program is not running correctly (1) choose incorrectly partition scheme, choose the first scheme is okay for standard esp32s board (2) esptools version is too old. Use the latest esptools (esptools is upload tools for esp32, you can find it in /usr/local/arduino/hardware/espressif/esp32/tools) 3.esptools download link https://github.com/espressif/esptool arduino/esp32.txt Last modified: 2023/03/31 00:14by cederom