mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-11-01 10:21:59 +00:00
perf(l2): bigger CPU instruction cache, TLS and BLE buffers in PSRAM
The framework libs are rebuilt for the L2's own ESP-IDF options (solo/wio-tracker-l2/idf/sdkconfig): a 32 KB instruction cache and 64-byte data cache lines make frames ~35% faster (map 45 -> 30 ms, settings ~36 -> 22 ms). mbedTLS and the NimBLE host allocate in PSRAM, so internal RAM ends up with more free than before (103 KB, largest block 57 KB; was 89.6 / 45). Wio_Tracker_L2_idf_libs does the rebuild; it has to run before the firmware env, also in CI. idf/arduino_tinyusb gives the rebuild the TinyUSB options and the framework's prebuilt library, which it would otherwise lose. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -55,6 +55,12 @@ jobs:
|
|||||||
echo "BUILD_VERSION=dev-$(git rev-parse --short HEAD)" >> $GITHUB_ENV
|
echo "BUILD_VERSION=dev-$(git rev-parse --short HEAD)" >> $GITHUB_ENV
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# The L2 links framework libs rebuilt for its own ESP-IDF options
|
||||||
|
# (solo/wio-tracker-l2/idf/sdkconfig), which this env builds first.
|
||||||
|
- name: Rebuild framework libs
|
||||||
|
if: matrix.env == 'Wio_Tracker_L2_companion_solo_lvgl'
|
||||||
|
run: pio run -e Wio_Tracker_L2_idf_libs
|
||||||
|
|
||||||
- name: Build Firmware
|
- name: Build Firmware
|
||||||
env:
|
env:
|
||||||
FIRMWARE_VERSION: ${{ env.BUILD_VERSION }}
|
FIRMWARE_VERSION: ${{ env.BUILD_VERSION }}
|
||||||
|
|||||||
@@ -31,3 +31,12 @@ graphify-out/
|
|||||||
|
|
||||||
# local assistant notes
|
# local assistant notes
|
||||||
CLAUDE.md
|
CLAUDE.md
|
||||||
|
|
||||||
|
# pioarduino's framework-lib rebuild (custom_sdkconfig, Wio_Tracker_L2_idf_libs)
|
||||||
|
# generates an ESP-IDF project in the repo root
|
||||||
|
/.dummy/
|
||||||
|
/CMakeLists.txt
|
||||||
|
/sdkconfig.defaults
|
||||||
|
/sdkconfig.*
|
||||||
|
/dependencies.lock
|
||||||
|
/managed_components/
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ pio run -e <env> -t upload # build and flash ov
|
|||||||
FIRMWARE_VERSION=v1.0.0 bash build.sh build-firmware <env> # release artifacts into out/
|
FIRMWARE_VERSION=v1.0.0 bash build.sh build-firmware <env> # release artifacts into out/
|
||||||
```
|
```
|
||||||
|
|
||||||
Environments are the `*_solo_dual` (OLED / e-ink) and `*_solo_lvgl` (touch) entries in `solo/<board>/platformio.ini`. Optional hardware (CardKB, joystick, GPIO, buzzer…) is enabled with [build flags](./docs/solo/developer/build-flags.md). Releasing: [RELEASE.md](./RELEASE.md).
|
Environments are the `*_solo_dual` (OLED / e-ink) and `*_solo_lvgl` (touch) entries in `solo/<board>/platformio.ini`. The Wio Tracker L2 needs `pio run -e Wio_Tracker_L2_idf_libs` once before its first build (it rebuilds the framework libs for its ESP-IDF options). Optional hardware (CardKB, joystick, GPIO, buzzer…) is enabled with [build flags](./docs/solo/developer/build-flags.md). Releasing: [RELEASE.md](./RELEASE.md).
|
||||||
|
|
||||||
This README is protected from upstream merges via `.gitattributes`; after cloning run once `git config merge.ours.driver true`.
|
This README is protected from upstream merges via `.gitattributes`; after cloning run once `git config merge.ours.driver true`.
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
# Stands in for esp32-arduino-lib-builder's arduino_tinyusb during the
|
||||||
|
# custom_sdkconfig rebuild: its options (Kconfig), and the framework's own
|
||||||
|
# prebuilt library and headers. No sources, so no archive replaces the
|
||||||
|
# prebuilt one.
|
||||||
|
if(CMAKE_BUILD_EARLY_EXPANSION) # the requirements scan: nothing to resolve yet
|
||||||
|
idf_component_register()
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
foreach(dir ${EXTRA_COMPONENT_DIRS})
|
||||||
|
if(dir MATCHES "framework-arduinoespressif32$")
|
||||||
|
set(libs "${dir}-libs/${IDF_TARGET}")
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
if(NOT libs)
|
||||||
|
message(FATAL_ERROR "arduino_tinyusb: the Arduino framework isn't among EXTRA_COMPONENT_DIRS")
|
||||||
|
endif()
|
||||||
|
idf_component_register(INCLUDE_DIRS "${libs}/include/arduino_tinyusb/tinyusb/src"
|
||||||
|
"${libs}/include/arduino_tinyusb/include")
|
||||||
|
target_link_libraries(${COMPONENT_LIB} INTERFACE "${libs}/lib/libarduino_tinyusb.a")
|
||||||
@@ -0,0 +1,105 @@
|
|||||||
|
# The TinyUSB options of the Arduino-ESP32 3.3.12 libs (their values), for
|
||||||
|
# the custom_sdkconfig rebuild: the component that declares them lives in
|
||||||
|
# esp32-arduino-lib-builder, so without this file they'd drop out of
|
||||||
|
# sdkconfig.h and the prebuilt libarduino_tinyusb.a would lose its USB serial.
|
||||||
|
menu "Arduino TinyUSB"
|
||||||
|
config TINYUSB_ENABLED
|
||||||
|
bool
|
||||||
|
default y
|
||||||
|
config TINYUSB_CDC_ENABLED
|
||||||
|
bool
|
||||||
|
default y
|
||||||
|
config TINYUSB_DESC_CDC_STRING
|
||||||
|
string
|
||||||
|
default "Espressif CDC Device"
|
||||||
|
config TINYUSB_CDC_RX_BUFSIZE
|
||||||
|
int
|
||||||
|
default 64
|
||||||
|
config TINYUSB_CDC_TX_BUFSIZE
|
||||||
|
int
|
||||||
|
default 64
|
||||||
|
config TINYUSB_CDC_MAX_PORTS
|
||||||
|
int
|
||||||
|
default 2
|
||||||
|
config TINYUSB_MSC_ENABLED
|
||||||
|
bool
|
||||||
|
default y
|
||||||
|
config TINYUSB_DESC_MSC_STRING
|
||||||
|
string
|
||||||
|
default "Espressif MSC Device"
|
||||||
|
config TINYUSB_MSC_BUFSIZE
|
||||||
|
int
|
||||||
|
default 4096
|
||||||
|
config TINYUSB_HID_ENABLED
|
||||||
|
bool
|
||||||
|
default y
|
||||||
|
config TINYUSB_DESC_HID_STRING
|
||||||
|
string
|
||||||
|
default "Espressif HID Device"
|
||||||
|
config TINYUSB_HID_BUFSIZE
|
||||||
|
int
|
||||||
|
default 64
|
||||||
|
config TINYUSB_MIDI_ENABLED
|
||||||
|
bool
|
||||||
|
default y
|
||||||
|
config TINYUSB_DESC_MIDI_STRING
|
||||||
|
string
|
||||||
|
default "Espressif MIDI Device"
|
||||||
|
config TINYUSB_MIDI_RX_BUFSIZE
|
||||||
|
int
|
||||||
|
default 64
|
||||||
|
config TINYUSB_MIDI_TX_BUFSIZE
|
||||||
|
int
|
||||||
|
default 64
|
||||||
|
config TINYUSB_AUDIO_ENABLED
|
||||||
|
bool
|
||||||
|
default y
|
||||||
|
config TINYUSB_DESC_AUDIO_STRING
|
||||||
|
string
|
||||||
|
default "Espressif AUDIO Device"
|
||||||
|
config TINYUSB_VIDEO_ENABLED
|
||||||
|
bool
|
||||||
|
default y
|
||||||
|
config TINYUSB_DESC_VIDEO_STRING
|
||||||
|
string
|
||||||
|
default "Espressif VIDEO Device"
|
||||||
|
config TINYUSB_VIDEO_STREAMING_BUFSIZE
|
||||||
|
int
|
||||||
|
default 64
|
||||||
|
config TINYUSB_VIDEO_STREAMING_IFS
|
||||||
|
int
|
||||||
|
default 1
|
||||||
|
config TINYUSB_DFU_RT_ENABLED
|
||||||
|
bool
|
||||||
|
default y
|
||||||
|
config TINYUSB_DESC_DFU_RT_STRING
|
||||||
|
string
|
||||||
|
default "Espressif DFU_RT Device"
|
||||||
|
config TINYUSB_DFU_ENABLED
|
||||||
|
bool
|
||||||
|
default y
|
||||||
|
config TINYUSB_DESC_DFU_STRING
|
||||||
|
string
|
||||||
|
default "Espressif DFU Device"
|
||||||
|
config TINYUSB_DFU_BUFSIZE
|
||||||
|
int
|
||||||
|
default 4096
|
||||||
|
config TINYUSB_VENDOR_ENABLED
|
||||||
|
bool
|
||||||
|
default y
|
||||||
|
config TINYUSB_DESC_VENDOR_STRING
|
||||||
|
string
|
||||||
|
default "Espressif VENDOR Device"
|
||||||
|
config TINYUSB_VENDOR_RX_BUFSIZE
|
||||||
|
int
|
||||||
|
default 64
|
||||||
|
config TINYUSB_VENDOR_TX_BUFSIZE
|
||||||
|
int
|
||||||
|
default 64
|
||||||
|
config TINYUSB_NCM_ENABLED
|
||||||
|
bool
|
||||||
|
default y
|
||||||
|
config TINYUSB_DEBUG_LEVEL
|
||||||
|
int
|
||||||
|
default 0
|
||||||
|
endmenu
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
# ESP-IDF options for the L2's LVGL firmware, over the Arduino framework's own
|
||||||
|
# (custom_sdkconfig in solo/wio-tracker-l2/platformio.ini; changing this file
|
||||||
|
# means rebuilding the framework libs: pio run -e Wio_Tracker_L2_idf_libs).
|
||||||
|
|
||||||
|
# The reason for all this: a 32 KB instruction cache (the framework ships
|
||||||
|
# 16 KB) and 64-byte data cache lines. LVGL runs from flash and draws into
|
||||||
|
# PSRAM; frames draw ~35% faster. Costs 16 KB internal RAM.
|
||||||
|
CONFIG_ESP32S3_INSTRUCTION_CACHE_32KB=y
|
||||||
|
CONFIG_ESP32S3_DATA_CACHE_LINE_64B=y
|
||||||
|
|
||||||
|
# ...won back, and more: TLS (map downloads, live tiles, OTA) and the BLE
|
||||||
|
# host keep their buffers in PSRAM.
|
||||||
|
CONFIG_MBEDTLS_EXTERNAL_MEM_ALLOC=y
|
||||||
|
CONFIG_BT_NIMBLE_MEM_ALLOC_MODE_EXTERNAL=y
|
||||||
|
|
||||||
|
# What the framework's own build sets for octal-PSRAM boards, which a rebuild
|
||||||
|
# from its generic config would lose: PSRAM up before global constructors
|
||||||
|
# (MESH_IN_PSRAM needs it), WiFi TX buffers allocated as needed.
|
||||||
|
CONFIG_SPIRAM_BOOT_HW_INIT=y
|
||||||
|
CONFIG_SPIRAM_BOOT_INIT=y
|
||||||
|
CONFIG_SPIRAM_IGNORE_NOTFOUND=y
|
||||||
|
CONFIG_SPIRAM_PRE_CONFIGURE_MEMORY_PROTECTION=y
|
||||||
|
# CONFIG_SPIRAM_MEMTEST is not set
|
||||||
|
CONFIG_ESP_WIFI_DYNAMIC_TX_BUFFER=y
|
||||||
|
CONFIG_ESP_WIFI_DYNAMIC_TX_BUFFER_NUM=32
|
||||||
|
CONFIG_ESP_WIFI_RX_BA_WIN=6
|
||||||
|
CONFIG_LWIP_TCP_OOSEQ_MAX_PBUFS=4
|
||||||
@@ -48,6 +48,9 @@ platform = https://github.com/pioarduino/platform-espressif32/releases/download/
|
|||||||
; a computer as a USB drive (ui-lvgl/LvglPort.h). A firmware that crashes
|
; a computer as a USB drive (ui-lvgl/LvglPort.h). A firmware that crashes
|
||||||
; early may need BOOT held over reset to flash.
|
; early may need BOOT held over reset to flash.
|
||||||
build_unflags = -DARDUINO_USB_MODE=1
|
build_unflags = -DARDUINO_USB_MODE=1
|
||||||
|
; Bigger CPU caches and other ESP-IDF options (idf/sdkconfig): the framework
|
||||||
|
; libs are rebuilt for them. Build Wio_Tracker_L2_idf_libs first (see there).
|
||||||
|
custom_sdkconfig = file://solo/wio-tracker-l2/idf/sdkconfig
|
||||||
build_flags =
|
build_flags =
|
||||||
${Wio_Tracker_L2.build_flags}
|
${Wio_Tracker_L2.build_flags}
|
||||||
-D ARDUINO_USB_MODE=0
|
-D ARDUINO_USB_MODE=0
|
||||||
@@ -121,3 +124,18 @@ lib_deps =
|
|||||||
Preferences
|
Preferences
|
||||||
LittleFS
|
LittleFS
|
||||||
|
|
||||||
|
; Rebuilds the framework libs (ESP-IDF) with the custom_sdkconfig above; the
|
||||||
|
; firmware env above then links them. Run once before it, and again after a
|
||||||
|
; custom_sdkconfig change (pio run -e Wio_Tracker_L2_idf_libs). Needed because
|
||||||
|
; pioarduino's rebuild pass compiles the env's own sources without its include
|
||||||
|
; paths and libraries, which fails for ours; this env's only source is the
|
||||||
|
; stub sketch pioarduino puts in .dummy/. idf/ supplies the TinyUSB options.
|
||||||
|
[env:Wio_Tracker_L2_idf_libs]
|
||||||
|
platform = ${env:Wio_Tracker_L2_companion_solo_lvgl.platform}
|
||||||
|
board = seeed_wio_tracker_l2
|
||||||
|
framework = arduino
|
||||||
|
custom_sdkconfig = ${env:Wio_Tracker_L2_companion_solo_lvgl.custom_sdkconfig}
|
||||||
|
board_build.cmake_extra_args = -DEXTRA_COMPONENT_DIRS=${platformio.src_dir}/../.dummy;${platformio.packages_dir}/framework-arduinoespressif32;${platformio.src_dir}/../solo/wio-tracker-l2/idf
|
||||||
|
lib_deps =
|
||||||
|
lib_ldf_mode = off
|
||||||
|
build_src_filter = +<../.dummy/*>
|
||||||
|
|||||||
Reference in New Issue
Block a user