๐ ESP32 Examples - HardFOC Internal Interface Wrapper
๐ฏ Comprehensive Examples with Advanced Build System for HardFOC ESP32 Development
Professional-grade examples demonstrating all HardFOC ESP32 interface capabilities with automated ESP-IDF management, structured build system, and CI/CD integration
๐ Table of Contents
- ๐ฏ Overview
- ๐๏ธ Build System Architecture
- ๐ ESP-IDF Management
- ๐ Project Structure
- ๐ง Quick Start
- ๐ Detailed Usage
- โ๏ธ Configuration
- ๐ฆ Build Artifacts
- ๐ CI/CD Integration
- ๐ Troubleshooting
- ๐ Examples List
๐ฏ Overview
The ESP32 examples directory provides comprehensive demonstrations of all HardFOC interface capabilities, featuring a sophisticated build system that automatically manages ESP-IDF versions, generates build matrices, and produces structured, parseable build outputs.
๐ Key Features
- ๐ง Automated ESP-IDF Management - Auto-detection, installation, and environment setup
- ๐ Dynamic Build Matrix Generation - CI/CD matrix generation from configuration
- ๐ Structured Build Directories - Parseable naming convention for automation
- ๐ Incremental Builds - Fast rebuilds with intelligent caching
- ๐ฆ Complete Artifact Management - All build outputs properly organized
- ๐ CI/CD Ready - Seamless integration with GitHub Actions
- ๐ก๏ธ Enhanced Validation System - Smart combination validation and error prevention
- ๐ง Smart Defaults - Automatic ESP-IDF version selection based on app and build type
๐๏ธ Build System Architecture
System Components
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๐ CONFIGURATION LAYER โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ app_config.yml โโโ โ
โ โ โ
โ generate_matrix.py โโโ โ
โโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๐ง BUILD LAYER โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ build_app.sh โโโ โ
โ setup_common.sh โ โ
โ setup_ci.sh โ โ
โ setup_repo.sh โโโ โ
โโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๐ฆ OUTPUT LAYER โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Dynamic Build Directories โโโ โ
โ Structured Naming โ โ
โ Complete Artifacts โโโ โ
โโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๐ CI/CD LAYER โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ GitHub Actions โโโ โ
โ Matrix Generation โ โ
โ Artifact Upload โโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Data Flow:
app_config.yml โ generate_matrix.py โ Matrix Generation
setup_common.sh โ build_app.sh โ Dynamic Build Directories โ Structured Naming โ Complete Artifacts
โ Artifact Upload
Build Process Flow
- Configuration Loading - Read
app_config.ymlfor build parameters - ๐ก๏ธ Smart Validation - Validate app + build type + IDF version combination
- ๐ง Smart Default Selection - Auto-select ESP-IDF version if not specified
- ESP-IDF Detection - Auto-detect or install required ESP-IDF version
- Environment Setup - Source ESP-IDF and configure build environment
- Build Execution - Run ESP-IDF build with project-specific settings
- Output Generation - Create structured build directory with all artifacts
- Path Export - Export build directory path for CI/CD integration
๐ก๏ธ Enhanced Validation System
The build system now includes comprehensive validation to prevent invalid build combinations and provide clear guidance to users.
Validation Features
- ๐ Combination Validation - Validates app + build type + IDF version combinations
- ๐ซ Invalid Build Prevention - Blocks builds with unsupported combinations
- ๐ก Smart Error Messages - Clear guidance on what combinations are allowed
- ๐ง Smart Defaults - Automatic ESP-IDF version selection when not specified
Validation Flow
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ BUILD REQUEST โ
โ app: gpio_test, build_type: Release, idf_version: (unspecified) โ
โโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ BASIC VALIDATION FIRST โ
โ โข Validate app type exists โ
โ โข Validate build type is supported โ
โ โข Fail fast if basic validation fails โ
โโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ SMART DEFAULT SELECTION โ
โ โข Only if basic validation passes โ
โ โข Check app-specific IDF versions โ
โ โข Find first version supporting requested build type โ
โ โข Fallback to global defaults if needed โ
โ โข Result: release/v5.5 โ
โโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ FINAL COMBINATION VALIDATION โ
โ โข Single comprehensive check (no redundant individual validations) โ
โ โข Functions remain standalone-safe for independent sourcing โ
โ โข Check combination constraints โ
โโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ VALIDATION RESULT โ
โ โ
VALID: gpio_test + Release + release/v5.5 โ
โ โ Proceed with build โ
โ โ
โ โ INVALID: gpio_test + Release + release/v5.4 โ
โ โ Show error with valid combinations โ
โ โ Provide helpful next steps โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
```text
**Key Optimization Points:**
- **Early Exit**: Basic validation happens first, failing fast on invalid inputs
- **Smart Defaults**: IDF version selection only occurs after basic validation passes
- **Function Safety**: Individual validation functions remain standalone-safe for independent sourcing
- **No Redundancy**: Combination validation doesn't repeat basic checks already performed
---
## ๐ **ESP-IDF Management**
### **Automatic ESP-IDF Setup**
The build system automatically manages ESP-IDF versions without manual intervention:
#### **Detection Process**
```bash
## 1. Check existing installations
~/.espressif/esp-idf-{version}/
~/esp/esp-idf-{version}/
## 2. Auto-download if missing
git clone --recursive https://github.com/espressif/esp-idf.git esp-idf-{version}
## 3. Install tools and dependencies
./install.sh
## 4. Source environment
source export.sh
```text
#### **Supported ESP-IDF Versions**
- **v4.4** - Legacy support for older projects
- **v5.0** - Stable release with modern features
- **v5.1** - Enhanced performance and security
- **v5.2** - Improved toolchain and debugging
- **v5.3** - Latest stable with full ESP32-C6 support
- **v5.4** - Performance optimizations
- **v5.5** - Current latest release (recommended)
#### **Target Support**
- **ESP32-C6** - Primary target with full feature support
- **ESP32-S3** - Secondary target for compatibility
- **ESP32** - Legacy target support
### **Environment Variables**
The system automatically sets and manages:
```bash
export IDF_PATH="/path/to/esp-idf-{version}"
export PATH="$IDF_PATH/tools:$PATH"
export ESP_IDF_VERSION="{version}"
export IDF_TARGET="esp32c6"
```text
---
## ๐ **Project Structure**
```text
examples/esp32/
โโโ ๐ components/ # Custom ESP-IDF components
โโโ ๐ main/ # Main application source code
โ โโโ ๐ CMakeLists.txt # App being built cmake list
โโโ ๐ scripts/ # Build and utility scripts
โ โโโ ๐ app_config.yml # Centralized configuration
โ โโโ ๐ generate_matrix.py # CI matrix generator
โ โโโ ๐ build_app.sh # Main build script
โ โโโ ๐ setup_common.sh # Shared setup functions
โ โโโ ๐ setup_ci.sh # CI environment setup
โ โโโ ๐ setup_repo.sh # Local development setup
โ โโโ ๐ flash_app.sh # Flashing and monitoring
โ โโโ ๐ config_loader.sh # Configuration utilities
โโโ ๐ build-*/ # Generated build directories
โโโ ๐ app_config.yml # All possible main applications that can be built
โโโ ๐ CMakeLists.txt # Project Cmake list
โโโ ๐ sdkconfig # Project config (idf.py menuconfig)
โโโ ๐ README.md # This documentation
```yaml
### **Key Files Explained**
#### **`app_config.yml`**
Centralized configuration for all applications, build types, and ESP-IDF versions:
```yaml
metadata:
idf_versions: ["release/v5.5", "release/v5.4"]
build_types: [["Debug", "Release"], ["Debug", "Release"]]
target: "esp32c6"
apps:
gpio_test:
ci_enabled: true
description: "GPIO peripheral comprehensive testing"
idf_versions: ["release/v5.5"] # Override global
build_types: [["Debug", "Release"]]
```python
#### **`generate_matrix.py`**
Python script that generates CI/CD build matrices from centralized configuration:
```bash
## Generate full matrix (default JSON output)
python3 scripts/generate_matrix.py
## YAML format output
python3 scripts/generate_matrix.py --format yaml
## Filter for specific app
python3 scripts/generate_matrix.py --filter gpio_test
## Validate configuration
python3 scripts/generate_matrix.py --validate
## Verbose output with validation
python3 scripts/generate_matrix.py --verbose --validate
## Output to file
python3 scripts/generate_matrix.py --output matrix.json
## Complex combination
python3 scripts/generate_matrix.py --filter wifi_test --validate --verbose --format yaml --output
wifi_matrix.yaml
```yaml
**Features:**
- **Configuration Validation**: Validates `app_config.yml` structure and content
- **Flexible Output**: JSON (GitHub Actions) and YAML formats
- **App Filtering**: Filter matrix for specific applications
- **Verbose Processing**: Detailed processing information and statistics
- **Smart Path Detection**: Works from any directory
- **CI Integration**: Ready for GitHub Actions, GitLab CI, and Jenkins
#### **`build_app.sh`**
Main build script with automatic ESP-IDF management:
```bash
## Basic usage
./scripts/build_app.sh <app_name> <build_type> [idf_version]
## Examples
./scripts/build_app.sh gpio_test Release
./scripts/build_app.sh adc_test Debug release/v5.4
./scripts/build_app.sh wifi_test Release release/v5.5
```text
---
## ๐ง **Quick Start**
### **1. Initial Setup**
```bash
## Clone the repository
git clone <repository-url>
cd hf-internal-interface-wrap
## Navigate to ESP32 examples
cd examples/esp32
## Setup development environment
source scripts/setup_repo.sh
```text
### **2. Build Your First Application**
```bash
## Build GPIO test application
./scripts/build_app.sh gpio_test Release
## Build ADC test with specific ESP-IDF version
./scripts/build_app.sh adc_test Debug release/v5.4
## Build with clean rebuild
CLEAN=1 ./scripts/build_app.sh wifi_test Release
## Or
./scripts/build_app.sh wifi_test Release --clean
```text
### **3. Flash and Monitor**
```bash
## Flash and monitor
./scripts/flash_app.sh flash_monitor gpio_test Release
## Flash only
./scripts/flash_app.sh flash gpio_test Release
## Monitor only
./scripts/flash_app.sh monitor
```text
---
## ๐ **Detailed Usage**
### **Build Script Options**
#### **`build_app.sh`**
```bash
./scripts/build_app.sh [OPTIONS] <app_name> <build_type> [idf_version]
Options:
-c, --clean Clean build (remove existing build directory)
-v, --verbose Verbose output
-h, --help Show this help message
Arguments:
app_name Application name from app_config.yml
build_type Build type (Debug, Release)
idf_version ESP-IDF version (optional, uses default if not specified)
Examples:
./scripts/build_app.sh gpio_test Release
./scripts/build_app.sh adc_test Debug release/v5.4
./scripts/build_app.sh --clean wifi_test Release
```text
#### **`flash_app.sh`**
```bash
./scripts/flash_app.sh <action> [app_name] [build_type]
Actions:
flash Flash firmware only
monitor Monitor serial output only
flash_monitor Flash and then monitor
flash_erase Erase flash and flash firmware
Examples:
./scripts/flash_app.sh flash_monitor gpio_test Release
./scripts/flash_app.sh monitor
./scripts/flash_app.sh flash_erase adc_test Debug
```text
### **Environment Setup Scripts**
#### **`setup_repo.sh` (Local Development)**
```bash
## Setup local development environment
source scripts/setup_repo.sh
## This script:
## 1. Installs development tools (clang, clang-format, clang-tidy)
## 2. Sets up ESP-IDF environment
## 3. Configures build tools
## 4. Exports necessary environment variables
```text
#### **`setup_ci.sh` (CI/CD Environment)**
```bash
## Setup CI environment
source scripts/setup_ci.sh
## This script:
## 1. Installs CI-specific tools
## 2. Sets up ESP-IDF environment
## 3. Configures for automated builds
## 4. Exports CI-specific variables
```yaml
---
## โ๏ธ **Configuration**
### **Application Configuration**
Each application can be configured in `app_config.yml`:
```yaml
apps:
gpio_test:
ci_enabled: true # Include in CI builds
description: "GPIO testing suite" # Human-readable description
idf_versions: ["release/v5.5"] # Override global IDF versions
build_types: [["Debug", "Release"]] # Override global build types
adc_test:
ci_enabled: true
description: "ADC peripheral testing"
# Uses global IDF versions and build types
wifi_test:
ci_enabled: false # Exclude from CI builds
description: "WiFi functionality testing"
idf_versions: ["release/v5.4"] # Specific IDF version only
build_types: [["Release"]] # Release builds only
```text
### **Build Configuration**
#### **Global Settings**
```yaml
metadata:
# ESP-IDF versions to support
idf_versions: ["release/v5.5", "release/v5.4", "release/v5.3"]
# Build types per IDF version (nested array)
build_types: [
["Debug", "Release"], # For release/v5.5
["Debug", "Release"], # For release/v5.4
["Debug"] # For release/v5.3
]
# Target MCU
target: "esp32c6"
# Build directory pattern
build_directory_pattern: "build-app-{app_type}-type-{build_type}-target-{target}-idf-{idf_version}"
```text
#### **CI Configuration**
```yaml
ci_config:
# Exclude specific combinations
exclude_combinations:
- app_name: "wifi_test"
idf_version: "release/v5.3"
build_type: "Release"
- app_name: "bluetooth_test"
idf_version: "release/v5.4"
build_type: "Debug"
```text
### **Build Directory Naming**
The system generates structured build directory names:
```text
build-app-{app_type}-type-{build_type}-target-{target}-idf-{idf_version}
```json
**Examples:**
- `build-app-gpio_test-type-Release-target-esp32c6-idf-release_v5_5`
- `build-app-adc_test-type-Debug-target-esp32c6-idf-release_v5_4`
- `build-app-wifi_test-type-Release-target-esp32c6-idf-release_v5_3`
**Benefits:**
- โ
**ESP-IDF Compatible** - No special characters
- โ
**Cross-Platform Safe** - Works on all file systems
- โ
**Handles Hyphenated Names** - No parsing ambiguity
- โ
**Structured & Parsable** - Clear section boundaries
- โ
**CI/CD Ready** - Easy automation integration
---
## ๐ฆ **Build Artifacts**
### **Generated Files**
Each build produces comprehensive artifacts:
#### **Main Application Files**
- **`{app_name}.bin`** - Flashable firmware binary
- **`{app_name}.elf`** - ELF file for debugging and analysis
- **`{app_name}.map`** - Memory layout and symbol information
- **`{app_name}.hex`** - Intel HEX format (if enabled)
#### **Bootloader and System Files**
- **`bootloader/bootloader.bin`** - ESP32 bootloader
- **`partition_table/partition-table.bin`** - Flash partition layout
- **`sdkconfig`** - ESP-IDF configuration file
- **`config.env`** - Environment configuration
#### **Build System Files**
- **`build.ninja`** - Ninja build system file
- **`CMakeCache.txt`** - CMake cache
- **`compile_commands.json`** - IDE integration
- **`.ninja_deps`** - Build dependencies
#### **Documentation and Analysis**
- **`project_description.json`** - Project metadata
- **`size.txt`** - Memory usage analysis
- **`ccache_stats.txt`** - Cache statistics (if enabled)
### **Artifact Organization**
```text
build-app-{app_name}-type-{build_type}-target-{target}-idf-{idf_version}/
โโโ ๐ {app_name}.bin # Main firmware
โโโ ๐ {app_name}.elf # Debug information
โโโ ๐ {app_name}.map # Memory layout
โโโ ๐ bootloader/ # Bootloader files
โ โโโ ๐ bootloader.bin
โ โโโ ๐ bootloader.elf
โโโ ๐ partition_table/ # Partition information
โ โโโ ๐ partition-table.bin
โโโ ๐ esp-idf/ # ESP-IDF components
โโโ ๐ sdkconfig # Configuration
โโโ ๐ build.ninja # Build system
โโโ ๐ compile_commands.json # IDE integration
```text
---
## ๐ **CI/CD Integration**
### **GitHub Actions Workflow**
The project includes a comprehensive CI/CD pipeline:
#### **Workflow Structure**
```yaml
name: ESP32 Component CI โข Build โข Size โข Static Analysis
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
jobs:
setup-environment: # Setup development tools
generate-matrix: # Generate build matrix from config
build: # Build all applications
static-analysis: # Code quality analysis
workflow-lint: # Workflow validation
```yaml
#### **Matrix Generation**
The CI automatically generates build matrices from `app_config.yml`:
```yaml
## Generated matrix example
matrix:
include:
- idf_version: "release/v5.5"
build_type: "Debug"
app_name: "gpio_test"
target: "esp32c6"
- idf_version: "release/v5.5"
build_type: "Release"
app_name: "gpio_test"
target: "esp32c6"
# ... more combinations
```text
#### **Build Process**
```yaml
- name: ESP-IDF Build
run: |
# Source CI setup
source $/scripts/setup_ci.sh
# Build using standard script
./scripts/build_app.sh "$" "$" "$"
# Capture build directory for artifacts
echo "build_dir=$ESP32_BUILD_APP_MOST_RECENT_DIRECTORY" >> $GITHUB_OUTPUT
```text
#### **Artifact Upload**
```yaml
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: fw-$-$-$
path: $
```text
### **CI Environment Variables**
```yaml
env:
BUILD_PATH: ci_build_path
IDF_CCACHE_ENABLE: "1"
ESP32_PROJECT_PATH: examples/esp32
```text
### **Caching Strategy**
The CI implements intelligent caching:
```yaml
- name: Cache ESP-IDF and tools
uses: actions/cache@v4
with:
path: |
~/.espressif
~/esp
key: esp-idf-$-$
- name: Cache ccache
uses: actions/cache@v4
with:
path: ~/.ccache
key: ccache-$-$
```text
---
## ๐ **Troubleshooting**
### **Common Issues and Solutions**
#### **ESP-IDF Not Found**
```bash
## Error: ESP-IDF environment not found
## Solution: The build system will auto-install ESP-IDF
## Manual installation if needed:
cd ~/esp
git clone --recursive https://github.com/espressif/esp-idf.git esp-idf-release_v5_5
cd esp-idf-release_v5_5
./install.sh
source export.sh
```text
#### **Build Directory Issues**
```bash
## Error: Invalid build directory name
## Solution: Check app_config.yml build_directory_pattern
## Ensure pattern follows format:
build_directory_pattern: "build-app-{app_type}-type-{build_type}-target-{target}-idf-{idf_version}"
```text
#### **Permission Issues**
```bash
## Error: Permission denied
## Solution: Make scripts executable
chmod +x scripts/*.sh
chmod +x scripts/*.py
```python
#### **Python Dependencies**
```bash
## Error: Module not found
## Solution: Install required packages
pip install pyyaml
pip install esptool
```text
### **Debug Mode**
Enable verbose output for debugging:
```bash
## Verbose build
./scripts/build_app.sh --verbose gpio_test Release
## Clean rebuild
CLEAN=1 ./scripts/build_app.sh gpio_test Release
## Check environment
source scripts/setup_repo.sh
echo $IDF_PATH
echo $IDF_TARGET
```text
### **Log Files**
Build logs are available in:
```bash
## Build log
cat build-*/log/build.log
## CMake log
cat build-*/CMakeFiles/CMakeOutput.log
## Ninja log
cat build-*/.ninja_log
```cpp
---
## ๐ **Examples List**
### **Available Applications**
| Application | Description | CI Status | IDF Versions | Build Types |
|-------------|-------------|-----------|--------------|-------------|
| `gpio_test` | GPIO peripheral comprehensive testing | โ
Enabled | v5.5 | Debug, Release |
| `adc_test` | ADC peripheral testing | โ
Enabled | v5.5 | Debug, Release |
| `uart_test` | UART communication testing | โ
Enabled | v5.5 | Debug, Release |
| `spi_test` | SPI interface testing | โ
Enabled | v5.5 | Debug, Release |
| `i2c_test` | I2C interface testing | โ
Enabled | v5.5 | Debug, Release |
| `pwm_test` | PWM generation testing | โ
Enabled | v5.5 | Debug, Release |
| `can_test` | CAN bus testing | โ
Enabled | v5.5 | Debug, Release |
| `pio_test` | Programmable I/O testing | โ
Enabled | v5.5 | Debug, Release |
| `temperature_test` | Temperature sensor testing | โ
Enabled | v5.5 | Debug, Release |
| `nvs_test` | Non-volatile storage testing | โ
Enabled | v5.5 | Debug, Release |
| `timer_test` | Timer functionality testing | โ
Enabled | v5.5 | Debug, Release |
| `logger_test` | Logging system testing | โ
Enabled | v5.5 | Debug, Release |
| `wifi_test` | WiFi functionality testing | โ
Enabled | v5.5 | Debug, Release |
| `bluetooth_test` | Bluetooth testing | โ
Enabled | v5.5 | Debug, Release |
| `utils_test` | Utility functions testing | โ
Enabled | v5.5 | Debug, Release |
| `ascii_art` | ASCII art generation demo | โ
Enabled | v5.5 | Debug, Release |
### **Application Categories**
#### **Core Peripherals**
- **GPIO** - Digital input/output testing
- **ADC** - Analog-to-digital conversion
- **PWM** - Pulse-width modulation
- **Timer** - Hardware timer functionality
#### **Communication Interfaces**
- **UART** - Serial communication
- **SPI** - Serial peripheral interface
- **I2C** - Inter-integrated circuit
- **CAN** - Controller area network
#### **Wireless Technologies**
- **WiFi** - Wireless networking
- **Bluetooth** - Short-range communication
#### **System Features**
- **NVS** - Non-volatile storage
- **Logger** - Logging and debugging
- **PIO** - Programmable I/O
- **Temperature** - Thermal monitoring
#### **Utilities**
- **ASCII Art** - Text-based graphics
- **Utils** - Common utility functions
### **Test Documentation**
Each application includes comprehensive test documentation:
- **[Test Documentation](/hf-internal-interface-wrap/development/examples/esp32/docs/)** - Complete test documentation index
- **[CAN Test Documentation](/hf-internal-interface-wrap/development/examples/esp32/docs/can_test/)** - CAN bus testing with SN65 transceiver
- **[GPIO Test Documentation](/hf-internal-interface-wrap/development/examples/esp32/docs/gpio_test/)** - GPIO testing and validation
- **[ADC Test Documentation](/hf-internal-interface-wrap/development/examples/esp32/docs/adc_test/)** - ADC testing and calibration
- **[PWM Test Documentation](/hf-internal-interface-wrap/development/examples/esp32/docs/pwm_test/)** - PWM testing and frequency control
- **[UART Test Documentation](/hf-internal-interface-wrap/development/examples/esp32/docs/uart_test/)** - UART communication testing
- **[SPI Test Documentation](/hf-internal-interface-wrap/development/examples/esp32/docs/spi_test/)** - SPI interface testing
- **[I2C Test Documentation](/hf-internal-interface-wrap/development/examples/esp32/docs/i2c_test/)** - I2C device testing
- **[PIO Test Documentation](/hf-internal-interface-wrap/development/examples/esp32/docs/pio_test/)** - Programmable I/O testing
- **[Temperature Test Documentation](/hf-internal-interface-wrap/development/examples/esp32/docs/temperature_test/)** - Temperature sensor testing
- **[NVS Test Documentation](/hf-internal-interface-wrap/development/examples/esp32/docs/nvs_test/)** - Non-volatile storage testing
- **[Logger Test Documentation](/hf-internal-interface-wrap/development/examples/esp32/docs/logger_test/)** - Logging system testing
---
## ๐ค **Contributing**
### **Adding New Applications**
1. **Create Application Source**
```cpp
// main/NewAppTest.cpp
#include "TestFramework.h"
class NewAppTest : public TestFramework {
public:
void RunTests() override {
// Test implementation
}
};
TEST_MAIN(NewAppTest)
- Update Configuration
1 2 3 4 5 6 7
# app_config.yml apps: new_app_test: ci_enabled: true description: "New application testing" idf_versions: ["release/v5.5"] build_types: [["Debug", "Release"]]
- Test Build
1
./scripts/build_app.sh new_app_test Release
Modifying Build System
- Update Scripts - Modify scripts in
scripts/directory - Test Locally - Verify changes work in local environment
- Update CI - Ensure CI pipeline compatibility
- Update Documentation - Keep this README current
๐ License
This project is licensed under the GPL-3.0 License - see the LICENSE file for details.
๐ Related Documentation
- Main Project README - Project overview and architecture
- API Documentation - Interface API documentation
- Test Documentation - Comprehensive test documentation and examples
- CI/CD Workflows - GitHub Actions workflows
- ESP-IDF Documentation - ESP-IDF reference
๐ Built with โค๏ธ for the HardFOC Community
Professional-grade examples with enterprise-ready build system