Skip to content

Commit c80c3b7

Browse files
authored
Merge branch 'master' into feat/touch-ng-all-socs
2 parents 04459fa + 956b687 commit c80c3b7

Some content is hidden

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

57 files changed

+1903
-261
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
# CI
1313
/.github/ @lucasssvaz @me-no-dev @P-R-O-C-H-Y
14+
/.github/codeql/ @lucasssvaz
1415
/.gitlab/ @lucasssvaz
1516
/tests/ @lucasssvaz @P-R-O-C-H-Y
1617

.github/ISSUE_TEMPLATE/Issue-report.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,17 @@ body:
8080
- other
8181
validations:
8282
required: true
83+
- type: dropdown
84+
id: type
85+
attributes:
86+
label: Type
87+
description: How would you define the type of the issue? Please select from the types below.
88+
options:
89+
- "Task"
90+
- "Bug"
91+
- "Question"
92+
validations:
93+
required: true
8394
- type: input
8495
id: IDE
8596
attributes:

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,3 @@ contact_links:
33
- name: Arduino Core for Espressif Discord Server
44
url: https://discord.gg/8xY6e9crwv
55
about: Community Discord server for questions and help
6-
- name: ESP32 Forum - Arduino
7-
url: https://esp32.com/viewforum.php?f=19
8-
about: Official Forum for questions

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
## Description of Change
1414
Please describe your proposed Pull Request and it's impact.
1515

16-
## Tests scenarios
16+
## Test Scenarios
1717
Please describe on what Hardware and Software combinations you have tested this Pull Request and how.
1818

1919
(*eg. I have tested my Pull Request on Arduino-esp32 core v2.0.2 with ESP32 and ESP32-S2 Board with this scenario*)

.github/codeql/codeql-config.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: "CodeQL config"
2+
3+
packs:
4+
- trailofbits/cpp-queries
5+
- githubsecuritylab/codeql-cpp-queries
6+
- githubsecuritylab/codeql-python-queries
7+
8+
queries:
9+
- uses: security-extended
10+
- uses: security-and-quality
11+
12+
query-filters:
13+
- exclude:
14+
query path:
15+
- /^experimental\/.*/
16+
- exclude:
17+
tags contain:
18+
- experimental
19+
- exclude:
20+
problem.severity:
21+
- recommendation
22+
- exclude:
23+
id: tob/cpp/use-of-legacy-algorithm # We use legacy algorithms in many places for integrity checks
24+
- exclude:
25+
id: cpp/dead-code-goto # Too many false positives in no-build mode
26+
27+
paths-ignore:
28+
- tests/**

.github/scripts/process_sarif.py

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
#!/usr/bin/env python3
2+
3+
# This script is used to process the SARIF file generated by CodeQL and
4+
# to rename files back to .ino and adjust line numbers to match the original .ino files.
5+
6+
import json
7+
import sys
8+
import os
9+
10+
def process_artifact_location(artifact_location, renamed_files):
11+
"""
12+
Process a single artifact location to rename .cpp files back to .ino
13+
"""
14+
if 'uri' in artifact_location:
15+
uri = artifact_location['uri']
16+
if uri in renamed_files:
17+
print(f"Renaming file: {uri} -> {renamed_files[uri]}")
18+
artifact_location['uri'] = renamed_files[uri]
19+
return True
20+
return False
21+
22+
def process_region(region):
23+
"""
24+
Adjust line numbers in a region by decreasing them by 1
25+
"""
26+
if 'startLine' in region:
27+
region['startLine'] = max(1, region['startLine'] - 1)
28+
if 'endLine' in region:
29+
region['endLine'] = max(1, region['endLine'] - 1)
30+
31+
def process_physical_location(physical_location, renamed_files):
32+
"""
33+
Process a physical location to rename files and adjust line numbers
34+
"""
35+
file_renamed = False
36+
37+
if 'artifactLocation' in physical_location:
38+
if process_artifact_location(physical_location['artifactLocation'], renamed_files):
39+
file_renamed = True
40+
41+
# Adjust line numbers if the file was renamed
42+
if file_renamed and 'region' in physical_location:
43+
process_region(physical_location['region'])
44+
45+
return file_renamed
46+
47+
48+
def process_sarif_file(sarif_file, renamed_files_file):
49+
"""
50+
Process SARIF file to rename files back to .ino and adjust line numbers
51+
"""
52+
# Read the renamed files mapping
53+
with open(renamed_files_file, 'r') as f:
54+
renamed_files = json.load(f)
55+
56+
print(f"Loaded {len(renamed_files)} file mappings:")
57+
for cpp_file, ino_file in renamed_files.items():
58+
print(f" {cpp_file} -> {ino_file}")
59+
60+
61+
# Read the SARIF file
62+
with open(sarif_file, 'r') as f:
63+
sarif_data = json.load(f)
64+
65+
files_processed = 0
66+
67+
# Process each run
68+
if 'runs' in sarif_data:
69+
for run in sarif_data['runs']:
70+
# Process results
71+
if 'results' in run:
72+
for result in run['results']:
73+
# Process all locations in the result
74+
if 'locations' in result:
75+
for location in result['locations']:
76+
if 'physicalLocation' in location:
77+
if process_physical_location(location['physicalLocation'], renamed_files):
78+
files_processed += 1
79+
80+
# Process related locations if they exist
81+
if 'relatedLocations' in result:
82+
for location in result['relatedLocations']:
83+
if 'physicalLocation' in location:
84+
if process_physical_location(location['physicalLocation'], renamed_files):
85+
files_processed += 1
86+
87+
# Process artifacts if they exist
88+
if 'artifacts' in run:
89+
for artifact in run['artifacts']:
90+
if 'location' in artifact and 'uri' in artifact['location']:
91+
uri = artifact['location']['uri']
92+
if uri in renamed_files:
93+
artifact['location']['uri'] = renamed_files[uri]
94+
files_processed += 1
95+
96+
print(f"Processed {files_processed} file references")
97+
98+
# Write the processed SARIF file
99+
with open(sarif_file, 'w') as f:
100+
json.dump(sarif_data, f, indent=2)
101+
102+
def main():
103+
if len(sys.argv) != 3:
104+
print("Usage: python3 sarif_nobuild.py <sarif_file> <renamed_files_file>")
105+
sys.exit(1)
106+
107+
sarif_file = sys.argv[1]
108+
renamed_files_file = sys.argv[2]
109+
110+
# Check if files exist
111+
if not os.path.exists(sarif_file):
112+
print(f"SARIF file not found: {sarif_file}")
113+
sys.exit(1)
114+
115+
if not os.path.exists(renamed_files_file):
116+
print(f"Renamed files mapping not found: {renamed_files_file}")
117+
sys.exit(1)
118+
119+
try:
120+
process_sarif_file(sarif_file, renamed_files_file)
121+
print("SARIF file processed successfully")
122+
except Exception as e:
123+
print(f"Error processing SARIF file: {e}")
124+
import traceback
125+
traceback.print_exc()
126+
sys.exit(1)
127+
128+
if __name__ == "__main__":
129+
main()

.github/scripts/set_push_chunks.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ chunks+="]"
7878
echo "build_all=$build_all"
7979
echo "build_libraries=$BUILD_LIBRARIES"
8080
echo "build_static_sketches=$BUILD_STATIC_SKETCHES"
81-
echo "build_idf=$BUILD_IDF"
8281
echo "chunk_count=$chunks_count"
8382
echo "chunks=$chunks"
8483
} >> "$GITHUB_OUTPUT"

.github/workflows/allboards.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on:
55
repository_dispatch:
66
types: [test-boards]
77

8+
permissions:
9+
contents: read
10+
811
jobs:
912
find-boards:
1013
runs-on: ubuntu-latest
@@ -36,10 +39,6 @@ jobs:
3639
with:
3740
ref: ${{ github.event.client_payload.branch }}
3841

39-
- run: npm install
40-
- name: Setup jq
41-
uses: dcarbone/install-jq-action@e397bd87438d72198f81efd21f876461183d383a # v3.0.1
42-
4342
- id: set-test-chunks
4443
name: Set Chunks
4544
run: echo "test-chunks<<EOF" >> $GITHUB_OUTPUT

.github/workflows/boards.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ on:
88
- "libraries/ESP32/examples/CI/CIBoardsTest/CIBoardsTest.ino"
99
- ".github/workflows/boards.yml"
1010

11+
permissions:
12+
contents: read
13+
1114
env:
1215
# It's convenient to set variables for values used multiple times in the workflow
1316
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
@@ -24,9 +27,6 @@ jobs:
2427
- name: Checkout repository
2528
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2629

27-
- name: Setup jq
28-
uses: dcarbone/install-jq-action@e397bd87438d72198f81efd21f876461183d383a # v3.0.1
29-
3030
- name: Get board name
3131
run: bash .github/scripts/find_new_boards.sh ${{ github.repository }} ${{github.base_ref}}
3232

.github/workflows/build_component.yml

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
name: Arduino as ESP-IDF Component
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
idf_ver:
7+
description: "IDF Versions"
8+
default: "release-v5.3,release-v5.4,release-v5.5"
9+
type: "string"
10+
required: true
11+
idf_targets:
12+
description: "IDF Targets"
13+
default: "esp32,esp32s2,esp32s3,esp32c2,esp32c3,esp32c6,esp32h2,esp32p4"
14+
type: "string"
15+
required: true
16+
push:
17+
branches:
18+
- master
19+
- release/*
20+
pull_request:
21+
paths:
22+
- "cores/**"
23+
- "libraries/**/*.cpp"
24+
- "libraries/**/*.c"
25+
- "libraries/**/*.h"
26+
- "libraries/**/*.ino"
27+
- "libraries/**/ci.json"
28+
- "idf_component_examples/**"
29+
- "idf_component.yml"
30+
- "Kconfig.projbuild"
31+
- "CMakeLists.txt"
32+
- ".github/workflows/build_component.yml"
33+
- ".github/scripts/check-cmakelists.sh"
34+
- ".github/scripts/on-push-idf.sh"
35+
- ".github/scripts/sketch_utils.sh"
36+
- "variants/esp32/**"
37+
- "variants/esp32c2/**"
38+
- "variants/esp32c3/**"
39+
- "variants/esp32c6/**"
40+
- "variants/esp32h2/**"
41+
- "variants/esp32p4/**"
42+
- "variants/esp32s2/**"
43+
- "variants/esp32s3/**"
44+
- "!*.md"
45+
- "!*.txt"
46+
- "!*.properties"
47+
48+
permissions:
49+
contents: read
50+
51+
concurrency:
52+
group: build-component-${{github.event.pull_request.number || github.ref}}
53+
cancel-in-progress: true
54+
55+
jobs:
56+
cmake-check:
57+
name: Check CMakeLists
58+
runs-on: ubuntu-latest
59+
if: ${{ !(github.event_name == 'pull_request' && startsWith(github.head_ref, 'release/')) }}
60+
steps:
61+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
62+
- run: bash ./.github/scripts/check-cmakelists.sh
63+
64+
set-matrix:
65+
name: Set Matrix
66+
runs-on: ubuntu-latest
67+
if: ${{ !(github.event_name == 'pull_request' && startsWith(github.head_ref, 'release/')) }}
68+
outputs:
69+
idf_ver: ${{ steps.set-matrix.outputs.idf_ver }}
70+
idf_target: ${{ steps.set-matrix.outputs.idf_target }}
71+
steps:
72+
- name: Get IDF Version and Targets
73+
id: set-matrix
74+
run: |
75+
# Default values
76+
idf_ver="release-v5.3,release-v5.4,release-v5.5"
77+
idf_targets="esp32,esp32s2,esp32s3,esp32c2,esp32c3,esp32c6,esp32h2,esp32p4"
78+
79+
# Override with inputs if provided
80+
if [[ -n "${{ inputs.idf_ver }}" ]]; then
81+
idf_ver="${{ inputs.idf_ver }}"
82+
fi
83+
if [[ -n "${{ inputs.idf_targets }}" ]]; then
84+
idf_targets="${{ inputs.idf_targets }}"
85+
fi
86+
87+
# Convert comma-separated strings to JSON arrays using a more robust method
88+
idf_ver_json=$(printf '%s\n' "$idf_ver" | tr ',' '\n' | jq -R . | jq -s . | jq -c .)
89+
idf_targets_json=$(printf '%s\n' "$idf_targets" | tr ',' '\n' | jq -R . | jq -s . | jq -c .)
90+
91+
# Debug: Print the JSON for verification
92+
echo "Debug - idf_ver_json: $idf_ver_json"
93+
echo "Debug - idf_targets_json: $idf_targets_json"
94+
95+
# Set outputs - ensure no extra whitespace
96+
printf "idf_ver=%s\n" "$idf_ver_json" >> $GITHUB_OUTPUT
97+
printf "idf_target=%s\n" "$idf_targets_json" >> $GITHUB_OUTPUT
98+
99+
build-esp-idf-component:
100+
name: Build IDF ${{ matrix.idf_ver }} for ${{ matrix.idf_target }}
101+
runs-on: ubuntu-latest
102+
needs: set-matrix
103+
strategy:
104+
fail-fast: false
105+
matrix:
106+
# The version names here correspond to the versions of espressif/idf Docker image.
107+
# See https://hub.docker.com/r/espressif/idf/tags and
108+
# https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/tools/idf-docker-image.html
109+
# for details.
110+
idf_ver: ${{ fromJson(needs.set-matrix.outputs.idf_ver) }}
111+
idf_target: ${{ fromJson(needs.set-matrix.outputs.idf_target) }}
112+
container: espressif/idf:${{ matrix.idf_ver }}
113+
steps:
114+
- name: Check out arduino-esp32 as a component
115+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
116+
with:
117+
submodules: recursive
118+
path: components/arduino-esp32
119+
120+
# Need to install jq in the container to be able to use it in the script
121+
- name: Setup jq
122+
uses: dcarbone/install-jq-action@e397bd87438d72198f81efd21f876461183d383a # v3.0.1
123+
124+
- name: Build
125+
env:
126+
IDF_TARGET: ${{ matrix.idf_target }}
127+
shell: bash
128+
run: |
129+
chmod a+x ./components/arduino-esp32/.github/scripts/*
130+
./components/arduino-esp32/.github/scripts/on-push-idf.sh
131+
132+
- name: Upload generated sdkconfig files for debugging
133+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
134+
if: always()
135+
with:
136+
name: sdkconfig-${{ matrix.idf_ver }}-${{ matrix.idf_target }}
137+
path: ./components/arduino-esp32/idf_component_examples/**/sdkconfig

0 commit comments

Comments
 (0)