Skip to content

Commit f0282b7

Browse files
authored
Merge branch 'espressif:master' into master
2 parents 7e96b75 + ef453a5 commit f0282b7

File tree

224 files changed

+3927
-772
lines changed

Some content is hidden

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

224 files changed

+3927
-772
lines changed

.github/ISSUE_TEMPLATE/Issue-report.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ body:
4343
- latest stable Release (if not listed below)
4444
- latest development Release Candidate (RC-X)
4545
- latest master (checkout manually)
46+
- v3.3.1
4647
- v3.3.0
4748
- v3.2.1
4849
- v3.2.0

.github/scripts/get_affected.py

Lines changed: 119 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,123 @@ def detect_universal_ctags() -> bool:
222222
except Exception:
223223
return False
224224

225+
def normalize_function_signature(signature: str) -> str:
226+
"""
227+
Normalize a function signature by removing parameter names, keeping only types.
228+
229+
This handles cases where header declarations and implementations have different parameter names.
230+
Uses a simple heuristic: the last word in each parameter is typically the parameter name.
231+
232+
For example:
233+
- "ltoa(long val, char *s, int radix)" -> "ltoa(long,char *,int)"
234+
- "ltoa(long value, char *result, int base)" -> "ltoa(long,char *,int)"
235+
236+
Args:
237+
signature: The function signature string, e.g., "(long val, char *s, int radix)"
238+
239+
Returns:
240+
Normalized signature with parameter names removed, e.g., "(long,char *,int)"
241+
"""
242+
if not signature:
243+
return signature
244+
245+
# Normalize signatures: treat (void) and () as equivalent (both mean no parameters)
246+
if signature == "(void)":
247+
return "()"
248+
249+
if not (signature.startswith("(") and signature.endswith(")")):
250+
return signature
251+
252+
# Handle const qualifier at the end (e.g., "(int i) const")
253+
const_qualifier = ""
254+
if signature.endswith(" const"):
255+
signature = signature[:-6] # Remove " const"
256+
const_qualifier = " const"
257+
258+
# Extract parameter list without parentheses
259+
param_list = signature[1:-1]
260+
if not param_list.strip():
261+
return "()" + const_qualifier
262+
263+
# Split by comma and process each parameter
264+
params = []
265+
for param in param_list.split(","):
266+
param = param.strip()
267+
if not param:
268+
continue
269+
270+
# Handle default parameters (e.g., "int x = 5")
271+
if "=" in param:
272+
param = param.split("=")[0].strip()
273+
274+
# Try simple approach first: remove the last word
275+
# This works for most cases: "int x" -> "int", "MyStruct s" -> "MyStruct"
276+
import re
277+
278+
# Handle arrays first: "int arr[10]" -> "int [10]", "char *argv[]" -> "char *[]"
279+
array_match = re.match(r'^(.+?)\s+(\w+)((?:\[\d*\])+)$', param)
280+
if array_match:
281+
type_part = array_match.group(1).strip()
282+
array_brackets = array_match.group(3)
283+
params.append(type_part + array_brackets)
284+
else:
285+
# Handle function pointers: "int (*func)(int, char)" -> "int (*)(int, char)"
286+
func_ptr_match = re.match(r'^(.+?)\s*\(\s*\*\s*(\w+)\s*\)\s*\((.+?)\)\s*$', param)
287+
if func_ptr_match:
288+
return_type = func_ptr_match.group(1).strip()
289+
inner_params = func_ptr_match.group(3).strip()
290+
# Recursively normalize the inner parameters
291+
if inner_params:
292+
inner_normalized = normalize_function_signature(f"({inner_params})")
293+
inner_normalized = inner_normalized[1:-1] # Remove outer parentheses
294+
else:
295+
inner_normalized = ""
296+
params.append(f"{return_type} (*)({inner_normalized})")
297+
else:
298+
# Try simple approach: remove the last word
299+
simple_match = re.match(r'^(.+)\s+(\w+)$', param)
300+
if simple_match:
301+
# Simple case worked - just remove the last word
302+
type_part = simple_match.group(1).strip()
303+
params.append(type_part)
304+
else:
305+
# Fallback to complex regex for edge cases with pointers
306+
# First, try to match cases with pointers/references (including multiple *)
307+
# Pattern: (everything before) (one or more * or &) (space) (parameter name)
308+
m = re.match(r'^(.+?)(\s*[*&]+\s+)(\w+)$', param)
309+
if m:
310+
# Keep everything before the pointers, plus the pointers (without the space before param name)
311+
type_part = m.group(1) + m.group(2).rstrip()
312+
params.append(type_part.strip())
313+
else:
314+
# Try to match cases without space between type and pointer: "char*ptr", "char**ptr"
315+
m = re.match(r'^(.+?)([*&]+)(\w+)$', param)
316+
if m:
317+
# Keep everything before the pointers, plus the pointers
318+
type_part = m.group(1) + m.group(2)
319+
params.append(type_part.strip())
320+
else:
321+
# Single word - assume it's a type
322+
params.append(param.strip())
323+
324+
# Normalize spacing around pointers to ensure consistent output
325+
# This ensures "char *" and "char*" both become "char *"
326+
if params:
327+
last_param = params[-1]
328+
# Normalize spacing around * and & symbols
329+
# Replace multiple spaces with single space, ensure space before * and &
330+
normalized = re.sub(r'\s+', ' ', last_param) # Collapse multiple spaces
331+
normalized = re.sub(r'\s*([*&]+)', r' \1', normalized) # Ensure space before * and &
332+
normalized = re.sub(r'([*&]+)\s*', r'\1 ', normalized) # Ensure space after * and &
333+
normalized = re.sub(r'\s+', ' ', normalized).strip() # Clean up extra spaces
334+
params[-1] = normalized
335+
336+
result = "(" + ",".join(params) + ")"
337+
if const_qualifier:
338+
result += const_qualifier
339+
340+
return result
341+
225342
def build_qname_from_tag(tag: dict) -> str:
226343
"""
227344
Compose a qualified name for a function/method using scope + name + signature.
@@ -231,9 +348,8 @@ def build_qname_from_tag(tag: dict) -> str:
231348
name = tag.get("name") or ""
232349
signature = tag.get("signature") or ""
233350

234-
# Normalize signatures: treat (void) and () as equivalent (both mean no parameters)
235-
if signature == "(void)":
236-
signature = "()"
351+
# Normalize the signature to remove parameter names
352+
signature = normalize_function_signature(signature)
237353

238354
qparts = []
239355
if scope:

.github/scripts/update-version.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,20 @@ ESP_ARDUINO_VERSION_MINOR="$2"
2424
ESP_ARDUINO_VERSION_PATCH="$3"
2525
ESP_ARDUINO_VERSION="$ESP_ARDUINO_VERSION_MAJOR.$ESP_ARDUINO_VERSION_MINOR.$ESP_ARDUINO_VERSION_PATCH"
2626

27-
# Get ESP-IDF version from push.yml (this way we can ensure that the version is correct even if the local libs are not up to date)
28-
ESP_IDF_VERSION=$(grep "idf_ver:" .github/workflows/push.yml | sed 's/.*release-v\([^"]*\).*/\1/')
27+
# Get ESP-IDF version from build_component.yml (this way we can ensure that the version is correct even if the local libs are not up to date)
28+
ESP_IDF_VERSION=$(grep -m 1 "default:" .github/workflows/build_component.yml | sed 's/.*release-v\([^"]*\).*/\1/')
2929
if [ -z "$ESP_IDF_VERSION" ]; then
30-
echo "Error: ESP-IDF version not found in push.yml" >&2
30+
echo "Error: ESP-IDF version not found in build_component.yml" >&2
3131
exit 1
3232
fi
3333

3434
echo "New Arduino Version: $ESP_ARDUINO_VERSION"
3535
echo "ESP-IDF Version: $ESP_IDF_VERSION"
3636

37+
echo "Updating issue template..."
38+
cat .github/ISSUE_TEMPLATE/Issue-report.yml | \
39+
sed "s/.*\- latest master .*/ - latest master \(checkout manually\)\\n - v$ESP_ARDUINO_VERSION/g" > __issue-report.yml && mv __issue-report.yml .github/ISSUE_TEMPLATE/Issue-report.yml
40+
3741
echo "Updating platform.txt..."
3842
cat platform.txt | sed "s/version=.*/version=$ESP_ARDUINO_VERSION/g" > __platform.txt && mv __platform.txt platform.txt
3943

.github/scripts/update_esptool.py

100644100755
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import os
3434
import shutil
3535
import stat
36+
import subprocess
3637
import tarfile
3738
import zipfile
3839
import hashlib
@@ -201,10 +202,34 @@ def get_release_info(version):
201202
response.raise_for_status()
202203
return response.json()
203204

205+
def create_branch_and_commit(version, json_path):
206+
"""Create a new branch and commit the changes to it."""
207+
branch_name = f"update-esptool-{version}"
208+
commit_message = f"change(esptool): Upgrade to version {version}"
209+
210+
try:
211+
# Create and checkout new branch
212+
subprocess.run(["git", "checkout", "-b", branch_name], check=True, capture_output=True, text=True)
213+
print(f"Created and switched to new branch: {branch_name}")
214+
215+
# Stage the JSON file
216+
subprocess.run(["git", "add", str(json_path)], check=True, capture_output=True, text=True)
217+
print(f"Staged file: {json_path}")
218+
219+
# Commit the changes
220+
subprocess.run(["git", "commit", "-m", commit_message], check=True, capture_output=True, text=True)
221+
print(f"Committed changes with message: {commit_message}")
222+
223+
except subprocess.CalledProcessError as e:
224+
print(f"Git operation failed: {e}")
225+
print(f"Command output: {e.stderr if e.stderr else e.stdout}")
226+
raise
227+
204228
def main():
205229
parser = argparse.ArgumentParser(description="Repack esptool and update JSON metadata.")
206230
parser.add_argument("version", help="Version of the esptool (e.g. 5.0.dev1)")
207231
parser.add_argument("-l", "--local", dest="base_folder", help="Enable local build mode and set the base folder with unpacked artifacts")
232+
parser.add_argument("-c", "--commit", action="store_true", help="Automatically create a new branch and commit the JSON file changes")
208233
args = parser.parse_args()
209234

210235
script_dir = Path(__file__).resolve().parent
@@ -232,5 +257,10 @@ def main():
232257
shutil.move(tmp_json_path, json_path)
233258
print(f"Done. JSON updated at {json_path}")
234259

260+
# Auto-commit if requested
261+
if args.commit:
262+
print("Auto-commit enabled. Creating branch and committing changes...")
263+
create_branch_and_commit(args.version, json_path)
264+
235265
if __name__ == "__main__":
236266
main()

.github/workflows/pre-commit-status.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,3 +131,24 @@ jobs:
131131
gh pr edit ${{ steps.pr-info.outputs.pr_number }} --repo ${{ github.repository }} --remove-label 'Status: Pre-commit fixes required ⚠️'
132132
env:
133133
GH_TOKEN: ${{ github.token }}
134+
135+
- name: Comment on PR about pre-commit failures
136+
if: |
137+
steps.pr-info.outputs.artifacts_found == 'true' &&
138+
steps.pr-info.outputs.pre_commit_outcome == 'failure' &&
139+
steps.pr-info.outputs.pending_commit == '0'
140+
uses: thollander/actions-comment-pull-request@24bffb9b452ba05a4f3f77933840a6a841d1b32b # v3.0.1
141+
with:
142+
pr-number: ${{ steps.pr-info.outputs.pr_number }}
143+
message: |
144+
## ⚠️ Pre-commit Hooks Failed
145+
146+
Some pre-commit hooks failed and require manual fixes. Please see the detailed error report below.
147+
148+
**What to do:**
149+
1. 📋 [**View the detailed error report**](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.event.workflow_run.id }}) to see which hooks failed
150+
2. 🔧 Fix the issues locally in your code
151+
3. 💾 Commit and push your changes
152+
4. 🔄 The hooks will run again automatically
153+
154+
**Need help?** Ask in the comments below.

.gitlab/workflows/common.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ stages:
1010

1111
variables:
1212
ESP_IDF_VERSION: "5.5"
13-
ESP_ARDUINO_VERSION: "3.3.0"
13+
ESP_ARDUINO_VERSION: "3.3.1"
1414

1515
#############
1616
# `default` #

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ set(CORE_SRCS
3232
cores/esp32/esp32-hal-cpu.c
3333
cores/esp32/esp32-hal-dac.c
3434
cores/esp32/esp32-hal-gpio.c
35+
cores/esp32/esp32-hal-hosted.c
3536
cores/esp32/esp32-hal-i2c.c
3637
cores/esp32/esp32-hal-i2c-ng.c
3738
cores/esp32/esp32-hal-i2c-slave.c

Kconfig.projbuild

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,9 +341,15 @@ config ARDUINO_SELECTIVE_PPP
341341
depends on ARDUINO_SELECTIVE_COMPILATION
342342
default y
343343

344+
config ARDUINO_SELECTIVE_Hash
345+
bool "Enable Hash"
346+
depends on ARDUINO_SELECTIVE_COMPILATION
347+
default y
348+
344349
config ARDUINO_SELECTIVE_ArduinoOTA
345350
bool "Enable ArduinoOTA"
346351
depends on ARDUINO_SELECTIVE_COMPILATION && ARDUINO_SELECTIVE_Network
352+
select ARDUINO_SELECTIVE_Hash
347353
select ARDUINO_SELECTIVE_ESPmDNS
348354
default y
349355

@@ -383,6 +389,7 @@ config ARDUINO_SELECTIVE_WebServer
383389
depends on ARDUINO_SELECTIVE_COMPILATION && ARDUINO_SELECTIVE_Network
384390
default y
385391
select ARDUINO_SELECTIVE_FS
392+
select ARDUINO_SELECTIVE_Hash
386393

387394
config ARDUINO_SELECTIVE_WiFi
388395
bool "Enable WiFi"

0 commit comments

Comments
 (0)