Skip to content

Commit a0d685d

Browse files
authored
Merge branch 'release/v3.1.x' into uart_loop_back
2 parents 5748548 + 3554927 commit a0d685d

File tree

236 files changed

+8838
-1553
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

236 files changed

+8838
-1553
lines changed

.editorconfig

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ indent_size = 2
1818
indent_style = space
1919

2020
[*.{bash,sh}]
21-
indent_size = 2
21+
indent_size = 4
2222
indent_style = space
2323

2424
[*.{c,cc,cp,cpp,cxx,h,hh,hpp,hxx,ii,inl,ino,ixx,pde,tpl,tpp,txx}]

.github/ISSUE_TEMPLATE/Issue-report.yml

+2
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ body:
4141
options:
4242
- latest master (checkout manually)
4343
- latest development Release Candidate (RC-X)
44+
- v3.0.6
45+
- v3.0.5
4446
- v3.0.4
4547
- v3.0.3
4648
- v3.0.2

.github/scripts/find_new_boards.sh

+23-44
Original file line numberDiff line numberDiff line change
@@ -2,59 +2,39 @@
22

33
# Get inputs from command
44
owner_repository=$1
5-
pr_number=$2
5+
base_ref=$2
66

7-
url="https://api.github.com/repos/$owner_repository/pulls/$pr_number/files"
8-
echo $url
7+
# Download the boards.txt file from the base branch
8+
curl -L -o boards_base.txt https://raw.githubusercontent.com/$owner_repository/$base_ref/boards.txt
99

10-
# Get changes in boards.txt file from PR
11-
Patch=$(curl $url | jq -r '.[] | select(.filename == "boards.txt") | .patch ')
10+
# Compare boards.txt file in the repo with the modified file from PR
11+
diff=$(diff -u boards_base.txt boards.txt)
1212

13-
# Extract only changed lines number and count
14-
substring_patch=$(echo "$Patch" | grep -o '@@[^@]*@@')
15-
16-
params_array=()
13+
# Check if the diff is empty
14+
if [ -z "$diff" ]
15+
then
16+
echo "No changes in boards.txt file"
17+
echo "FQBNS="
18+
exit 0
19+
fi
1720

18-
IFS=$'\n' read -d '' -ra params <<< $(echo "$substring_patch" | grep -oE '[-+][0-9]+,[0-9]+')
21+
# Extract added or modified lines (lines starting with '+' or '-')
22+
modified_lines=$(echo "$diff" | grep -E '^[+-][^+-]')
1923

20-
for param in "${params[@]}"
21-
do
22-
echo "The parameter is $param"
23-
params_array+=("$param")
24-
done
24+
# Print the modified lines for debugging
25+
echo "Modified lines:"
26+
echo "$modified_lines"
2527

2628
boards_array=()
2729
previous_board=""
28-
file="boards.txt"
2930

30-
# Loop through boards.txt file and extract all boards that were added
31-
for (( c=0; c<${#params_array[@]}; c+=2 ))
31+
# Extract board names from the modified lines, and add them to the boards_array
32+
while read -r line
3233
do
33-
deletion_count=$( echo "${params_array[c]}" | cut -d',' -f2 | cut -d' ' -f1 )
34-
addition_line=$( echo "${params_array[c+1]}" | cut -d'+' -f2 | cut -d',' -f1 )
35-
addition_count=$( echo "${params_array[c+1]}" | cut -d'+' -f2 | cut -d',' -f2 | cut -d' ' -f1 )
36-
addition_end=$(($addition_line+$addition_count))
37-
38-
addition_line=$(($addition_line + 3))
39-
addition_end=$(($addition_end - $deletion_count))
40-
41-
echo $addition_line
42-
echo $addition_end
43-
44-
i=0
45-
46-
while read -r line
47-
do
48-
i=$((i+1))
49-
if [ $i -lt $addition_line ]
50-
then
51-
continue
52-
elif [ $i -gt $addition_end ]
53-
then
54-
break
55-
fi
5634
board_name=$(echo "$line" | cut -d '.' -f1 | cut -d '#' -f1)
57-
if [ "$board_name" != "" ] && [ "$board_name" != "esp32_family" ]
35+
# remove + or - from the board name at the beginning
36+
board_name=$(echo "$board_name" | sed 's/^[+-]//')
37+
if [ "$board_name" != "" ] && [ "$board_name" != "+" ] && [ "$board_name" != "-" ] && [ "$board_name" != "esp32_family" ]
5838
then
5939
if [ "$board_name" != "$previous_board" ]
6040
then
@@ -63,8 +43,7 @@ do
6343
echo "Added 'espressif:esp32:$board_name' to array"
6444
fi
6545
fi
66-
done < "$file"
67-
done
46+
done <<< "$modified_lines"
6847

6948
# Create JSON like string with all boards found and pass it to env variable
7049
board_count=${#boards_array[@]}

.github/scripts/install-platformio-esp32.sh

+38-4
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,9 @@ function count_sketches(){ # count_sketches <examples-path>
9696
continue
9797
fi
9898

99-
# Check if the sketch requires any configuration options
99+
# Check if the sketch requires any configuration options (AND)
100100
requirements=$(jq -r '.requires[]? // empty' $sketchdir/ci.json)
101-
if [[ "$requirements" != "null" ]] || [[ "$requirements" != "" ]]; then
101+
if [[ "$requirements" != "null" && "$requirements" != "" ]]; then
102102
for requirement in $requirements; do
103103
requirement=$(echo $requirement | xargs)
104104
found_line=$(grep -E "^$requirement" "$SDKCONFIG_DIR/esp32/sdkconfig")
@@ -107,6 +107,23 @@ function count_sketches(){ # count_sketches <examples-path>
107107
fi
108108
done
109109
fi
110+
111+
# Check if the sketch requires any configuration options (OR)
112+
requirements_or=$(jq -r '.requires_any[]? // empty' $sketchdir/ci.json)
113+
if [[ "$requirements_or" != "null" && "$requirements_or" != "" ]]; then
114+
found=false
115+
for requirement in $requirements_or; do
116+
requirement=$(echo $requirement | xargs)
117+
found_line=$(grep -E "^$requirement" "$SDKCONFIG_DIR/esp32/sdkconfig")
118+
if [[ "$found_line" != "" ]]; then
119+
found=true
120+
break
121+
fi
122+
done
123+
if [[ "$found" == "false" ]]; then
124+
continue
125+
fi
126+
fi
110127
fi
111128

112129
echo $sketch >> sketches.txt
@@ -187,9 +204,9 @@ function build_pio_sketches(){ # build_pio_sketches <board> <options> <examples-
187204
continue
188205
fi
189206

190-
# Check if the sketch requires any configuration options
207+
# Check if the sketch requires any configuration options (AND)
191208
requirements=$(jq -r '.requires[]? // empty' $sketchdir/ci.json)
192-
if [[ "$requirements" != "null" ]] || [[ "$requirements" != "" ]]; then
209+
if [[ "$requirements" != "null" && "$requirements" != "" ]]; then
193210
for requirement in $requirements; do
194211
requirement=$(echo $requirement | xargs)
195212
found_line=$(grep -E "^$requirement" "$SDKCONFIG_DIR/esp32/sdkconfig")
@@ -198,6 +215,23 @@ function build_pio_sketches(){ # build_pio_sketches <board> <options> <examples-
198215
fi
199216
done
200217
fi
218+
219+
# Check if the sketch requires any configuration options (OR)
220+
requirements_or=$(jq -r '.requires_any[]? // empty' $sketchdir/ci.json)
221+
if [[ "$requirements_or" != "null" && "$requirements_or" != "" ]]; then
222+
found=false
223+
for requirement in $requirements_or; do
224+
requirement=$(echo $requirement | xargs)
225+
found_line=$(grep -E "^$requirement" "$SDKCONFIG_DIR/esp32/sdkconfig")
226+
if [[ "$found_line" != "" ]]; then
227+
found=true
228+
break
229+
fi
230+
done
231+
if [[ "$found" == "false" ]]; then
232+
continue
233+
fi
234+
fi
201235
fi
202236

203237
sketchnum=$(($sketchnum + 1))

.github/scripts/on-push.sh

+1
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ if [ "$BUILD_PIO" -eq 0 ]; then
9191
fi
9292

9393
#build sketches for different targets
94+
build "esp32p4" "$CHUNK_INDEX" "$CHUNKS_CNT" "$BUILD_LOG" "$SKETCHES_FILE" "$SKETCHES_ESP32"
9495
build "esp32s3" "$CHUNK_INDEX" "$CHUNKS_CNT" "$BUILD_LOG" "$SKETCHES_FILE" "$SKETCHES_ESP32"
9596
build "esp32s2" "$CHUNK_INDEX" "$CHUNKS_CNT" "$BUILD_LOG" "$SKETCHES_FILE" "$SKETCHES_ESP32"
9697
build "esp32c3" "$CHUNK_INDEX" "$CHUNKS_CNT" "$BUILD_LOG" "$SKETCHES_FILE" "$SKETCHES_ESP32"

.github/scripts/on-release.sh

+3-17
Original file line numberDiff line numberDiff line change
@@ -219,12 +219,8 @@ find "$PKG_DIR" -name '*.git*' -type f -delete
219219
##
220220
RVTC_NAME="riscv32-esp-elf-gcc"
221221
RVTC_NEW_NAME="esp-rv32"
222-
X32TC_NAME="xtensa-esp32-elf-gcc"
222+
X32TC_NAME="xtensa-esp-elf-gcc"
223223
X32TC_NEW_NAME="esp-x32"
224-
XS2TC_NAME="xtensa-esp32s2-elf-gcc"
225-
XS2TC_NEW_NAME="esp-xs2"
226-
XS3TC_NAME="xtensa-esp32s3-elf-gcc"
227-
XS3TC_NEW_NAME="esp-xs3"
228224

229225
# Replace tools locations in platform.txt
230226
echo "Generating platform.txt..."
@@ -233,9 +229,7 @@ sed "s/version=.*/version=$RELEASE_TAG/g" | \
233229
sed 's/tools\.esp32-arduino-libs\.path\.windows=.*//g' | \
234230
sed 's/{runtime\.platform\.path}.tools.esp32-arduino-libs/\{runtime.tools.esp32-arduino-libs.path\}/g' | \
235231
sed 's/{runtime\.platform\.path}.tools.xtensa-esp-elf-gdb/\{runtime.tools.xtensa-esp-elf-gdb.path\}/g' | \
236-
sed "s/{runtime\.platform\.path}.tools.xtensa-esp32-elf/\\{runtime.tools.$X32TC_NEW_NAME.path\\}/g" | \
237-
sed "s/{runtime\.platform\.path}.tools.xtensa-esp32s2-elf/\\{runtime.tools.$XS2TC_NEW_NAME.path\\}/g" | \
238-
sed "s/{runtime\.platform\.path}.tools.xtensa-esp32s3-elf/\\{runtime.tools.$XS3TC_NEW_NAME.path\\}/g" | \
232+
sed "s/{runtime\.platform\.path}.tools.xtensa-esp-elf/\\{runtime.tools.$X32TC_NEW_NAME.path\\}/g" | \
239233
sed 's/{runtime\.platform\.path}.tools.riscv32-esp-elf-gdb/\{runtime.tools.riscv32-esp-elf-gdb.path\}/g' | \
240234
sed "s/{runtime\.platform\.path}.tools.riscv32-esp-elf/\\{runtime.tools.$RVTC_NEW_NAME.path\\}/g" | \
241235
sed 's/{runtime\.platform\.path}.tools.esptool/\{runtime.tools.esptool_py.path\}/g' | \
@@ -293,15 +287,7 @@ rvtc_jq_arg="\
293287
(.packages[0].platforms[0].toolsDependencies[] | select(.name==\"$X32TC_NAME\")).version = \"$RVTC_VERSION\" |\
294288
(.packages[0].platforms[0].toolsDependencies[] | select(.name==\"$X32TC_NAME\")).name = \"$X32TC_NEW_NAME\" |\
295289
(.packages[0].tools[] | select(.name==\"$X32TC_NAME\")).version = \"$RVTC_VERSION\" |\
296-
(.packages[0].tools[] | select(.name==\"$X32TC_NAME\")).name = \"$X32TC_NEW_NAME\" |\
297-
(.packages[0].platforms[0].toolsDependencies[] | select(.name==\"$XS2TC_NAME\")).version = \"$RVTC_VERSION\" |\
298-
(.packages[0].platforms[0].toolsDependencies[] | select(.name==\"$XS2TC_NAME\")).name = \"$XS2TC_NEW_NAME\" |\
299-
(.packages[0].tools[] | select(.name==\"$XS2TC_NAME\")).version = \"$RVTC_VERSION\" |\
300-
(.packages[0].tools[] | select(.name==\"$XS2TC_NAME\")).name = \"$XS2TC_NEW_NAME\" |\
301-
(.packages[0].platforms[0].toolsDependencies[] | select(.name==\"$XS3TC_NAME\")).version = \"$RVTC_VERSION\" |\
302-
(.packages[0].platforms[0].toolsDependencies[] | select(.name==\"$XS3TC_NAME\")).name = \"$XS3TC_NEW_NAME\" |\
303-
(.packages[0].tools[] | select(.name==\"$XS3TC_NAME\")).version = \"$RVTC_VERSION\" |\
304-
(.packages[0].tools[] | select(.name==\"$XS3TC_NAME\")).name = \"$XS3TC_NEW_NAME\""
290+
(.packages[0].tools[] | select(.name==\"$X32TC_NAME\")).name = \"$X32TC_NEW_NAME\""
305291
cat "$PACKAGE_JSON_TEMPLATE" | jq "$rvtc_jq_arg" > "$OUTPUT_DIR/package-rvfix.json"
306292
PACKAGE_JSON_TEMPLATE="$OUTPUT_DIR/package-rvfix.json"
307293

.github/scripts/sketch_utils.sh

+66-18
Original file line numberDiff line numberDiff line change
@@ -98,34 +98,47 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex
9898

9999
# Default FQBN options if none were passed in the command line.
100100

101-
esp32_opts="PSRAM=enabled,FlashMode=dio${fqbn_append:+,$fqbn_append}"
102-
esp32s2_opts="PSRAM=enabled,FlashMode=dio${fqbn_append:+,$fqbn_append}"
103-
esp32s3_opts="PSRAM=opi,USBMode=default,FlashMode=dio${fqbn_append:+,$fqbn_append}"
104-
esp32c3_opts="FlashMode=dio${fqbn_append:+,$fqbn_append}"
105-
esp32c6_opts="FlashMode=dio${fqbn_append:+,$fqbn_append}"
106-
esp32h2_opts="FlashMode=dio${fqbn_append:+,$fqbn_append}"
101+
esp32_opts="PSRAM=enabled${fqbn_append:+,$fqbn_append}"
102+
esp32s2_opts="PSRAM=enabled${fqbn_append:+,$fqbn_append}"
103+
esp32s3_opts="PSRAM=opi,USBMode=default${fqbn_append:+,$fqbn_append}"
104+
esp32c3_opts="$fqbn_append"
105+
esp32c6_opts="$fqbn_append"
106+
esp32h2_opts="$fqbn_append"
107+
esp32p4_opts="USBMode=default${fqbn_append:+,$fqbn_append}"
107108

108109
# Select the common part of the FQBN based on the target. The rest will be
109110
# appended depending on the passed options.
110111

112+
opt=""
113+
111114
case "$target" in
112115
"esp32")
113-
fqbn="espressif:esp32:esp32:${options:-$esp32_opts}"
116+
[ -n "${options:-$esp32_opts}" ] && opt=":${options:-$esp32_opts}"
117+
fqbn="espressif:esp32:esp32$opt"
114118
;;
115119
"esp32s2")
116-
fqbn="espressif:esp32:esp32s2:${options:-$esp32s2_opts}"
120+
[ -n "${options:-$esp32s2_opts}" ] && opt=":${options:-$esp32s2_opts}"
121+
fqbn="espressif:esp32:esp32s2$opt"
117122
;;
118123
"esp32c3")
119-
fqbn="espressif:esp32:esp32c3:${options:-$esp32c3_opts}"
124+
[ -n "${options:-$esp32c3_opts}" ] && opt=":${options:-$esp32c3_opts}"
125+
fqbn="espressif:esp32:esp32c3$opt"
120126
;;
121127
"esp32s3")
122-
fqbn="espressif:esp32:esp32s3:${options:-$esp32s3_opts}"
128+
[ -n "${options:-$esp32s3_opts}" ] && opt=":${options:-$esp32s3_opts}"
129+
fqbn="espressif:esp32:esp32s3$opt"
123130
;;
124131
"esp32c6")
125-
fqbn="espressif:esp32:esp32c6:${options:-$esp32c6_opts}"
132+
[ -n "${options:-$esp32c6_opts}" ] && opt=":${options:-$esp32c6_opts}"
133+
fqbn="espressif:esp32:esp32c6$opt"
126134
;;
127135
"esp32h2")
128-
fqbn="espressif:esp32:esp32h2:${options:-$esp32h2_opts}"
136+
[ -n "${options:-$esp32h2_opts}" ] && opt=":${options:-$esp32h2_opts}"
137+
fqbn="espressif:esp32:esp32h2$opt"
138+
;;
139+
"esp32p4")
140+
[ -n "${options:-$esp32p4_opts}" ] && opt=":${options:-$esp32p4_opts}"
141+
fqbn="espressif:esp32:esp32p4$opt"
129142
;;
130143
esac
131144

@@ -163,9 +176,9 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex
163176
exit 0
164177
fi
165178

166-
# Check if the sketch requires any configuration options
179+
# Check if the sketch requires any configuration options (AND)
167180
requirements=$(jq -r '.requires[]? // empty' $sketchdir/ci.json)
168-
if [[ "$requirements" != "null" ]] || [[ "$requirements" != "" ]]; then
181+
if [[ "$requirements" != "null" && "$requirements" != "" ]]; then
169182
for requirement in $requirements; do
170183
requirement=$(echo $requirement | xargs)
171184
found_line=$(grep -E "^$requirement" "$SDKCONFIG_DIR/$target/sdkconfig")
@@ -175,6 +188,24 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex
175188
fi
176189
done
177190
fi
191+
192+
# Check if the sketch excludes any configuration options (OR)
193+
requirements_or=$(jq -r '.requires_any[]? // empty' $sketchdir/ci.json)
194+
if [[ "$requirements_or" != "null" && "$requirements_or" != "" ]]; then
195+
found=false
196+
for requirement in $requirements_or; do
197+
requirement=$(echo $requirement | xargs)
198+
found_line=$(grep -E "^$requirement" "$SDKCONFIG_DIR/$target/sdkconfig")
199+
if [[ "$found_line" != "" ]]; then
200+
found=true
201+
break
202+
fi
203+
done
204+
if [[ "$found" == "false" ]]; then
205+
echo "Target $target meets none of the requirements in requires_any for $sketchname. Skipping."
206+
exit 0
207+
fi
208+
fi
178209
fi
179210

180211
ARDUINO_CACHE_DIR="$HOME/.arduino/cache.tmp"
@@ -213,9 +244,9 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex
213244
--build-cache-path "$ARDUINO_CACHE_DIR" \
214245
--build-path "$build_dir" \
215246
$xtra_opts "${sketchdir}" \
216-
> $output_file
247+
2>&1 | tee $output_file
217248

218-
exit_status=$?
249+
exit_status=${PIPESTATUS[0]}
219250
if [ $exit_status -ne 0 ]; then
220251
echo "ERROR: Compilation failed with error code $exit_status"
221252
exit $exit_status
@@ -322,9 +353,9 @@ function count_sketches(){ # count_sketches <path> [target] [file] [ignore-requi
322353
fi
323354

324355
if [ "$ignore_requirements" != "1" ]; then
325-
# Check if the sketch requires any configuration options
356+
# Check if the sketch requires any configuration options (AND)
326357
requirements=$(jq -r '.requires[]? // empty' $sketchdir/ci.json)
327-
if [[ "$requirements" != "null" ]] || [[ "$requirements" != "" ]]; then
358+
if [[ "$requirements" != "null" && "$requirements" != "" ]]; then
328359
for requirement in $requirements; do
329360
requirement=$(echo $requirement | xargs)
330361
found_line=$(grep -E "^$requirement" $SDKCONFIG_DIR/$target/sdkconfig)
@@ -333,6 +364,23 @@ function count_sketches(){ # count_sketches <path> [target] [file] [ignore-requi
333364
fi
334365
done
335366
fi
367+
368+
# Check if the sketch excludes any configuration options (OR)
369+
requirements_or=$(jq -r '.requires_any[]? // empty' $sketchdir/ci.json)
370+
if [[ "$requirements_or" != "null" && "$requirements_or" != "" ]]; then
371+
found=false
372+
for requirement in $requirements_or; do
373+
requirement=$(echo $requirement | xargs)
374+
found_line=$(grep -E "^$requirement" $SDKCONFIG_DIR/$target/sdkconfig)
375+
if [[ "$found_line" != "" ]]; then
376+
found=true
377+
break
378+
fi
379+
done
380+
if [[ "$found" == "false" ]]; then
381+
continue 2
382+
fi
383+
fi
336384
fi
337385
fi
338386
echo $sketch >> sketches.txt

0 commit comments

Comments
 (0)