fbuild 1.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of fbuild might be problematic. Click here for more details.

Files changed (93) hide show
  1. fbuild/__init__.py +0 -0
  2. fbuild/assets/example.txt +1 -0
  3. fbuild/build/__init__.py +117 -0
  4. fbuild/build/archive_creator.py +186 -0
  5. fbuild/build/binary_generator.py +444 -0
  6. fbuild/build/build_component_factory.py +131 -0
  7. fbuild/build/build_state.py +325 -0
  8. fbuild/build/build_utils.py +98 -0
  9. fbuild/build/compilation_executor.py +422 -0
  10. fbuild/build/compiler.py +165 -0
  11. fbuild/build/compiler_avr.py +574 -0
  12. fbuild/build/configurable_compiler.py +612 -0
  13. fbuild/build/configurable_linker.py +637 -0
  14. fbuild/build/flag_builder.py +186 -0
  15. fbuild/build/library_dependency_processor.py +185 -0
  16. fbuild/build/linker.py +708 -0
  17. fbuild/build/orchestrator.py +67 -0
  18. fbuild/build/orchestrator_avr.py +656 -0
  19. fbuild/build/orchestrator_esp32.py +797 -0
  20. fbuild/build/orchestrator_teensy.py +543 -0
  21. fbuild/build/source_compilation_orchestrator.py +220 -0
  22. fbuild/build/source_scanner.py +516 -0
  23. fbuild/cli.py +566 -0
  24. fbuild/cli_utils.py +312 -0
  25. fbuild/config/__init__.py +16 -0
  26. fbuild/config/board_config.py +457 -0
  27. fbuild/config/board_loader.py +92 -0
  28. fbuild/config/ini_parser.py +209 -0
  29. fbuild/config/mcu_specs.py +88 -0
  30. fbuild/daemon/__init__.py +34 -0
  31. fbuild/daemon/client.py +929 -0
  32. fbuild/daemon/compilation_queue.py +293 -0
  33. fbuild/daemon/daemon.py +474 -0
  34. fbuild/daemon/daemon_context.py +196 -0
  35. fbuild/daemon/error_collector.py +263 -0
  36. fbuild/daemon/file_cache.py +332 -0
  37. fbuild/daemon/lock_manager.py +270 -0
  38. fbuild/daemon/logging_utils.py +149 -0
  39. fbuild/daemon/messages.py +301 -0
  40. fbuild/daemon/operation_registry.py +288 -0
  41. fbuild/daemon/process_tracker.py +366 -0
  42. fbuild/daemon/processors/__init__.py +12 -0
  43. fbuild/daemon/processors/build_processor.py +157 -0
  44. fbuild/daemon/processors/deploy_processor.py +327 -0
  45. fbuild/daemon/processors/monitor_processor.py +146 -0
  46. fbuild/daemon/request_processor.py +401 -0
  47. fbuild/daemon/status_manager.py +216 -0
  48. fbuild/daemon/subprocess_manager.py +316 -0
  49. fbuild/deploy/__init__.py +17 -0
  50. fbuild/deploy/deployer.py +67 -0
  51. fbuild/deploy/deployer_esp32.py +314 -0
  52. fbuild/deploy/monitor.py +495 -0
  53. fbuild/interrupt_utils.py +34 -0
  54. fbuild/packages/__init__.py +53 -0
  55. fbuild/packages/archive_utils.py +1098 -0
  56. fbuild/packages/arduino_core.py +412 -0
  57. fbuild/packages/cache.py +249 -0
  58. fbuild/packages/downloader.py +366 -0
  59. fbuild/packages/framework_esp32.py +538 -0
  60. fbuild/packages/framework_teensy.py +346 -0
  61. fbuild/packages/github_utils.py +96 -0
  62. fbuild/packages/header_trampoline_cache.py +394 -0
  63. fbuild/packages/library_compiler.py +203 -0
  64. fbuild/packages/library_manager.py +549 -0
  65. fbuild/packages/library_manager_esp32.py +413 -0
  66. fbuild/packages/package.py +163 -0
  67. fbuild/packages/platform_esp32.py +383 -0
  68. fbuild/packages/platform_teensy.py +312 -0
  69. fbuild/packages/platform_utils.py +131 -0
  70. fbuild/packages/platformio_registry.py +325 -0
  71. fbuild/packages/sdk_utils.py +231 -0
  72. fbuild/packages/toolchain.py +436 -0
  73. fbuild/packages/toolchain_binaries.py +196 -0
  74. fbuild/packages/toolchain_esp32.py +484 -0
  75. fbuild/packages/toolchain_metadata.py +185 -0
  76. fbuild/packages/toolchain_teensy.py +404 -0
  77. fbuild/platform_configs/esp32.json +150 -0
  78. fbuild/platform_configs/esp32c2.json +144 -0
  79. fbuild/platform_configs/esp32c3.json +143 -0
  80. fbuild/platform_configs/esp32c5.json +151 -0
  81. fbuild/platform_configs/esp32c6.json +151 -0
  82. fbuild/platform_configs/esp32p4.json +149 -0
  83. fbuild/platform_configs/esp32s3.json +151 -0
  84. fbuild/platform_configs/imxrt1062.json +56 -0
  85. fbuild-1.1.0.dist-info/METADATA +447 -0
  86. fbuild-1.1.0.dist-info/RECORD +93 -0
  87. fbuild-1.1.0.dist-info/WHEEL +5 -0
  88. fbuild-1.1.0.dist-info/entry_points.txt +5 -0
  89. fbuild-1.1.0.dist-info/licenses/LICENSE +21 -0
  90. fbuild-1.1.0.dist-info/top_level.txt +2 -0
  91. fbuild_lint/__init__.py +0 -0
  92. fbuild_lint/ruff_plugins/__init__.py +0 -0
  93. fbuild_lint/ruff_plugins/keyboard_interrupt_checker.py +158 -0
@@ -0,0 +1,151 @@
1
+ {
2
+ "name": "ESP32-S3",
3
+ "description": "Configuration for ESP32-S3 MCU extracted from PlatformIO",
4
+ "mcu": "esp32s3",
5
+ "architecture": "xtensa-esp32s3",
6
+
7
+ "compiler_flags": {
8
+ "common": [
9
+ "-Os",
10
+ "-mlongcalls",
11
+ "-ffunction-sections",
12
+ "-fdata-sections",
13
+ "-Wno-error=unused-function",
14
+ "-Wno-error=unused-variable",
15
+ "-Wno-error=unused-but-set-variable",
16
+ "-Wno-error=deprecated-declarations",
17
+ "-Wno-error=extra",
18
+ "-Wno-unused-parameter",
19
+ "-Wno-sign-compare",
20
+ "-Wno-enum-conversion",
21
+ "-gdwarf-4",
22
+ "-ggdb",
23
+ "-mdisable-hardware-atomics",
24
+ "-freorder-blocks",
25
+ "-Wwrite-strings",
26
+ "-fstack-protector",
27
+ "-fstrict-volatile-bitfields",
28
+ "-fno-jump-tables",
29
+ "-fno-tree-switch-conversion",
30
+ "-MMD"
31
+ ],
32
+ "c": [
33
+ "-fno-builtin-memcpy",
34
+ "-fno-builtin-memset",
35
+ "-fno-builtin-bzero",
36
+ "-fno-builtin-stpcpy",
37
+ "-fno-builtin-strncpy",
38
+ "-std=gnu17",
39
+ "-Wno-old-style-declaration",
40
+ "-Wno-strict-prototypes"
41
+ ],
42
+ "cxx": [
43
+ "-fno-builtin-memcpy",
44
+ "-fno-builtin-memset",
45
+ "-fno-builtin-bzero",
46
+ "-fno-builtin-stpcpy",
47
+ "-fno-builtin-strncpy",
48
+ "-std=gnu++2b",
49
+ "-fexceptions",
50
+ "-fno-rtti",
51
+ "-fuse-cxa-atexit"
52
+ ]
53
+ },
54
+
55
+ "linker_flags": [
56
+ "-mlongcalls",
57
+ "-nostartfiles",
58
+ "-Wl,--cref",
59
+ "-Wl,--defsym=IDF_TARGET_ESP32S3=0",
60
+ "-Wl,--no-warn-rwx-segments",
61
+ "-Wl,--orphan-handling=warn",
62
+ "-fno-rtti",
63
+ "-fno-lto",
64
+ "-Wl,--gc-sections",
65
+ "-Wl,--warn-common",
66
+ "-Wl,--wrap=log_printf",
67
+ "-Wl,--wrap=longjmp",
68
+ "-Wl,--undefined=FreeRTOS_openocd_params",
69
+ "-u", "nvs_sec_provider_include_impl",
70
+ "-u", "_Z5setupv",
71
+ "-u", "_Z4loopv",
72
+ "-u", "esp_app_desc",
73
+ "-u", "esp_efuse_startup_include_func",
74
+ "-u", "ld_include_highint_hdl",
75
+ "-u", "start_app",
76
+ "-u", "start_app_other_cores",
77
+ "-u", "__ubsan_include",
78
+ "-u", "esp_system_include_startup_funcs",
79
+ "-u", "__assert_func",
80
+ "-u", "esp_security_init_include_impl",
81
+ "-u", "app_main",
82
+ "-u", "esp_libc_include_heap_impl",
83
+ "-u", "esp_libc_include_reent_syscalls_impl",
84
+ "-u", "esp_libc_include_syscalls_impl",
85
+ "-u", "esp_libc_include_pthread_impl",
86
+ "-u", "esp_libc_include_assert_impl",
87
+ "-u", "esp_libc_include_getentropy_impl",
88
+ "-u", "esp_libc_include_init_funcs",
89
+ "-u", "esp_libc_init_funcs",
90
+ "-u", "pthread_include_pthread_impl",
91
+ "-u", "pthread_include_pthread_cond_var_impl",
92
+ "-u", "pthread_include_pthread_local_storage_impl",
93
+ "-u", "pthread_include_pthread_rwlock_impl",
94
+ "-u", "pthread_include_pthread_semaphore_impl",
95
+ "-u", "__cxa_guard_dummy",
96
+ "-u", "__cxx_init_dummy",
97
+ "-u", "esp_timer_init_include_func",
98
+ "-u", "uart_vfs_include_dev_init",
99
+ "-u", "include_esp_phy_override",
100
+ "-u", "usb_serial_jtag_vfs_include_dev_init",
101
+ "-u", "usb_serial_jtag_connection_monitor_include",
102
+ "-u", "esp_vfs_include_console_register",
103
+ "-u", "vfs_include_syscalls_impl",
104
+ "-u", "esp_vfs_include_nullfs_register",
105
+ "-u", "esp_system_include_coredump_init"
106
+ ],
107
+
108
+ "linker_scripts": [
109
+ "esp32s3.peripherals.ld",
110
+ "esp32s3.rom.ld",
111
+ "esp32s3.rom.api.ld",
112
+ "esp32s3.rom.bt_funcs.ld",
113
+ "esp32s3.rom.libgcc.ld",
114
+ "esp32s3.rom.wdt.ld",
115
+ "esp32s3.rom.version.ld",
116
+ "esp32s3.rom.ble_cca.ld",
117
+ "esp32s3.rom.ble_test.ld",
118
+ "esp32s3.rom.libc.ld",
119
+ "esp32s3.rom.newlib.ld",
120
+ "memory.ld",
121
+ "sections.ld"
122
+ ],
123
+
124
+ "defines": [
125
+ "ESP32_ARDUINO_LIB_BUILDER",
126
+ ["ESP_MDNS_VERSION_NUMBER", "\"1.9.0\""],
127
+ "ESP_PLATFORM",
128
+ ["IDF_VER", "\"v5.5.1-710-g8410210c9a\""],
129
+ ["MBEDTLS_CONFIG_FILE", "\"mbedtls/esp_config.h\""],
130
+ ["MD5_ENABLED", "1"],
131
+ ["OPENTHREAD_CONFIG_FILE", "\"openthread-core-esp32x-spinel-config.h\""],
132
+ ["OPENTHREAD_PROJECT_LIB_CONFIG_FILE", "\"openthread-core-esp32x-spinel-config.h\""],
133
+ ["SERIAL_FLASHER_BOOT_HOLD_TIME_MS", "50"],
134
+ ["SERIAL_FLASHER_RESET_HOLD_TIME_MS", "100"],
135
+ ["SOC_MMU_PAGE_SIZE", "CONFIG_MMU_PAGE_SIZE"],
136
+ ["SOC_XTAL_FREQ_MHZ", "CONFIG_XTAL_FREQ"],
137
+ "UNITY_INCLUDE_CONFIG_H",
138
+ "_GLIBCXX_HAVE_POSIX_SEMAPHORE",
139
+ "_GLIBCXX_USE_POSIX_SEMAPHORE",
140
+ "_GNU_SOURCE",
141
+ "_POSIX_READER_WRITER_LOCKS",
142
+ "TF_LITE_STATIC_MEMORY",
143
+ ["CHIP_CONFIG_SOFTWARE_VERSION_NUMBER", "0"],
144
+ ["CHIP_DNSSD_DEFAULT_PLATFORM", "true"],
145
+ ["CHIP_DNSSD_DEFAULT_NONE", "false"],
146
+ ["CHIP_DNSSD_DEFAULT_MINIMAL", "false"],
147
+ "ARDUINO_ARCH_ESP32",
148
+ "CHIP_HAVE_CONFIG_H",
149
+ ["ESP32", "ESP32"]
150
+ ]
151
+ }
@@ -0,0 +1,56 @@
1
+ {
2
+ "name": "NXP i.MX RT1062",
3
+ "description": "Configuration for i.MX RT1062 MCU (Teensy 4.x) - ARM Cortex-M7 @ 600MHz",
4
+ "mcu": "imxrt1062",
5
+ "architecture": "arm",
6
+
7
+ "compiler_flags": {
8
+ "common": [
9
+ "-mcpu=cortex-m7",
10
+ "-mthumb",
11
+ "-mfloat-abi=hard",
12
+ "-mfpu=fpv5-d16",
13
+ "-O2",
14
+ "-g",
15
+ "-Wall",
16
+ "-Wextra",
17
+ "-Wno-unused-parameter",
18
+ "-ffunction-sections",
19
+ "-fdata-sections",
20
+ "-MMD"
21
+ ],
22
+ "c": [
23
+ "-std=gnu11"
24
+ ],
25
+ "cxx": [
26
+ "-std=gnu++17",
27
+ "-fno-exceptions",
28
+ "-fno-rtti",
29
+ "-felide-constructors",
30
+ "-fno-threadsafe-statics"
31
+ ]
32
+ },
33
+
34
+ "linker_flags": [
35
+ "-mcpu=cortex-m7",
36
+ "-mthumb",
37
+ "-mfloat-abi=hard",
38
+ "-mfpu=fpv5-d16",
39
+ "-O2",
40
+ "-Wl,--gc-sections",
41
+ "-Wl,--print-memory-usage",
42
+ "-lm",
43
+ "-lstdc++"
44
+ ],
45
+
46
+ "linker_scripts": [],
47
+
48
+ "defines": [
49
+ "__IMXRT1062__",
50
+ "ARDUINO_ARCH_TEENSY",
51
+ ["ARDUINO", "10819"],
52
+ ["TEENSYDUINO", "159"],
53
+ "USB_SERIAL",
54
+ "LAYOUT_US_ENGLISH"
55
+ ]
56
+ }
@@ -0,0 +1,447 @@
1
+ Metadata-Version: 2.4
2
+ Name: fbuild
3
+ Version: 1.1.0
4
+ Summary: Modern replacement for PlatformIO with URL-based platform/toolchain management and bug-free architecture
5
+ Home-page: https://github.com/fastled/fbuild
6
+ Maintainer: Zachary Vorhies
7
+ License: BSD 3-Clause License
8
+ Keywords: embedded,arduino,platformio,compiler,toolchain,firmware,microcontroller
9
+ Classifier: Programming Language :: Python :: 3
10
+ Requires-Python: >=3.10
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Requires-Dist: requests>=2.28.0
14
+ Requires-Dist: tqdm>=4.64.0
15
+ Requires-Dist: pyserial>=3.5
16
+ Requires-Dist: esptool>=4.6.0
17
+ Requires-Dist: psutil>=5.9.0
18
+ Provides-Extra: dev
19
+ Requires-Dist: pytest>=7.0; extra == "dev"
20
+ Requires-Dist: pytest-cov; extra == "dev"
21
+ Requires-Dist: pytest-xdist; extra == "dev"
22
+ Dynamic: home-page
23
+ Dynamic: license-file
24
+ Dynamic: maintainer
25
+
26
+ # Fbuild
27
+
28
+ A fast, next-generation multi-platform compiler, deployer, and monitor for embedded development.
29
+
30
+ [![Linting](../../actions/workflows/lint.yml/badge.svg)](../../actions/workflows/lint.yml)
31
+
32
+ [![MacOS_Tests](../../actions/workflows/push_macos.yml/badge.svg)](../../actions/workflows/push_macos.yml)
33
+ [![Ubuntu_Tests](../../actions/workflows/push_ubuntu.yml/badge.svg)](../../actions/workflows/push_ubuntu.yml)
34
+ [![Win_Tests](../../actions/workflows/push_win.yml/badge.svg)](../../actions/workflows/push_win.yml)
35
+
36
+ ## What is Fbuild?
37
+
38
+ Fbuild is a next-generation embedded development tool featuring a clean, transparent architecture. It provides fast incremental builds, URL-based package management, and comprehensive multi-platform support for Arduino and ESP32 development.
39
+
40
+ **Current Status**: v0.1.0 - Full Arduino Uno support with working build system
41
+
42
+ ## Examples
43
+
44
+ **Quick start** - Build, deploy, and monitor in one command:
45
+
46
+ ```bash
47
+ # Default action: build + deploy + monitor
48
+ uv run fbuild tests/esp32c6
49
+ ```
50
+
51
+ **Deploy commands:**
52
+
53
+ ```bash
54
+ # Deploy with clean build
55
+ uv run fbuild deploy tests/esp32c6 --clean
56
+
57
+ # Deploy with monitoring and test patterns
58
+ uv run fbuild deploy tests/esp32c6 --monitor="--timeout 60 --halt-on-error \"TEST FAILED\" --halt-on-success \"TEST PASSED\""
59
+ ```
60
+
61
+ **Monitor command:**
62
+
63
+ ```bash
64
+ # Monitor serial output with pattern matching
65
+ uv run fbuild monitor --timeout 60 --halt-on-error "TEST FAILED" --halt-on-success "TEST PASSED"
66
+ ```
67
+
68
+ * Serial monitoring requires pyserial to attach to the USB device
69
+ * Port auto-detection works similarly to PlatformIO
70
+
71
+ ## Key Features
72
+
73
+ - **URL-based Package Management**: Direct URLs to toolchains and platforms - no hidden registries
74
+ - **Library Management**: Download and compile Arduino libraries from GitHub URLs
75
+ - **Fast Incremental Builds**: 0.76s rebuilds, 3s full builds (cached)
76
+ - **LTO Support**: Link-Time Optimization for optimal code size
77
+ - **Transparent Architecture**: Know exactly what's happening at every step
78
+ - **Real Downloads, No Mocks**: All packages are real, validated, and checksummed
79
+ - **Cross-platform Support**: Windows, macOS, and Linux
80
+ - **Modern Python**: 100% type-safe, PEP 8 compliant, tested
81
+
82
+ ## Installation
83
+
84
+ ```bash
85
+ # Install from PyPI (when published)
86
+ pip install fbuild
87
+
88
+ # Or install from source
89
+ git clone https://github.com/yourusername/fbuild.git
90
+ cd fbuild
91
+ pip install -e .
92
+ ```
93
+
94
+ ## Quick Start
95
+
96
+ ### Building an Arduino Uno Project
97
+
98
+ 1. **Create project structure**:
99
+ ```bash
100
+ mkdir my-project && cd my-project
101
+ mkdir src
102
+ ```
103
+
104
+ 2. **Create platformio.ini**:
105
+ ```ini
106
+ [env:uno]
107
+ platform = atmelavr
108
+ board = uno
109
+ framework = arduino
110
+ ```
111
+
112
+ 3. **Write your sketch** (`src/main.ino`):
113
+ ```cpp
114
+ void setup() {
115
+ pinMode(LED_BUILTIN, OUTPUT);
116
+ }
117
+
118
+ void loop() {
119
+ digitalWrite(LED_BUILTIN, HIGH);
120
+ delay(1000);
121
+ digitalWrite(LED_BUILTIN, LOW);
122
+ delay(1000);
123
+ }
124
+ ```
125
+
126
+ 4. **Build**:
127
+ ```bash
128
+ fbuild build
129
+ ```
130
+
131
+ On first build, Fbuild will:
132
+ - Download AVR-GCC toolchain (50MB, one-time)
133
+ - Download Arduino AVR core (5MB, one-time)
134
+ - Compile your sketch
135
+ - Generate `firmware.hex` in `.fbuild/build/uno/`
136
+
137
+ **Build time**: ~19s first build, ~3s subsequent builds, <1s incremental
138
+
139
+ ## CLI Usage
140
+
141
+ ### Build Command
142
+
143
+ ```bash
144
+ # Build with auto-detected environment
145
+ fbuild build
146
+
147
+ # Build specific environment
148
+ fbuild build --environment uno
149
+ fbuild build -e mega
150
+
151
+ # Clean build (remove all build artifacts)
152
+ fbuild build --clean
153
+
154
+ # Verbose output (shows all compiler commands)
155
+ fbuild build --verbose
156
+
157
+ # Build in different directory
158
+ fbuild build --project-dir /path/to/project
159
+ ```
160
+
161
+ ### Output
162
+
163
+ ```
164
+ Building environment: uno
165
+ Downloading toolchain: avr-gcc 7.3.0-atmel3.6.1-arduino7
166
+ Downloading: 100% ████████████████████ 50.1MB/50.1MB
167
+ Extracting package...
168
+ Toolchain ready at: .fbuild/cache/...
169
+ Downloading Arduino core: 1.8.6
170
+ Compiling sketch...
171
+ Compiling Arduino core...
172
+ Linking firmware...
173
+ Converting to Intel HEX...
174
+
175
+ ✓ Build successful!
176
+
177
+ Firmware: .fbuild/build/uno/firmware.hex
178
+ Program: 1058 bytes (3.3% of 32256 bytes)
179
+ RAM: 9 bytes (0.4% of 2048 bytes)
180
+ Build time: 3.06s
181
+ ```
182
+
183
+ ## Configuration
184
+
185
+ ### platformio.ini Reference
186
+
187
+ **Minimal configuration**:
188
+ ```ini
189
+ [env:uno]
190
+ platform = atmelavr
191
+ board = uno
192
+ framework = arduino
193
+ ```
194
+
195
+ **Full configuration**:
196
+ ```ini
197
+ [platformio]
198
+ default_envs = uno
199
+
200
+ [env:uno]
201
+ platform = atmelavr
202
+ board = uno
203
+ framework = arduino
204
+ upload_port = COM3 # Future: for uploading
205
+ monitor_speed = 9600 # Future: for serial monitor
206
+ build_flags =
207
+ -DDEBUG
208
+ -DLED_PIN=13
209
+ lib_deps =
210
+ https://github.com/FastLED/FastLED
211
+ https://github.com/adafruit/Adafruit_NeoPixel
212
+ ```
213
+
214
+ ### Library Dependencies
215
+
216
+ Fbuild supports downloading and compiling Arduino libraries directly from GitHub URLs:
217
+
218
+ ```ini
219
+ [env:uno]
220
+ platform = atmelavr
221
+ board = uno
222
+ framework = arduino
223
+ lib_deps =
224
+ https://github.com/FastLED/FastLED
225
+ ```
226
+
227
+ **Features**:
228
+ - Automatic GitHub URL optimization (converts repo URLs to zip downloads)
229
+ - Automatic branch detection (main vs master)
230
+ - Proper Arduino library structure handling
231
+ - LTO (Link-Time Optimization) for optimal code size
232
+ - Support for complex libraries with assembly optimizations
233
+
234
+ **Example build with FastLED**:
235
+ ```
236
+ ✓ Build successful!
237
+ Firmware: tests/uno/.fbuild/build/uno/firmware.hex
238
+ Size: 12KB (4318 bytes program, 3689 bytes RAM)
239
+ Build time: 78.59 seconds
240
+ ```
241
+
242
+
243
+ ### Supported Platforms and Boards
244
+
245
+ **Arduino AVR Platform** - Fully Supported ✓
246
+ - **Arduino Uno** (atmega328p, 16MHz) - Fully tested ✓
247
+
248
+ **ESP32 Platform** - Supported ✓
249
+ - **ESP32 Dev** (esp32dev) - Supported ✓
250
+ - **ESP32-C3** (esp32-c3-devkitm-1) - Supported ✓
251
+ - **ESP32-C6** (esp32c6-devkit) - Supported ✓
252
+ - **ESP32-S3** (esp32-s3-devkitc-1) - Supported ✓
253
+ - **ESP32-S2** - Supported ✓
254
+ - **ESP32-H2** - Supported ✓
255
+ - **ESP32-P4** - Supported ✓
256
+ - **ESP32-C2** - Supported ✓ (v0.1.0+)
257
+ - Uses skeleton library approach with ROM linker scripts
258
+ - Full Arduino framework support
259
+ - 220KB firmware size typical
260
+
261
+ **Planned Support**:
262
+ - Arduino Mega
263
+ - Arduino Nano
264
+ - Arduino Leonardo
265
+ - More AVR boards
266
+ - Teensy 3.x/4.x platforms
267
+ ## Performance
268
+
269
+ **Benchmarks** (Arduino Uno Blink sketch):
270
+
271
+ | Build Type | Time | Description |
272
+ |------------|------|-------------|
273
+ | First build | 19.25s | Includes toolchain download (50MB) |
274
+ | Full build | 3.06s | All packages cached |
275
+ | Incremental | 0.76s | No source changes |
276
+ | Clean build | 2.58s | Rebuild from cache |
277
+
278
+ **Firmware Size** (Blink):
279
+ - Program: 1,058 bytes (3.3% of 32KB flash)
280
+ - RAM: 9 bytes (0.4% of 2KB RAM)
281
+
282
+ ## Key Benefits
283
+
284
+ ### Transparency
285
+ Direct URLs and hash-based caching mean you know exactly what you're downloading. No hidden package registries or opaque dependency resolution.
286
+
287
+ ### Reliability
288
+ Real downloads with checksum verification ensure consistent, reproducible builds. No mocks in production code.
289
+
290
+ ### Speed
291
+ Optimized incremental builds complete in under 1 second, with intelligent caching for full rebuilds in 2-5 seconds.
292
+
293
+ ### Code Quality
294
+ 100% type-safe (mypy), PEP 8 compliant, and comprehensive test coverage ensure a maintainable and reliable codebase.
295
+
296
+ ### Clear Error Messages
297
+ Actionable error messages with suggestions help you quickly identify and fix issues without requiring forum searches.
298
+
299
+ ## Architecture
300
+
301
+ See [docs/build-system.md](docs/build-system.md) for comprehensive architecture documentation.
302
+
303
+ **High-level flow**:
304
+ ```
305
+ platformio.ini → Config Parser → Package Manager → Build Orchestrator
306
+
307
+ ┌─────────────────┼─────────────────┬──────────────────┐
308
+ ↓ ↓ ↓ ↓
309
+ Toolchain Arduino Core Source Scanner Library Manager
310
+ (AVR-GCC) (cores/variants) (.ino/.cpp/.c) (GitHub libs)
311
+ ↓ ↓ ↓ ↓
312
+ └─────────────────┼─────────────────┴──────────────────┘
313
+
314
+ Compiler (avr-g++)
315
+
316
+ Linker (avr-gcc)
317
+
318
+ objcopy (ELF → HEX)
319
+
320
+ firmware.hex
321
+ ```
322
+
323
+ ### Library System Architecture
324
+
325
+ The library management system handles downloading, compiling, and linking Arduino libraries:
326
+
327
+ 1. **Library Downloading**
328
+ - Optimizes GitHub URLs to direct zip downloads
329
+ - Detects and uses appropriate branch (main/master)
330
+ - Extracts libraries with proper directory structure
331
+
332
+ 2. **Library Compilation**
333
+ - Compiles C/C++ library sources with LTO flags (`-flto -fno-fat-lto-objects`)
334
+ - Resolves include paths for Arduino library structure
335
+ - Generates LTO bytecode objects for optimal linking
336
+
337
+ 3. **Library Linking**
338
+ - Passes library object files directly to linker (no archiving)
339
+ - LTO-aware linking with `--allow-multiple-definition` for symbol resolution
340
+ - Proper handling of weak symbols and ISR handlers
341
+
342
+ **Technical Solutions**:
343
+ - **LTO Bytecode**: Generate only LTO bytecode to avoid AVR register limitations during compilation
344
+ - **Direct Object Linking**: Pass object files directly to linker instead of archiving for better LTO integration
345
+ - **Multiple Definition Handling**: Support libraries that define symbols in multiple files (e.g., FastLED ISR handlers)
346
+
347
+ ## Project Structure
348
+
349
+ ```
350
+ my-project/
351
+ ├── platformio.ini # Configuration file
352
+ ├── src/
353
+ │ ├── main.ino # Your Arduino sketch
354
+ │ └── helpers.cpp # Additional C++ files
355
+ └── .fbuild/ # Build artifacts (auto-generated)
356
+ ├── cache/
357
+ │ ├── packages/ # Downloaded toolchains
358
+ │ └── extracted/ # Arduino cores
359
+ └── build/
360
+ └── uno/
361
+ ├── src/ # Compiled sketch objects
362
+ ├── core/ # Compiled Arduino core
363
+ └── firmware.hex # Final output ← Upload this!
364
+ ```
365
+
366
+ ## Testing
367
+
368
+ Fbuild includes comprehensive integration tests:
369
+
370
+ ```bash
371
+ # Run all tests
372
+ pytest tests/
373
+
374
+ # Run integration tests only
375
+ pytest tests/integration/
376
+
377
+ # Run with verbose output
378
+ pytest -v tests/integration/
379
+
380
+ # Test results: 11/11 passing
381
+ ```
382
+
383
+ **Test Coverage**:
384
+ - Full build success path
385
+ - Incremental builds
386
+ - Clean builds
387
+ - Firmware size validation
388
+ - HEX format validation
389
+ - Error handling (missing config, syntax errors, etc.)
390
+
391
+ ## Troubleshooting
392
+
393
+ ### Build fails with "platformio.ini not found"
394
+
395
+ Make sure you're in the project directory or use `-d`:
396
+ ```bash
397
+ fbuild build -d /path/to/project
398
+ ```
399
+
400
+ ### Build fails with checksum mismatch
401
+
402
+ Clear cache and rebuild:
403
+ ```bash
404
+ rm -rf .fbuild/cache/
405
+ fbuild build
406
+ ```
407
+
408
+ ### Compiler errors in sketch
409
+
410
+ Check the error message for line numbers:
411
+ ```
412
+ Error: src/main.ino:5:1: error: expected ';' before '}' token
413
+ ```
414
+
415
+ Common issues:
416
+ - Missing semicolon
417
+ - Missing closing brace
418
+ - Undefined function (missing #include or prototype)
419
+
420
+ ### Slow builds
421
+
422
+ - First build with downloads: 15-30s (expected)
423
+ - Cached builds: 2-5s (expected)
424
+ - Incremental: <1s (expected)
425
+
426
+ If slower, check:
427
+ - Network speed (for downloads)
428
+ - Disk speed (SSD recommended)
429
+ - Use `--verbose` to see what's slow
430
+
431
+ See [docs/build-system.md](docs/build-system.md) for more troubleshooting.
432
+
433
+ ## Development
434
+
435
+ To develop Fbuild, run `. ./activate.sh`
436
+
437
+ ### Windows
438
+
439
+ This environment requires you to use `git-bash`.
440
+
441
+ ### Linting
442
+
443
+ Run `./lint.sh` to find linting errors using `pylint`, `flake8` and `mypy`.
444
+
445
+ ## License
446
+
447
+ BSD 3-Clause License