@geastack/targets 0.1.100 → 0.1.101
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 +7 -7
- package/targets/cmake/geatsc-generated-archive-build.mjs +32 -1
- package/targets/esp32/app_project.cmake +2 -2
- package/targets/esp32/chip_bindings/audio/echo_cancellation.cpp +392 -28
- package/targets/esp32/chip_bindings/audio/echo_cancellation.h +18 -2
- package/targets/esp32/chip_bindings/audio/es8311.cpp +117 -13
- package/targets/esp32/chip_bindings/displays/co5300.cpp +68 -28
- package/targets/esp32/components/gea_framework/CMakeLists.txt +17 -1
- package/targets/esp32/components/gea_framework/idf_component.yml +4 -0
- package/targets/esp32/components/gea_vpx/CMakeLists.txt +1 -1
- package/targets/esp32/connectivity/wifi.cpp +800 -543
- package/targets/esp32/display.cpp +121 -26
- package/targets/esp32/gea_framework.cmake +22 -28
- package/targets/esp32/host_sources.cmake +1 -0
- package/targets/esp32/services/comparison_benchmark.h +137 -0
- package/targets/esp32/services/comparison_gesture.h +133 -0
- package/targets/esp32/services/comparison_input_trace.h +64 -0
- package/targets/esp32/services/comparison_upload_capture.h +125 -0
- package/targets/esp32/services/debugger.h +634 -0
- package/targets/esp32/services/device_control.cpp +965 -20
- package/targets/esp32/services/frame_scheduler.cpp +128 -4
- package/targets/esp32/services/heap.cpp +125 -0
- package/targets/esp32/services/opus_benchmark.h +1 -1
- package/targets/esp32/services/storage_service.cpp +119 -104
- package/targets/esp32-p4-m5stack-tab5/dependencies.lock +27 -16
- package/targets/esp32-s3-m5stack-stopwatch/README.md +14 -9
- package/targets/esp32-s3-m5stack-stopwatch/dependencies.lock +54 -1
- package/targets/esp32-s3-m5stack-stopwatch/main/CMakeLists.txt +10 -7
- package/targets/esp32-s3-m5stack-stopwatch/main/buttons.cpp +80 -0
- package/targets/esp32-s3-m5stack-stopwatch/main/idf_component.yml +18 -0
- package/targets/esp32-s3-m5stack-stopwatch/main/include/board.h +38 -17
- package/targets/esp32-s3-m5stack-stopwatch/main/panel_reset.cpp +132 -129
- package/targets/esp32-s3-m5stack-stopwatch/main/power.cpp +253 -0
- package/targets/esp32-s3-m5stack-stopwatch/main/touch.cpp +158 -88
- package/targets/esp32-s3-m5stack-stopwatch/sdkconfig.defaults +13 -0
- package/targets/esp32-s3-touch-amoled-1.8/main/CMakeLists.txt +30 -3
- package/targets/esp32-s3-touch-amoled-2.06/dependencies.lock +10 -148
- package/targets/esp32-s31-espressif-mosaico/README.md +34 -0
- package/targets/esp32-s31-espressif-mosaico/dependencies.lock +49 -1
- package/targets/esp32-s31-espressif-mosaico/main/CMakeLists.txt +23 -1
- package/targets/esp32-s31-espressif-mosaico/main/board_power.cpp +117 -0
- package/targets/esp32-s31-espressif-mosaico/main/camera.cpp +326 -0
- package/targets/esp32-s31-espressif-mosaico/main/idf_component.yml +11 -0
- package/targets/esp32-s31-espressif-mosaico/main/include/board.h +23 -0
- package/targets/esp32-s31-espressif-mosaico/main/nand_mount.cpp +172 -0
- package/targets/esp32-s31-espressif-mosaico/partitions.csv +7 -3
- package/targets/esp32-s31-espressif-mosaico/sdkconfig.defaults +24 -0
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
// The board's 1 Gbit SPI NAND as its file storage, FAT on Espressif's
|
|
2
|
+
// spi_nand_flash driver (Dhara wear levelling), mounted at /nand.
|
|
3
|
+
//
|
|
4
|
+
// It is where an app keeps what is too large for its app slot: the NOR holds
|
|
5
|
+
// the firmware and the slot caps an image near 8 MB, while assets pushed here
|
|
6
|
+
// (`gea devctl push <file> /nand/...`) are read back at run time through
|
|
7
|
+
// readCacheFile. It is the storage provider gea::platform::storage::
|
|
8
|
+
// ensureMounted() answers from, so every file op mounts it first.
|
|
9
|
+
//
|
|
10
|
+
// The chip is on SPI3 (SPI2 is the panel's) behind VCC_3V3, which the mount
|
|
11
|
+
// opens first. A blank chip has no filesystem: the first mount formats it.
|
|
12
|
+
#include "platform/file_cache.h"
|
|
13
|
+
#include "board.h"
|
|
14
|
+
|
|
15
|
+
#include <cinttypes>
|
|
16
|
+
#include <cstring>
|
|
17
|
+
#include <initializer_list>
|
|
18
|
+
|
|
19
|
+
#include "driver/gpio.h"
|
|
20
|
+
#include "driver/spi_master.h"
|
|
21
|
+
#include "esp_log.h"
|
|
22
|
+
#include "esp_vfs_fat_nand.h"
|
|
23
|
+
#include "freertos/FreeRTOS.h"
|
|
24
|
+
#include "freertos/semphr.h"
|
|
25
|
+
|
|
26
|
+
namespace gea::platform::board {
|
|
27
|
+
void powerOnRails();
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
namespace gea::platform::storage {
|
|
31
|
+
|
|
32
|
+
namespace {
|
|
33
|
+
|
|
34
|
+
constexpr char kTag[] = "nand";
|
|
35
|
+
constexpr char kMountPoint[] = "/nand";
|
|
36
|
+
// The GD5F1GM7 reads at up to 133 MHz; 40 MHz single-line is what the
|
|
37
|
+
// driver's own examples run and is ample for loading assets once.
|
|
38
|
+
constexpr int kClockHz = 40 * 1000 * 1000;
|
|
39
|
+
|
|
40
|
+
StaticSemaphore_t g_lockStorage;
|
|
41
|
+
SemaphoreHandle_t g_lock = nullptr;
|
|
42
|
+
bool g_busReady = false;
|
|
43
|
+
spi_device_handle_t g_spi = nullptr;
|
|
44
|
+
spi_nand_flash_device_t *g_flash = nullptr;
|
|
45
|
+
bool g_mounted = false;
|
|
46
|
+
|
|
47
|
+
// Each step is kept once it succeeds, and a failed mount is retried on the
|
|
48
|
+
// next file op: the first attempt runs at boot, before the USB console is up,
|
|
49
|
+
// so its log line is lost -- a retry while a host is attached says why.
|
|
50
|
+
bool mountNand()
|
|
51
|
+
{
|
|
52
|
+
gea::platform::board::powerOnRails();
|
|
53
|
+
const auto &pins = gea::platform::board::nand;
|
|
54
|
+
esp_err_t err = ESP_OK;
|
|
55
|
+
if (!g_busReady) {
|
|
56
|
+
// WP# and HOLD# are active low and stay plain GPIOs held high. Handed to
|
|
57
|
+
// the SPI bus as IO2/IO3 they float to levels the chip reads as HOLD#
|
|
58
|
+
// asserted, and READ ID answers zeros (seen on the board; Espressif's
|
|
59
|
+
// own Mosaico bring-up does the same). Single-line needs neither.
|
|
60
|
+
for (gpio_num_t pin : {pins.hold, pins.wp}) {
|
|
61
|
+
gpio_set_level(pin, 1);
|
|
62
|
+
gpio_config_t control = {};
|
|
63
|
+
control.pin_bit_mask = 1ULL << pin;
|
|
64
|
+
control.mode = GPIO_MODE_OUTPUT;
|
|
65
|
+
control.pull_up_en = GPIO_PULLUP_ENABLE;
|
|
66
|
+
gpio_config(&control);
|
|
67
|
+
gpio_set_level(pin, 1);
|
|
68
|
+
}
|
|
69
|
+
spi_bus_config_t bus = {};
|
|
70
|
+
bus.mosi_io_num = pins.mosi;
|
|
71
|
+
bus.miso_io_num = pins.miso;
|
|
72
|
+
bus.sclk_io_num = pins.clk;
|
|
73
|
+
bus.quadwp_io_num = GPIO_NUM_NC;
|
|
74
|
+
bus.quadhd_io_num = GPIO_NUM_NC;
|
|
75
|
+
bus.max_transfer_sz = 4096 * 2;
|
|
76
|
+
err = spi_bus_initialize(pins.spiHost, &bus, SPI_DMA_CH_AUTO);
|
|
77
|
+
if (err != ESP_OK) {
|
|
78
|
+
ESP_LOGE(kTag, "SPI bus init failed: %s", esp_err_to_name(err));
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
g_busReady = true;
|
|
82
|
+
}
|
|
83
|
+
if (g_spi == nullptr) {
|
|
84
|
+
spi_device_interface_config_t device = {};
|
|
85
|
+
device.clock_speed_hz = kClockHz;
|
|
86
|
+
device.mode = 0;
|
|
87
|
+
device.spics_io_num = pins.cs;
|
|
88
|
+
device.queue_size = 10;
|
|
89
|
+
device.flags = SPI_DEVICE_HALFDUPLEX;
|
|
90
|
+
err = spi_bus_add_device(pins.spiHost, &device, &g_spi);
|
|
91
|
+
if (err != ESP_OK) {
|
|
92
|
+
g_spi = nullptr;
|
|
93
|
+
ESP_LOGE(kTag, "SPI device add failed: %s", esp_err_to_name(err));
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
if (g_flash == nullptr) {
|
|
98
|
+
spi_nand_flash_config_t config = {};
|
|
99
|
+
config.device_handle = g_spi;
|
|
100
|
+
config.io_mode = SPI_NAND_IO_MODE_SIO;
|
|
101
|
+
config.flags = SPI_DEVICE_HALFDUPLEX;
|
|
102
|
+
err = spi_nand_flash_init_device(&config, &g_flash);
|
|
103
|
+
if (err != ESP_OK) {
|
|
104
|
+
g_flash = nullptr;
|
|
105
|
+
ESP_LOGE(kTag, "NAND init failed: %s", esp_err_to_name(err));
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
esp_vfs_fat_mount_config_t mount = {};
|
|
111
|
+
mount.max_files = 4;
|
|
112
|
+
mount.format_if_mount_failed = true;
|
|
113
|
+
mount.allocation_unit_size = 16 * 1024;
|
|
114
|
+
err = esp_vfs_fat_nand_mount(kMountPoint, g_flash, &mount);
|
|
115
|
+
if (err != ESP_OK) {
|
|
116
|
+
ESP_LOGE(kTag, "mount %s failed: %s", kMountPoint, esp_err_to_name(err));
|
|
117
|
+
return false;
|
|
118
|
+
}
|
|
119
|
+
std::uint64_t total = 0;
|
|
120
|
+
std::uint64_t free = 0;
|
|
121
|
+
esp_vfs_fat_info(kMountPoint, &total, &free);
|
|
122
|
+
ESP_LOGI(kTag, "mounted %s: %" PRIu64 " KB, %" PRIu64 " KB free", kMountPoint, total / 1024, free / 1024);
|
|
123
|
+
return true;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// Serialized: the board start task mounts eagerly (GEADEV PUSH writes /nand
|
|
127
|
+
// without asking) while the app's first file read may ask at the same moment.
|
|
128
|
+
bool ensureNandMounted()
|
|
129
|
+
{
|
|
130
|
+
xSemaphoreTake(g_lock, portMAX_DELAY);
|
|
131
|
+
if (!g_mounted) g_mounted = mountNand();
|
|
132
|
+
const bool mounted = g_mounted;
|
|
133
|
+
xSemaphoreGive(g_lock);
|
|
134
|
+
return mounted;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
} // namespace
|
|
138
|
+
|
|
139
|
+
} // namespace gea::platform::storage
|
|
140
|
+
|
|
141
|
+
// GEADEV FORMAT /nand (device_control.cpp): unmount, erase the whole chip,
|
|
142
|
+
// and mount again, which formats the blank chip.
|
|
143
|
+
extern "C" int gea_board_storage_format(const char *mount)
|
|
144
|
+
{
|
|
145
|
+
using namespace gea::platform::storage;
|
|
146
|
+
if (std::strcmp(mount, kMountPoint) != 0) return -2;
|
|
147
|
+
if (g_lock == nullptr) return -3;
|
|
148
|
+
xSemaphoreTake(g_lock, portMAX_DELAY);
|
|
149
|
+
if (!g_mounted && g_flash == nullptr) g_mounted = mountNand();
|
|
150
|
+
if (g_flash == nullptr) {
|
|
151
|
+
xSemaphoreGive(g_lock);
|
|
152
|
+
return -4;
|
|
153
|
+
}
|
|
154
|
+
if (g_mounted) esp_vfs_fat_nand_unmount(kMountPoint, g_flash);
|
|
155
|
+
g_mounted = false;
|
|
156
|
+
const esp_err_t err = spi_nand_erase_chip(g_flash);
|
|
157
|
+
if (err != ESP_OK) ESP_LOGE(kTag, "erase failed: %s", esp_err_to_name(err));
|
|
158
|
+
g_mounted = mountNand();
|
|
159
|
+
const bool mounted = g_mounted;
|
|
160
|
+
xSemaphoreGive(g_lock);
|
|
161
|
+
return err != ESP_OK ? -5 : (mounted ? 0 : -6);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
namespace gea::platform::storage {
|
|
165
|
+
|
|
166
|
+
void installNandFileStorage()
|
|
167
|
+
{
|
|
168
|
+
if (g_lock == nullptr) g_lock = xSemaphoreCreateMutexStatic(&g_lockStorage);
|
|
169
|
+
setMountProvider(&ensureNandMounted);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
} // namespace gea::platform::storage
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
# Espressif ESP-Mosaico V1.2, 16 MB quad NOR flash (GD25Q128E).
|
|
2
2
|
# The S31 bootloader sits at 0x2000 (the first two sectors are reserved), which
|
|
3
3
|
# leaves it 24 KB below the partition table at 0x8000.
|
|
4
|
+
# The app slots take all but 256 KB of storage: an app is installed over USB
|
|
5
|
+
# into a slot, so the slot is the largest app the board can run, and three.js
|
|
6
|
+
# games (skytail) outgrew 7 MB. A board still on the old 7 MB layout rewrites
|
|
7
|
+
# its table to this one on boot (board_power.cpp, migratePartitionTable).
|
|
4
8
|
# Name, Type, SubType, Offset, Size
|
|
5
9
|
nvs, data, nvs, 0x9000, 0x6000
|
|
6
10
|
otadata, data, ota, 0xf000, 0x2000
|
|
7
11
|
phy_init, data, phy, 0x11000, 0x1000
|
|
8
|
-
ota_0, app, ota_0, 0x20000,
|
|
9
|
-
ota_1, app, ota_1,
|
|
10
|
-
storage, data, spiffs,
|
|
12
|
+
ota_0, app, ota_0, 0x20000, 0x7d0000
|
|
13
|
+
ota_1, app, ota_1, 0x7f0000, 0x7d0000
|
|
14
|
+
storage, data, spiffs, 0xfc0000, 0x40000
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
# Target: ESP32-S31 (Espressif ESP-Mosaico V1.2) -- an ESP-IDF 6.2-dev preview target
|
|
2
2
|
CONFIG_IDF_TARGET="esp32s31"
|
|
3
3
|
|
|
4
|
+
# The camera's official BSP supplies expansion-slot resource ownership only.
|
|
5
|
+
# Gea owns the display, touch, audio and the power rail already brought up.
|
|
6
|
+
# CONFIG_BSP_DISPLAY_ENABLE is not set
|
|
7
|
+
# CONFIG_BSP_DISPLAY_LVGL_ENABLE is not set
|
|
8
|
+
# CONFIG_BSP_MOTOR_ENABLE_PWM is not set
|
|
9
|
+
|
|
4
10
|
# Flash: 16 MB GD25Q128E quad NOR (ESP-Mosaico V1.2)
|
|
5
11
|
CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y
|
|
6
12
|
# Match Waveshare's board-check/audio/template configurations. DIO needlessly
|
|
@@ -46,6 +52,12 @@ CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=4096
|
|
|
46
52
|
# Custom partition table with two OTA slots for wireless updates
|
|
47
53
|
CONFIG_PARTITION_TABLE_CUSTOM=y
|
|
48
54
|
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv"
|
|
55
|
+
# The app rewrites the partition table once, when a board still has an older
|
|
56
|
+
# layout (board_power.cpp, migratePartitionTable): there is no other way to
|
|
57
|
+
# change it without the ROM downloader, which needs BOOT held through a power
|
|
58
|
+
# cycle. The default aborts on any write below the first partition.
|
|
59
|
+
CONFIG_SPI_FLASH_DANGEROUS_WRITE_ALLOWED=y
|
|
60
|
+
# CONFIG_SPI_FLASH_DANGEROUS_WRITE_ABORTS is not set
|
|
49
61
|
|
|
50
62
|
# On panic: print backtrace then reboot. (Halting was meant to "keep USB alive
|
|
51
63
|
# for reflashing", but a halted ESP32-S3 won't accept an esptool reset — it has
|
|
@@ -198,3 +210,15 @@ CONFIG_HEAP_TRACING_OFF=y
|
|
|
198
210
|
# boot rolls back to the previous app instead of needing BOOT to recover.
|
|
199
211
|
CONFIG_BOOTLOADER_APP_ROLLBACK=y
|
|
200
212
|
CONFIG_BOOTLOADER_APP_ROLLBACK_CONFIRM_BY_APP=y
|
|
213
|
+
|
|
214
|
+
# esp_io_expander (pulled in by esp_lcd_panel_io_additions) defaults to wrapping
|
|
215
|
+
# six gpio_* functions so expander pins can be driven through the GPIO API. No
|
|
216
|
+
# code here registers an expander with that wrapper, so the wraps only forward to
|
|
217
|
+
# the real functions -- and any active --wrap makes RISC-V relaxation quadratic
|
|
218
|
+
# in an object's globals, which turned the app link into ~27 minutes.
|
|
219
|
+
# CONFIG_IO_EXPANDER_ENABLE_GPIO_API_WRAPPER is not set
|
|
220
|
+
|
|
221
|
+
# A core that stops yielding (both cores run the game and the 3D present task)
|
|
222
|
+
# reboots the board instead of leaving USB dead until a power cycle.
|
|
223
|
+
CONFIG_ESP_TASK_WDT_PANIC=y
|
|
224
|
+
CONFIG_ESP_TASK_WDT_TIMEOUT_S=20
|