#!/usr/bin/env bash
# Print the ESP-IDF CMake build directory for the release profile.
#
# embuild puts it under a content hash, and cargo keeps the old directory when
# the hash changes — so there can be several and only the newest is the one
# that matches the ELF cargo just linked. Picking the first alphabetically
# (which is what a glob does) is how you end up flashing a bootloader built
# from a different sdkconfig, which fails as a boot loop rather than as an
# error. Newest wins.
#
# Prints nothing and exits 1 if the tree has not been built.
set -euo pipefail
profile=${1:-release}
root="target/riscv32imac-esp-espidf/${profile}/build/esp-idf-sys"
newest=""
while IFS= read -r dir; do
[ -d "$dir" ] || continue
if [ -z "$newest" ] || [ "$dir" -nt "$newest" ]; then
newest=$dir
fi
done < <(find "$root" -maxdepth 3 -type d -path "*/out/build" 2>/dev/null)
[ -n "$newest" ] || exit 1
printf '%s\n' "$newest"
neiam
/lambent-flex-c6
public · Issues · Pulls · Labels · Forks · Compare · Actions success · Badges · Packages
⭐
Log in to mark this repository.
944 B · text
History
9d79b3d