ESP-IDF: Difference between revisions
imported>Mirrexagon Add easy setup with nixpkgs-esp-dev |
Link to archive.org for broken link to vscode tutorial |
||
| (2 intermediate revisions by 2 users not shown) | |||
| Line 25: | Line 25: | ||
=== Setting up the toolchain === | === Setting up the toolchain === | ||
ESP-IDF uses the Xtensa ESP32 GCC toolchain. Espressif hosts the official [https://github.com/espressif/crosstool-NG/releases prebuilt binaries] on GitHub. Sadly, these are not statically compiled, and do not work on NixOS without the use of a FHS environment. I will use <code>buildFHSUserEnv</code> to make the binaries work. Let's make a derivation out of this: | ESP-IDF uses the Xtensa or risc-v32 ESP32 GCC toolchain. Espressif hosts the official [https://github.com/espressif/crosstool-NG/releases prebuilt binaries] on GitHub. Sadly, these are not statically compiled, and do not work on NixOS without the use of a FHS environment. I will use <code>buildFHSUserEnv</code> to make the binaries work. Let's make a derivation out of this: | ||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
| Line 40: | Line 40: | ||
stdenv.mkDerivation rec { | stdenv.mkDerivation rec { | ||
pname = "esp32-toolchain"; | pname = "esp32-toolchain"; | ||
version = "2021r2"; | version = "2021r2-patch3"; | ||
src = fetchurl { | src = fetchurl { | ||
# url = "https://github.com/espressif/crosstool-NG/releases/download/esp-${version}/riscv32-esp-elf-gcc8_4_0-esp-${version}-linux-amd64.tar.gz"; | |||
# hash = "sha256-F5y61Xl5CtNeD0FKGNkAF8DxWMOXAiQRqOmGfbIXTxU="; | |||
url = "https://github.com/espressif/crosstool-NG/releases/download/esp-${version}/xtensa-esp32-elf-gcc8_4_0-esp-${version}-linux-amd64.tar.gz"; | url = "https://github.com/espressif/crosstool-NG/releases/download/esp-${version}/xtensa-esp32-elf-gcc8_4_0-esp-${version}-linux-amd64.tar.gz"; | ||
hash = "sha256- | hash = "sha256-nt0ed2J2iPQ1Vhki0UKZ9qACG6H2/2fkcuEQhpWmnlM="; | ||
}; | }; | ||
| Line 87: | Line 89: | ||
pkgs.mkShell { | pkgs.mkShell { | ||
name = "esp-idf-env"; | name = "esp-idf-env"; | ||
buildInputs = with pkgs; [ | buildInputs = with pkgs; [ | ||
(pkgs.callPackage ./esp32-toolchain.nix {}) | (pkgs.callPackage ./esp32-toolchain.nix {}) | ||
| Line 98: | Line 99: | ||
bison | bison | ||
gperf | gperf | ||
pkg-config | |||
cmake | cmake | ||
| Line 145: | Line 146: | ||
* [https://github.com/bgamari/esp32.nix esp32.nix] provides nix expression for building the esp32 sdk as well as micropython. | * [https://github.com/bgamari/esp32.nix esp32.nix] provides nix expression for building the esp32 sdk as well as micropython. | ||
* [https://github.com/taktoa/esp32-baremetal esp32-baremetal] has an example how to build esp32 firmware without relying on an sdk. | * [https://github.com/taktoa/esp32-baremetal esp32-baremetal] has an example how to build esp32 firmware without relying on an sdk. | ||
* [https://specific.solutions.limited/projects/hanging-plotter/electronics tutorial] for setting up the prebuilt toolchain with vscode | * [https://web.archive.org/web/20240621182952/https://specific.solutions.limited/projects/hanging-plotter/electronics tutorial] for setting up the prebuilt toolchain with vscode | ||
[[Category:Guide]] | [[Category:Guide]] | ||