@geastack/cli 0.1.114 → 0.1.115

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geastack/cli",
3
- "version": "0.1.114",
3
+ "version": "0.1.115",
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.112",
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')
@@ -307,6 +311,12 @@ export function applySdkconfigPolicy(sdkconfig, { selection, app, capabilities,
307
311
  // A P4's MIPI-CSI camera: the esp_cam_sensor driver and the mode it streams.
308
312
  if (boardCamera) {
309
313
  const sensor = boardCamera.sensor.toUpperCase()
314
+ // Only the board's sensor: the esp32-p4 base enables the Waveshare board's
315
+ // OV5647, and esp_video would probe it too.
316
+ for (const line of `${sdkconfig.defaults}\n${sdkconfig.text}`.split('\n')) {
317
+ const other = /^(CONFIG_CAMERA_([A-Z0-9]+))=y$/.exec(line)
318
+ if (other && other[2] !== sensor && other[2] !== 'XCLK') unset(other[1])
319
+ }
310
320
  board('CONFIG_IDF_EXPERIMENTAL_FEATURES', 'y')
311
321
  board(`CONFIG_CAMERA_${sensor}`, 'y')
312
322
  board(`CONFIG_CAMERA_${sensor}_AUTO_DETECT_MIPI_INTERFACE_SENSOR`, 'y')
@@ -804,7 +814,24 @@ function runInTarget(command, args, { cwd, env, dryRun, verbose, label, logFile,
804
814
  // App capability flags are CMake cache entries. Reconfigure only when those
805
815
  // inputs change; ordinary source/CMake dependency changes remain the build
806
816
  // system's responsibility. This retains Ninja's sub-second no-op.
817
+ // A build directory belongs to the CMake project it was configured from, and
818
+ // CMake refuses to reuse it for another ("does not match the source used to
819
+ // generate cache"). A target whose project moved -- the esp32-p4 base moving
820
+ // onto the Waveshare 7-inch project -- leaves such a directory behind, so its
821
+ // cache goes and configure starts the directory afresh.
822
+ export function dropCacheFromOtherSource(buildDir, sourceDir) {
823
+ const cacheFile = path.join(buildDir, 'CMakeCache.txt')
824
+ if (!existsSync(cacheFile)) return false
825
+ const home = /^CMAKE_HOME_DIRECTORY:INTERNAL=(.*)$/m.exec(readFileSync(cacheFile, 'utf8'))?.[1]
826
+ const real = (dir) => (existsSync(dir) ? realpathSync(dir) : path.resolve(dir))
827
+ if (!home || real(home) === real(sourceDir)) return false
828
+ rmSync(cacheFile, { force: true })
829
+ rmSync(path.join(buildDir, 'CMakeFiles'), { recursive: true, force: true })
830
+ return true
831
+ }
832
+
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) {