@geastack/targets 0.1.111 → 0.1.113

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/targets",
3
- "version": "0.1.111",
3
+ "version": "0.1.113",
4
4
  "description": "Native embedded build targets (ESP32-IDF, RP2350) for geastack apps: board sources, target catalog, and CMake glue driven by the gea CLI.",
5
5
  "license": "GPL-3.0-only",
6
6
  "repository": {
@@ -976,10 +976,6 @@ void handleNode(char *&cursor)
976
976
  std::printf(" text=");
977
977
  printEscaped(textCommand && textCommand->text.text ? textCommand->text.text : "");
978
978
  std::printf("\n");
979
- int revealFrom = 0, revealTo = 0;
980
- if (tree.inputPasswordReveal(nodeId, &revealFrom, &revealTo))
981
- std::printf("GEADEV:NODEREVEAL id=%d from=%d to=%d frame_ms=%d now_ms=%d\n", nodeId, revealFrom, revealTo,
982
- tree.lastFrameMs(), static_cast<int>(esp_timer_get_time() / 1000));
983
979
  }
984
980
  printed++;
985
981
  }
@@ -157,5 +157,13 @@
157
157
  "pin": 35,
158
158
  "activeLevel": 0
159
159
  }
160
+ },
161
+ "_partitions": "16MB flash: two ~7.9MB OTA app slots (the esp32-p4 base's own table is laid out for the Waveshare board's 32MB).",
162
+ "partitions": {
163
+ "nvs": { "type": "data", "subtype": "nvs", "offset": "0x9000", "size": "0x6000" },
164
+ "otadata": { "type": "data", "subtype": "ota", "offset": "0xf000", "size": "0x2000" },
165
+ "phy_init": { "type": "data", "subtype": "phy", "offset": "0x11000", "size": "0x1000" },
166
+ "ota_0": { "type": "app", "subtype": "ota_0", "offset": "0x20000", "size": "0x7f0000" },
167
+ "ota_1": { "type": "app", "subtype": "ota_1", "offset": "0x810000", "size": "0x7f0000" }
160
168
  }
161
169
  }
@@ -1,5 +1,12 @@
1
1
  cmake_minimum_required(VERSION 3.16)
2
2
 
3
+ # Resolve exactly what main/idf_component.yml pins. The component manager's
4
+ # "is there a newer version" pass reads registry metadata for releases this
5
+ # board never uses, and newer esp_hosted releases gate their USB-host transports
6
+ # on `$CONFIG{ESP_HOSTED_HOST_USB_*} == 1` rules that no Kconfig in the build
7
+ # defines -- which stops every fresh dependency solve at configure time.
8
+ set(ENV{IDF_COMPONENT_CHECK_NEW_VERSION} 0)
9
+
3
10
  set(EXTRA_COMPONENT_DIRS "${CMAKE_CURRENT_LIST_DIR}/../esp32/components")
4
11
  include("${CMAKE_CURRENT_LIST_DIR}/../esp32/app_project.cmake")
5
12
  set(GEA_EMBEDDED_APP "tic-tac-toe" CACHE STRING "Example app to build (must match a package.json gea.id)")
@@ -7,6 +7,31 @@ cmake_path(ABSOLUTE_PATH GEA_EMBEDDED_ROOT NORMALIZE)
7
7
  include("${GEA_EMBEDDED_ROOT}/targets/esp32/gea_framework.cmake")
8
8
  include("${GEA_EMBEDDED_ROOT}/targets/cmake/geatsc_generated_archive.cmake")
9
9
 
10
+ # This project is also the esp32-p4 base for composed boards (targets/<id>.json,
11
+ # `extends: esp32-p4`), as esp32-s3-touch-amoled-2.06 is for esp32-s3. Their JSON
12
+ # definition names the chips and pins; the gea CLI generates board.h and
13
+ # target.cmake from it into the build directory before configure, and passes the
14
+ # definition both as -DGEA_BOARD_DEFINITION and in the environment: IDF's
15
+ # requirement-extraction pass (cmake -P) runs before the -D arguments reach the
16
+ # cache, and a composed chip's own REQUIRES have to be visible in that pass.
17
+ set(GEA_CUSTOM_TARGET_ACTIVE 0)
18
+ if(NOT GEA_BOARD_DEFINITION AND DEFINED ENV{GEA_BOARD_DEFINITION})
19
+ set(GEA_BOARD_DEFINITION "$ENV{GEA_BOARD_DEFINITION}")
20
+ endif()
21
+ if(GEA_BOARD_DEFINITION)
22
+ if(NOT GEA_CUSTOM_TARGET_DIR AND DEFINED ENV{GEA_CUSTOM_TARGET_DIR})
23
+ set(GEA_CUSTOM_TARGET_DIR "$ENV{GEA_CUSTOM_TARGET_DIR}")
24
+ endif()
25
+ if(NOT GEA_CUSTOM_TARGET_DIR)
26
+ set(GEA_CUSTOM_TARGET_DIR "${CMAKE_BINARY_DIR}/gea-custom-target")
27
+ endif()
28
+ if(NOT EXISTS "${GEA_CUSTOM_TARGET_DIR}/target.cmake")
29
+ message(FATAL_ERROR "Custom board files were not generated at ${GEA_CUSTOM_TARGET_DIR}. Run this target through the gea CLI (gea build --board <alias>).")
30
+ endif()
31
+ include("${GEA_CUSTOM_TARGET_DIR}/target.cmake")
32
+ message(STATUS "Custom board: ${GEA_BOARD_DEFINITION}")
33
+ endif()
34
+
10
35
  # GEA_EMBEDDED_APP must be set explicitly in the real configure pass — no
11
36
  # default. The build script `scripts/board` passes
12
37
  # `-DGEA_EMBEDDED_APP=<id>` for every command, so this is invisible in
@@ -29,6 +54,19 @@ endif()
29
54
 
30
55
  set(GEA_EMBEDDED_HTTPS_SUPPORT "auto" CACHE STRING "Enable HTTPS fetch support: auto, on, or off")
31
56
  set(GEA_EMBEDDED_CPP_BOARD "esp32-p4-waveshare-touch-lcd-7" CACHE STRING "Board profile passed to geatsc for C++ target selection")
57
+ # A composed board builds through this project but is not this board: geatsc gets
58
+ # its own name, panel pixel order and font viewport.
59
+ set(GEA_EMBEDDED_TARGET_PIXEL_PANEL_ENDIAN 0)
60
+ set(GEA_EMBEDDED_FONT_VIEWPORT_ARGS "")
61
+ if(GEA_CUSTOM_TARGET_ACTIVE AND GEA_CUSTOM_TARGET_BOARD_ID)
62
+ set(GEA_EMBEDDED_CPP_BOARD "${GEA_CUSTOM_TARGET_BOARD_ID}")
63
+ set(GEA_EMBEDDED_TARGET_PIXEL_PANEL_ENDIAN ${GEA_CUSTOM_TARGET_PIXEL_PANEL_ENDIAN})
64
+ if(GEA_CUSTOM_TARGET_VIEWPORT_WIDTH AND GEA_CUSTOM_TARGET_VIEWPORT_HEIGHT)
65
+ set(GEA_EMBEDDED_FONT_VIEWPORT_ARGS
66
+ --font-viewport-width ${GEA_CUSTOM_TARGET_VIEWPORT_WIDTH}
67
+ --font-viewport-height ${GEA_CUSTOM_TARGET_VIEWPORT_HEIGHT})
68
+ endif()
69
+ endif()
32
70
  set(GEA_EMBEDDED_CSS_DEVICE_PIXEL_RATIO "1.0" CACHE STRING "Logical CSS px to physical pixel scale for this board")
33
71
 
34
72
  # Write a file only when its content would change. Preserves mtime when content matches,
@@ -285,19 +323,51 @@ if(_GEA_EMBEDDED_ENABLE_HTTPS)
285
323
  list(APPEND GEA_EMBEDDED_HTTPS_REQUIRES mbedtls)
286
324
  endif()
287
325
 
326
+ # The board's own chips: the Waveshare MIPI-DSI ILI9881C panel, GT911 touch,
327
+ # power, QMI8658 IMU and ES8311 codec -- or, for a composed board, the ones its
328
+ # definition names (the rgb_panel binding IS the Display; touch, power, IMU,
329
+ # expander and RTC or their *_absent backends; the speaker's binding).
330
+ if(GEA_CUSTOM_TARGET_ACTIVE)
331
+ set(GEA_P4_BOARD_SOURCES ${GEA_CUSTOM_TARGET_DISPLAY_SOURCES} ${GEA_CUSTOM_TARGET_PERIPHERAL_SOURCES})
332
+ set(GEA_P4_BOARD_REQUIRES ${GEA_CUSTOM_TARGET_REQUIRES})
333
+ set(GEA_P4_BOARD_DEFINITIONS ${GEA_CUSTOM_TARGET_COMPILE_DEFINITIONS} GEA_CUSTOM_TARGET_ACTIVE=1)
334
+ if(GEA_CUSTOM_TARGET_AUDIO_SOURCES)
335
+ list(APPEND GEA_P4_BOARD_SOURCES ${GEA_CUSTOM_TARGET_AUDIO_SOURCES} "${GEA_HOST}/audio_runtime.cpp")
336
+ list(APPEND GEA_P4_BOARD_DEFINITIONS GEA_EMBEDDED_APP_USES_AUDIO=1 GEA_BOARD_HAS_SPEAKER=1)
337
+ else()
338
+ list(APPEND GEA_P4_BOARD_SOURCES "${GEA_EMBEDDED_ROOT}/targets/esp32/services/audio_runtime_stub.cpp")
339
+ list(APPEND GEA_P4_BOARD_DEFINITIONS GEA_EMBEDDED_AUDIO_UNUSED=1)
340
+ endif()
341
+ else()
342
+ set(GEA_P4_BOARD_SOURCES
343
+ "display.cpp"
344
+ "power.cpp"
345
+ "touch.cpp"
346
+ "${GEA_CHIPS}/imu/qmi8658/qmi8658.cpp"
347
+ "${GEA_EMBEDDED_ROOT}/targets/esp32/chip_bindings/audio/es8311.cpp"
348
+ "${GEA_EMBEDDED_ROOT}/targets/esp32/chip_bindings/imu/qmi8658.cpp"
349
+ "${GEA_HOST}/audio_runtime.cpp"
350
+ )
351
+ set(GEA_P4_BOARD_REQUIRES esp_lcd_ili9881c esp_lcd_touch_gt911)
352
+ set(GEA_P4_BOARD_DEFINITIONS
353
+ GEA_CUSTOM_TARGET_ACTIVE=0
354
+ GEA_EMBEDDED_PIXEL_PANEL_ENDIAN=0
355
+ GEA_EMBEDDED_DISPLAY_WIDTH=720
356
+ GEA_EMBEDDED_DISPLAY_HEIGHT=1280
357
+ GEA_EMBEDDED_DISPLAY_NATIVE_WIDTH=720
358
+ GEA_EMBEDDED_DISPLAY_NATIVE_HEIGHT=1280
359
+ )
360
+ endif()
361
+
288
362
  idf_component_register(
289
363
  SRCS
290
364
  "app_main.cpp"
365
+ # The MIPI-CSI camera; it declines to start when the board has none.
291
366
  "camera.cpp"
292
- "display.cpp"
293
367
  "i2c.cpp"
294
368
  "launcher_button.cpp"
295
- "power.cpp"
296
369
  "sdcard_mount.cpp"
297
- "touch.cpp"
298
- "${GEA_CHIPS}/imu/qmi8658/qmi8658.cpp"
299
- "${GEA_EMBEDDED_ROOT}/targets/esp32/chip_bindings/audio/es8311.cpp"
300
- "${GEA_EMBEDDED_ROOT}/targets/esp32/chip_bindings/imu/qmi8658.cpp"
370
+ ${GEA_P4_BOARD_SOURCES}
301
371
  "${GEA_EMBEDDED_ROOT}/targets/esp32/apps/app_manager.cpp"
302
372
  "${GEA_EMBEDDED_ROOT}/targets/esp32/connectivity/diagnostics_transport.cpp"
303
373
  # WiFi station driver (registerDriver / WifiStation). On P4 its esp_wifi_*
@@ -309,7 +379,6 @@ idf_component_register(
309
379
  ${GEA_FW_APP_SENSITIVE_SOURCES}
310
380
  # esp32-specific host shims (generic host + services come from the manifest):
311
381
  "${GEA_HOST}/host/rtc_esp.cpp"
312
- "${GEA_HOST}/audio_runtime.cpp"
313
382
  "${GEA_EMBEDDED_ROOT}/targets/esp32/services/app_runner.cpp"
314
383
  "${GEA_EMBEDDED_ROOT}/targets/esp32/services/app_state.cpp"
315
384
  "${GEA_EMBEDDED_ROOT}/targets/esp32/services/battery_service.cpp"
@@ -323,6 +392,8 @@ idf_component_register(
323
392
  "${GEA_EMBEDDED_ROOT}/targets/esp32/services/heap.cpp"
324
393
  ${APP_GENERATED_SOURCES}
325
394
  INCLUDE_DIRS
395
+ # A composed board's generated board.h comes before this board's own.
396
+ ${GEA_CUSTOM_TARGET_INCLUDE_DIR}
326
397
  "include"
327
398
  "${GEA_EMBEDDED_ROOT}/targets/esp32"
328
399
  ${GEA_FW_INCLUDE_DIRS}
@@ -362,8 +433,7 @@ idf_component_register(
362
433
  fatfs
363
434
  esp_codec_dev
364
435
  esp_video
365
- esp_lcd_ili9881c
366
- esp_lcd_touch_gt911
436
+ ${GEA_P4_BOARD_REQUIRES}
367
437
  LDFRAGMENTS
368
438
  )
369
439
 
@@ -394,16 +464,13 @@ if(DEFINED ENV{GEA_EMBEDDED_HEAP_DIAGNOSTICS_LOG})
394
464
  endif()
395
465
 
396
466
  target_compile_definitions(${COMPONENT_LIB} PRIVATE
397
- GEA_EMBEDDED_PIXEL_PANEL_ENDIAN=0
467
+ ${GEA_P4_BOARD_DEFINITIONS}
468
+ GEA_EMBEDDED_BOARD_ID="${GEA_EMBEDDED_CPP_BOARD}"
398
469
  GEA_CPP_ENABLE_REGEX=0
399
470
  GEA_CPP_USE_TO_CHARS_DOUBLE=0
400
471
  GEA_EMBEDDED_HEAP_DIAGNOSTICS_LOG=${GEA_EMBEDDED_HEAP_DIAGNOSTICS_LOG_VALUE}
401
472
  GEA_EMBEDDED_CSS_DEVICE_PIXEL_RATIO=${GEA_EMBEDDED_CSS_DEVICE_PIXEL_RATIO}
402
473
  GEA_EMBEDDED_HAS_GENERATED_FONTS=1
403
- GEA_EMBEDDED_DISPLAY_WIDTH=720
404
- GEA_EMBEDDED_DISPLAY_HEIGHT=1280
405
- GEA_EMBEDDED_DISPLAY_NATIVE_WIDTH=720
406
- GEA_EMBEDDED_DISPLAY_NATIVE_HEIGHT=1280
407
474
  # WiFi re-enabled for network apps (e.g. maps OSM tiles). Was =1 to isolate
408
475
  # whether WiFi PSRAM/cache-bus contention starves the direct-PSRAM SPI flush
409
476
  # FIFO; the WPA2-auth stack overflow is already mitigated by the osi_funcs
@@ -483,7 +550,8 @@ add_custom_command(
483
550
  --out-dir ${GENERATED_APP_DIR}
484
551
  --geatsc-bin ${_GEATSC_BIN}
485
552
  --font-device-pixel-ratio ${GEA_EMBEDDED_CSS_DEVICE_PIXEL_RATIO}
486
- --pixel-panel-endian 0
553
+ --pixel-panel-endian ${GEA_EMBEDDED_TARGET_PIXEL_PANEL_ENDIAN}
554
+ ${GEA_EMBEDDED_FONT_VIEWPORT_ARGS}
487
555
  --gea-ir-backend
488
556
  # gea.compilerPlugins: an app's own geatsc plugins, e.g. the one that
489
557
  # declares its native host-function boundary. Empty for most apps.
@@ -1,6 +1,10 @@
1
1
  #include "camera.h"
2
2
 
3
+ #include "board.h"
3
4
  #include "canvas.h"
5
+ #if GEA_CUSTOM_TARGET_ACTIVE && GEA_BOARD_HAS_EXPANDER
6
+ #include "chip_bindings/expanders/io_expander.h"
7
+ #endif
4
8
  #include "display.h"
5
9
  #include "i2c.h"
6
10
  #include "image.h"
@@ -60,16 +64,35 @@ namespace {
60
64
 
61
65
  constexpr char kTag[] = "p4_camera";
62
66
  constexpr char kDevicePath[] = "/dev/video0";
67
+ #if GEA_CUSTOM_TARGET_ACTIVE
68
+ // A composed board previews at its panel's size.
69
+ constexpr int kDefaultWidth = GEA_EMBEDDED_DISPLAY_WIDTH;
70
+ constexpr int kDefaultHeight = GEA_EMBEDDED_DISPLAY_HEIGHT;
71
+ #else
63
72
  constexpr int kDefaultWidth = 800;
64
73
  constexpr int kDefaultHeight = 1280;
74
+ #endif
65
75
  constexpr int kBufferCount = 3;
66
76
  constexpr int kSccbFrequencyHz = 400000;
67
77
  // The OV5647 module is mounted 90deg rotated, so frames arrive rotated 90deg
68
78
  // clockwise; rotate the preview 90deg counter-clockwise (one quarter turn) to
69
79
  // bring the scene upright. With the display in LANDSCAPE orientation (it PPA-
70
80
  // rotates the framebuffer 90deg), this rot=1 lands the scene upright on-screen.
71
- // (Confirmed correct on-device.)
81
+ // (Confirmed correct on-device.) A composed board names its mounting in quarter
82
+ // turns counter-clockwise (the definition's camera.rotation).
83
+ #if !GEA_CUSTOM_TARGET_ACTIVE
72
84
  constexpr int kPreviewRotateCcw = 1;
85
+ #elif GEA_BOARD_HAS_CAMERA
86
+ constexpr int kPreviewRotateCcw = gea::platform::board::camera.rotateCcw;
87
+ #else
88
+ constexpr int kPreviewRotateCcw = 0;
89
+ #endif
90
+ // Whether this build has a camera at all: the Waveshare board always does.
91
+ #if GEA_CUSTOM_TARGET_ACTIVE
92
+ constexpr bool kHasCamera = GEA_BOARD_HAS_CAMERA != 0;
93
+ #else
94
+ constexpr bool kHasCamera = true;
95
+ #endif
73
96
  // OV5647 default auto-exposure target brightness (OV5647_AE_TARGET_DEFAULT, range
74
97
  // 2..235). setExposure() shifts this to brighten/darken the auto-exposed preview.
75
98
  constexpr int kAeTargetDefault = 0x50;
@@ -180,7 +203,7 @@ public:
180
203
  return driver;
181
204
  }
182
205
 
183
- bool isAvailable() const { return true; }
206
+ bool isAvailable() const { return kHasCamera; }
184
207
  bool hasPermission() const { return true; }
185
208
  bool requestPermission() const { return true; }
186
209
 
@@ -262,12 +285,19 @@ public:
262
285
  }
263
286
  }
264
287
 
265
- int deviceCount() const { return 1; }
288
+ int deviceCount() const { return kHasCamera ? 1 : 0; }
266
289
 
267
290
  gea::platform::camera::DeviceInfo deviceAt(int index) const
268
291
  {
269
292
  if (index != 0) return {};
293
+ #if !GEA_CUSTOM_TARGET_ACTIVE
270
294
  return {"mipi-csi-ov5647-center", gea::platform::camera::Facing::Front, kDefaultWidth, kDefaultHeight};
295
+ #elif GEA_BOARD_HAS_CAMERA
296
+ return {gea::platform::board::camera.name, gea::platform::camera::Facing::Front, kDefaultWidth, kDefaultHeight};
297
+ #else
298
+ (void)index;
299
+ return {};
300
+ #endif
271
301
  }
272
302
 
273
303
  void drawPreview(int x, int y, int destW, int destH)
@@ -849,16 +879,42 @@ private:
849
879
  bool initializeVideo()
850
880
  {
851
881
  if (videoInitialized_) return true;
882
+ esp_video_init_csi_config_t csiConfig{};
883
+ #if GEA_CUSTOM_TARGET_ACTIVE
884
+ #if !GEA_BOARD_HAS_CAMERA
885
+ return false;
886
+ #else
887
+ #if GEA_BOARD_HAS_EXPANDER
888
+ // A sensor reset routed through the board's I/O expander: pulse it low,
889
+ // then release it before esp_video probes the sensor.
890
+ const int resetLine = gea::platform::board::camera.expanderReset;
891
+ auto &boardControl = gea::platform::esp32::chip_bindings::expanders::ioExpander();
892
+ if (resetLine >= 0 && boardControl.init()) {
893
+ boardControl.writePin(resetLine, false);
894
+ vTaskDelay(pdMS_TO_TICKS(10));
895
+ boardControl.writePin(resetLine, true);
896
+ vTaskDelay(pdMS_TO_TICKS(20));
897
+ }
898
+ #endif
899
+ // SCCB has a bus of its own, so esp_video creates it on the other I2C port.
900
+ csiConfig.sccb_config.init_sccb = true;
901
+ csiConfig.sccb_config.i2c_config.port = I2C_NUM_0;
902
+ csiConfig.sccb_config.i2c_config.sda_pin = gea::platform::board::camera.sccbSda;
903
+ csiConfig.sccb_config.i2c_config.scl_pin = gea::platform::board::camera.sccbScl;
904
+ csiConfig.reset_pin = gea::platform::board::camera.reset;
905
+ #endif
906
+ #else
907
+ // The OV5647 shares the board's primary I2C bus.
852
908
  auto bus = gea::platform::i2c::Bus::primary();
853
909
  if (!bus.available()) {
854
910
  ESP_LOGE(kTag, "I2C bus is not ready for camera SCCB");
855
911
  return false;
856
912
  }
857
- esp_video_init_csi_config_t csiConfig{};
858
913
  csiConfig.sccb_config.init_sccb = false;
859
914
  csiConfig.sccb_config.i2c_handle = static_cast<i2c_master_bus_handle_t>(bus.nativeHandle());
860
- csiConfig.sccb_config.freq = kSccbFrequencyHz;
861
915
  csiConfig.reset_pin = -1;
916
+ #endif
917
+ csiConfig.sccb_config.freq = kSccbFrequencyHz;
862
918
  csiConfig.pwdn_pin = -1;
863
919
 
864
920
  esp_video_init_config_t videoConfig{};
@@ -13,13 +13,20 @@
13
13
  #include "esp_log.h"
14
14
  #include "freertos/FreeRTOS.h"
15
15
  #include "freertos/task.h"
16
+ #include "board.h"
16
17
 
17
18
  namespace gea::platform::esp32::apps {
18
19
 
19
20
  namespace {
20
21
 
21
22
  constexpr const char *kTag = "launcher_button";
23
+ // BOOT: GPIO0 on the Waveshare board, the definition's launcher button on a
24
+ // composed one.
25
+ #if GEA_CUSTOM_TARGET_ACTIVE
26
+ constexpr gpio_num_t kGpio = gea::platform::board::launcherButton.pin;
27
+ #else
22
28
  constexpr gpio_num_t kGpio = GPIO_NUM_0;
29
+ #endif
23
30
  constexpr int kActiveLevel = 0;
24
31
  constexpr int kDebounceMs = 50;
25
32
  constexpr int kPollMs = 25;
@@ -1,5 +1,6 @@
1
- // Mounts the Waveshare microSD at /sdcard for the persistent file cache (e.g. the
2
- // maps OSM tile cache). Lazy + idempotent (mounts on first use).
1
+ // Mounts the microSD at /sdcard for the persistent file cache (e.g. the maps
2
+ // OSM tile cache): the Waveshare's 4-bit slot, or a composed board's
3
+ // storage.microSD. Lazy + idempotent (mounts on first use).
3
4
  //
4
5
  // The ESP32-P4 has ONE SDMMC host controller with TWO slots. The onboard ESP32-C6
5
6
  // WiFi co-processor (esp_hosted) creates that controller at boot and uses SLOT 1.
@@ -20,6 +21,7 @@
20
21
  #include "esp_log.h"
21
22
  #include "esp_vfs_fat.h"
22
23
  #include "ff.h"
24
+ #include "board.h"
23
25
  #include "sd_pwr_ctrl_by_on_chip_ldo.h"
24
26
  #include "sdmmc_cmd.h"
25
27
 
@@ -36,6 +38,9 @@ bool mountSdCard()
36
38
  {
37
39
  if (g_attempted) return g_mounted;
38
40
  g_attempted = true;
41
+ #if GEA_CUSTOM_TARGET_ACTIVE && !GEA_BOARD_HAS_MICROSD
42
+ return false;
43
+ #endif
39
44
 
40
45
  // Reuse an existing mount (e.g. the camera already mounted /sdcard).
41
46
  struct stat st {};
@@ -45,7 +50,24 @@ bool mountSdCard()
45
50
  }
46
51
 
47
52
  sdmmc_host_t host = SDMMC_HOST_DEFAULT();
48
- host.slot = SDMMC_HOST_SLOT_0; // the SD's slot (C6/WiFi has slot 1)
53
+ host.slot = SDMMC_HOST_SLOT_0; // the SD's slot (the hosted WiFi has slot 1)
54
+ sdmmc_slot_config_t slot = SDMMC_SLOT_CONFIG_DEFAULT();
55
+ #if GEA_CUSTOM_TARGET_ACTIVE
56
+ // A composed board's slot (storage.microSD): SD_MMC 1-bit at the 20 MHz
57
+ // default speed over board-length lines, the card on VDD_3V3 rather than an
58
+ // on-chip LDO channel. Only CLK, CMD and D0 come from the definition.
59
+ host.max_freq_khz = SDMMC_FREQ_DEFAULT;
60
+ host.flags = SDMMC_HOST_FLAG_1BIT;
61
+ slot.width = 1;
62
+ slot.clk = gea::platform::board::storage.clk;
63
+ slot.cmd = gea::platform::board::storage.cmd;
64
+ slot.d0 = gea::platform::board::storage.data0;
65
+ slot.d1 = GPIO_NUM_NC;
66
+ slot.d2 = GPIO_NUM_NC;
67
+ slot.d3 = GPIO_NUM_NC;
68
+ slot.cd = SDMMC_SLOT_NO_CD;
69
+ slot.wp = SDMMC_SLOT_NO_WP;
70
+ #else
49
71
  host.max_freq_khz = SDMMC_FREQ_HIGHSPEED; // 40 MHz
50
72
  // On-chip LDO (chan 4) powers the SD I/O rail; card init drives voltage through it.
51
73
  sd_pwr_ctrl_ldo_config_t ldo = {};
@@ -54,7 +76,6 @@ bool mountSdCard()
54
76
  host.pwr_ctrl_handle = g_pwr;
55
77
  }
56
78
 
57
- sdmmc_slot_config_t slot = SDMMC_SLOT_CONFIG_DEFAULT();
58
79
  slot.width = 4;
59
80
  slot.clk = static_cast<gpio_num_t>(43);
60
81
  slot.cmd = static_cast<gpio_num_t>(44);
@@ -62,10 +83,16 @@ bool mountSdCard()
62
83
  slot.d1 = static_cast<gpio_num_t>(40);
63
84
  slot.d2 = static_cast<gpio_num_t>(41);
64
85
  slot.d3 = static_cast<gpio_num_t>(42);
86
+ #endif
65
87
  slot.flags |= SDMMC_SLOT_FLAG_INTERNAL_PULLUP;
66
88
 
67
89
  // Add slot 0 to the EXISTING controller (esp_hosted's). NOT sdmmc_host_init().
68
90
  esp_err_t err = sdmmc_host_init_slot(SDMMC_HOST_SLOT_0, &slot);
91
+ if (err == ESP_ERR_INVALID_STATE) {
92
+ // Wi-Fi has not brought the shared controller up (an app with no network
93
+ // use never starts esp_hosted): create it here instead.
94
+ if (sdmmc_host_init() == ESP_OK) err = sdmmc_host_init_slot(SDMMC_HOST_SLOT_0, &slot);
95
+ }
69
96
  if (err != ESP_OK) {
70
97
  ESP_LOGW(kTag, "init slot 0 failed (%s); file cache disabled", esp_err_to_name(err));
71
98
  return false;
package/targets.json CHANGED
@@ -179,16 +179,17 @@
179
179
  },
180
180
  "esp32-p4": {
181
181
  "adapter": "esp32-idf",
182
- "targetPath": "targets/esp32-p4",
183
- "flashSize": "16MB",
182
+ "targetPath": "targets/esp32-p4-waveshare-touch-lcd-7",
183
+ "flashSize": "32MB",
184
184
  "appPlatform": "esp32",
185
185
  "idfTarget": "esp32p4",
186
186
  "esptoolChip": "esp32p4",
187
- "ipcTaskStackSize": "4096"
187
+ "ipcTaskStackSize": "4096",
188
+ "composable": true
188
189
  },
189
190
  "esp32-p4-elecrow-crowpanel-advanced-5.0": {
190
191
  "adapter": "esp32-idf",
191
- "targetPath": "targets/esp32-p4",
192
+ "targetPath": "targets/esp32-p4-waveshare-touch-lcd-7",
192
193
  "definition": "targets/esp32-p4-elecrow-crowpanel-advanced-5.0.json",
193
194
  "flashSize": "16MB",
194
195
  "appPlatform": "esp32",
@@ -1,18 +0,0 @@
1
- cmake_minimum_required(VERSION 3.16)
2
-
3
- # Resolve exactly what main/idf_component.yml pins. The component manager's
4
- # "is there a newer version" pass reads registry metadata for releases this
5
- # board never uses, and newer esp_hosted releases gate their USB-host transports
6
- # on `$CONFIG{ESP_HOSTED_HOST_USB_*} == 1` rules that no Kconfig in the build
7
- # defines -- which stops every fresh dependency solve at configure time.
8
- set(ENV{IDF_COMPONENT_CHECK_NEW_VERSION} 0)
9
-
10
- set(EXTRA_COMPONENT_DIRS "${CMAKE_CURRENT_LIST_DIR}/../esp32/components")
11
- include("${CMAKE_CURRENT_LIST_DIR}/../esp32/app_project.cmake")
12
- set(GEA_EMBEDDED_APP "tic-tac-toe" CACHE STRING "Example app to build (must match a package.json gea.id)")
13
- set(PROJECT_VER "${GEA_EMBEDDED_APP}" CACHE STRING "Firmware app id" FORCE)
14
-
15
- include($ENV{IDF_PATH}/tools/cmake/project.cmake)
16
- idf_build_set_property(MINIMAL_BUILD ON)
17
- gea_solve_dependencies_in_build_dir()
18
- project(gea_embedded)