Skip to content

Commit 179d347

Browse files
Copilotdobairoland
authored andcommitted
ci(github): Update the Github Copilot configuration file
1 parent fcabe4e commit 179d347

File tree

1 file changed

+30
-21
lines changed

1 file changed

+30
-21
lines changed

.github/copilot-instructions.md

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88

99
**Project Type**: Embedded C firmware with CMake build system
1010
**Languages**: C (firmware), Python (build tools, tests)
11-
**Size**: Small-medium (~20 C source files, ~1000 lines main codebase)
12-
**Target Chips**: esp32, esp32s2, esp32s3, esp32c2, esp32c3, esp32c5, esp32c6, esp32c61, esp32h2, esp32p4, esp8266
13-
**Build Time**: ~5-10 seconds per chip, ~2-3 minutes for all chips
11+
**Size**: Small (~8 C source files, ~1600 lines main codebase)
12+
**Target Chips**: esp32, esp32s2, esp32s3, esp32c2, esp32c3, esp32c5, esp32c6, esp32c61, esp32h2, esp32h21, esp32h4, esp32p4-rev1, esp32p4, esp8266
13+
**Build Time**: ~0.5-1.5 seconds per chip, ~10-15 seconds for all chips built by build_all_chips.sh (12 chips)
1414

1515
## Critical Setup Steps (ALWAYS Follow This Order)
1616

@@ -57,7 +57,7 @@ cd ..
5757
This downloads and extracts three toolchains (takes ~2-5 minutes):
5858
1. `xtensa-esp-elf-15.1.0_20250607` - For esp32, esp32s2, esp32s3 (~120MB download)
5959
2. `xtensa-lx106-elf-gcc8_4_0-esp-2020r3` - For esp8266 (~100MB download)
60-
3. `riscv32-esp-elf-15.1.0_20250607` - For esp32c2, esp32c3, esp32c5, esp32c6, esp32c61, esp32h2, esp32p4 (~255MB download)
60+
3. `riscv32-esp-elf-15.1.0_20250607` - For esp32c2, esp32c3, esp32c5, esp32c6, esp32c61, esp32h2, esp32h21, esp32h4, esp32p4-rev1, esp32p4 (~255MB download)
6161

6262
**Note**: Network issues may cause partial downloads. If esp8266 toolchain fails, you can still build other chips.
6363

@@ -94,7 +94,7 @@ cmake . -B build -G Ninja -DTARGET_CHIP=esp32s2 # Replace with desired chip
9494
ninja -C build
9595
```
9696

97-
**Build Time**: ~5-10 seconds per chip
97+
**Build Time**: ~0.5-1.5 seconds per chip
9898
**Output Files**:
9999
- `build/src/stub-{chip}.elf` - ELF binary
100100
- `build/{chip}.json` - JSON file with stub data (used by esptool)
@@ -112,7 +112,7 @@ source ./tools/export_toolchains.sh
112112
./tools/build_all_chips.sh
113113
```
114114

115-
**Build Time**: ~2-3 minutes for all 11 chips
115+
**Build Time**: ~10-15 seconds for all 12 chips built by build_all_chips.sh (note: cmake defines 14 total chips, but only 12 are in the build script)
116116
**Output**: Creates `build-{chip}/` directories for each chip with ELF and JSON files
117117

118118
This script:
@@ -156,25 +156,27 @@ source venv/bin/activate
156156
pre-commit run --all-files
157157
```
158158

159-
**Note**: Astyle formatting is configured in `.astyle-rules.yml`. Submodules and libraries (like `src/miniz.*`) are excluded from checks.
159+
**Note**: Astyle formatting is configured in `.astyle-rules.yml`. Submodules are excluded from checks.
160160

161161
### Copyright Headers
162162

163-
**ALWAYS** include this header in new C files:
163+
**ALWAYS** include this header in new C files (the year will be auto-updated by the check-copyright tool):
164164
```c
165165
/*
166-
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
166+
* SPDX-FileCopyrightText: 2025-2026 Espressif Systems (Shanghai) CO LTD
167167
*
168168
* SPDX-License-Identifier: Apache-2.0 OR MIT
169169
*/
170170
```
171171

172172
For Python files:
173173
```python
174-
# SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
174+
# SPDX-FileCopyrightText: 2025-2026 Espressif Systems (Shanghai) CO LTD
175175
# SPDX-License-Identifier: Apache-2.0 OR MIT
176176
```
177177

178+
**Note**: The check-copyright tool uses `{years}` as a placeholder and will automatically manage copyright years based on the file's creation and modification dates.
179+
178180
## CI/CD Workflows
179181

180182
### GitHub Actions Workflows
@@ -228,8 +230,7 @@ The repository uses pre-commit.ci for automated PR checks. It runs all pre-commi
228230
- `command_handler.c/h` - Command parsing and dispatch
229231
- `commands.h` - Command ID definitions
230232
- `transport.c/h` - UART/USB-JTAG transport layer
231-
- `miniz.c/h` - ZIP compression library (esp8266 only, third-party library with upstream TODOs)
232-
- `ld/` - Linker scripts for each chip (e.g., `esp32s2.ld`, `esp8266.ld`)
233+
- `ld/` - Linker scripts: one for each chip target (12 chip-specific scripts) plus `common.ld` included by all chip scripts
233234

234235
**`cmake/`**
235236
- `esp-targets.cmake` - ESP chip definitions, toolchain configuration functions, target-specific compiler flags
@@ -239,7 +240,7 @@ The repository uses pre-commit.ci for automated PR checks. It runs all pre-commi
239240
- `setup_toolchains.sh` - Downloads and extracts toolchains
240241
- `export_toolchains.sh` - Adds toolchains to PATH (must be sourced)
241242
- `elf2json.py` - Converts ELF binaries to JSON format for esptool
242-
- `install_all_chips.sh` - (Not commonly used)
243+
- `install_all_chips.sh` - Copies built JSON files to esptool directory (requires ESPTOOL_STUBS_DIR env var)
243244

244245
**`esp-stub-lib/`** (submodule)
245246
- Core library providing flash operations, UART, security, memory utilities
@@ -252,7 +253,14 @@ The repository uses pre-commit.ci for automated PR checks. It runs all pre-commi
252253
- `TestSlip.c` - SLIP protocol tests
253254
- `cmock_config.yml` - CMock configuration
254255
- `CMakeLists.txt` - Host test build configuration
256+
- `soc/` - Mock SOC headers for host tests
255257
- `target/` - Cross-compiled tests (run on actual hardware)
258+
- `run-tests.sh` - Target test runner script
259+
- `load-test.py` - Python script to load and run tests on hardware
260+
- `TestTargetExample.c` - Example target test
261+
- `CMakeLists.txt` - Target test build configuration
262+
- `scripts/` - Utility scripts
263+
- `generate_mocks.sh` - Script to generate mocks from headers
256264
- `Unity/` (submodule) - Unit testing framework
257265
- `CMock/` (submodule) - Mocking framework
258266
- `README.md` - Detailed testing documentation
@@ -263,7 +271,7 @@ The repository uses pre-commit.ci for automated PR checks. It runs all pre-commi
263271
- **CMake target configuration**: `cmake/esp-targets.cmake` determines toolchain and compiler flags based on TARGET_CHIP
264272
- **Linker scripts**: Each chip has a specific linker script in `src/ld/{chip}.ld`
265273
- **Post-build processing**: `tools/elf2json.py` requires esptool and is called automatically after build
266-
- **Chip-specific code**: esp8266 includes miniz library for compression; other chips don't need it
274+
- **Chip support**: cmake defines 14 chips (esp32, esp32s2, esp32s3, esp32c2, esp32c3, esp32c5, esp32c6, esp32c61, esp32h2, esp32h21, esp32h4, esp32p4-rev1, esp32p4, esp8266), but build_all_chips.sh only builds 12 (excludes esp32h21 and esp32h4)
267275

268276
## Common Issues and Workarounds
269277

@@ -317,20 +325,16 @@ pre-commit run astyle_py --all-files
317325

318326
The following TODOs exist in the codebase:
319327

320-
**src/command_handler.c** (lines 47, 54, 71, 104, 110):
321-
- Flash initialization improvements needed
328+
**src/command_handler.c** (lines 213, 218, 300, 563, 905):
322329
- Cleanup procedures for flash operations
323330
- Reboot command implementation
324331
- Delay consideration for flash operations
332+
- Reboot command implementation (duplicate entry)
325333
- WDT reset implementation for system reset
326334

327-
**src/transport.c** (line 40):
335+
**src/transport.c** (line 58):
328336
- Proper fix needed for zero-length packet handling
329337

330-
**src/miniz.c** (multiple locations):
331-
- Various compression optimizations and improvements
332-
- **Note**: This is a third-party library - these are upstream issues and should NOT be modified locally
333-
334338
When working on these areas, consider whether the TODO is actionable or requires broader design decisions.
335339

336340
## Validation Steps Before PR Submission
@@ -359,6 +363,11 @@ When working on these areas, consider whether the TODO is actionable or requires
359363
ls -la build/*.json
360364
```
361365

366+
5. **Update documentation if needed**:
367+
- If your PR adds or removes files, update the file lists in `.github/copilot-instructions.md` and `README.md` accordingly
368+
- If your PR adds support for a new chip target, update the chip lists in `.github/copilot-instructions.md` and verify `tools/build_all_chips.sh` includes it
369+
- Review whether `.github/copilot-instructions.md` or `README.md` need updates to reflect your changes (e.g., new build steps, changed dependencies, updated workflows)
370+
362371
## Tips for Efficient Development
363372

364373
1. **Trust these instructions**: They are validated and tested. Only search for additional information if something fails or is unclear.

0 commit comments

Comments
 (0)