@geastack/cli 0.1.112 → 0.1.114

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.
package/docs/SETUP.md CHANGED
@@ -335,13 +335,14 @@ at call time, so never record a port path.
335
335
 
336
336
  ### Composed targets
337
337
 
338
- A composed target is a JSON definition that extends the `esp32-s3` base and
339
- picks its chips from the `@geastack/chips` catalog (`gea chips list`). Every
338
+ A composed target is a JSON definition that extends a base (`esp32-s3` or
339
+ `esp32-p4`, with `mcu` set to `esp32s3` or `esp32p4` to match) and picks its chips from the `@geastack/chips` catalog (`gea chips list`). Every
340
340
  role is optional, so the definition describes the hardware that is there:
341
341
  `display`, `touch`, `power`, `imu`, `audio`, `rtc` and `expander`. Some boards are
342
342
  shipped composed in `@geastack/targets` and need no definition of your own,
343
343
  for example `esp32-s3-devkit-n16r8` (a bare module),
344
- `esp32-s3-waveshare-touch-lcd-7` and `esp32-s3-elecrow-crowpanel-advance-7.0`.
344
+ `esp32-s3-waveshare-touch-lcd-7`, `esp32-s3-elecrow-crowpanel-advance-7.0` and
345
+ `esp32-p4-elecrow-crowpanel-advanced-5.0`.
345
346
 
346
347
  Two kinds of display are understood. A QSPI controller (`co5300`) takes the
347
348
  `spiHost` and `cs`/`pclk`/`data0-3`/`reset`/`te` pins. A bare parallel RGB
@@ -410,6 +411,37 @@ hardware switch the firmware does not drive, `pinSharing` lists the roles that
410
411
  may coincide, e.g. `[["audio", "microSD"]]`; every other pin must still belong
411
412
  to one role. The CrowPanel Advance 7.0 definition uses all of these.
412
413
 
414
+ #### The `esp32-p4` base
415
+
416
+ A P4 definition takes the same roles, with GPIOs up to 54. Its display is a
417
+ parallel RGB panel scanned straight out of the P4's in-package PSRAM by the
418
+ LCD driver, through only a small FIFO: a PSRAM stall of a few microseconds
419
+ underruns it and the picture creeps right. The base therefore runs flash at
420
+ QIO 80MHz, as the vendors' own firmware does (DIO 40MHz underran the CrowPanel
421
+ Advance 5.0 every few seconds); a board whose flash is wired DIO-only sets
422
+ `flashMode`. Use
423
+ `scanFramebuffers: 3` so the renderer draws straight into a buffer not being
424
+ scanned (one buffer adds a PSRAM-to-PSRAM copy of every changed region; with
425
+ two, each swap can wait up to a frame for the panel to let go of the old
426
+ front). Scroll copies and full-width patches between the buffers go through
427
+ the AXI-GDMA, about three times faster than the CPU. Keep the L2 cache's
428
+ 64-byte lines: 128-byte lines speed CPU copies up but stall PSRAM long enough
429
+ for the panel to underrun at 60Hz. Leave `restartInVsync` off; the driver restarts the DMA itself at the next VSYNC
430
+ if it ever falls behind. `psram` is not configurable (the base sets
431
+ it up). `pclkIdleHigh: true` idles the pixel clock high between lines, which
432
+ some panels need. Two sections exist only on this base:
433
+
434
+ - `wireless`: the WiFi/BLE coprocessor (an ESP32-C6, say) on SDIO through
435
+ esp_hosted: `slot`, `busWidth` (1 or 4), `clockKhz`, `resetActiveHigh`, and
436
+ `pins` `clk`/`cmd`/`d0`-`d3`/`reset`.
437
+ - `camera`: a MIPI-CSI sensor: `sensor` (the esp_cam_sensor name, e.g.
438
+ `sc2336`), `mode` (its Kconfig mode, e.g. `MIPI_RAW8_1024x600_30FPS`),
439
+ `width`/`height`, `rotation` (degrees counter-clockwise), the `sccb` bus's
440
+ `sda`/`scl`, and a `reset` that is a GPIO (`pin`) or an expander line
441
+ (`expander`).
442
+
443
+ The CrowPanel Advanced 5.0 definition is the reference.
444
+
413
445
  ## Common Verification Flow
414
446
 
415
447
  After installing tools:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geastack/cli",
3
- "version": "0.1.112",
3
+ "version": "0.1.114",
4
4
  "description": "Command-line front door for GeaStack apps, targets, and local toolchains.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -38,7 +38,7 @@
38
38
  "dependencies": {
39
39
  "@clack/prompts": "^1.8.0",
40
40
  "@geastack/simulator": "^0.1.15",
41
- "@geastack/targets": "^0.1.109",
41
+ "@geastack/targets": "^0.1.111",
42
42
  "picocolors": "^1.1.1",
43
43
  "serialport": "^13.0.0"
44
44
  },
@@ -8,7 +8,9 @@ import { writePartitionTable } from '../esp32/partitions-from-manifest.mjs'
8
8
  // generated board.h + target.cmake inside the app's build directory before
9
9
  // IDF configures, so the target project only ever includes generated files.
10
10
 
11
- const supportedBase = 'esp32-s3'
11
+ // Each base is a target project that includes the generated files, keyed by
12
+ // the `extends` a definition names, with the MCU it runs on.
13
+ const supportedBases = { 'esp32-s3': 'esp32s3', 'esp32-p4': 'esp32p4' }
12
14
 
13
15
  function object(value, label) {
14
16
  if (!value || typeof value !== 'object' || Array.isArray(value)) throw new Error(`${label} must be an object.`)
@@ -40,15 +42,20 @@ function boolean(value, label, fallback) {
40
42
  throw new Error(`${label} must be true or false.`)
41
43
  }
42
44
 
45
+ // The highest GPIO of the MCU being normalized: GPIO0-48 on the S3, 0-54 on
46
+ // the P4. Set once per definition, before any pin is read.
47
+ const maxGpioByMcu = { esp32s3: 48, esp32p4: 54 }
48
+ let maxGpio = maxGpioByMcu.esp32s3
49
+
43
50
  function pin(value, label, { optional = false } = {}) {
44
51
  if (optional && (value === null || value === undefined || value === 'none')) return -1
45
- return integer(value, label)
52
+ return integer(value, label, { max: maxGpio })
46
53
  }
47
54
 
48
55
  function exact(value, expected, label) {
49
56
  const actual = text(value, label).toLowerCase()
50
57
  if (actual !== expected) {
51
- throw new Error(`${label} '${actual}' is not supported by the ${supportedBase} base. Supported value: ${expected}.`)
58
+ throw new Error(`${label} '${actual}' is not supported. Supported value: ${expected}.`)
52
59
  }
53
60
  return actual
54
61
  }
@@ -129,8 +136,11 @@ export function normalizeCustomTarget(raw, catalog) {
129
136
  const definition = object(raw, 'Target definition')
130
137
  const id = text(definition.id, 'id')
131
138
  if (!/^[a-z0-9][a-z0-9._-]*$/.test(id)) throw new Error('id may contain lowercase letters, digits, dots, underscores, and hyphens.')
132
- const base = exact(definition.extends, supportedBase, 'extends')
133
- const mcu = exact(definition.mcu, 'esp32s3', 'mcu')
139
+ const base = text(definition.extends, 'extends')
140
+ if (!Object.hasOwn(supportedBases, base)) throw new Error(`extends must be one of ${Object.keys(supportedBases).join(', ')}, not '${base}'.`)
141
+ const mcu = exact(definition.mcu, supportedBases[base], 'mcu')
142
+ const p4 = mcu === 'esp32p4'
143
+ maxGpio = maxGpioByMcu[mcu]
134
144
  const adapter = definition.adapter ? exact(definition.adapter, 'esp32-idf', 'adapter') : 'esp32-idf'
135
145
  const chips = absent(definition.chips) ? {} : object(definition.chips, 'chips')
136
146
  const display = optionalChip(chips, 'display', 'display', adapter, mcu, catalog)
@@ -178,9 +188,10 @@ export function normalizeCustomTarget(raw, catalog) {
178
188
  // share nothing but a size, so each carries its own pins and parameters.
179
189
  const displayInterface = display ? display.interface : ''
180
190
  if (display && !['qspi', 'rgb'].includes(displayInterface)) {
181
- throw new Error(`chips.display.interface '${displayInterface}' is not supported by the ${supportedBase} base. Supported values: qspi, rgb.`)
191
+ throw new Error(`chips.display.interface '${displayInterface}' is not supported by the ${base} base. Supported values: qspi, rgb.`)
182
192
  }
183
193
  const spiHost = display && displayInterface === 'qspi' ? String(display.spiHost ?? 'spi2').toLowerCase() : 'spi2'
194
+ if (p4 && display && displayInterface !== 'rgb') throw new Error(`chips.display.interface '${displayInterface}' is not supported by the esp32-p4 base yet. Supported values: rgb.`)
184
195
  if (display && displayInterface === 'qspi' && !['spi2', 'spi3'].includes(spiHost)) throw new Error("chips.display.spiHost must be 'spi2' or 'spi3'.")
185
196
  const expanderOutputs = expander ? (absent(expander.outputs) ? {} : object(expander.outputs, 'chips.expander.outputs')) : null
186
197
  const expanderMaxPin = ['tca9554', 'pca9557', 'elecrow_board_control'].includes(expander?.driver) ? 7 : expander?.driver === 'ch422g' ? 11 : 15
@@ -227,6 +238,9 @@ export function normalizeCustomTarget(raw, catalog) {
227
238
  // console: octal settings on a quad-wired part do not fail cleanly, they
228
239
  // bring up a device that reports the wrong size and corrupts under load.
229
240
  const psram = absent(definition.psram) ? null : object(definition.psram, 'psram')
241
+ // The P4's PSRAM is in the package (16-line HEX, 200MHz), not a module
242
+ // choice: the base configures it, and the S3's octal/quad knobs mean nothing.
243
+ if (psram && p4) throw new Error('psram is not configurable on the esp32-p4 base: its PSRAM is in-package and the base sets it up.')
230
244
  const psramModes = ['octal', 'quad', 'none']
231
245
  const psramMode = psram && !absent(psram.mode) ? text(psram.mode, 'psram.mode').toLowerCase() : ''
232
246
  if (psramMode && !psramModes.includes(psramMode)) {
@@ -291,6 +305,63 @@ export function normalizeCustomTarget(raw, catalog) {
291
305
  }
292
306
  }
293
307
 
308
+ // A P4 has no radio: WiFi/BLE come from an ESP32-C6/C5 coprocessor on
309
+ // SDIO, through esp_hosted. Its bus and reset line are board wiring.
310
+ const wireless = absent(definition.wireless) ? null : object(definition.wireless, 'wireless')
311
+ if (wireless && !p4) throw new Error('wireless (a hosted coprocessor) is only supported by the esp32-p4 base.')
312
+ const wirelessPins = wireless ? object(wireless.pins, 'wireless.pins') : null
313
+ const wirelessConfig = wireless ? (() => {
314
+ exact(wireless.transport ?? 'sdio', 'sdio', 'wireless.transport')
315
+ const busWidth = integer(wireless.busWidth ?? 4, 'wireless.busWidth', { min: 1, max: 4 })
316
+ if (![1, 4].includes(busWidth)) throw new Error('wireless.busWidth must be 1 or 4.')
317
+ return {
318
+ coprocessor: text(wireless.coprocessor ?? 'esp32c6', 'wireless.coprocessor'),
319
+ transport: 'sdio',
320
+ slot: integer(wireless.slot ?? 1, 'wireless.slot', { min: 0, max: 1 }),
321
+ busWidth,
322
+ clockKhz: integer(wireless.clockKhz ?? 40000, 'wireless.clockKhz', { min: 400, max: 50000 }),
323
+ resetActiveHigh: boolean(wireless.resetActiveHigh, 'wireless.resetActiveHigh', true),
324
+ pins: {
325
+ clk: pin(wirelessPins.clk, 'wireless.pins.clk'),
326
+ cmd: pin(wirelessPins.cmd, 'wireless.pins.cmd'),
327
+ d0: pin(wirelessPins.d0, 'wireless.pins.d0'),
328
+ d1: busWidth === 4 ? pin(wirelessPins.d1, 'wireless.pins.d1') : -1,
329
+ d2: busWidth === 4 ? pin(wirelessPins.d2, 'wireless.pins.d2') : -1,
330
+ d3: busWidth === 4 ? pin(wirelessPins.d3, 'wireless.pins.d3') : -1,
331
+ reset: pin(wirelessPins.reset, 'wireless.pins.reset', { optional: true })
332
+ }
333
+ }
334
+ })() : null
335
+ // A MIPI-CSI camera: the sensor (an esp_cam_sensor driver), its mode, and
336
+ // its SCCB control bus. Reset may be a GPIO or a board-control line.
337
+ const camera = absent(definition.camera) ? null : object(definition.camera, 'camera')
338
+ if (camera && !p4) throw new Error('camera is only supported by the esp32-p4 base.')
339
+ const cameraConfig = camera ? (() => {
340
+ exact(camera.interface ?? 'mipi-csi', 'mipi-csi', 'camera.interface')
341
+ const sensor = text(camera.sensor, 'camera.sensor').toLowerCase()
342
+ if (!/^[a-z0-9]+$/.test(sensor)) throw new Error(`camera.sensor must be an esp_cam_sensor name such as sc2336 or ov5647, not '${sensor}'.`)
343
+ // Spelled exactly as the sensor's Kconfig spells it (the resolution keeps its lowercase x).
344
+ const mode = absent(camera.mode) ? '' : text(camera.mode, 'camera.mode')
345
+ if (mode && !/^[A-Za-z0-9_]+$/.test(mode)) throw new Error(`camera.mode must be the sensor's Kconfig mode name such as MIPI_RAW8_1024x600_30FPS, not '${mode}'.`)
346
+ const sccb = object(camera.sccb, 'camera.sccb')
347
+ const reset = absent(camera.reset) ? {} : object(camera.reset, 'camera.reset')
348
+ if (!absent(reset.expander) && !expander) throw new Error('camera.reset.expander names an expander line, but the board has no chips.expander.')
349
+ return {
350
+ sensor,
351
+ mode,
352
+ width: integer(camera.width, 'camera.width', { min: 1, max: 4096 }),
353
+ height: integer(camera.height, 'camera.height', { min: 1, max: 4096 }),
354
+ // Sensor mounting relative to the panel, degrees counter-clockwise.
355
+ rotation: (() => {
356
+ const value = integer(camera.rotation ?? 0, 'camera.rotation', { min: 0, max: 270 })
357
+ if (value % 90) throw new Error('camera.rotation must be 0, 90, 180 or 270.')
358
+ return value
359
+ })(),
360
+ sccb: { sda: pin(sccb.sda, 'camera.sccb.sda'), scl: pin(sccb.scl, 'camera.sccb.scl') },
361
+ reset: { pin: pin(reset.pin, 'camera.reset.pin', { optional: true }), expander: expanderPin(reset.expander, 'camera.reset.expander') }
362
+ }
363
+ })() : null
364
+
294
365
  const target = {
295
366
  id,
296
367
  extends: base,
@@ -313,6 +384,8 @@ export function normalizeCustomTarget(raw, catalog) {
313
384
  return roles
314
385
  }),
315
386
  console: consoleTransport ? { transport: consoleTransport, baud: consoleBaud, uart: consoleUart } : null,
387
+ wireless: wirelessConfig,
388
+ camera: cameraConfig,
316
389
  psram: psramMode ? { mode: psramMode, speed: psramSpeed, xip: psramXip } : null,
317
390
  buses: {
318
391
  i2c: i2c === null ? null : {
@@ -336,6 +409,8 @@ export function normalizeCustomTarget(raw, catalog) {
336
409
  vsyncBackPorch: integer(display.vsyncBackPorch ?? 8, 'chips.display.vsyncBackPorch', { min: 0, max: 1024 }),
337
410
  vsyncFrontPorch: integer(display.vsyncFrontPorch ?? 8, 'chips.display.vsyncFrontPorch', { min: 0, max: 1024 }),
338
411
  pclkActiveNeg: boolean(display.pclkActiveNeg, 'chips.display.pclkActiveNeg', true),
412
+ // PCLK's level between lines; some panels sample garbage unless it idles high.
413
+ pclkIdleHigh: boolean(display.pclkIdleHigh, 'chips.display.pclkIdleHigh', false),
339
414
  scanFramebuffers: integer(display.scanFramebuffers ?? 3, 'chips.display.scanFramebuffers', { min: 1, max: 3 }),
340
415
  backlightActiveLow: boolean(display.backlightActiveLow, 'chips.display.backlightActiveLow', false),
341
416
  bounceRows: integer(display.bounceRows ?? 0, 'chips.display.bounceRows', { min: 0, max: 120 }),
@@ -512,7 +587,7 @@ export function normalizeCustomTarget(raw, catalog) {
512
587
  return target
513
588
  }
514
589
 
515
- const pinRoles = ['i2c', 'display', 'touch', 'audio', 'microphone', 'microSD', 'launcherButton']
590
+ const pinRoles = ['i2c', 'display', 'touch', 'audio', 'microphone', 'microSD', 'launcherButton', 'wireless', 'camera']
516
591
 
517
592
  function pinRoleOf(label) {
518
593
  if (label.startsWith('I2C ')) return 'i2c'
@@ -521,6 +596,8 @@ function pinRoleOf(label) {
521
596
  if (label.startsWith('audio ')) return 'audio'
522
597
  if (label.startsWith('microphone ')) return 'microphone'
523
598
  if (label.startsWith('microSD ')) return 'microSD'
599
+ if (label.startsWith('wireless ')) return 'wireless'
600
+ if (label.startsWith('camera ')) return 'camera'
524
601
  return 'launcherButton'
525
602
  }
526
603
 
@@ -580,7 +657,13 @@ function validatePinAssignments(target) {
580
657
  ['microSD CS', sd.pins.cs]
581
658
  ] : [])
582
659
  ] : []),
583
- ...(launcher ? [['launcher button', launcher.pin]] : [])
660
+ ...(launcher ? [['launcher button', launcher.pin]] : []),
661
+ ...(target.wireless ? Object.entries(target.wireless.pins).map(([name, value]) => [`wireless ${name.toUpperCase()}`, value]) : []),
662
+ ...(target.camera ? [
663
+ ['camera SCCB SDA', target.camera.sccb.sda],
664
+ ['camera SCCB SCL', target.camera.sccb.scl],
665
+ ['camera reset', target.camera.reset.pin]
666
+ ] : [])
584
667
  ]
585
668
  const shared = (a, b) => a !== b && target.pinSharing.some((group) => group.includes(a) && group.includes(b))
586
669
  const used = new Map()
@@ -640,6 +723,8 @@ ${includes}
640
723
  #define GEA_BOARD_HAS_LAUNCHER_BUTTON ${target.controls.launcherButton ? 1 : 0}
641
724
  #define GEA_BOARD_HAS_EXPANDER ${expander ? 1 : 0}
642
725
  #define GEA_BOARD_HAS_RGB_CONTROLLER ${rgb?.controller ? 1 : 0}
726
+ #define GEA_BOARD_HAS_CAMERA ${target.camera ? 1 : 0}
727
+ #define GEA_BOARD_HAS_HOSTED_WIRELESS ${target.wireless ? 1 : 0}
643
728
 
644
729
  namespace gea::platform::board {
645
730
 
@@ -694,6 +779,13 @@ inline constexpr Es8311AudioConfig audio{
694
779
  .ws = ${gpio(audioPins.ws)}, .dout = ${gpio(audioPins.dout)}, .din = ${gpio(audioPins.din)},
695
780
  .powerAmplifier = ${gpio(audioPins.powerAmplifier)}, .es7210Address = ${audio.es7210Address}
696
781
  };` : ''}
782
+ ${target.camera ? `
783
+ // The MIPI-CSI camera's SCCB bus and reset: a GPIO, or a board-control line (-1 where neither).
784
+ struct CameraConfig { const char *name; gpio_num_t sccbSda; gpio_num_t sccbScl; gpio_num_t reset; int expanderReset; int width; int height; int rotateCcw; };
785
+ inline constexpr CameraConfig camera{ .name = "mipi-csi-${target.camera.sensor}", .sccbSda = ${gpio(target.camera.sccb.sda)}, .sccbScl = ${gpio(target.camera.sccb.scl)}, .reset = ${gpio(target.camera.reset.pin)}, .expanderReset = ${target.camera.reset.expander}, .width = ${target.camera.width}, .height = ${target.camera.height}, .rotateCcw = ${target.camera.rotation / 90} };` : ''}${target.wireless ? `
786
+ // The hosted WiFi/BLE coprocessor's SDIO bus (esp_hosted reads the same pins from sdkconfig).
787
+ struct HostedConfig { gpio_num_t clk; gpio_num_t cmd; gpio_num_t d0; gpio_num_t d1; gpio_num_t d2; gpio_num_t d3; gpio_num_t reset; };
788
+ inline constexpr HostedConfig hosted{ .clk = ${gpio(target.wireless.pins.clk)}, .cmd = ${gpio(target.wireless.pins.cmd)}, .d0 = ${gpio(target.wireless.pins.d0)}, .d1 = ${gpio(target.wireless.pins.d1)}, .d2 = ${gpio(target.wireless.pins.d2)}, .d3 = ${gpio(target.wireless.pins.d3)}, .reset = ${gpio(target.wireless.pins.reset)} };` : ''}
697
789
 
698
790
  ${rgb?.controller ? `struct RgbControllerConfig { int cs; int clock; int data; int reset; int addressSelect; };
699
791
  inline constexpr RgbControllerConfig rgbController{ ${rgb.controller.cs}, ${rgb.controller.clock}, ${rgb.controller.data}, ${rgb.controller.reset}, ${rgb.controller.addressSelect} };
@@ -782,7 +874,10 @@ export function renderTargetCmake(target, includeDir, appDefines = new Set()) {
782
874
  // it stores native order -- exactly what the Elecrow rotary target does.
783
875
  display?.panel ? boardDefine('GEA_CUSTOM_QSPI_PANEL_CONFIG', 1) : '',
784
876
  display?.panel?.minChunkRows ? boardDefine('GEA_EMBEDDED_DISPLAY_FLUSH_CHUNK_MIN', display.panel.minChunkRows) : '',
785
- display && display.interface === 'rgb' ? boardDefine('GEA_EMBEDDED_PIXEL_PANEL_ENDIAN', 0) : ''
877
+ display && display.interface === 'rgb' ? boardDefine('GEA_EMBEDDED_PIXEL_PANEL_ENDIAN', 0) : '',
878
+ display?.pclkIdleHigh ? boardDefine('GEA_EMBEDDED_DISPLAY_RGB_PCLK_IDLE_HIGH', 1) : '',
879
+ // The P4's driver-owned framebuffers take the direct path in rgb_panel.cpp.
880
+ display && display.interface === 'rgb' && target.mcu === 'esp32p4' ? boardDefine('GEA_EMBEDDED_DISPLAY_RGB_BOUNCE', 0) : ''
786
881
  ].join('')
787
882
  // The board's own identity and pixel order reach geatsc too: the base project
788
883
  // is another board's, and its defaults (name, viewport, byte-swapped RGB565)
@@ -802,6 +897,9 @@ set(GEA_CUSTOM_TARGET_TOUCH_DRIVER "${touch ? touch.driver : ''}")
802
897
  set(GEA_CUSTOM_TARGET_HAS_EXPANDER ${expander ? 1 : 0})
803
898
  set(GEA_CUSTOM_TARGET_HAS_MICROSD ${target.storage.microSD ? 1 : 0})
804
899
  set(GEA_CUSTOM_TARGET_AUDIO_DRIVER "${audio ? audio.driver : ''}")
900
+ set(GEA_CUSTOM_TARGET_HAS_CAMERA ${target.camera ? 1 : 0})
901
+ set(GEA_CUSTOM_TARGET_CAMERA_SENSOR "${target.camera ? target.camera.sensor : ''}")
902
+ set(GEA_CUSTOM_TARGET_HAS_HOSTED_WIRELESS ${target.wireless ? 1 : 0})
805
903
  set(GEA_CUSTOM_TARGET_AUDIO_SOURCES
806
904
  ${audio?.kind === 'i2s-amplifier' ? sourcesFor(audio).join('\n') : ''}
807
905
  )
@@ -16,6 +16,7 @@ export const buildOptions = {
16
16
  'compiler.staticCssTapeMinChunk': { type: 'integer', min: 1 },
17
17
  'compiler.translationUnits': { values: ['default', 'per-file', 'balanced'] },
18
18
  'compiler.storeRelowering': { type: 'boolean' },
19
+ 'compiler.heapMiB': { type: 'integer', min: 512 },
19
20
  'compiler.generatedCodeOptimization': { values: ['O0', 'O1', 'O2', 'O3', 'Os', 'Og'] },
20
21
  'compiler.numberPrecision': { values: ['float64', 'float32'], macro: 'GEA_NUMBER_FLOAT', encode: v => v === 'float32' ? 1 : undefined },
21
22
  'ui.styleStorage': { values: ['inline', 'shared'], macro: 'GEA_EMBEDDED_SHARED_STYLES', encode: v => Number(v === 'shared') },
@@ -453,7 +453,10 @@ export const geadev = {
453
453
  },
454
454
 
455
455
  async screenshot(d, { timeoutMs = 12000, fallbackTimeoutMs = 30000, attempts = 3, legacy = false } = {}) {
456
- if (legacy) return geadev.screenshotRle(d, fallbackTimeoutMs)
456
+ // A 115200-baud UART console moves ~11 KB/s, so a busy 800x480 frame can
457
+ // need longer than the default: a longer --timeout covers the RLE path too.
458
+ const rleTimeoutMs = Math.max(timeoutMs, fallbackTimeoutMs)
459
+ if (legacy) return geadev.screenshotRle(d, rleTimeoutMs)
457
460
  let lastError = null
458
461
  for (let attempt = 0; attempt < Math.max(1, attempts); attempt += 1) {
459
462
  try {
@@ -465,7 +468,7 @@ export const geadev = {
465
468
  }
466
469
  }
467
470
  if (d.trace) d.stderr(`binary screenshot unavailable, falling back to RLE: ${lastError?.message}`)
468
- return geadev.screenshotRle(d, fallbackTimeoutMs)
471
+ return geadev.screenshotRle(d, rleTimeoutMs)
469
472
  },
470
473
 
471
474
  // Streams a file onto the device's storage over USB. Throttled bursts keep
@@ -169,7 +169,7 @@ export function requireEspIdf(env, log, selection = null) {
169
169
 
170
170
  // The per-app sdkconfig policy: development logging, the board's stack
171
171
  // sizes, the S3 instruction cache and the BLE host exactly as the app needs.
172
- export function applySdkconfigPolicy(sdkconfig, { selection, app, capabilities, bleOta, partitionCsv, boardConsole, boardPsram, boardRgbPanel }) {
172
+ export function applySdkconfigPolicy(sdkconfig, { selection, app, capabilities, bleOta, partitionCsv, boardConsole, boardPsram, boardRgbPanel, boardWireless = null, boardCamera = null }) {
173
173
  const set = (key, value) => sdkconfig.set(key, value)
174
174
  const unset = (key) => sdkconfig.unset(key)
175
175
  // A board value the app's own defaults may replace. Every value this policy
@@ -266,6 +266,62 @@ export function applySdkconfigPolicy(sdkconfig, { selection, app, capabilities,
266
266
  // `restartInVsync: false` skips the restart: it runs in the VSYNC interrupt,
267
267
  // which waits out a refill in progress, and once that pushes it past the
268
268
  // vertical blanking the restarted frame lands shifted sideways.
269
+ // A P4's hosted WiFi/BLE coprocessor: esp_hosted takes its SDIO bus and the
270
+ // coprocessor's reset line from these, so they are the board's wiring.
271
+ if (boardWireless) {
272
+ for (const slot of [0, 1]) if (slot !== boardWireless.slot) unset(`CONFIG_ESP_HOSTED_SDIO_SLOT_${slot}`)
273
+ board(`CONFIG_ESP_HOSTED_SDIO_SLOT_${boardWireless.slot}`, 'y')
274
+ if (boardWireless.busWidth === 4) {
275
+ unset('CONFIG_ESP_HOSTED_SDIO_1_BIT_BUS')
276
+ board('CONFIG_ESP_HOSTED_SDIO_4_BIT_BUS', 'y')
277
+ } else {
278
+ unset('CONFIG_ESP_HOSTED_SDIO_4_BIT_BUS')
279
+ board('CONFIG_ESP_HOSTED_SDIO_1_BIT_BUS', 'y')
280
+ }
281
+ board('CONFIG_ESP_HOSTED_SDIO_CLOCK_FREQ_KHZ', String(boardWireless.clockKhz))
282
+ if (boardWireless.resetActiveHigh) {
283
+ unset('CONFIG_ESP_HOSTED_SDIO_RESET_ACTIVE_LOW')
284
+ board('CONFIG_ESP_HOSTED_SDIO_RESET_ACTIVE_HIGH', 'y')
285
+ } else {
286
+ unset('CONFIG_ESP_HOSTED_SDIO_RESET_ACTIVE_HIGH')
287
+ board('CONFIG_ESP_HOSTED_SDIO_RESET_ACTIVE_LOW', 'y')
288
+ }
289
+ board('CONFIG_ESP_HOSTED_SDIO_GPIO_RESET_SLAVE', String(boardWireless.pins.reset))
290
+ // esp_hosted's settable pins are the per-slot PRIV symbols; the plain
291
+ // CONFIG_ESP_HOSTED_SDIO_PIN_* are derived from them and a value written
292
+ // there is recomputed away. D1 is the interrupt line in 1-bit mode too.
293
+ const slot = `SLOT_${boardWireless.slot}`
294
+ const bus = boardWireless.busWidth === 4 ? '4BIT_BUS' : '1BIT_BUS'
295
+ const pins = {
296
+ [`CMD_${slot}`]: 'cmd',
297
+ [`CLK_${slot}`]: 'clk',
298
+ [`D0_${slot}`]: 'd0',
299
+ [`D1_${bus}_${slot}`]: 'd1',
300
+ ...(boardWireless.busWidth === 4 ? { [`D2_${bus}_${slot}`]: 'd2', [`D3_${bus}_${slot}`]: 'd3' } : {})
301
+ }
302
+ for (const [name, key] of Object.entries(pins)) {
303
+ if (boardWireless.pins[key] >= 0) board(`CONFIG_ESP_HOSTED_PRIV_SDIO_PIN_${name}`, String(boardWireless.pins[key]))
304
+ }
305
+ }
306
+
307
+ // A P4's MIPI-CSI camera: the esp_cam_sensor driver and the mode it streams.
308
+ if (boardCamera) {
309
+ const sensor = boardCamera.sensor.toUpperCase()
310
+ board('CONFIG_IDF_EXPERIMENTAL_FEATURES', 'y')
311
+ board(`CONFIG_CAMERA_${sensor}`, 'y')
312
+ board(`CONFIG_CAMERA_${sensor}_AUTO_DETECT_MIPI_INTERFACE_SENSOR`, 'y')
313
+ if (boardCamera.mode) {
314
+ // The mode is a choice: clear the one already selected (the sensor's
315
+ // default, or a previous board's) so the two cannot both stand.
316
+ const prefix = `CONFIG_CAMERA_${sensor}_${boardCamera.mode.split('_')[0]}_`
317
+ for (const line of sdkconfig.text.split('\n')) {
318
+ const key = line.endsWith('=y') ? line.slice(0, -2) : ''
319
+ if (key.startsWith(prefix) && !key.includes('_IF_FORMAT_') && key !== `CONFIG_CAMERA_${sensor}_${boardCamera.mode}`) unset(key)
320
+ }
321
+ board(`CONFIG_CAMERA_${sensor}_${boardCamera.mode}`, 'y')
322
+ }
323
+ }
324
+
269
325
  if (boardRgbPanel) {
270
326
  board('CONFIG_LCD_RGB_ISR_IRAM_SAFE', 'y')
271
327
  if (boardRgbPanel.restartInVsync) board('CONFIG_LCD_RGB_RESTART_IN_VSYNC', 'y')
@@ -527,6 +583,8 @@ export function prepareEsp32Build({ ctx, selection, app = null, env = ctx.env ||
527
583
  let boardConsole = null
528
584
  let boardPsram = null
529
585
  let boardRgbPanel = false
586
+ let boardWireless = null
587
+ let boardCamera = null
530
588
  // Physical buttons: the board's JSON list with the app's changes, generated
531
589
  // into a header the firmware's button service includes.
532
590
  const buttons = resolveButtons({ board: selection.buttons || [], app, platform: 'esp32', boardId: selection.target })
@@ -563,6 +621,8 @@ export function prepareEsp32Build({ ctx, selection, app = null, env = ctx.env ||
563
621
  if (boardPsram && appEsp32Config?.psram) boardPsram = { ...boardPsram, ...appEsp32Config.psram }
564
622
  const display = generated.target.chips?.display
565
623
  boardRgbPanel = display?.interface === 'rgb' ? { restartInVsync: display.restartInVsync !== false } : false
624
+ boardWireless = generated.target.wireless
625
+ boardCamera = generated.target.camera
566
626
  log(`Generated custom board files in ${outDir} (${path.basename(generated.headerPath)}, ${path.basename(generated.cmakePath)})`)
567
627
  }
568
628
 
@@ -694,7 +754,9 @@ function preparePartitions(app, config, buildDir, targetId) {
694
754
  partitionCsv: appPartitionCsv || boardPartitionCsv,
695
755
  boardConsole,
696
756
  boardPsram,
697
- boardRgbPanel
757
+ boardRgbPanel,
758
+ boardWireless,
759
+ boardCamera
698
760
  }).save()
699
761
 
700
762
  const defaultsArg = [defaultsFile, appSdkconfigFile].filter(Boolean).join(';')
package/src/manifest.mjs CHANGED
@@ -96,7 +96,7 @@ export function validateApp(app) {
96
96
  }
97
97
  if (config.providers !== null && (typeof config.providers !== 'object' || Array.isArray(config.providers))) errors.push(`${where('providers')} must be an object keyed by capability`)
98
98
  else if (Object.keys(config.providers).length && !TARGET_PROVIDER_TARGETS.includes(target)) errors.push(`${where('providers')} is supported only by ${TARGET_PROVIDER_TARGETS.join(', ')}`)
99
- if (config.tsconfig && !TARGET_NATIVE_SOURCE_TARGETS.includes(target)) errors.push(`${where('tsconfig')} is supported only by ${TARGET_NATIVE_SOURCE_TARGETS.join(', ')}`)
99
+ if (config.tsconfig && !TARGET_TSCONFIG_TARGETS.includes(target)) errors.push(`${where('tsconfig')} is supported only by ${TARGET_TSCONFIG_TARGETS.join(', ')}`)
100
100
  else if (config.tsconfig && !exists(path.join(app.root, config.tsconfig))) errors.push(`${where('tsconfig')} does not exist: ${config.tsconfig}`)
101
101
  try { resolveNativeResources(app.root, target, config.nativeResources); resolveNativeLink(app.root, target, config) } catch (error) { errors.push(`${where('nativeLibraries/frameworks')}: ${error.message}`) }
102
102
  for (const fragment of config.ldFragments) {
@@ -362,10 +362,11 @@ export function resolveAppSourcePath(root, source) {
362
362
 
363
363
  // Targets whose build consumes per-target gea.targets.<target>.nativeSources,
364
364
  // gea.targets.<target>.providers (runtime implementations a package requires,
365
- // staged with the executable) and gea.targets.<target>.tsconfig (the
366
- // TypeScript project the compiler reads the program under). The other targets
367
- // take gea.nativeSources only.
365
+ // staged with the executable). The other targets take gea.nativeSources only.
368
366
  const TARGET_NATIVE_SOURCE_TARGETS = ['windows', 'ios', 'tvos']
367
+ // Targets whose build passes gea.targets.<target>.tsconfig (the TypeScript
368
+ // project the compiler reads the program under) to the compiler.
369
+ const TARGET_TSCONFIG_TARGETS = ['windows', 'ios', 'tvos', 'macos']
369
370
  const TARGET_PROVIDER_TARGETS = ['windows']
370
371
 
371
372
  export function normalizeNativeSources(raw) {