Skip to content

fix(board): Update variant.cpp for senseBox MCU-S2 ESP32-S2 #11502

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 13 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
129 changes: 129 additions & 0 deletions .github/scripts/package_esptool.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
#!/bin/bash

set -euo pipefail

# Check version argument
if [[ $# -ne 3 ]]; then
echo "Usage: $0 <version> <base_folder> <json_path>"
echo "Example: $0 5.0.dev1 /tmp/esptool /tmp/esptool-5.0.dev1.json"
exit 1
fi

VERSION=$1
BASE_FOLDER=$2
JSON_PATH=$3

export COPYFILE_DISABLE=1

shopt -s nullglob # So for loop doesn't run if no matches

# Function to update JSON for a given host
function update_json_for_host {
local host=$1
local archive=$2

# Extract the old url from the JSON for this host, then replace only the filename
old_url=$(jq -r --arg host "$host" '
.packages[].tools[] | select(.name == "esptool_py") | .systems[] | select(.host == $host) | .url // empty
' "$tmp_json")
if [[ -n "$old_url" ]]; then
base_url="${old_url%/*}"
url="$base_url/$archive"
else
echo "No old url found for $host"
exit 1
fi

archiveFileName="$archive"
checksum="SHA-256:$(shasum -a 256 "$archive" | awk '{print $1}')"
size=$(stat -f%z "$archive")

# Use jq to update the JSON
jq --arg host "$host" \
--arg url "$url" \
--arg archiveFileName "$archiveFileName" \
--arg checksum "$checksum" \
--arg size "$size" \
'
.packages[].tools[]
|= if .name == "esptool_py" then
.systems = (
((.systems // []) | map(select(.host != $host))) + [{
host: $host,
url: $url,
archiveFileName: $archiveFileName,
checksum: $checksum,
size: $size
}]
)
else
.
end
' "$tmp_json" > "$tmp_json.new" && mv "$tmp_json.new" "$tmp_json"
}

cd "$BASE_FOLDER"

# Delete all archives before starting
rm -f esptool-*.tar.gz esptool-*.zip

for dir in esptool-*; do
# Check if directory exists and is a directory
if [[ ! -d "$dir" ]]; then
continue
fi

base="${dir#esptool-}"

# Add 'linux-' prefix if base doesn't contain linux/macos/win64
if [[ "$base" != *linux* && "$base" != *macos* && "$base" != *win64* ]]; then
base="linux-${base}"
fi

if [[ "$dir" == esptool-win* ]]; then
# Windows zip archive
zipfile="esptool-v${VERSION}-${base}.zip"
echo "Creating $zipfile from $dir ..."
zip -r "$zipfile" "$dir"
else
# Non-Windows: set permissions and tar.gz archive
tarfile="esptool-v${VERSION}-${base}.tar.gz"
echo "Setting permissions and creating $tarfile from $dir ..."
chmod -R u=rwx,g=rx,o=rx "$dir"
tar -cvzf "$tarfile" "$dir"
fi
done

# After the for loop, update the JSON for each archive
# Create a temporary JSON file to accumulate changes
tmp_json="${JSON_PATH}.tmp"
cp "$JSON_PATH" "$tmp_json"

for archive in esptool-v"${VERSION}"-*.tar.gz esptool-v"${VERSION}"-*.zip; do
[ -f "$archive" ] || continue

echo "Updating JSON for $archive"

# Determine host from archive name
case "$archive" in
*linux-amd64*) host="x86_64-pc-linux-gnu" ;;
*linux-armv7*) host="arm-linux-gnueabihf" ;;
*linux-aarch64*) host="aarch64-linux-gnu" ;;
*macos-amd64*) host="x86_64-apple-darwin" ;;
*macos-arm64*) host="arm64-apple-darwin" ;;
*win64*) hosts=("x86_64-mingw32" "i686-mingw32") ;;
*) echo "Unknown host for $archive"; continue ;;
esac

# For win64, loop over both hosts; otherwise, use a single host
if [[ "$archive" == *win64* ]]; then
for host in "${hosts[@]}"; do
update_json_for_host "$host" "$archive"
done
else
update_json_for_host "$host" "$archive"
fi
done

# After all archives are processed, move the temporary JSON to the final file
mv "$tmp_json" "$JSON_PATH"
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ set(ARDUINO_LIBRARY_LittleFS_SRCS libraries/LittleFS/src/LittleFS.cpp)
set(ARDUINO_LIBRARY_NetBIOS_SRCS libraries/NetBIOS/src/NetBIOS.cpp)

set(ARDUINO_LIBRARY_OpenThread_SRCS
libraries/OpenThread/src/OThread.cpp
libraries/OpenThread/src/OThreadCLI.cpp
libraries/OpenThread/src/OThreadCLI_Util.cpp)

Expand Down
6 changes: 2 additions & 4 deletions boards.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36051,12 +36051,12 @@ XIAO_ESP32S3_Plus.build.cdc_on_boot=1
XIAO_ESP32S3_Plus.build.msc_on_boot=0
XIAO_ESP32S3_Plus.build.dfu_on_boot=0
XIAO_ESP32S3_Plus.build.f_cpu=240000000L
XIAO_ESP32S3_Plus.build.flash_size=8MB
XIAO_ESP32S3_Plus.build.flash_size=16MB
XIAO_ESP32S3_Plus.build.flash_freq=80m
XIAO_ESP32S3_Plus.build.flash_mode=dio
XIAO_ESP32S3_Plus.build.boot=qio
XIAO_ESP32S3_Plus.build.boot_freq=80m
XIAO_ESP32S3_Plus.build.partitions=default_8MB
XIAO_ESP32S3_Plus.build.partitions=ffat
XIAO_ESP32S3_Plus.build.defines=
XIAO_ESP32S3_Plus.build.loop_core=
XIAO_ESP32S3_Plus.build.event_core=
Expand Down Expand Up @@ -36093,8 +36093,6 @@ XIAO_ESP32S3_Plus.menu.FlashMode.dio.build.boot=dio
XIAO_ESP32S3_Plus.menu.FlashMode.dio.build.boot_freq=80m
XIAO_ESP32S3_Plus.menu.FlashMode.dio.build.flash_freq=80m

XIAO_ESP32S3_Plus.menu.FlashSize.8M=8MB (64Mb)
XIAO_ESP32S3_Plus.menu.FlashSize.8M.build.flash_size=8MB
XIAO_ESP32S3_Plus.menu.FlashSize.16M=16MB (128Mb)
XIAO_ESP32S3_Plus.menu.FlashSize.16M.build.flash_size=16MB

Expand Down
Loading
Loading