ESP-IDF: Difference between revisions
imported>Mirrexagon Add easy setup with nixpkgs-esp-dev |
imported>Mse63 pkgconfig has been replaced by pkg-config |
||
(One intermediate revision by one other user 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 |