@geastack/cli 0.1.114 → 0.1.116

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
@@ -336,7 +336,8 @@ at call time, so never record a port path.
336
336
  ### Composed targets
337
337
 
338
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
339
+ `esp32-p4`, with `mcu` set to `esp32s3` or `esp32p4` to match) and picks its
340
+ chips from the `@geastack/chips` catalog (`gea chips list`). Every
340
341
  role is optional, so the definition describes the hardware that is there:
341
342
  `display`, `touch`, `power`, `imu`, `audio`, `rtc` and `expander`. Some boards are
342
343
  shipped composed in `@geastack/targets` and need no definition of your own,
@@ -413,23 +414,30 @@ to one role. The CrowPanel Advance 7.0 definition uses all of these.
413
414
 
414
415
  #### The `esp32-p4` base
415
416
 
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
417
+ A P4 definition takes the same roles, with GPIOs up to 54. The base is the
418
+ Waveshare ESP32-P4 7-inch project (`esp32-p4-waveshare-touch-lcd-7`), as
419
+ `esp32-s3-touch-amoled-2.06` is for `esp32-s3`; everything the definition
420
+ names replaces that board's own chips, console, camera sensor and wireless
421
+ wiring. Its sdkconfig and partition table are laid out for the Waveshare's
422
+ 32MB flash at DIO 40MHz, so a board with other flash sets `flashSize`,
423
+ `flashMode`, `flashFreq` and its own `partitions`.
424
+
425
+ Its display is a parallel RGB panel scanned straight out of the P4's
426
+ in-package PSRAM by the LCD driver, through only a small FIFO: a PSRAM stall
427
+ of a few microseconds underruns it and the picture creeps right. Run flash the
428
+ way the vendor's own firmware does; the CrowPanel Advanced 5.0 underran every
429
+ few seconds at DIO 40MHz and never at its vendor's QIO 80MHz. Use
423
430
  `scanFramebuffers: 3` so the renderer draws straight into a buffer not being
424
431
  scanned (one buffer adds a PSRAM-to-PSRAM copy of every changed region; with
425
432
  two, each swap can wait up to a frame for the panel to let go of the old
426
433
  front). Scroll copies and full-width patches between the buffers go through
427
434
  the AXI-GDMA, about three times faster than the CPU. Keep the L2 cache's
428
435
  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:
436
+ for the panel to underrun at 60Hz. Leave `restartInVsync` off; the driver
437
+ restarts the DMA itself at the next VSYNC if it ever falls behind. `psram` is
438
+ not configurable (the base sets it up). `pclkIdleHigh: true` idles the pixel
439
+ clock high between lines, which some panels need. Two sections exist only on
440
+ this base:
433
441
 
434
442
  - `wireless`: the WiFi/BLE coprocessor (an ESP32-C6, say) on SDIO through
435
443
  esp_hosted: `slot`, `busWidth` (1 or 4), `clockKhz`, `resetActiveHigh`, and
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geastack/cli",
3
- "version": "0.1.114",
3
+ "version": "0.1.116",
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.111",
41
+ "@geastack/targets": "^0.1.113",
42
42
  "picocolors": "^1.1.1",
43
43
  "serialport": "^13.0.0"
44
44
  },
@@ -2,7 +2,7 @@ import { debugFps } from '../debug-fps.mjs'
2
2
  import { spawnSync } from 'node:child_process'
3
3
  import { createHash } from 'node:crypto'
4
4
  import { appForNativeDebugger, resolveBuildConfig, writeBuildConfig } from '../build-config.mjs'
5
- import { copyFileSync, existsSync, lstatSync, mkdirSync, readdirSync, readFileSync, readlinkSync, renameSync, rmSync, symlinkSync, unlinkSync, writeFileSync } from 'node:fs'
5
+ import { copyFileSync, existsSync, lstatSync, mkdirSync, readdirSync, readFileSync, readlinkSync, realpathSync, renameSync, rmSync, symlinkSync, unlinkSync, writeFileSync } from 'node:fs'
6
6
  import path from 'node:path'
7
7
 
8
8
  import { geastackHome } from '../boards/config.mjs'
@@ -198,9 +198,13 @@ export function applySdkconfigPolicy(sdkconfig, { selection, app, capabilities,
198
198
  // firmware would run correctly and log into a port nobody is connected to,
199
199
  // which is indistinguishable from a board that never booted.
200
200
  if (boardConsole) {
201
- for (const key of ['CONFIG_ESP_CONSOLE_UART_DEFAULT', 'CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG', 'CONFIG_ESP_CONSOLE_USB_CDC', 'CONFIG_ESP_CONSOLE_NONE']) {
201
+ // A base's own console choice goes with it: the esp32-p4 base (the Waveshare
202
+ // 7-inch project) runs a CUSTOM UART at 921600 with the USB-Serial/JTAG as a
203
+ // secondary console, none of which a composed board's wiring has.
204
+ for (const key of ['CONFIG_ESP_CONSOLE_UART_DEFAULT', 'CONFIG_ESP_CONSOLE_UART_CUSTOM', 'CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_0', 'CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_1', 'CONFIG_ESP_CONSOLE_UART_TX_GPIO', 'CONFIG_ESP_CONSOLE_UART_RX_GPIO', 'CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG', 'CONFIG_ESP_CONSOLE_USB_CDC', 'CONFIG_ESP_CONSOLE_NONE', 'CONFIG_ESP_CONSOLE_SECONDARY_USB_SERIAL_JTAG']) {
202
205
  unset(key)
203
206
  }
207
+ board('CONFIG_ESP_CONSOLE_SECONDARY_NONE', 'y')
204
208
  if (boardConsole.transport === 'uart') {
205
209
  board('CONFIG_ESP_CONSOLE_UART_DEFAULT', 'y')
206
210
  board('CONFIG_ESP_CONSOLE_UART', 'y')
@@ -253,19 +257,6 @@ export function applySdkconfigPolicy(sdkconfig, { selection, app, capabilities,
253
257
  }
254
258
  }
255
259
 
256
- // A bare RGB panel is scanned out of PSRAM through bounce buffers refilled
257
- // by the LCD interrupt. Its code must sit in IRAM: otherwise it is fetched
258
- // over the same PSRAM bus rendering saturates (always so with XIP from
259
- // PSRAM), the refill misses its slot, the FIFO underruns and every later
260
- // line lands shifted -- the picture shreds on each repaint and stays slid.
261
- // Restarting the transfer at each VSYNC puts a slipped frame back. In that
262
- // mode the driver never resets the EOF count it picks each refill's buffer
263
- // from, so one lost EOF would leave every refill a buffer out of step with
264
- // the DMA (thin lines at each band's head); rgb_panel.cpp's refill reads the
265
- // buffer and band from the DMA itself instead. A board whose display says
266
- // `restartInVsync: false` skips the restart: it runs in the VSYNC interrupt,
267
- // which waits out a refill in progress, and once that pushes it past the
268
- // vertical blanking the restarted frame lands shifted sideways.
269
260
  // A P4's hosted WiFi/BLE coprocessor: esp_hosted takes its SDIO bus and the
270
261
  // coprocessor's reset line from these, so they are the board's wiring.
271
262
  if (boardWireless) {
@@ -307,6 +298,12 @@ export function applySdkconfigPolicy(sdkconfig, { selection, app, capabilities,
307
298
  // A P4's MIPI-CSI camera: the esp_cam_sensor driver and the mode it streams.
308
299
  if (boardCamera) {
309
300
  const sensor = boardCamera.sensor.toUpperCase()
301
+ // Only the board's sensor: the esp32-p4 base enables the Waveshare board's
302
+ // OV5647, and esp_video would probe it too.
303
+ for (const line of `${sdkconfig.defaults}\n${sdkconfig.text}`.split('\n')) {
304
+ const other = /^(CONFIG_CAMERA_([A-Z0-9]+))=y$/.exec(line)
305
+ if (other && other[2] !== sensor && other[2] !== 'XCLK') unset(other[1])
306
+ }
310
307
  board('CONFIG_IDF_EXPERIMENTAL_FEATURES', 'y')
311
308
  board(`CONFIG_CAMERA_${sensor}`, 'y')
312
309
  board(`CONFIG_CAMERA_${sensor}_AUTO_DETECT_MIPI_INTERFACE_SENSOR`, 'y')
@@ -322,6 +319,19 @@ export function applySdkconfigPolicy(sdkconfig, { selection, app, capabilities,
322
319
  }
323
320
  }
324
321
 
322
+ // A bare RGB panel is scanned out of PSRAM through bounce buffers refilled
323
+ // by the LCD interrupt. Its code must sit in IRAM: otherwise it is fetched
324
+ // over the same PSRAM bus rendering saturates (always so with XIP from
325
+ // PSRAM), the refill misses its slot, the FIFO underruns and every later
326
+ // line lands shifted -- the picture shreds on each repaint and stays slid.
327
+ // Restarting the transfer at each VSYNC puts a slipped frame back. In that
328
+ // mode the driver never resets the EOF count it picks each refill's buffer
329
+ // from, so one lost EOF would leave every refill a buffer out of step with
330
+ // the DMA (thin lines at each band's head); rgb_panel.cpp's refill reads the
331
+ // buffer and band from the DMA itself instead. A board whose display says
332
+ // `restartInVsync: false` skips the restart: it runs in the VSYNC interrupt,
333
+ // which waits out a refill in progress, and once that pushes it past the
334
+ // vertical blanking the restarted frame lands shifted sideways.
325
335
  if (boardRgbPanel) {
326
336
  board('CONFIG_LCD_RGB_ISR_IRAM_SAFE', 'y')
327
337
  if (boardRgbPanel.restartInVsync) board('CONFIG_LCD_RGB_RESTART_IN_VSYNC', 'y')
@@ -801,10 +811,27 @@ function runInTarget(command, args, { cwd, env, dryRun, verbose, label, logFile,
801
811
  return runQuiet(command, args, { cwd, env, dryRun, verbose, label, logFile, stdout, stderr, failureCode })
802
812
  }
803
813
 
814
+ // A build directory belongs to the CMake project it was configured from, and
815
+ // CMake refuses to reuse it for another ("does not match the source used to
816
+ // generate cache"). When a target's project changes (a board moved onto another
817
+ // base project, a renamed checkout), its cache goes and configure starts the
818
+ // directory afresh.
819
+ export function dropCacheFromOtherSource(buildDir, sourceDir) {
820
+ const cacheFile = path.join(buildDir, 'CMakeCache.txt')
821
+ if (!existsSync(cacheFile)) return false
822
+ const home = /^CMAKE_HOME_DIRECTORY:INTERNAL=(.*)$/m.exec(readFileSync(cacheFile, 'utf8'))?.[1]
823
+ const real = (dir) => (existsSync(dir) ? realpathSync(dir) : path.resolve(dir))
824
+ if (!home || real(home) === real(sourceDir)) return false
825
+ rmSync(cacheFile, { force: true })
826
+ rmSync(path.join(buildDir, 'CMakeFiles'), { recursive: true, force: true })
827
+ return true
828
+ }
829
+
804
830
  // App capability flags are CMake cache entries. Reconfigure only when those
805
831
  // inputs change; ordinary source/CMake dependency changes remain the build
806
832
  // system's responsibility. This retains Ninja's sub-second no-op.
807
833
  export async function ensureConfigured({ idf, prepared, env, dryRun = false, verbose = false, stdout, stderr = console.error }) {
834
+ if (!dryRun) dropCacheFromOtherSource(prepared.binaryDir || prepared.buildDir, prepared.targetDir)
808
835
  const signatureFile = path.join(prepared.buildDir, '.gea-configure-args')
809
836
  const signature = [`IDF_PATH=${idf.idfDir}`, `IDF_PYTHON_ENV_PATH=${idf.pythonEnv}`, `-DSDKCONFIG=${prepared.sdkconfigFile}`, `-DSDKCONFIG_DEFAULTS=${prepared.defaultsArg || prepared.defaultsFile}`, ...prepared.idfArgs, ...(prepared.sourceSet || [])].join('\n') + '\n'
810
837
  if (existsSync(path.join(prepared.buildDir, 'CMakeCache.txt')) && existsSync(signatureFile) && readFileSync(signatureFile, 'utf8') === signature) {