@geastack/targets 0.1.82 → 0.1.83
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/chip_bindings/audio/es8311.cpp +95 -9
- package/targets/esp32/display.cpp +36 -1
- package/targets/esp32/gea_framework.cmake +7 -0
- package/targets/esp32-s3-touch-amoled-1.8/main/CMakeLists.txt +21 -1
- package/targets/esp32-s3-touch-amoled-1.8/main/app_main.cpp +55 -4
- package/targets/esp32-s3-touch-amoled-2.06/dependencies.lock +41 -0
- package/targets/esp32-s3-touch-amoled-2.06/main/include/board.h +4 -0
- package/targets/esp32-s3-touch-amoled-2.06/sdkconfig.defaults +4 -0
- package/targets/esp32-s3-touch-amoled-2.41/dependencies.lock +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geastack/targets",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.83",
|
|
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": {
|
|
@@ -42,6 +42,18 @@ constexpr gpio_num_t kDinPin = gea::platform::board::audio.din;
|
|
|
42
42
|
constexpr gpio_num_t kPaPin = gea::platform::board::audio.powerAmplifier;
|
|
43
43
|
constexpr int kCodecDataPort = 0;
|
|
44
44
|
|
|
45
|
+
// Boards whose microphones sit on an ES7210 ADC sharing this I2S bus (Waveshare AMOLED 2.06) name its
|
|
46
|
+
// 7-bit I2C address as `audio.es7210Address`; everywhere else the ES8311's own ADC records.
|
|
47
|
+
template <typename AudioConfig>
|
|
48
|
+
constexpr int micAdcAddressOf(const AudioConfig &audio) {
|
|
49
|
+
if constexpr (requires { audio.es7210Address; }) {
|
|
50
|
+
return audio.es7210Address;
|
|
51
|
+
} else {
|
|
52
|
+
return 0;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
constexpr int kMicAdcAddress = micAdcAddressOf(gea::platform::board::audio);
|
|
56
|
+
|
|
45
57
|
class AudioOutputDriver {
|
|
46
58
|
public:
|
|
47
59
|
static AudioOutputDriver &instance() {
|
|
@@ -104,9 +116,12 @@ public:
|
|
|
104
116
|
|
|
105
117
|
bool write(const std::int16_t *pcm, std::size_t sampleCount, int timeoutMs) {
|
|
106
118
|
(void)timeoutMs;
|
|
107
|
-
if (!
|
|
119
|
+
if (!pcm || sampleCount == 0) return false;
|
|
108
120
|
|
|
121
|
+
// Checked under the lock, so idle-capture cleanup cannot delete the codec between check and write.
|
|
109
122
|
std::lock_guard<std::mutex> lock(writeMutex_);
|
|
123
|
+
if (!speakerCodec_ || !speakerOpen_) return false;
|
|
124
|
+
|
|
110
125
|
auto *cursor = reinterpret_cast<const std::uint8_t *>(pcm);
|
|
111
126
|
std::size_t remaining = sampleCount * sizeof(std::int16_t);
|
|
112
127
|
while (remaining > 0) {
|
|
@@ -128,6 +143,8 @@ public:
|
|
|
128
143
|
void close() {
|
|
129
144
|
std::lock_guard<std::mutex> lock(writeMutex_);
|
|
130
145
|
closeSpeakerLocked();
|
|
146
|
+
// An idle capture task leaves the audio path up while the speaker plays; free it once neither uses it.
|
|
147
|
+
if (!micInUse()) releaseAudioLocked();
|
|
131
148
|
}
|
|
132
149
|
|
|
133
150
|
int volume() const {
|
|
@@ -218,6 +235,26 @@ private:
|
|
|
218
235
|
i2sDataIf_ = nullptr;
|
|
219
236
|
}
|
|
220
237
|
|
|
238
|
+
// Frees everything the audio path holds in internal RAM: the codec devices, the I2S data
|
|
239
|
+
// interface, and both I2S channels with their DMA buffers. A recording app that also uses the
|
|
240
|
+
// network needs this RAM back once the mic stops (esp_wifi_init fails with ESP_ERR_NO_MEM
|
|
241
|
+
// otherwise). initCodecDevice() rebuilds it all on the next open. Call with writeMutex_ held.
|
|
242
|
+
void releaseAudioLocked() {
|
|
243
|
+
closeRecorderLocked();
|
|
244
|
+
closeSpeakerLocked();
|
|
245
|
+
if (speakerCodec_) {
|
|
246
|
+
esp_codec_dev_delete(speakerCodec_);
|
|
247
|
+
speakerCodec_ = nullptr;
|
|
248
|
+
}
|
|
249
|
+
if (recordCodec_) {
|
|
250
|
+
esp_codec_dev_delete(recordCodec_);
|
|
251
|
+
recordCodec_ = nullptr;
|
|
252
|
+
}
|
|
253
|
+
if (i2sDataIf_) audio_codec_delete_data_if(i2sDataIf_);
|
|
254
|
+
releaseI2s();
|
|
255
|
+
i2sSampleRate_ = 0;
|
|
256
|
+
}
|
|
257
|
+
|
|
221
258
|
esp_err_t initI2s(int sampleRate) {
|
|
222
259
|
if (txChannel_ && i2sDataIf_) {
|
|
223
260
|
if (i2sSampleRate_ == sampleRate) return ESP_OK;
|
|
@@ -240,6 +277,8 @@ private:
|
|
|
240
277
|
return err;
|
|
241
278
|
}
|
|
242
279
|
|
|
280
|
+
// esp_codec_dev_open() reconfigures each channel's slots to Philips I2S (the format the ES8311 and
|
|
281
|
+
// ES7210 use) before any data moves, so this initial slot format is only a placeholder.
|
|
243
282
|
i2s_std_config_t stdConfig = {};
|
|
244
283
|
stdConfig.clk_cfg = I2S_STD_CLK_DEFAULT_CONFIG(static_cast<std::uint32_t>(sampleRate));
|
|
245
284
|
stdConfig.slot_cfg = I2S_STD_MSB_SLOT_DEFAULT_CONFIG(I2S_DATA_BIT_WIDTH_32BIT, I2S_SLOT_MODE_STEREO);
|
|
@@ -416,6 +455,10 @@ private:
|
|
|
416
455
|
esp_codec_dev_cfg_t codecConfig = {};
|
|
417
456
|
codecConfig.dev_type = deviceType;
|
|
418
457
|
codecConfig.codec_if = codecIf_;
|
|
458
|
+
if (deviceType == ESP_CODEC_DEV_TYPE_IN && kMicAdcAddress != 0) {
|
|
459
|
+
codecConfig.codec_if = micAdcIf();
|
|
460
|
+
if (!codecConfig.codec_if) return ESP_ERR_NO_MEM;
|
|
461
|
+
}
|
|
419
462
|
codecConfig.data_if = i2sDataIf_;
|
|
420
463
|
device = esp_codec_dev_new(&codecConfig);
|
|
421
464
|
if (!device) return ESP_ERR_NO_MEM;
|
|
@@ -423,6 +466,32 @@ private:
|
|
|
423
466
|
return ESP_OK;
|
|
424
467
|
}
|
|
425
468
|
|
|
469
|
+
// The ES7210 codec interface, created on first use: slave mode on the shared bus, mics 1 and 2 as
|
|
470
|
+
// the stereo pair (the capture task keeps mic 1).
|
|
471
|
+
const audio_codec_if_t *micAdcIf() {
|
|
472
|
+
if (micAdcIf_) return micAdcIf_;
|
|
473
|
+
|
|
474
|
+
auto i2cBus = gea::platform::i2c::Bus::primary();
|
|
475
|
+
audio_codec_i2c_cfg_t i2cConfig = {};
|
|
476
|
+
i2cConfig.addr = static_cast<std::uint8_t>(kMicAdcAddress << 1);
|
|
477
|
+
i2cConfig.bus_handle = static_cast<i2c_master_bus_handle_t>(i2cBus.nativeHandle());
|
|
478
|
+
micAdcCtrlIf_ = audio_codec_new_i2c_ctrl(&i2cConfig);
|
|
479
|
+
if (!micAdcCtrlIf_) return nullptr;
|
|
480
|
+
|
|
481
|
+
es7210_codec_cfg_t es7210Config = {};
|
|
482
|
+
es7210Config.ctrl_if = micAdcCtrlIf_;
|
|
483
|
+
es7210Config.master_mode = false;
|
|
484
|
+
es7210Config.mic_selected = ES7210_SEL_MIC1 | ES7210_SEL_MIC2;
|
|
485
|
+
es7210Config.mclk_src = ES7210_MCLK_FROM_PAD;
|
|
486
|
+
es7210Config.mclk_div = 256;
|
|
487
|
+
micAdcIf_ = es7210_codec_new(&es7210Config);
|
|
488
|
+
if (!micAdcIf_) {
|
|
489
|
+
audio_codec_delete_ctrl_if(micAdcCtrlIf_);
|
|
490
|
+
micAdcCtrlIf_ = nullptr;
|
|
491
|
+
}
|
|
492
|
+
return micAdcIf_;
|
|
493
|
+
}
|
|
494
|
+
|
|
426
495
|
static constexpr const char *kTag = "audio";
|
|
427
496
|
|
|
428
497
|
i2s_chan_handle_t txChannel_ = nullptr;
|
|
@@ -431,6 +500,8 @@ private:
|
|
|
431
500
|
const audio_codec_ctrl_if_t *i2cCtrlIf_ = nullptr;
|
|
432
501
|
const audio_codec_gpio_if_t *gpioIf_ = nullptr;
|
|
433
502
|
const audio_codec_if_t *codecIf_ = nullptr;
|
|
503
|
+
const audio_codec_ctrl_if_t *micAdcCtrlIf_ = nullptr;
|
|
504
|
+
const audio_codec_if_t *micAdcIf_ = nullptr;
|
|
434
505
|
esp_codec_dev_handle_t speakerCodec_ = nullptr;
|
|
435
506
|
esp_codec_dev_handle_t recordCodec_ = nullptr;
|
|
436
507
|
bool i2sChannelEnabled_ = false;
|
|
@@ -452,6 +523,11 @@ private:
|
|
|
452
523
|
std::array<std::int16_t, kCaptureFrameSamples * 2> stereoFrame_{};
|
|
453
524
|
std::array<std::int16_t, kCaptureFrameSamples> monoFrame_{};
|
|
454
525
|
|
|
526
|
+
bool micInUse() {
|
|
527
|
+
std::lock_guard<std::mutex> lock(attachedMutex_);
|
|
528
|
+
return !attachedTracks_.empty();
|
|
529
|
+
}
|
|
530
|
+
|
|
455
531
|
static void captureTaskTrampoline(void *arg) {
|
|
456
532
|
static_cast<AudioOutputDriver *>(arg)->runCaptureTask();
|
|
457
533
|
}
|
|
@@ -460,18 +536,29 @@ private:
|
|
|
460
536
|
int consecutiveReadErrors = 0;
|
|
461
537
|
|
|
462
538
|
while (true) {
|
|
539
|
+
bool idle = false;
|
|
463
540
|
{
|
|
464
541
|
std::lock_guard<std::mutex> lock(attachedMutex_);
|
|
465
542
|
captureSnapshot_ = attachedTracks_;
|
|
543
|
+
idle = captureSnapshot_.empty();
|
|
544
|
+
// Cleared under the same lock attachTrack() checks, so a track attached from here on
|
|
545
|
+
// starts a fresh capture task instead of relying on this one.
|
|
546
|
+
if (idle) captureTask_ = nullptr;
|
|
466
547
|
}
|
|
467
548
|
|
|
468
|
-
|
|
549
|
+
// The last track detached: close the mic and, unless the speaker is still playing, free the
|
|
550
|
+
// I2S channels and codec devices, then end this task so its stack is freed too.
|
|
551
|
+
if (idle) {
|
|
469
552
|
{
|
|
470
553
|
std::lock_guard<std::mutex> lock(writeMutex_);
|
|
471
|
-
|
|
554
|
+
// A track attached since the check started a new capture task, which now owns the audio path.
|
|
555
|
+
if (!micInUse()) {
|
|
556
|
+
closeRecorderLocked();
|
|
557
|
+
if (!speakerOpen_) releaseAudioLocked();
|
|
558
|
+
}
|
|
472
559
|
}
|
|
473
|
-
|
|
474
|
-
|
|
560
|
+
vTaskDelete(nullptr);
|
|
561
|
+
return;
|
|
475
562
|
}
|
|
476
563
|
|
|
477
564
|
int err = ESP_OK;
|
|
@@ -506,10 +593,9 @@ private:
|
|
|
506
593
|
|
|
507
594
|
public:
|
|
508
595
|
void attachTrack(gea::host::NativeMediaTrackHandle handle) {
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
}
|
|
596
|
+
std::lock_guard<std::mutex> lock(attachedMutex_);
|
|
597
|
+
attachedTracks_.push_back(handle);
|
|
598
|
+
// Checked and set under the lock the capture task clears it with, so only one capture task runs.
|
|
513
599
|
if (captureTask_ == nullptr) {
|
|
514
600
|
xTaskCreatePinnedToCore(captureTaskTrampoline, "gea_mic", 8192, this, 5, &captureTask_, 1);
|
|
515
601
|
}
|
|
@@ -272,7 +272,15 @@ namespace gea::platform::esp32::display
|
|
|
272
272
|
// when radios and recovery services leave a few KiB of DMA heap. A radio-heavy
|
|
273
273
|
// AMOLED build reached the old 4-row floor with only 48 bytes free; allowing a
|
|
274
274
|
// 1-row, 820-byte strip keeps the UI alive instead of parking the runtime.
|
|
275
|
+
// RM69080/RM690B0 windows require an even first row and an even row count.
|
|
276
|
+
// clampAndAlign aligns the outer rect, but a one-row fallback would split it
|
|
277
|
+
// into invalid windows. Prefer a two-row, one-deep pipeline if RAM is tight.
|
|
278
|
+
#if GEA_EMBEDDED_RM690B0_PANEL
|
|
279
|
+
constexpr int kFlushChunkMin = 2;
|
|
280
|
+
#else
|
|
275
281
|
constexpr int kFlushChunkMin = 1;
|
|
282
|
+
#endif
|
|
283
|
+
static_assert(kFlushChunkLimit >= kFlushChunkMin, "flush limit is below the panel minimum");
|
|
276
284
|
// Leave enough DMA-capable internal RAM for the WiFi driver to receive a
|
|
277
285
|
// packet after the display pipeline is allocated. On the 2.06-inch S3 board,
|
|
278
286
|
// accepting a 1-row, 2-deep pipeline consumed all but 80 bytes and made the
|
|
@@ -1015,6 +1023,7 @@ namespace gea::platform::esp32::display
|
|
|
1015
1023
|
#endif
|
|
1016
1024
|
const int colCount = colEnd - colStart + 1;
|
|
1017
1025
|
|
|
1026
|
+
#if !GEA_EMBEDDED_RM690B0_PANEL
|
|
1018
1027
|
// Program one full-scanline window for the entire native row band. Color
|
|
1019
1028
|
// chunks continue with RAMWRC, avoiding repeated CASET/RASET while keeping
|
|
1020
1029
|
// every command strictly serialized with the preceding DMA.
|
|
@@ -1030,6 +1039,8 @@ namespace gea::platform::esp32::display
|
|
|
1030
1039
|
return false;
|
|
1031
1040
|
}
|
|
1032
1041
|
|
|
1042
|
+
#endif
|
|
1043
|
+
|
|
1033
1044
|
// Rows per chunk come from what the staging slot HOLDS, not from a row count
|
|
1034
1045
|
// fixed for full-width transfers. A narrowed window makes each row colCount
|
|
1035
1046
|
// pixels instead of nativeWidth, so the same buffer takes proportionally more
|
|
@@ -1044,7 +1055,9 @@ namespace gea::platform::esp32::display
|
|
|
1044
1055
|
if (colCount <= 0)
|
|
1045
1056
|
return flushChunkRows_;
|
|
1046
1057
|
const int fits = flushBufferCapacity_ / colCount;
|
|
1047
|
-
|
|
1058
|
+
// Narrow windows can fit an odd number of native rows. Keep every
|
|
1059
|
+
// independently addressed RM69080 chunk aligned, including the tail.
|
|
1060
|
+
return fits < kFlushChunkMin ? kFlushChunkMin : fits - fits % kFlushChunkMin;
|
|
1048
1061
|
}();
|
|
1049
1062
|
|
|
1050
1063
|
auto rowsAt = [&](int row)
|
|
@@ -1105,7 +1118,9 @@ namespace gea::platform::esp32::display
|
|
|
1105
1118
|
std::uint16_t *prefetchedBuffer = nullptr;
|
|
1106
1119
|
int prefetchedRow = -1;
|
|
1107
1120
|
int prefetchedRows = 0;
|
|
1121
|
+
#if !GEA_EMBEDDED_RM690B0_PANEL
|
|
1108
1122
|
bool firstChunk = true;
|
|
1123
|
+
#endif
|
|
1109
1124
|
for (int physicalRow = physicalY0; physicalRow <= physicalY1;)
|
|
1110
1125
|
{
|
|
1111
1126
|
const int rows = rowsAt(physicalRow);
|
|
@@ -1148,10 +1163,17 @@ namespace gea::platform::esp32::display
|
|
|
1148
1163
|
|
|
1149
1164
|
setFlushStage(FlushStage::Tx, physicalRow);
|
|
1150
1165
|
const int64_t txStartUs = esp_timer_get_time();
|
|
1166
|
+
#if GEA_EMBEDDED_RM690B0_PANEL
|
|
1167
|
+
// This panel needs a fresh window per chunk. drawBitmap also applies
|
|
1168
|
+
// the panel's column gap, which raw setWindow/txColor bypasses.
|
|
1169
|
+
const esp_err_t err = panel().drawBitmap(
|
|
1170
|
+
colStart, physicalRow, colEnd + 1, physicalRow + rows, buffer);
|
|
1171
|
+
#else
|
|
1151
1172
|
const esp_err_t err = panel().txColor(
|
|
1152
1173
|
firstChunk ? LCD_CMD_RAMWR : LCD_CMD_RAMWRC,
|
|
1153
1174
|
buffer,
|
|
1154
1175
|
static_cast<std::size_t>(pixelCount) * sizeof(std::uint16_t));
|
|
1176
|
+
#endif
|
|
1155
1177
|
flushStats_.txUs += esp_timer_get_time() - txStartUs;
|
|
1156
1178
|
flushStats_.chunkCount++;
|
|
1157
1179
|
if (err != ESP_OK)
|
|
@@ -1161,7 +1183,9 @@ namespace gea::platform::esp32::display
|
|
|
1161
1183
|
setFlushStage(FlushStage::Idle, 0);
|
|
1162
1184
|
return false;
|
|
1163
1185
|
}
|
|
1186
|
+
#if !GEA_EMBEDDED_RM690B0_PANEL
|
|
1164
1187
|
firstChunk = false;
|
|
1188
|
+
#endif
|
|
1165
1189
|
|
|
1166
1190
|
// While this chunk streams from internal DMA RAM, pull the next native
|
|
1167
1191
|
// rows out of PSRAM into the other staging slot. We still wait before
|
|
@@ -2127,6 +2151,14 @@ namespace gea::platform::esp32::display
|
|
|
2127
2151
|
int y0 = y;
|
|
2128
2152
|
int x1 = x + w - 1;
|
|
2129
2153
|
int y1 = y + h - 1;
|
|
2154
|
+
#if GEA_EMBEDDED_RM690B0_PANEL
|
|
2155
|
+
const auto aligned = present::clampAndAlign(
|
|
2156
|
+
{x0, y0, x1, y1}, platform_display::kWidth, platform_display::kHeight);
|
|
2157
|
+
x0 = aligned.x0;
|
|
2158
|
+
y0 = aligned.y0;
|
|
2159
|
+
x1 = aligned.x1;
|
|
2160
|
+
y1 = aligned.y1;
|
|
2161
|
+
#endif
|
|
2130
2162
|
if (x0 < 0)
|
|
2131
2163
|
x0 = 0;
|
|
2132
2164
|
if (y0 < 0)
|
|
@@ -3008,6 +3040,9 @@ namespace gea::platform::esp32::display
|
|
|
3008
3040
|
rows = kFlushChunkMin;
|
|
3009
3041
|
if (rows > kFlushChunkLimit)
|
|
3010
3042
|
rows = kFlushChunkLimit;
|
|
3043
|
+
#if GEA_EMBEDDED_RM690B0_PANEL
|
|
3044
|
+
rows &= ~1;
|
|
3045
|
+
#endif
|
|
3011
3046
|
return rows;
|
|
3012
3047
|
}
|
|
3013
3048
|
|
|
@@ -132,6 +132,13 @@ if(COMMAND idf_build_set_property)
|
|
|
132
132
|
idf_build_set_property(COMPILE_DEFINITIONS "${_GEA_APP_DEFINE}" APPEND)
|
|
133
133
|
endif()
|
|
134
134
|
endforeach()
|
|
135
|
+
# The runtime sizes its allocation pools for a board when GEA_EMBEDDED_CPP_BOARD is defined
|
|
136
|
+
# (gea_runtime.h: 16 KiB chunks instead of the desktop's 2 MiB). geatsc v1 defined it from
|
|
137
|
+
# `--cpp-board`; the current compiler reports that option as unhonored, so every ESP32 build lost
|
|
138
|
+
# it and pooled freed memory in 2 MiB chunks that are never returned. Every build through this
|
|
139
|
+
# file is a board, and the runtime only tests that the macro is defined, so it is set here for
|
|
140
|
+
# the whole build: the app, main and the framework must agree on the pool layout.
|
|
141
|
+
idf_build_set_property(COMPILE_DEFINITIONS "GEA_EMBEDDED_CPP_BOARD" APPEND)
|
|
135
142
|
endif()
|
|
136
143
|
|
|
137
144
|
# Linker fragments are absolute paths from the CLI. ldgen merges every
|
|
@@ -549,11 +549,31 @@ if(DEFINED ENV{GEA_EMBEDDED_HEAP_DIAGNOSTICS_LOG})
|
|
|
549
549
|
set(GEA_EMBEDDED_HEAP_DIAGNOSTICS_LOG_VALUE "$ENV{GEA_EMBEDDED_HEAP_DIAGNOSTICS_LOG}")
|
|
550
550
|
endif()
|
|
551
551
|
|
|
552
|
-
|
|
552
|
+
# App dimensions are already applied to every component by gea_framework.cmake.
|
|
553
|
+
# Only supply missing board defaults: repeating a portrait default beside an
|
|
554
|
+
# app's landscape dimension produces conflicting -D flags and incompatible types.
|
|
555
|
+
set(_GEA_BOARD_DISPLAY_DEFAULTS
|
|
553
556
|
GEA_EMBEDDED_DISPLAY_WIDTH=${GEA_BOARD_DISPLAY_WIDTH}
|
|
554
557
|
GEA_EMBEDDED_DISPLAY_HEIGHT=${GEA_BOARD_DISPLAY_HEIGHT}
|
|
555
558
|
GEA_EMBEDDED_DISPLAY_NATIVE_WIDTH=${GEA_BOARD_NATIVE_DISPLAY_WIDTH}
|
|
556
559
|
GEA_EMBEDDED_DISPLAY_NATIVE_HEIGHT=${GEA_BOARD_NATIVE_DISPLAY_HEIGHT}
|
|
560
|
+
)
|
|
561
|
+
set(_GEA_BOARD_DISPLAY_DEFINITIONS "")
|
|
562
|
+
foreach(_GEA_DISPLAY_DEFAULT IN LISTS _GEA_BOARD_DISPLAY_DEFAULTS)
|
|
563
|
+
string(REGEX REPLACE "=.*$" "" _GEA_DISPLAY_NAME "${_GEA_DISPLAY_DEFAULT}")
|
|
564
|
+
set(_GEA_DISPLAY_OVERRIDDEN OFF)
|
|
565
|
+
foreach(_GEA_APP_DEFINE IN LISTS GEA_EMBEDDED_APP_DEFINES)
|
|
566
|
+
if(_GEA_APP_DEFINE MATCHES "^${_GEA_DISPLAY_NAME}=")
|
|
567
|
+
set(_GEA_DISPLAY_OVERRIDDEN ON)
|
|
568
|
+
endif()
|
|
569
|
+
endforeach()
|
|
570
|
+
if(NOT _GEA_DISPLAY_OVERRIDDEN)
|
|
571
|
+
list(APPEND _GEA_BOARD_DISPLAY_DEFINITIONS "${_GEA_DISPLAY_DEFAULT}")
|
|
572
|
+
endif()
|
|
573
|
+
endforeach()
|
|
574
|
+
|
|
575
|
+
target_compile_definitions(${COMPONENT_LIB} PRIVATE
|
|
576
|
+
${_GEA_BOARD_DISPLAY_DEFINITIONS}
|
|
557
577
|
GEA_EMBEDDED_FLUSH_ANCHOR_LEFT_PARTIAL_RECTS=0
|
|
558
578
|
GEA_EMBEDDED_PIXEL_PANEL_ENDIAN=1
|
|
559
579
|
GEA_CPP_ENABLE_REGEX=0
|
|
@@ -19,9 +19,8 @@ void registerDriver();
|
|
|
19
19
|
#include "runtime.h"
|
|
20
20
|
#include "services/device_control.h"
|
|
21
21
|
|
|
22
|
-
#
|
|
22
|
+
#include <cstdlib>
|
|
23
23
|
#include "esp_heap_caps.h"
|
|
24
|
-
#endif
|
|
25
24
|
#include "esp_log.h"
|
|
26
25
|
#include "sdkconfig.h"
|
|
27
26
|
#include "freertos/FreeRTOS.h"
|
|
@@ -55,6 +54,16 @@ constexpr int kAppMainTaskStack = CONFIG_ESP_MAIN_TASK_STACK_SIZE;
|
|
|
55
54
|
#endif
|
|
56
55
|
constexpr UBaseType_t kRuntimeTaskPriority = GEA_EMBEDDED_RUNTIME_TASK_PRIORITY;
|
|
57
56
|
|
|
57
|
+
// Match the 2.06 target: keep flash-touching boot on the internal main stack,
|
|
58
|
+
// then optionally give the event loop its own stack and release main's stack.
|
|
59
|
+
#ifndef GEA_EMBEDDED_RUNTIME_TASK_STACK_BYTES
|
|
60
|
+
#define GEA_EMBEDDED_RUNTIME_TASK_STACK_BYTES 0
|
|
61
|
+
#endif
|
|
62
|
+
#ifndef GEA_EMBEDDED_RUNTIME_TASK_STACK_EXTERNAL
|
|
63
|
+
#define GEA_EMBEDDED_RUNTIME_TASK_STACK_EXTERNAL 0
|
|
64
|
+
#endif
|
|
65
|
+
constexpr int kRuntimeTaskStackBytes = GEA_EMBEDDED_RUNTIME_TASK_STACK_BYTES;
|
|
66
|
+
|
|
58
67
|
#if GEA_EMBEDDED_FRAME_SCHEDULER_PERF_LOG
|
|
59
68
|
void logCurrentTaskStack(const char *stage, int stackBytes)
|
|
60
69
|
{
|
|
@@ -69,7 +78,7 @@ void logCurrentTaskStack(const char *stage, int stackBytes)
|
|
|
69
78
|
}
|
|
70
79
|
#endif
|
|
71
80
|
|
|
72
|
-
|
|
81
|
+
gea::framework::RuntimeOptions runtimeOptions()
|
|
73
82
|
{
|
|
74
83
|
gea::framework::RuntimeOptions options{};
|
|
75
84
|
#if GEA_EMBEDDED_DISPLAY_RUNTIME_SOFTWARE_ORIENTATION
|
|
@@ -92,8 +101,26 @@ void runRuntime()
|
|
|
92
101
|
options.width = gea::platform::display::kWidth;
|
|
93
102
|
options.height = gea::platform::display::kHeight;
|
|
94
103
|
#endif
|
|
95
|
-
|
|
104
|
+
return options;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
void runRuntime()
|
|
108
|
+
{
|
|
109
|
+
gea::framework::Runtime::run(runtimeOptions());
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
#if GEA_EMBEDDED_RUNTIME_TASK_STACK_BYTES
|
|
113
|
+
void runtimeTask(void *)
|
|
114
|
+
{
|
|
115
|
+
ESP_LOGI(kTag, "Gea runtime task started stack=%d %s", kRuntimeTaskStackBytes,
|
|
116
|
+
GEA_EMBEDDED_RUNTIME_TASK_STACK_EXTERNAL ? "external" : "internal");
|
|
117
|
+
runRuntime();
|
|
118
|
+
ESP_LOGE(kTag, "Runtime returned unexpectedly; parking runtime task");
|
|
119
|
+
while (true) {
|
|
120
|
+
vTaskDelay(pdMS_TO_TICKS(1000));
|
|
121
|
+
}
|
|
96
122
|
}
|
|
123
|
+
#endif
|
|
97
124
|
|
|
98
125
|
} // namespace
|
|
99
126
|
|
|
@@ -152,7 +179,9 @@ extern "C" void app_main(void)
|
|
|
152
179
|
gea::targets::esp32::ble::registerHidDriver();
|
|
153
180
|
#endif
|
|
154
181
|
|
|
182
|
+
#if !GEA_EMBEDDED_RUNTIME_TASK_STACK_BYTES
|
|
155
183
|
vTaskPrioritySet(nullptr, kRuntimeTaskPriority);
|
|
184
|
+
#endif
|
|
156
185
|
#if GEA_EMBEDDED_FRAME_SCHEDULER_PERF_LOG
|
|
157
186
|
logCurrentTaskStack("main_task:before_runtime", kAppMainTaskStack);
|
|
158
187
|
#endif
|
|
@@ -163,10 +192,32 @@ extern "C" void app_main(void)
|
|
|
163
192
|
#if GEA_EMBEDDED_HEAP_DIAGNOSTICS_LOG
|
|
164
193
|
logHeapProbe("app_main:before_runtime");
|
|
165
194
|
#endif
|
|
195
|
+
#if GEA_EMBEDDED_RUNTIME_TASK_STACK_BYTES
|
|
196
|
+
// Boot includes SPIFFS/NVS and must finish before entering a PSRAM stack.
|
|
197
|
+
if (!gea::framework::Runtime::boot(runtimeOptions())) {
|
|
198
|
+
ESP_LOGE(kTag, "Gea bring-up failed; the UI will not start (the app's own tasks keep running)");
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
#if !GEA_EMBEDDED_NO_DISPLAY
|
|
202
|
+
TaskHandle_t runtime = nullptr;
|
|
203
|
+
const BaseType_t created = xTaskCreatePinnedToCoreWithCaps(
|
|
204
|
+
&runtimeTask, "gea_runtime", kRuntimeTaskStackBytes, nullptr,
|
|
205
|
+
kRuntimeTaskPriority, &runtime, xPortGetCoreID(),
|
|
206
|
+
GEA_EMBEDDED_RUNTIME_TASK_STACK_EXTERNAL ? (MALLOC_CAP_SPIRAM | MALLOC_CAP_8BIT)
|
|
207
|
+
: (MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT));
|
|
208
|
+
if (created != pdPASS) {
|
|
209
|
+
ESP_LOGE(kTag, "Failed to allocate %d-byte Gea runtime stack", kRuntimeTaskStackBytes);
|
|
210
|
+
std::abort();
|
|
211
|
+
}
|
|
212
|
+
ESP_LOGI(kTag, "Bootstrap complete; Gea runtime task=%p stack=%d", runtime, kRuntimeTaskStackBytes);
|
|
213
|
+
#endif
|
|
214
|
+
// Returning releases the internal main stack; the runtime task owns the loop.
|
|
215
|
+
#else
|
|
166
216
|
runRuntime();
|
|
167
217
|
|
|
168
218
|
ESP_LOGE(kTag, "Runtime returned unexpectedly; parking main task");
|
|
169
219
|
while (true) {
|
|
170
220
|
vTaskDelay(pdMS_TO_TICKS(1000));
|
|
171
221
|
}
|
|
222
|
+
#endif
|
|
172
223
|
}
|
|
@@ -9,6 +9,16 @@ dependencies:
|
|
|
9
9
|
registry_url: https://components.espressif.com
|
|
10
10
|
type: service
|
|
11
11
|
version: 0.5.3
|
|
12
|
+
espressif/esp_codec_dev:
|
|
13
|
+
component_hash: 4779f31a3ba3f9b38aee1afe6ccb9ba8f6108dc3a6e77d39d7d714e9a215371b
|
|
14
|
+
dependencies:
|
|
15
|
+
- name: idf
|
|
16
|
+
require: private
|
|
17
|
+
version: '>=4.0'
|
|
18
|
+
source:
|
|
19
|
+
registry_url: https://components.espressif.com/
|
|
20
|
+
type: service
|
|
21
|
+
version: 1.6.2
|
|
12
22
|
espressif/esp_io_expander:
|
|
13
23
|
component_hash: 7b7f91270172e46ca4597e3874f48d8412e280e8c295559f5922ec38656e3e5f
|
|
14
24
|
dependencies:
|
|
@@ -51,13 +61,44 @@ dependencies:
|
|
|
51
61
|
registry_url: https://components.espressif.com/
|
|
52
62
|
type: service
|
|
53
63
|
version: 1.0.1
|
|
64
|
+
espressif/esp_libsrtp:
|
|
65
|
+
component_hash: 131560184c73ec09f77d8904a2db709307803f0f9f111898921b6966776eac15
|
|
66
|
+
dependencies: []
|
|
67
|
+
source:
|
|
68
|
+
registry_url: https://components.espressif.com
|
|
69
|
+
type: service
|
|
70
|
+
version: 1.0.0
|
|
71
|
+
espressif/esp_peer:
|
|
72
|
+
component_hash: e29d65a3d2eba15f761e7d2740ab62650384edff27a1f8277dd6ccfa45813863
|
|
73
|
+
dependencies:
|
|
74
|
+
- name: espressif/esp_libsrtp
|
|
75
|
+
registry_url: https://components.espressif.com
|
|
76
|
+
require: private
|
|
77
|
+
version: ^1.0.0
|
|
78
|
+
source:
|
|
79
|
+
registry_url: https://components.espressif.com/
|
|
80
|
+
type: service
|
|
81
|
+
version: 1.5.6
|
|
82
|
+
espressif/esp_websocket_client:
|
|
83
|
+
component_hash: dc00233af846f3a744ada283a300e0d586040aadc3ee67361645ecdce4523672
|
|
84
|
+
dependencies:
|
|
85
|
+
- name: idf
|
|
86
|
+
require: private
|
|
87
|
+
version: '>=5.0'
|
|
88
|
+
source:
|
|
89
|
+
registry_url: https://components.espressif.com/
|
|
90
|
+
type: service
|
|
91
|
+
version: 1.8.0
|
|
54
92
|
idf:
|
|
55
93
|
source:
|
|
56
94
|
type: idf
|
|
57
95
|
version: 6.0.2
|
|
58
96
|
direct_dependencies:
|
|
97
|
+
- espressif/esp_codec_dev
|
|
59
98
|
- espressif/esp_lcd_co5300
|
|
60
99
|
- espressif/esp_lcd_panel_io_additions
|
|
100
|
+
- espressif/esp_peer
|
|
101
|
+
- espressif/esp_websocket_client
|
|
61
102
|
- idf
|
|
62
103
|
manifest_hash: 4251b5a6af848c92c5fbc8b9dbb076a8b2a53c265de5eadaa6d4357945f77209
|
|
63
104
|
target: esp32s3
|
|
@@ -42,6 +42,9 @@ struct Es8311AudioConfig {
|
|
|
42
42
|
gpio_num_t dout;
|
|
43
43
|
gpio_num_t din;
|
|
44
44
|
gpio_num_t powerAmplifier;
|
|
45
|
+
// The microphones are on an ES7210 ADC (I2C 0x40) sharing the I2S bus; the ES8311's own input
|
|
46
|
+
// is not wired to a mic on this board.
|
|
47
|
+
int es7210Address;
|
|
45
48
|
};
|
|
46
49
|
|
|
47
50
|
struct SdMmcConfig {
|
|
@@ -92,6 +95,7 @@ public:
|
|
|
92
95
|
.dout = GPIO_NUM_40,
|
|
93
96
|
.din = GPIO_NUM_42,
|
|
94
97
|
.powerAmplifier = GPIO_NUM_46,
|
|
98
|
+
.es7210Address = 0x40,
|
|
95
99
|
};
|
|
96
100
|
};
|
|
97
101
|
|
|
@@ -56,6 +56,10 @@ CONFIG_SPIRAM_MODE_OCT=y
|
|
|
56
56
|
CONFIG_SPIRAM_SPEED_80M=y
|
|
57
57
|
CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY=y
|
|
58
58
|
CONFIG_FREERTOS_TASK_CREATE_ALLOW_EXT_MEM=y
|
|
59
|
+
# vTaskDeleteWithCaps(NULL) (fetchAsync job tasks end this way) deletes the task from a helper task with
|
|
60
|
+
# configMINIMAL_STACK_SIZE, which follows this; the default 1536 overflows while the job's thread-local
|
|
61
|
+
# state is torn down and reboots the board.
|
|
62
|
+
CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=3072
|
|
59
63
|
CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP=y
|
|
60
64
|
CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL=0
|
|
61
65
|
# IDF defaults this to 32 KiB when SPIRAM malloc is enabled. That creates a
|
|
@@ -75,6 +75,6 @@ direct_dependencies:
|
|
|
75
75
|
- espressif/esp_lcd_panel_io_additions
|
|
76
76
|
- espressif/esp_lcd_sh8601
|
|
77
77
|
- idf
|
|
78
|
-
manifest_hash:
|
|
78
|
+
manifest_hash: 877cab124fe9bc18750b436566feb51710be048484445812ba342e0427c514a8
|
|
79
79
|
target: esp32s3
|
|
80
80
|
version: 3.0.0
|