@geastack/targets 0.1.95 → 0.1.99

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.
Files changed (52) hide show
  1. package/README.md +6 -0
  2. package/build-config.json +79 -0
  3. package/package.json +2 -2
  4. package/targets/esp32/chip_bindings/displays/co5300.cpp +50 -2
  5. package/targets/esp32/chip_bindings/displays/sh8601.cpp +22 -3
  6. package/targets/esp32/chip_bindings/touch/cst9217.cpp +19 -1
  7. package/targets/esp32/display.cpp +4 -0
  8. package/targets/esp32-s3-epaper-1.54/main/CMakeLists.txt +10 -0
  9. package/targets/esp32-s3-m5stack-sticks3/main/display.cpp +29 -8
  10. package/targets/esp32-s3-m5stack-stopwatch/CMakeLists.txt +9 -0
  11. package/targets/esp32-s3-m5stack-stopwatch/README.md +76 -0
  12. package/targets/esp32-s3-m5stack-stopwatch/dependencies.lock +35 -0
  13. package/targets/esp32-s3-m5stack-stopwatch/main/CMakeLists.txt +45 -0
  14. package/targets/esp32-s3-m5stack-stopwatch/main/Kconfig.projbuild +1 -0
  15. package/targets/esp32-s3-m5stack-stopwatch/main/idf_component.yml +4 -0
  16. package/targets/esp32-s3-m5stack-stopwatch/main/include/board.h +33 -0
  17. package/targets/esp32-s3-m5stack-stopwatch/main/include/panel_power.h +12 -0
  18. package/targets/esp32-s3-m5stack-stopwatch/main/panel_reset.cpp +199 -0
  19. package/targets/esp32-s3-m5stack-stopwatch/main/touch.cpp +147 -0
  20. package/targets/esp32-s3-m5stack-stopwatch/partitions.csv +8 -0
  21. package/targets/esp32-s3-m5stack-stopwatch/sdkconfig.defaults +33 -0
  22. package/targets/esp32-s3-touch-amoled-2.06/main/CMakeLists.txt +11 -2
  23. package/targets/esp32-s3-touch-amoled-2.06/main/idf_component.yml +2 -0
  24. package/targets/esp32-s3-touch-amoled-2.06-sh8601.json +158 -0
  25. package/targets/esp32-s3-touch-lcd-1.54/CMakeLists.txt +10 -0
  26. package/targets/esp32-s3-touch-lcd-1.54/README.md +45 -0
  27. package/targets/esp32-s3-touch-lcd-1.54/dependencies.lock +87 -0
  28. package/targets/esp32-s3-touch-lcd-1.54/main/CMakeLists.txt +27 -0
  29. package/targets/esp32-s3-touch-lcd-1.54/main/Kconfig.projbuild +12 -0
  30. package/targets/esp32-s3-touch-lcd-1.54/main/app_main.cpp +133 -0
  31. package/targets/esp32-s3-touch-lcd-1.54/main/buttons.cpp +102 -0
  32. package/targets/esp32-s3-touch-lcd-1.54/main/display.cpp +2 -0
  33. package/targets/esp32-s3-touch-lcd-1.54/main/fatfs_ffconf.h +377 -0
  34. package/targets/esp32-s3-touch-lcd-1.54/main/i2c.cpp +2 -0
  35. package/targets/esp32-s3-touch-lcd-1.54/main/idf_component.yml +7 -0
  36. package/targets/esp32-s3-touch-lcd-1.54/main/include/board.h +37 -0
  37. package/targets/esp32-s3-touch-lcd-1.54/main/include/buttons.h +2 -0
  38. package/targets/esp32-s3-touch-lcd-1.54/main/launcher_button.cpp +2 -0
  39. package/targets/esp32-s3-touch-lcd-1.54/main/power.cpp +69 -0
  40. package/targets/esp32-s3-touch-lcd-1.54/main/sdcard_mount.cpp +2 -0
  41. package/targets/esp32-s3-touch-lcd-1.54/main/touch.cpp +2 -0
  42. package/targets/esp32-s3-touch-lcd-1.54/partitions.csv +7 -0
  43. package/targets/esp32-s3-touch-lcd-1.54/sdkconfig.defaults +272 -0
  44. package/targets/esp32-s31-espressif-mosaico/main/CMakeLists.txt +2 -0
  45. package/targets/esp32-s31-espressif-mosaico/main/include/mosaico_peer_uart.h +17 -0
  46. package/targets/esp32-s31-espressif-mosaico/main/peer_uart.cpp +86 -0
  47. package/targets/rp2350-tufty-2350/CMakeLists.txt +11 -2
  48. package/targets/rp2350-waveshare-touch-amoled-2.41/CMakeLists.txt +6 -2
  49. package/targets/rp2350-waveshare-touch-amoled-2.41/main/app.cpp +5 -1
  50. package/targets/rp2350-waveshare-touch-amoled-2.41/main/rp2350_gea_platform.cpp +13 -7
  51. package/targets/rp2350-waveshare-touch-amoled-2.41/main/rp2350_panel.h +4 -0
  52. package/targets.json +29 -0
@@ -0,0 +1,272 @@
1
+ # Target: ESP32-S3
2
+ CONFIG_IDF_TARGET="esp32s3"
3
+
4
+ # Flash: 16 MB (Waveshare ESP32-S3-Touch-LCD-1.54)
5
+ CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y
6
+
7
+ # Console over USB Serial/JTAG (native USB-C on this board)
8
+ CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG=y
9
+
10
+ # esp_codec_dev should share the existing new-driver I2C bus with touch/PMIC.
11
+ # CONFIG_CODEC_I2C_BACKWARD_COMPATIBLE is not set
12
+
13
+ # Disable secondary console to avoid duplicate output
14
+ CONFIG_ESP_CONSOLE_SECONDARY_NONE=y
15
+
16
+ # FreeRTOS tick rate — 1000 Hz gives 1 ms resolution for modMilliseconds
17
+ CONFIG_FREERTOS_HZ=1000
18
+
19
+ # Run the S3 at its full rated app CPU clock. Bouncing display workloads are
20
+ # otherwise CPU-bound before the 80 MHz QSPI flush finishes.
21
+ CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y
22
+ CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ=240
23
+
24
+ # Main task stack for the app event loop. gea TSX frames can build deep
25
+ # reactive call chains before returning to the firmware loop.
26
+ CONFIG_ESP_MAIN_TASK_STACK_SIZE=32768
27
+ # The IPC task is per-core and its stack is internal DRAM, so 16384 cost 32 KiB of
28
+ # the scarcest memory on this board for tasks that only ever run ESP-IDF's own
29
+ # cross-core callbacks (intr_alloc is the single caller of esp_ipc_call_blocking
30
+ # in this firmware). IDF's default is 1024; 4096 keeps a 4x margin and hands ~24
31
+ # KiB back to the DMA-capable heap that the display staging and the WiFi RX
32
+ # frames were fighting over.
33
+ CONFIG_ESP_IPC_TASK_STACK_SIZE=4096
34
+
35
+ # Wi-Fi scan/connect callbacks run on ESP-IDF's system event task.
36
+ CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=4096
37
+
38
+ # Custom partition table with two OTA slots for wireless updates
39
+ CONFIG_PARTITION_TABLE_CUSTOM=y
40
+ CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv"
41
+
42
+ # On panic: print backtrace then reboot. (Halting was meant to "keep USB alive
43
+ # for reflashing", but a halted ESP32-S3 won't accept an esptool reset — it has
44
+ # to be recovered over JTAG. Rebooting allows the firmware to remain
45
+ # reachable for diagnosis and reflashing.)
46
+ CONFIG_ESP_SYSTEM_PANIC_PRINT_REBOOT=y
47
+
48
+ # Enable octal PSRAM for framebuffer
49
+ CONFIG_SPIRAM=y
50
+ CONFIG_SPIRAM_MODE_OCT=y
51
+ CONFIG_SPIRAM_SPEED_80M=y
52
+ CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY=y
53
+ CONFIG_FREERTOS_TASK_CREATE_ALLOW_EXT_MEM=y
54
+ # vTaskDeleteWithCaps(NULL) (fetchAsync job tasks end this way) deletes the task from a helper task with
55
+ # configMINIMAL_STACK_SIZE, which follows this; the default 1536 overflows while the job's thread-local
56
+ # state is torn down and reboots the board.
57
+ CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=3072
58
+ CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP=y
59
+ CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL=0
60
+ # IDF defaults this to 32 KiB when SPIRAM malloc is enabled. That creates a
61
+ # second DMA/internal heap by allocating a chunk from internal DRAM and
62
+ # re-registering it, which splits the physical heap map into a middle green
63
+ # reserve island. Keep internal memory globally allocatable; app/display code
64
+ # already asks for MALLOC_CAP_INTERNAL/MALLOC_CAP_DMA when it truly needs it.
65
+ CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL=0
66
+
67
+ # Wi-Fi/LwIP memory budget: prefer lower throughput over internal DRAM pressure.
68
+ CONFIG_ESP_WIFI_STATIC_RX_BUFFER_NUM=8
69
+ CONFIG_ESP_WIFI_DYNAMIC_RX_BUFFER_NUM=16
70
+ CONFIG_ESP_WIFI_STATIC_TX_BUFFER_NUM=4
71
+ CONFIG_ESP_WIFI_CACHE_TX_BUFFER_NUM=2
72
+ CONFIG_ESP_WIFI_MGMT_SBUF_NUM=16
73
+ CONFIG_ESP_WIFI_RX_BA_WIN=8
74
+ # RX-MGMT buffers DYNAMIC, not static. A RAM-tight app (maps: full-screen canvas
75
+ # + tile cache) leaves esp_wifi_init only ~11 KB internal DMA, but its STATIC
76
+ # esf_buf pool (static_rx 3 + rx_mgmt 5 + cache_tx 2 = 10 DMA-capable internal
77
+ # buffers) overflows it → esf_buf_setup_static NO_MEM → WiFi never comes up (no
78
+ # map tiles). Dynamic mgmt buffers leave the static pool and, with
79
+ # CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP=y above, allocate on demand from PSRAM.
80
+ # MUST be set here, not via the runtime wifi_init_config: flipping rx_mgmt_buf_type
81
+ # at runtime against a static-configured build asserts inside esp_wifi_init
82
+ # (panic/reboot loop). Doing it in sdkconfig keeps WIFI_INIT_CONFIG_DEFAULT consistent.
83
+ # CONFIG_ESP_WIFI_STATIC_RX_MGMT_BUFFER is not set
84
+ CONFIG_ESP_WIFI_DYNAMIC_RX_MGMT_BUFFER=y
85
+ # CONFIG_ESP_WIFI_IRAM_OPT is not set
86
+ # Measured on this board, NOT worth it for OTA. Putting the WiFi RX path in IRAM
87
+ # does what it promises — the receive phase of a 3.8 MB image went from 277 KB/s
88
+ # to 488 KB/s, because RX keeps running through the cache-disabled windows that
89
+ # esp_ota_write opens. But the same live RX path then contends with the flash
90
+ # operation it is running alongside, and the write phase fell from 502 KB/s to
91
+ # 213 KB/s. End to end that is 116 KB/s against 133 KB/s, plus ~10 KB of internal
92
+ # DRAM. Left off deliberately; do not re-enable without re-measuring both phases.
93
+ # CONFIG_ESP_WIFI_RX_IRAM_OPT is not set
94
+ # Wi-Fi driver task: IDF 5.5/6.0 no longer exposes a public
95
+ # CONFIG_ESP_WIFI_TASK_STACK_SIZE knob. targets/esp32/connectivity/wifi.cpp
96
+ # wraps wifi_init_config_t.osi_funcs task creation and bumps the closed-source
97
+ # "wifi" task to 8192 bytes there.
98
+ CONFIG_LWIP_TCPIP_TASK_STACK_SIZE=4096
99
+
100
+ # Allow lwIP to buffer out-of-sequence TCP segments. Without them a single dropped
101
+ # segment forces go-back-N retransmission of everything in flight, which (with RTO
102
+ # backoff 1.5+3+6+...s) turns one packet loss into a ~15s stall on an otherwise-fast
103
+ # link. 0 means UNCAPPED here, which is also IDF's own default whenever
104
+ # CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP is set, because the pbufs then come from
105
+ # PSRAM and are only held while a gap actually exists. The previous cap of 8 was
106
+ # below the widened receive window, so a loss early in a 16-segment window could
107
+ # not be bridged: an OTA transfer was bimodal, either ~17 s or ~87 s for the same
108
+ # 3.9 MB image under identical conditions, with the slow mode sitting in RTO backoff.
109
+ CONFIG_LWIP_TCP_OOSEQ_MAX_PBUFS=0
110
+
111
+ # Advertise selective acknowledgements. An OTA receiver drops frames every time
112
+ # esp_ota_write disables the flash cache, and without SACK the sender cannot tell
113
+ # which single segment went missing — it retransmits the whole window and backs
114
+ # off. This is the other half of the bimodal-throughput fix above.
115
+ CONFIG_LWIP_TCP_SACK_OUT=y
116
+
117
+ # TCP receive window. The IDF default of 5760 is four segments: an OTA image
118
+ # arrives through a receiver that has to stop and write to flash, and with a
119
+ # four-segment window the sender spends most of the transfer blocked waiting for
120
+ # a window update instead of keeping the link busy. Sixteen segments give the
121
+ # flash writes something to overlap with. The buffering behind the window is
122
+ # lwIP pbufs and WiFi dynamic RX frames, both of which prefer PSRAM here
123
+ # (CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP above), so this does not spend internal
124
+ # DRAM. 23040 stays under 65535, so no window scaling is required.
125
+ CONFIG_LWIP_TCP_WND_DEFAULT=23040
126
+ CONFIG_LWIP_TCP_RECVMBOX_SIZE=16
127
+
128
+ # Firmware uses STA mode for OTA/log/mirror; trim unused Wi-Fi/LwIP features.
129
+ CONFIG_ESP_WIFI_SOFTAP_SUPPORT=y
130
+ # CONFIG_ESP_WIFI_ENTERPRISE_SUPPORT is not set
131
+ # CONFIG_ESP_WIFI_ENABLE_WPA3_SAE is not set
132
+ # CONFIG_ESP_WIFI_ENABLE_WPA3_OWE_STA is not set
133
+ CONFIG_LWIP_IPV6=y
134
+ CONFIG_LWIP_DHCPS=y
135
+
136
+ # Bluetooth: NimBLE dual-role for the BLE control surface. This board serves
137
+ # HID + BLE-MIDI as a peripheral AND hosts remote peripherals as a central
138
+ # (XPPen ACK05 macro pad, WIDI/pedal BLE-MIDI adapter) — 4 simultaneous links:
139
+ # desktop (our HID), DAW (our MIDI), XPPen, pedal.
140
+ CONFIG_BT_ENABLED=y
141
+ CONFIG_BT_NIMBLE_ENABLED=y
142
+ CONFIG_BT_NIMBLE_MEM_ALLOC_MODE_EXTERNAL=y
143
+ CONFIG_BT_NIMBLE_MAX_CONNECTIONS=4
144
+ CONFIG_BT_NIMBLE_ROLE_BROADCASTER=y
145
+ CONFIG_BT_NIMBLE_ROLE_PERIPHERAL=y
146
+ CONFIG_BT_NIMBLE_ROLE_CENTRAL=y
147
+ CONFIG_BT_NIMBLE_ROLE_OBSERVER=y
148
+ CONFIG_BT_NIMBLE_SM_LEGACY=y
149
+ CONFIG_BT_NIMBLE_SM_SC=y
150
+ CONFIG_BT_NIMBLE_NVS_PERSIST=y
151
+ CONFIG_BT_NIMBLE_LOG_LEVEL_NONE=y
152
+
153
+ # Pin WiFi + BT controller + NimBLE host to core 1, leaving core 0 for the app
154
+ # frame/render task (GEA_EMBEDDED_APP_FRAME_TASK_CORE=0). IDF pins all of these
155
+ # to core 0 by default, where they contend with rendering: launching an app
156
+ # through the launcher dropped to ~22 fps because the per-chunk flush wait was
157
+ # preempted (19 ms vs 1.6 ms). Moving them to core 1 restores ~60 fps. Keep
158
+ # WiFi and BT on the SAME core for coexistence (ESP_COEX_SW_COEXIST_ENABLE).
159
+ CONFIG_ESP_WIFI_TASK_PINNED_TO_CORE_1=y
160
+ CONFIG_BT_CTRL_PINNED_TO_CORE_1=y
161
+ CONFIG_BT_NIMBLE_PINNED_TO_CORE_1=y
162
+
163
+ # WebRTC: mbedTLS DTLS + DTLS-SRTP for esp_peer
164
+ # Required by espressif/esp_peer (DTLS-SRTP handshake, DTLS cookies, MTU
165
+ # config). Off by default in IDF — turning them on costs ~30-40 kB of
166
+ # mbedTLS code but is non-negotiable for SRTP-protected RTP.
167
+ CONFIG_MBEDTLS_SSL_PROTO_DTLS=y
168
+ CONFIG_MBEDTLS_SSL_DTLS_SRTP=y
169
+ CONFIG_MBEDTLS_SSL_DTLS_HELLO_VERIFY=y
170
+ CONFIG_MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE=y
171
+ CONFIG_MBEDTLS_SSL_DTLS_CONNECTION_ID=y
172
+ # esp_peer generates a self-signed DTLS cert at runtime via
173
+ # mbedtls_x509write_crt_*; those live behind MBEDTLS_X509_CREATE_C, which
174
+ # ESP-IDF 6.0 flipped to default-off (was implicitly available in 5.5). Without
175
+ # it esp_peer fails to link (implicit-declaration of mbedtls_x509write_crt_*).
176
+ CONFIG_MBEDTLS_X509_CREATE_C=y
177
+ CONFIG_MBEDTLS_X509_CRT_WRITE_C=y
178
+ CONFIG_MBEDTLS_X509_CSR_WRITE_C=y
179
+
180
+ # Allocate mbedTLS memory from PSRAM instead of internal DRAM. IDF defaults to
181
+ # INTERNAL_MEM_ALLOC, but internal RAM is scarce on this board (app + 2-deep
182
+ # flush pipeline + WiFi driver). A TLS handshake's PSA signature verification
183
+ # and 16 KB input buffer then fail to allocate, surfacing as the misleading
184
+ # "esp-x509-crt-bundle: Certificate matched but signature verification failed"
185
+ # with PSA error -141 (PSA_ERROR_INSUFFICIENT_MEMORY) — a heap shortage, not a
186
+ # trust failure. PSRAM has megabytes free; the hardware MPI/crypto path copies
187
+ # operands into the peripheral so PSRAM-resident TLS buffers are fine.
188
+ # CONFIG_MBEDTLS_INTERNAL_MEM_ALLOC is not set
189
+ CONFIG_MBEDTLS_EXTERNAL_MEM_ALLOC=y
190
+
191
+ # Run TLS crypto in SOFTWARE so it allocates from PSRAM (via EXTERNAL_MEM_ALLOC
192
+ # above) rather than DMA-capable internal SRAM. EXTERNAL_MEM_ALLOC moves the
193
+ # mbedTLS input/output buffers to PSRAM, but the ESP32-S3 SHA/MPI/AES hardware
194
+ # drivers bypass the mbedTLS allocator and demand MALLOC_CAP_DMA|MALLOC_CAP_INTERNAL
195
+ # scratch buffers (e.g. sha.c allocates a DMA buffer sized to the data being
196
+ # hashed). Once WiFi is up, internal 8-bit RAM is ~1 KB free, so those allocations
197
+ # fail mid-handshake — surfacing as mbedtls_ssl_setup -> MBEDTLS_ERR_SSL_ALLOC_FAILED
198
+ # (PSA -141) and ESP_ERR_HTTP_CONNECT on every HTTPS fetch. Software crypto keeps
199
+ # everything in PSRAM and is amply fast for the app's occasional small fetches.
200
+ # CONFIG_MBEDTLS_HARDWARE_SHA is not set
201
+ # CONFIG_MBEDTLS_HARDWARE_MPI is not set
202
+ # CONFIG_MBEDTLS_MPI_USE_INTERRUPT is not set
203
+ # CONFIG_MBEDTLS_HARDWARE_AES is not set
204
+
205
+ # Release optimization level. ESP-IDF defaults to -Og (DEBUG) which is
206
+ # friendly for debugging but leaves real perf on the table for compute-heavy
207
+ # code paths. -O2 (PERF) is the correct release setting.
208
+ CONFIG_COMPILER_OPTIMIZATION_PERF=y
209
+ # CONFIG_COMPILER_OPTIMIZATION_DEBUG is not set
210
+
211
+ # --- Development logging / diagnostics defaults ---
212
+ # VS Code launch tasks build per-app firmware under build/app-builds/<app>.
213
+ # Keep those dev builds chatty by default so serial monitor shows boot logs,
214
+ # gea.perf fps windows, frame scheduler diagnostics, and assertion failures.
215
+ # Production lockdown can still be enabled via menuconfig, but it is not the
216
+ # default for local flash/monitor iteration.
217
+ # CONFIG_GEA_EMBEDDED_PRODUCTION_LOCKDOWN is not set
218
+
219
+ # Runtime and bootloader logs visible on USB serial/JTAG.
220
+ # CONFIG_LOG_DEFAULT_LEVEL_NONE is not set
221
+ CONFIG_LOG_DEFAULT_LEVEL_INFO=y
222
+ CONFIG_LOG_DEFAULT_LEVEL=3
223
+ CONFIG_LOG_MAXIMUM_EQUALS_DEFAULT=y
224
+ CONFIG_LOG_MAXIMUM_LEVEL=3
225
+
226
+ # Keep assertions enabled in local dev builds.
227
+ # CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE is not set
228
+ CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_ENABLE=y
229
+ CONFIG_COMPILER_OPTIMIZATION_ASSERTION_LEVEL=2
230
+ # geatsc lowers a program's `throw`/`try`/`catch` to real C++ exceptions, and
231
+ # its runtime header (`gea_runtime.h`, e.g. the regex cache's std::regex_error
232
+ # translation) contains typed catch handlers unconditionally. ESP-IDF's default
233
+ # stubs __cxa_throw to abort and compiles with -fno-exceptions, under which
234
+ # gcc rejects those handlers -- so no geatsc-generated app compiles for this
235
+ # board without exception support. The emergency pool stays 0: the cost is
236
+ # unwind tables in flash and ~500 B of heap on the first throw, nothing at rest.
237
+ CONFIG_COMPILER_CXX_EXCEPTIONS=y
238
+ CONFIG_COMPILER_CXX_EXCEPTIONS_EMG_POOL_SIZE=0
239
+
240
+ # Keep early boot output visible too.
241
+ # CONFIG_BOOTLOADER_LOG_LEVEL_NONE is not set
242
+ CONFIG_BOOTLOADER_LOG_LEVEL_INFO=y
243
+ CONFIG_BOOTLOADER_LOG_LEVEL=3
244
+
245
+ # Diagnostic allocation attribution. Keep standalone heap tracing available for
246
+ # app-init fragmentation investigations; trace records are placed in PSRAM by
247
+ # the caller, and tracing remains idle unless explicitly started.
248
+ # Heap tracing costs about a kilobyte of IRAM (1,067 bytes measured on
249
+ # esp32-s3-touch-amoled-2.06) and puts a hook on the allocator's hot path. On the
250
+ # S3 that IRAM is not free space: the linker sizes .dram0.dummy to whatever IRAM
251
+ # the image used, so every byte of .iram0.text is a byte the internal heap never
252
+ # gets -- and the internal heap is what DMA, USB host enumeration and aligned
253
+ # coefficient banks come out of. The framework's only users, the display and
254
+ # AXP2101 init traces, are already gated on GEA_EMBEDDED_HEAP_DIAGNOSTICS_LOG,
255
+ # which defaults to 0. So nothing traced by default and every app paid for it.
256
+ # Turn this and that macro on together when you actually want a trace.
257
+ CONFIG_HEAP_TRACING_OFF=y
258
+ # CONFIG_HEAP_TRACING_STANDALONE is not set
259
+ # CONFIG_HEAP_TRACING_TOHOST is not set
260
+ # CONFIG_HEAP_TRACING is not set
261
+ # CONFIG_HEAP_TRACE_HASH_MAP is not set
262
+
263
+ # Instruction cache: the default 16 KB / 32-byte-line I-cache thrashes on
264
+ # frame loops that touch libm. Measured on bubble-grid: a Math.pow costs
265
+ # 25.4k cycles cold but 6.5k warm back-to-back, and Date.now 11.5k vs 4.1k --
266
+ # i.e. ~19k and ~7.4k cycles per frame are pure cold-flash refetch, because
267
+ # the rest of the frame evicts the routine before the next frame calls it.
268
+ # 32 KB holds more of the frame's working set. (S3's I-cache line size is
269
+ # 16B or 32B only -- there is no 64B option.) the gea CLI also enforces this
270
+ # on every build, because the generated sdkconfig is sticky and defaults only
271
+ # fill values that an existing build directory has not already frozen.
272
+ CONFIG_ESP32S3_INSTRUCTION_CACHE_32KB=y
@@ -54,6 +54,7 @@ set(GEA_BOARD_PLATFORM_SOURCES
54
54
  "${CMAKE_CURRENT_LIST_DIR}/../../esp32-s3-touch-amoled-1.8/main/launcher_button.cpp"
55
55
  "${CMAKE_CURRENT_LIST_DIR}/touch.cpp"
56
56
  "${CMAKE_CURRENT_LIST_DIR}/board_power.cpp"
57
+ "${CMAKE_CURRENT_LIST_DIR}/peer_uart.cpp"
57
58
  "${GEA_CHIPS}/displays/co5300/co5300.cpp"
58
59
  "${CMAKE_CURRENT_LIST_DIR}/../../esp32/display.cpp"
59
60
  "${CMAKE_CURRENT_LIST_DIR}/../../esp32/chip_bindings/displays/co5300.cpp"
@@ -72,6 +73,7 @@ include("${CMAKE_CURRENT_LIST_DIR}/../../esp32-s3-touch-amoled-1.8/main/CMakeLis
72
73
  # std::move()s as redundant. Warnings, not errors, until the compiler runtime
73
74
  # and emitter are fixed for this toolchain.
74
75
  if(NOT CMAKE_BUILD_EARLY_EXPANSION)
76
+ target_link_libraries(${COMPONENT_LIB} INTERFACE "-Wl,-u,gea_mosaico_peer_uart_open")
75
77
  target_compile_options(${COMPONENT_LIB} PRIVATE -Wno-error=nonnull -Wno-error=redundant-move)
76
78
  # board_power.cpp keeps a crash's registers and log across the reset (no UART0 here)
77
79
  # and makes the USB console wait for the host instead of dropping output.
@@ -0,0 +1,17 @@
1
+ #pragma once
2
+ #include <stddef.h>
3
+ #include <stdbool.h>
4
+ #include <stdint.h>
5
+ #ifdef __cplusplus
6
+ extern "C" {
7
+ #endif
8
+ // Target-owned GPIO/UART reservation. Side 0 is left, side 1 is right. This API
9
+ // carries digital bytes only; packet framing and DSP are application concerns.
10
+ // Explicit opt-in; unconfigured boards do not drive expansion pins.
11
+ bool gea_mosaico_peer_uart_open(uint32_t baud);
12
+ void gea_mosaico_peer_uart_close(void);
13
+ int gea_mosaico_peer_uart_read(unsigned side, void* bytes, size_t capacity);
14
+ int gea_mosaico_peer_uart_write(unsigned side, const void* bytes, size_t length);
15
+ #ifdef __cplusplus
16
+ }
17
+ #endif
@@ -0,0 +1,86 @@
1
+ #include "driver/gpio.h"
2
+ #include "driver/uart.h"
3
+ #include "esp_err.h"
4
+ #include "freertos/FreeRTOS.h"
5
+ #include "mosaico_peer_uart.h"
6
+ #include <array>
7
+ namespace {
8
+ // Digital side-header link profile. H1 pin 12 -> H2 pin 12 is right TX
9
+ // -> left RX; H1 pin 11 <- H2 pin 11 is right RX <- left TX. Connect only
10
+ // these signal contacts plus GND; this does not join output power rails.
11
+ struct Pins {
12
+ uart_port_t uart;
13
+ int tx, rx;
14
+ };
15
+ constexpr std::array<Pins, 2> pins{{{UART_NUM_1, 15, 4}, {UART_NUM_2, 5, 38}}};
16
+ bool opened = false;
17
+ } // namespace
18
+ extern "C" bool gea_mosaico_peer_uart_open(uint32_t baud) {
19
+ #if GEA_MOSAICO_CAMERA_ENABLED
20
+ // Camera expansion owns these side GPIOs when that capability is enabled.
21
+ return false;
22
+ #endif
23
+ if (opened)
24
+ return true;
25
+ if (baud < 115200 || baud > 5000000)
26
+ return false;
27
+ // Never steal a UART already claimed by another board capability.
28
+ for (const auto &p : pins)
29
+ if (uart_is_driver_installed(p.uart))
30
+ return false;
31
+ unsigned installed = 0;
32
+ for (const auto &p : pins) {
33
+ uart_config_t config{};
34
+ config.baud_rate = baud;
35
+ config.data_bits = UART_DATA_8_BITS;
36
+ config.parity = UART_PARITY_DISABLE;
37
+ config.stop_bits = UART_STOP_BITS_1;
38
+ config.flow_ctrl = UART_HW_FLOWCTRL_DISABLE;
39
+ config.source_clk = UART_SCLK_DEFAULT;
40
+ // RX driver storage and TX ring are reserved once, off the audio path.
41
+ if (uart_param_config(p.uart, &config) != ESP_OK ||
42
+ uart_set_pin(p.uart, p.tx, p.rx, UART_PIN_NO_CHANGE,
43
+ UART_PIN_NO_CHANGE) != ESP_OK ||
44
+ uart_driver_install(p.uart, 4096, 4096, 0, nullptr, 0) != ESP_OK) {
45
+ for (unsigned i = 0; i < installed; ++i)
46
+ uart_driver_delete(pins[i].uart);
47
+ for (const auto &reset : pins) {
48
+ gpio_reset_pin(static_cast<gpio_num_t>(reset.tx));
49
+ gpio_reset_pin(static_cast<gpio_num_t>(reset.rx));
50
+ }
51
+ return false;
52
+ }
53
+ ++installed;
54
+ uart_set_rx_full_threshold(p.uart, 96);
55
+ uart_set_rx_timeout(p.uart, 2);
56
+ }
57
+ opened = true;
58
+ return true;
59
+ }
60
+ extern "C" void gea_mosaico_peer_uart_close(void) {
61
+ if (!opened)
62
+ return;
63
+ for (const auto &p : pins) {
64
+ uart_driver_delete(p.uart);
65
+ gpio_reset_pin(static_cast<gpio_num_t>(p.tx));
66
+ gpio_reset_pin(static_cast<gpio_num_t>(p.rx));
67
+ }
68
+ opened = false;
69
+ }
70
+ extern "C" int gea_mosaico_peer_uart_read(unsigned side, void *bytes,
71
+ size_t capacity) {
72
+ if (!opened || side >= pins.size() || !bytes || !capacity)
73
+ return -1;
74
+ return uart_read_bytes(pins[side].uart, bytes, capacity, 0);
75
+ }
76
+ extern "C" int gea_mosaico_peer_uart_write(unsigned side, const void *bytes,
77
+ size_t length) {
78
+ if (!opened || side >= pins.size() || !bytes || !length)
79
+ return -1;
80
+ // The transport task owns this call. DSP only pushes its preallocated queue.
81
+ size_t free = 0;
82
+ if (uart_get_tx_buffer_free_size(pins[side].uart, &free) != ESP_OK ||
83
+ free < length + 32)
84
+ return 0;
85
+ return uart_write_bytes(pins[side].uart, bytes, length);
86
+ }
@@ -4,6 +4,8 @@ cmake_minimum_required(VERSION 3.13)
4
4
  set(PICO_BOARD_HEADER_DIRS "${CMAKE_CURRENT_LIST_DIR}/boards" CACHE STRING "Pico board header search dirs")
5
5
  set(PICO_BOARD pimoroni_tufty2350 CACHE STRING "Pico SDK board")
6
6
  set(PICO_PLATFORM rp2350 CACHE STRING "Pico SDK platform")
7
+ # geatsc lowers JS throw/try to C++ exceptions; the SDK defaults to -fno-exceptions.
8
+ set(PICO_CXX_ENABLE_EXCEPTIONS 1)
7
9
  set(PICO_NUM_GPIOS 48 CACHE STRING "RP2350 GPIO count for Tufty 2350")
8
10
 
9
11
  if(DEFINED ENV{PICO_SDK_PATH})
@@ -138,6 +140,7 @@ if(GEA_EMBEDDED_APP)
138
140
  set(GEA_APP_SOURCE_LIST "${GEA_APP_BUILD_DIR}/geatsc-sources.txt")
139
141
  set(GEA_APP_GEATSC_ARCHIVE "${GEA_APP_BUILD_DIR}/libgea_app_geatsc.a")
140
142
  set(GEA_APP_FONT_CPP "${GEA_APP_BUILD_DIR}/gea_embedded_font_generated.cpp")
143
+ set(GEA_APP_ASSET_CPP "${GEA_APP_BUILD_DIR}/gea_embedded_assets_generated.cpp")
141
144
 
142
145
  file(GLOB_RECURSE GEA_APP_INPUTS CONFIGURE_DEPENDS
143
146
  "${GEA_APP_DIR}/*.css"
@@ -154,6 +157,7 @@ if(GEA_EMBEDDED_APP)
154
157
  "${GEA_APP_BUILD_DIR}/entry.cpp"
155
158
  "${GEA_APP_BUILD_DIR}/generated_support.hpp"
156
159
  "${GEA_APP_FONT_CPP}"
160
+ "${GEA_APP_ASSET_CPP}"
157
161
  "${GEA_APP_BUILD_DIR}/gea_embedded_font_generated.h"
158
162
  "${GEA_APP_BUILD_DIR}/runtime_pch.h"
159
163
  "${GEA_APP_BUILD_DIR}/runtime.cpp"
@@ -181,6 +185,7 @@ if(GEA_EMBEDDED_APP)
181
185
 
182
186
  set_source_files_properties(
183
187
  "${GEA_APP_FONT_CPP}"
188
+ "${GEA_APP_ASSET_CPP}"
184
189
  PROPERTIES GENERATED TRUE
185
190
  )
186
191
 
@@ -199,16 +204,19 @@ if(GEA_EMBEDDED_APP)
199
204
  "${GEA_ELEMENTS}/ui/camera_element.cpp"
200
205
  "${GEA_ELEMENTS}/ui/virtual_list.cpp"
201
206
  "${GEA_HOST}/input.cpp"
207
+ "${GEA_HOST}/host/image.cpp"
202
208
  ${GEA_ENGINE_UI_SOURCES}
203
209
  )
204
210
 
205
211
  add_executable(gea_rp2350_tufty_2350_app
206
212
  "${GEA_RP2350_SHARED_MAIN}/app.cpp"
207
213
  "${GEA_RP2350_SHARED_MAIN}/rp2350_gea_platform.cpp"
214
+ "${GEA_RP2350_SHARED_MAIN}/rp2350_host_fetch_stub.cpp"
208
215
  main/rp2350_panel.cpp
209
216
  "${GEA_RP2350_SHARED_MAIN}/vendor/waveshare_psram/rp_pico_alloc.c"
210
217
  "${GEA_RP2350_SHARED_MAIN}/vendor/waveshare_psram/tlsf/tlsf.c"
211
218
  "${GEA_APP_FONT_CPP}"
219
+ "${GEA_APP_ASSET_CPP}"
212
220
  ${GEA_APP_NATIVE_SOURCES}
213
221
  ${GEA_ENGINE_SOURCES}
214
222
  )
@@ -235,7 +243,8 @@ if(GEA_EMBEDDED_APP)
235
243
 
236
244
  target_compile_definitions(gea_rp2350_tufty_2350_app PRIVATE
237
245
  ${GEA_EMBEDDED_APP_DEFINES}
238
- GEA_CPP_VALUE_AVAILABLE=1
246
+ # Everything runs on core 0, and bare-metal has no TLS (__aeabi_read_tp).
247
+ GEA_RUNTIME_SINGLE_THREADED=1
239
248
  GEA_EMBEDDED_PIXEL_PANEL_ENDIAN=1
240
249
  GEA_EMBEDDED_DISPLAY_WIDTH=${GEA_RP2350_TUFTY_DISPLAY_WIDTH}
241
250
  GEA_EMBEDDED_DISPLAY_HEIGHT=${GEA_RP2350_TUFTY_DISPLAY_HEIGHT}
@@ -323,7 +332,7 @@ if(GEA_EMBEDDED_APP)
323
332
  -Os
324
333
  )
325
334
 
326
- target_link_libraries(gea_rp2350_tufty_2350_app
335
+ target_link_libraries(gea_rp2350_tufty_2350_app PRIVATE
327
336
  pico_stdlib
328
337
  hardware_adc
329
338
  hardware_clocks
@@ -4,6 +4,8 @@ cmake_minimum_required(VERSION 3.13)
4
4
  set(PICO_BOARD_HEADER_DIRS "${CMAKE_CURRENT_LIST_DIR}/boards" CACHE STRING "Pico board header search dirs")
5
5
  set(PICO_BOARD waveshare_rp2350_touch_amoled_2_41 CACHE STRING "Pico SDK board")
6
6
  set(PICO_PLATFORM rp2350 CACHE STRING "Pico SDK platform")
7
+ # geatsc lowers JS throw/try to C++ exceptions; the SDK defaults to -fno-exceptions.
8
+ set(PICO_CXX_ENABLE_EXCEPTIONS 1)
7
9
 
8
10
  if(DEFINED ENV{PICO_SDK_PATH})
9
11
  include("$ENV{PICO_SDK_PATH}/external/pico_sdk_import.cmake")
@@ -258,7 +260,9 @@ if(GEA_EMBEDDED_APP)
258
260
 
259
261
  target_compile_definitions(gea_rp2350_touch_amoled_241_app PRIVATE
260
262
  ${GEA_EMBEDDED_APP_DEFINES}
261
- GEA_CPP_VALUE_AVAILABLE=1
263
+ # The JS program runs on core 0 only; core 1 renders pixels and never
264
+ # touches a runtime object. Bare-metal has no TLS (__aeabi_read_tp).
265
+ GEA_RUNTIME_SINGLE_THREADED=1
262
266
  GEA_EMBEDDED_PIXEL_PANEL_ENDIAN=1
263
267
  GEA_EMBEDDED_DISPLAY_WIDTH=450
264
268
  GEA_EMBEDDED_DISPLAY_HEIGHT=600
@@ -325,7 +329,7 @@ if(GEA_EMBEDDED_APP)
325
329
  -Os
326
330
  )
327
331
 
328
- target_link_libraries(gea_rp2350_touch_amoled_241_app
332
+ target_link_libraries(gea_rp2350_touch_amoled_241_app PRIVATE
329
333
  pico_stdlib
330
334
  hardware_adc
331
335
  hardware_clocks
@@ -426,7 +426,7 @@ void runFrame(int timestampMs)
426
426
  phaseUs = nowUs;
427
427
  }
428
428
  #endif
429
- gea::host::runAnimationFrameCallbacks(static_cast<double>(timestampMs));
429
+ gea::host::runAnimationFrameCallbacks(timestampMs);
430
430
  #if GEA_RP2350_FRAME_PHASE_PERF
431
431
  {
432
432
  const std::uint64_t nowUs = time_us_64();
@@ -769,6 +769,7 @@ void handleDevCommand(char *line)
769
769
  } else if (std::strncmp(line, "VSCROLL", 7) == 0) {
770
770
  // Direct panel scroll-register test: the visible image should rotate
771
771
  // vertically by <rows> without any pixel data being streamed.
772
+ #ifdef GEA_RP2350_PANEL_HAS_VERTICAL_SCROLL
772
773
  int rows = 0;
773
774
  if (std::sscanf(line + 7, "%d", &rows) != 1) {
774
775
  std::printf("GEADEV:ERR VSCROLL usage=GEADEV_VSCROLL_rows\n");
@@ -776,6 +777,9 @@ void handleDevCommand(char *line)
776
777
  gea::rp2350::panelSetVerticalScroll(rows);
777
778
  std::printf("GEADEV:OK VSCROLL rows=%d\n", rows);
778
779
  }
780
+ #else
781
+ std::printf("GEADEV:ERR VSCROLL unsupported-panel\n");
782
+ #endif
779
783
  std::fflush(stdout);
780
784
  } else if (std::strncmp(line, "DRAG", 4) == 0) {
781
785
  int x1 = 0, y1 = 0, x2 = 0, y2 = 0, steps = 24, delayMs = 16;
@@ -620,6 +620,7 @@ void flushRectClipped(int x0, int y0, int x1, int y1)
620
620
  return;
621
621
  }
622
622
  #endif
623
+ #ifdef GEA_RP2350_PANEL_HAS_FULL_WIDTH_SPANS
623
624
  if (x0 == 0 && x1 == gea::rp2350::kPanelWidth - 1) {
624
625
  // Full-width flush of a circularly remapped region: the display-order
625
626
  // rows form contiguous framebuffer spans — DMA them straight from
@@ -652,6 +653,7 @@ void flushRectClipped(int x0, int y0, int x1, int y1)
652
653
  gFlushPixels += (x1 - x0 + 1) * (y1 - y0 + 1);
653
654
  return;
654
655
  }
656
+ #endif
655
657
  gea::rp2350::panelStreamRect(x0,
656
658
  y0,
657
659
  x1,
@@ -1665,7 +1667,7 @@ double requestAnimationFrame(AnimationFrameCallback callback)
1665
1667
  return id;
1666
1668
  }
1667
1669
 
1668
- void runAnimationFrameCallbacks(double timestampMs)
1670
+ void runAnimationFrameCallbacks(AnimationFrameTimestamp timestampMs)
1669
1671
  {
1670
1672
  gLastTimestampMs = timestampMs;
1671
1673
  for (auto &timer : gTimers) {
@@ -1732,11 +1734,15 @@ OscillatorNode AudioContext::createOscillator() const { return OscillatorNode();
1732
1734
  AudioBufferSourceNode AudioContext::createBufferSource() const { return AudioBufferSourceNode(); }
1733
1735
  AudioBuffer AudioContext::decodeAudioData(const std::vector<std::uint8_t> &) const { return AudioBuffer(); }
1734
1736
 
1735
- HTMLAudioElement::HTMLAudioElement(const char *src) : src_(src ? src : "") {}
1736
- HTMLAudioElement::HTMLAudioElement(const std::string &src) : src_(src) {}
1737
- HTMLAudioElement::HTMLAudioElement(const gea::embedded::ui::NodeHandle &node) : nodeId_(node.id()) {}
1738
- std::string HTMLAudioElement::src() const { return src_; }
1739
- void HTMLAudioElement::setSrc(const std::string &src) { src_ = src; }
1737
+ struct HTMLAudioElement::State {
1738
+ std::string src;
1739
+ int nodeId = -1;
1740
+ };
1741
+ HTMLAudioElement::HTMLAudioElement(const char *src) : state_(std::make_shared<State>()) { state_->src = src ? src : ""; }
1742
+ HTMLAudioElement::HTMLAudioElement(const std::string &src) : state_(std::make_shared<State>()) { state_->src = src; }
1743
+ HTMLAudioElement::HTMLAudioElement(const gea::embedded::ui::NodeHandle &node) : state_(std::make_shared<State>()) { state_->nodeId = node.id(); }
1744
+ std::string HTMLAudioElement::src() const { return state_ ? state_->src : std::string(); }
1745
+ void HTMLAudioElement::setSrc(const std::string &src) { if (state_) state_->src = src; }
1740
1746
  bool HTMLAudioElement::play() const { return false; }
1741
1747
  void HTMLAudioElement::pause() const {}
1742
1748
 
@@ -1842,7 +1848,7 @@ void Application::init(int width, int height, double devicePixelRatio)
1842
1848
  void Application::frame(int timestampMs)
1843
1849
  {
1844
1850
  generated::drainMicrotasks();
1845
- gea::host::runAnimationFrameCallbacks(static_cast<double>(timestampMs));
1851
+ gea::host::runAnimationFrameCallbacks(timestampMs);
1846
1852
  gea::embedded::ui::Document::instance().frame(timestampMs);
1847
1853
  generated::drainMicrotasks();
1848
1854
  gea::embedded::ui::Document::instance().refreshMountedIfDirty();
@@ -27,6 +27,9 @@ using PanelStreamRasterFn = void (*)(std::uint16_t *pixels,
27
27
  bool panelInit();
28
28
  void panelSetBrightness(int percent);
29
29
  void panelSetFlushConfig(int rows, int depth);
30
+ // The CO5300 has a vertical scroll register; panels without one (Tufty's
31
+ // ST7789 in landscape) leave this undefined.
32
+ #define GEA_RP2350_PANEL_HAS_VERTICAL_SCROLL 1
30
33
  // DCS vertical scroll (VSCRDEF/VSCSAD): the panel scans out GRAM row
31
34
  // (startRow + displayRow) % kPanelHeight, so a scroll becomes a 2-byte
32
35
  // register write instead of a full-GRAM re-stream. startRow 0 = identity.
@@ -37,6 +40,7 @@ void panelFlushRect(const std::uint16_t *pixels, int stridePixels, int x0, int y
37
40
  // bounce, no CPU copies). Cleans the XIP cache first so pending CPU writes are
38
41
  // visible to the DMA read. Used by the software scroll register: a circularly
39
42
  // remapped full-width flush is exactly two contiguous spans in display order.
43
+ #define GEA_RP2350_PANEL_HAS_FULL_WIDTH_SPANS 1
40
44
  void panelFlushFullWidthSpans(const std::uint16_t *span0, int rows0,
41
45
  const std::uint16_t *span1, int rows1,
42
46
  int gramY0);
package/targets.json CHANGED
@@ -191,5 +191,34 @@
191
191
  "ipcTaskStackSize": "4096",
192
192
  "manualBoot": true,
193
193
  "usbAppUpdate": "geadev-ota"
194
+ },
195
+ "esp32-s3-m5stack-stopwatch": {
196
+ "adapter": "esp32-idf",
197
+ "targetPath": "targets/esp32-s3-m5stack-stopwatch",
198
+ "flashSize": "16MB",
199
+ "appPlatform": "esp32",
200
+ "idfTarget": "esp32s3",
201
+ "esptoolChip": "esp32s3",
202
+ "ipcTaskStackSize": "4096"
203
+ },
204
+ "esp32-s3-touch-lcd-1.54": {
205
+ "adapter": "esp32-idf",
206
+ "targetPath": "targets/esp32-s3-touch-lcd-1.54",
207
+ "flashSize": "16MB",
208
+ "appPlatform": "esp32",
209
+ "idfTarget": "esp32s3",
210
+ "esptoolChip": "esp32s3",
211
+ "ipcTaskStackSize": "4096"
212
+ },
213
+ "esp32-s3-touch-amoled-2.06-sh8601": {
214
+ "adapter": "esp32-idf",
215
+ "targetPath": "targets/esp32-s3-touch-amoled-2.06",
216
+ "flashSize": "32MB",
217
+ "appPlatform": "esp32",
218
+ "idfTarget": "esp32s3",
219
+ "esptoolChip": "esp32s3",
220
+ "ipcTaskStackSize": "4096",
221
+ "definition": "targets/esp32-s3-touch-amoled-2.06-sh8601.json",
222
+ "variantOf": "esp32-s3-touch-amoled-2.06"
194
223
  }
195
224
  }