@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 +1 -1
- package/targets/esp32/services/device_control.cpp +0 -4
- package/targets/esp32-p4-elecrow-crowpanel-advanced-5.0.json +8 -0
- package/targets/esp32-p4-waveshare-touch-lcd-7/CMakeLists.txt +7 -0
- package/targets/esp32-p4-waveshare-touch-lcd-7/main/CMakeLists.txt +83 -15
- package/targets/esp32-p4-waveshare-touch-lcd-7/main/camera.cpp +61 -5
- package/targets/esp32-p4-waveshare-touch-lcd-7/main/launcher_button.cpp +7 -0
- package/targets/esp32-p4-waveshare-touch-lcd-7/main/sdcard_mount.cpp +31 -4
- package/targets.json +5 -4
- package/targets/esp32-p4/CMakeLists.txt +0 -18
- package/targets/esp32-p4/main/CMakeLists.txt +0 -564
- package/targets/esp32-p4/main/Kconfig.projbuild +0 -14
- package/targets/esp32-p4/main/app_main.cpp +0 -177
- package/targets/esp32-p4/main/camera.cpp +0 -1958
- package/targets/esp32-p4/main/fatfs_ffconf.h +0 -383
- package/targets/esp32-p4/main/i2c.cpp +0 -39
- package/targets/esp32-p4/main/idf_component.yml +0 -26
- package/targets/esp32-p4/main/launcher_button.cpp +0 -192
- package/targets/esp32-p4/main/sdcard_mount.cpp +0 -132
- package/targets/esp32-p4/partitions.csv +0 -8
- package/targets/esp32-p4/sdkconfig.defaults +0 -110
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
// Mounts the board's microSD (storage.microSD, SD_MMC 1-bit) at /sdcard for the persistent file cache (e.g. the
|
|
2
|
-
// maps OSM tile cache). Lazy + idempotent (mounts on first use).
|
|
3
|
-
//
|
|
4
|
-
// The ESP32-P4 has ONE SDMMC host controller with TWO slots. The hosted WiFi
|
|
5
|
-
// co-processor (esp_hosted) creates that controller at boot and uses SLOT 1.
|
|
6
|
-
// The microSD is a separate device on its own pins — it just needs to live on the
|
|
7
|
-
// OTHER slot (SLOT 0). The catch: esp_vfs_fat_sdmmc_mount() calls sdmmc_host_init(),
|
|
8
|
-
// which tries to create a SECOND controller and fails ("no available sd host
|
|
9
|
-
// controller"). So we DON'T re-init the host: we add slot 0 to the controller
|
|
10
|
-
// esp_hosted already made (sdmmc_host_init_slot reuses the shared static s_ctlr),
|
|
11
|
-
// then probe the card and mount FATFS manually. Both run on the one host at once.
|
|
12
|
-
#include "platform/file_cache.h"
|
|
13
|
-
|
|
14
|
-
#include <cstdlib>
|
|
15
|
-
#include <sys/stat.h>
|
|
16
|
-
|
|
17
|
-
#include "diskio_impl.h"
|
|
18
|
-
#include "diskio_sdmmc.h"
|
|
19
|
-
#include "driver/sdmmc_host.h"
|
|
20
|
-
#include "esp_log.h"
|
|
21
|
-
#include "esp_vfs_fat.h"
|
|
22
|
-
#include "ff.h"
|
|
23
|
-
#include "board.h"
|
|
24
|
-
#include "sdmmc_cmd.h"
|
|
25
|
-
|
|
26
|
-
namespace gea::platform::storage {
|
|
27
|
-
|
|
28
|
-
namespace {
|
|
29
|
-
constexpr char kTag[] = "sdcard";
|
|
30
|
-
bool g_attempted = false;
|
|
31
|
-
bool g_mounted = false;
|
|
32
|
-
sdmmc_card_t *g_card = nullptr;
|
|
33
|
-
|
|
34
|
-
bool mountSdCard()
|
|
35
|
-
{
|
|
36
|
-
if (g_attempted) return g_mounted;
|
|
37
|
-
g_attempted = true;
|
|
38
|
-
#if !GEA_BOARD_HAS_MICROSD
|
|
39
|
-
return false;
|
|
40
|
-
#endif
|
|
41
|
-
|
|
42
|
-
// Reuse an existing mount (e.g. the camera already mounted /sdcard).
|
|
43
|
-
struct stat st {};
|
|
44
|
-
if (stat("/sdcard", &st) == 0) {
|
|
45
|
-
g_mounted = true;
|
|
46
|
-
return true;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
sdmmc_host_t host = SDMMC_HOST_DEFAULT();
|
|
50
|
-
host.slot = SDMMC_HOST_SLOT_0; // the SD's slot (the hosted WiFi has slot 1)
|
|
51
|
-
// 20 MHz default speed: the slot is 1-bit and runs over board-length lines.
|
|
52
|
-
host.max_freq_khz = SDMMC_FREQ_DEFAULT;
|
|
53
|
-
// The card is powered from VDD_3V3, not an on-chip LDO channel.
|
|
54
|
-
host.flags = SDMMC_HOST_FLAG_1BIT;
|
|
55
|
-
|
|
56
|
-
// 1-bit: only CLK, CMD and D0 come from the definition.
|
|
57
|
-
sdmmc_slot_config_t slot = SDMMC_SLOT_CONFIG_DEFAULT();
|
|
58
|
-
slot.width = 1;
|
|
59
|
-
slot.clk = gea::platform::board::storage.clk;
|
|
60
|
-
slot.cmd = gea::platform::board::storage.cmd;
|
|
61
|
-
slot.d0 = gea::platform::board::storage.data0;
|
|
62
|
-
slot.d1 = GPIO_NUM_NC;
|
|
63
|
-
slot.d2 = GPIO_NUM_NC;
|
|
64
|
-
slot.d3 = GPIO_NUM_NC;
|
|
65
|
-
slot.cd = SDMMC_SLOT_NO_CD;
|
|
66
|
-
slot.wp = SDMMC_SLOT_NO_WP;
|
|
67
|
-
slot.flags |= SDMMC_SLOT_FLAG_INTERNAL_PULLUP;
|
|
68
|
-
|
|
69
|
-
// Add slot 0 to the EXISTING controller (esp_hosted's). NOT sdmmc_host_init().
|
|
70
|
-
esp_err_t err = sdmmc_host_init_slot(SDMMC_HOST_SLOT_0, &slot);
|
|
71
|
-
if (err == ESP_ERR_INVALID_STATE) {
|
|
72
|
-
// Wi-Fi has not brought the shared controller up (an app with no network
|
|
73
|
-
// use never starts esp_hosted): create it here instead.
|
|
74
|
-
if (sdmmc_host_init() == ESP_OK) err = sdmmc_host_init_slot(SDMMC_HOST_SLOT_0, &slot);
|
|
75
|
-
}
|
|
76
|
-
if (err != ESP_OK) {
|
|
77
|
-
ESP_LOGW(kTag, "init slot 0 failed (%s); file cache disabled", esp_err_to_name(err));
|
|
78
|
-
return false;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
g_card = static_cast<sdmmc_card_t *>(std::calloc(1, sizeof(sdmmc_card_t)));
|
|
82
|
-
if (!g_card) return false;
|
|
83
|
-
err = sdmmc_card_init(&host, g_card);
|
|
84
|
-
if (err != ESP_OK) {
|
|
85
|
-
ESP_LOGW(kTag, "no card on SDMMC slot 0 (%s); file cache disabled", esp_err_to_name(err));
|
|
86
|
-
return false;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
// Mount FATFS manually (esp_vfs_fat_sdmmc_mount would try to re-init the host).
|
|
90
|
-
BYTE pdrv = FF_DRV_NOT_USED;
|
|
91
|
-
if (ff_diskio_get_drive(&pdrv) != ESP_OK || pdrv == FF_DRV_NOT_USED) {
|
|
92
|
-
ESP_LOGW(kTag, "no free FATFS drive; file cache disabled");
|
|
93
|
-
return false;
|
|
94
|
-
}
|
|
95
|
-
ff_diskio_register_sdmmc(pdrv, g_card);
|
|
96
|
-
char drive[3] = {static_cast<char>('0' + pdrv), ':', '\0'};
|
|
97
|
-
const esp_vfs_fat_conf_t conf = {
|
|
98
|
-
.base_path = "/sdcard",
|
|
99
|
-
.fat_drive = drive,
|
|
100
|
-
.max_files = 4,
|
|
101
|
-
};
|
|
102
|
-
static FATFS *fs = nullptr;
|
|
103
|
-
err = esp_vfs_fat_register_cfg(&conf, &fs);
|
|
104
|
-
if (err != ESP_OK) {
|
|
105
|
-
ESP_LOGW(kTag, "vfs_fat register failed (%s); file cache disabled", esp_err_to_name(err));
|
|
106
|
-
ff_diskio_register_sdmmc(pdrv, nullptr);
|
|
107
|
-
return false;
|
|
108
|
-
}
|
|
109
|
-
const FRESULT fr = f_mount(fs, drive, 1);
|
|
110
|
-
if (fr != FR_OK) {
|
|
111
|
-
ESP_LOGW(kTag, "f_mount failed (%d); file cache disabled", static_cast<int>(fr));
|
|
112
|
-
esp_vfs_fat_unregister_path("/sdcard");
|
|
113
|
-
ff_diskio_register_sdmmc(pdrv, nullptr);
|
|
114
|
-
return false;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
g_mounted = true;
|
|
118
|
-
ESP_LOGI(kTag, "mounted /sdcard on SDMMC slot 0 (shared host) for file cache");
|
|
119
|
-
return g_mounted;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
} // namespace
|
|
123
|
-
|
|
124
|
-
// Wire the microSD card as the persistent file-cache backend. Called once from
|
|
125
|
-
// app_main at startup — that reference is what guarantees this translation unit
|
|
126
|
-
// is linked, so the SD provider actually replaces the default (no-storage) one.
|
|
127
|
-
void installSdCardFileCache()
|
|
128
|
-
{
|
|
129
|
-
setMountProvider(&mountSdCard);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
} // namespace gea::platform::storage
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
# The esp32-p4 base's default table for 16 MB flash: two ~7.9 MB OTA app
|
|
2
|
-
# slots. A board definition with other flash declares its own `partitions`.
|
|
3
|
-
# Name, Type, SubType, Offset, Size
|
|
4
|
-
nvs, data, nvs, 0x9000, 0x6000
|
|
5
|
-
otadata, data, ota, 0xf000, 0x2000
|
|
6
|
-
phy_init, data, phy, 0x11000, 0x1000
|
|
7
|
-
ota_0, app, ota_0, 0x20000, 0x7f0000
|
|
8
|
-
ota_1, app, ota_1, 0x810000, 0x7f0000
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
# Target: ESP32-P4
|
|
2
|
-
CONFIG_IDF_TARGET="esp32p4"
|
|
3
|
-
CONFIG_IDF_TARGET_ESP32P4=y
|
|
4
|
-
|
|
5
|
-
# The esp32-p4 base for composed boards (targets/<id>.json, extends esp32-p4).
|
|
6
|
-
# Flash size, console, the hosted coprocessor's SDIO wiring and the camera
|
|
7
|
-
# sensor come from the board definition; these are the defaults beneath it.
|
|
8
|
-
CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y
|
|
9
|
-
# QIO at 80MHz, as the vendors' own P4 firmware runs (Elecrow, Espressif). At
|
|
10
|
-
# DIO 40MHz the RGB panel, which the LCD DMA scans straight out of PSRAM,
|
|
11
|
-
# underran every few seconds on the CrowPanel Advance 5.0 and the picture crept
|
|
12
|
-
# right. A board whose flash is wired DIO-only says so (`flashMode`).
|
|
13
|
-
CONFIG_ESPTOOLPY_FLASHMODE_QIO=y
|
|
14
|
-
CONFIG_ESPTOOLPY_FLASHFREQ_80M=y
|
|
15
|
-
|
|
16
|
-
# Shipping P4 boards carry rev v1.x silicon. ESP-IDF defaults to rev v3.1+,
|
|
17
|
-
# whose bootloader rejects it.
|
|
18
|
-
CONFIG_ESP32P4_SELECTS_REV_LESS_V3=y
|
|
19
|
-
CONFIG_ESP32P4_REV_MIN_100=y
|
|
20
|
-
CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_360=y
|
|
21
|
-
|
|
22
|
-
# Console on UART0 unless the definition's `console` says otherwise.
|
|
23
|
-
CONFIG_ESP_CONSOLE_UART_DEFAULT=y
|
|
24
|
-
CONFIG_ESP_CONSOLE_SECONDARY_NONE=y
|
|
25
|
-
|
|
26
|
-
# Custom partition table with two OTA slots and installable app storage.
|
|
27
|
-
CONFIG_PARTITION_TABLE_CUSTOM=y
|
|
28
|
-
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv"
|
|
29
|
-
|
|
30
|
-
# Runtime timing and task budgets. The P4 creates its two IPC tasks before the
|
|
31
|
-
# IDF main task; keeping IPC at the older S3 16 KiB value fragments internal
|
|
32
|
-
# SRAM enough that the 32 KiB main stack cannot be allocated at startup.
|
|
33
|
-
CONFIG_FREERTOS_HZ=1000
|
|
34
|
-
CONFIG_ESP_MAIN_TASK_STACK_SIZE=32768
|
|
35
|
-
CONFIG_ESP_IPC_TASK_STACK_SIZE=4096
|
|
36
|
-
|
|
37
|
-
# External PSRAM is required for the RGB565 scanout framebuffers and staging
|
|
38
|
-
# buffers. Keep internal memory globally allocatable; code asks for DMA/internal
|
|
39
|
-
# caps explicitly when needed.
|
|
40
|
-
CONFIG_SPIRAM=y
|
|
41
|
-
CONFIG_SPIRAM_SPEED_200M=y
|
|
42
|
-
CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY=y
|
|
43
|
-
CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL=0
|
|
44
|
-
CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL=0
|
|
45
|
-
|
|
46
|
-
# WiFi runs on the board's hosted coprocessor (definition `wireless`) over esp_hosted SDIO. Allocate the SDIO
|
|
47
|
-
# transport mempool from DMA-capable PSRAM (the P4 GDMA reaches PSRAM through
|
|
48
|
-
# cache) instead of scarce internal DMA RAM, which the framebuffers
|
|
49
|
-
# already pressure. Without this, sdio_mempool_create asserts (buf_mp_g null) and
|
|
50
|
-
# the board boot-loops the moment WiFi is enabled.
|
|
51
|
-
CONFIG_ESP_HOSTED_MEMPOOL_PREFER_SPIRAM=y
|
|
52
|
-
# Also place esp_hosted's own task stacks (RPC + default worker) in SPIRAM. The
|
|
53
|
-
# WiFi blob lives on the C6, so the P4 host tasks don't need internal RAM; this
|
|
54
|
-
# keeps boot-time internal-SRAM free so the 32 KiB main-task stack still fits
|
|
55
|
-
# (otherwise esp_startup_start_app asserts res==pdTRUE and boot-loops).
|
|
56
|
-
CONFIG_ESP_HOSTED_DFLT_TASK_FROM_SPIRAM=y
|
|
57
|
-
|
|
58
|
-
# Camera: the sensor driver and its mode come from the definition's `camera`.
|
|
59
|
-
CONFIG_ESP_VIDEO_ENABLE_ISP_PIPELINE_CONTROLLER=y
|
|
60
|
-
# Hardware H.264 encoder exposed as a V4L2 M2M device (/dev/video11) for the
|
|
61
|
-
# full-resolution 1080p video recording path (Camera.recordH264Clip).
|
|
62
|
-
CONFIG_ESP_VIDEO_ENABLE_H264_VIDEO_DEVICE=y
|
|
63
|
-
CONFIG_ESP_VIDEO_ENABLE_HW_H264_VIDEO_DEVICE=y
|
|
64
|
-
# esp_video registers several /dev/video* VFS entries; with the console + the
|
|
65
|
-
# /sdcard FAT mount the default cap of 8 is exhausted (mount fails with NO_MEM).
|
|
66
|
-
CONFIG_VFS_MAX_COUNT=16
|
|
67
|
-
# microSD cards use 512-byte logical sectors; IDF's FATFS defaults to 4096 (for the
|
|
68
|
-
# on-flash wear-levelled FAT), which fails to mount an SD card (FR_NO_FILESYSTEM).
|
|
69
|
-
CONFIG_FATFS_SECTOR_512=y
|
|
70
|
-
# exFAT support is enabled in ffconf.h (FF_FS_EXFAT=1) so the board can read exFAT
|
|
71
|
-
# microSD cards; the exFAT code path references FF_USE_LABEL as a C value, so the
|
|
72
|
-
# volume-label option must be defined (it's "not set" => undefined => won't compile).
|
|
73
|
-
CONFIG_FATFS_USE_LABEL=y
|
|
74
|
-
# CONFIG_ESP_H264_DECODER_IRAM is not set
|
|
75
|
-
|
|
76
|
-
# WebRTC: mbedTLS DTLS + DTLS-SRTP for esp_peer.
|
|
77
|
-
CONFIG_MBEDTLS_SSL_PROTO_DTLS=y
|
|
78
|
-
CONFIG_MBEDTLS_SSL_DTLS_SRTP=y
|
|
79
|
-
CONFIG_MBEDTLS_SSL_DTLS_CONNECTION_ID=y
|
|
80
|
-
CONFIG_MBEDTLS_X509_CREATE_C=y
|
|
81
|
-
CONFIG_MBEDTLS_X509_CRT_WRITE_C=y
|
|
82
|
-
CONFIG_MBEDTLS_X509_CSR_WRITE_C=y
|
|
83
|
-
|
|
84
|
-
# Release optimization level for the large display workload.
|
|
85
|
-
CONFIG_COMPILER_OPTIMIZATION_PERF=y
|
|
86
|
-
CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_ENABLE=y
|
|
87
|
-
CONFIG_COMPILER_OPTIMIZATION_ASSERTION_LEVEL=2
|
|
88
|
-
|
|
89
|
-
# Development logging / diagnostics defaults.
|
|
90
|
-
# CONFIG_GEA_EMBEDDED_PRODUCTION_LOCKDOWN is not set
|
|
91
|
-
# CONFIG_LOG_DEFAULT_LEVEL_NONE is not set
|
|
92
|
-
CONFIG_LOG_DEFAULT_LEVEL_INFO=y
|
|
93
|
-
CONFIG_LOG_DEFAULT_LEVEL=3
|
|
94
|
-
CONFIG_LOG_MAXIMUM_EQUALS_DEFAULT=y
|
|
95
|
-
CONFIG_LOG_MAXIMUM_LEVEL=3
|
|
96
|
-
# CONFIG_BOOTLOADER_LOG_LEVEL_NONE is not set
|
|
97
|
-
CONFIG_BOOTLOADER_LOG_LEVEL_INFO=y
|
|
98
|
-
CONFIG_BOOTLOADER_LOG_LEVEL=3
|
|
99
|
-
|
|
100
|
-
# Keep standalone heap tracing available for framebuffer/app-init diagnosis.
|
|
101
|
-
# Heap tracing costs about a kilobyte of IRAM and puts a hook on the allocator's
|
|
102
|
-
# hot path. The framework's only users, the display and AXP2101 init traces, are
|
|
103
|
-
# already gated on GEA_EMBEDDED_HEAP_DIAGNOSTICS_LOG, which defaults to 0, so
|
|
104
|
-
# nothing traced by default and every app paid for it. Turn this and that macro
|
|
105
|
-
# on together when you actually want a trace.
|
|
106
|
-
CONFIG_HEAP_TRACING_OFF=y
|
|
107
|
-
# CONFIG_HEAP_TRACING_STANDALONE is not set
|
|
108
|
-
# CONFIG_HEAP_TRACING_TOHOST is not set
|
|
109
|
-
# CONFIG_HEAP_TRACING is not set
|
|
110
|
-
# CONFIG_HEAP_TRACE_HASH_MAP is not set
|