| 43 | |
| 44 | @dataclass |
| 45 | class Board: |
| 46 | board_name: str |
| 47 | real_board_name: str | None = None |
| 48 | platform: str | None = None |
| 49 | platform_needs_install: bool = False |
| 50 | use_pio_run: bool = ( |
| 51 | False # some platforms like esp32-c2-devkitm-1 will only work with pio run |
| 52 | ) |
| 53 | platform_packages: str | None = None |
| 54 | framework: str | None = None |
| 55 | board_build_mcu: str | None = None |
| 56 | board_build_core: str | None = None |
| 57 | board_build_filesystem_size: str | None = None |
| 58 | board_build_flash_size: str | None = ( |
| 59 | None # Flash size for ESP32 boards (e.g., '4MB') |
| 60 | ) |
| 61 | build_flags: list[str] | None = None # Reserved for future use. |
| 62 | build_unflags: list[str] | None = None # New: unflag options |
| 63 | defines: list[str] | None = None |
| 64 | customsdk: str | None = None |
| 65 | board_partitions: str | None = None # Reserved for future use. |
| 66 | no_board_spec: bool = ( |
| 67 | False # For platforms like 'native' that don't need a board specification |
| 68 | ) |
| 69 | add_board_to_all: bool = True |
| 70 | lib_compat_mode: str | None = ( |
| 71 | None # Library compatibility mode (e.g., 'off' for native platform) |
| 72 | ) |
| 73 | lib_ldf_mode: str | None = ( |
| 74 | None # Library Dependency Finder mode (e.g., 'chain+' for enhanced dependency finding) |
| 75 | ) |
| 76 | lib_ignore: list[str] | None = ( |
| 77 | None # Libraries to ignore during compilation (e.g., ['I2S'] for UNO R4 WiFi) |
| 78 | ) |
| 79 | extra_scripts: list[str] | None = ( |
| 80 | None # Custom build scripts to run (e.g., ['pre:script.py'] for pre-build hooks) |
| 81 | ) |
| 82 | # Opt-in for GCC -fopt-info-all -> optimization_report.txt. Default OFF |
| 83 | # because the file accumulates across every example in the matrix and can |
| 84 | # exceed 100 MB on no-LTO boards with a large sketch set (nrf52840 with |
| 85 | # the Adafruit BSP would overrun the GHA log buffer and shut the runner |
| 86 | # down — see PR #2658). Set True when the board's workflow genuinely |
| 87 | # needs the optimization-info dump for size/perf debugging. |
| 88 | generate_optimization_report: bool = False |
| 89 | |
| 90 | def __post_init__(self) -> None: |
| 91 | # Check if framework is set, warn and auto-set to arduino if missing (except for native/stub platforms) |
| 92 | if self.framework is None and not self._is_native_or_stub_platform(): |
| 93 | self.framework = "arduino" |
| 94 | |
| 95 | # Auto-detect and exclude problematic libraries based on environmental signals |
| 96 | self._auto_detect_library_exclusions() |
| 97 | |
| 98 | ALL.append(self) |
| 99 | |
| 100 | def _is_native_or_stub_platform(self) -> bool: |
| 101 | """Check if this is a native or stub platform that doesn't need a framework""" |
| 102 | # Check for native platform |
no outgoing calls