mirror of
https://github.com/ByteWelder/Tactility.git
synced 2026-02-18 10:53:17 +00:00
Implement support for ESP32 C6 and P4 SOCs (#421)
- Implement generic ESP32 devices - Updated GitHub Actions to first build the SDKs. These are now based on the generic device implementations and the build act as a filter before compiling the dozens of other devices. It should save on resources when boards fail to compile. - Adapted code to C6 and P4 differences, heavily borrowed from from https://github.com/ByteWelder/Tactility/pull/394 written by @marciogranzotto, with some changes of my own - Updated `device.py` to make the `[display]` section optional
This commit is contained in:
parent
fec8033fd7
commit
b565d56029
26
.github/workflows/build-sdk.yml
vendored
26
.github/workflows/build-sdk.yml
vendored
@ -1,26 +0,0 @@
|
||||
name: Build SDK
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
types: [ opened, synchronize, reopened ]
|
||||
|
||||
permissions: read-all
|
||||
|
||||
jobs:
|
||||
Build:
|
||||
strategy:
|
||||
matrix:
|
||||
board: [
|
||||
{ id: cyd-2432s028r, arch: esp32 },
|
||||
{ id: lilygo-tdeck, arch: esp32s3 },
|
||||
]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: "Build"
|
||||
uses: ./.github/actions/build-sdk
|
||||
with:
|
||||
board_id: ${{ matrix.board.id }}
|
||||
arch: ${{ matrix.board.arch }}
|
||||
@ -11,7 +11,24 @@ on:
|
||||
permissions: read-all
|
||||
|
||||
jobs:
|
||||
Build:
|
||||
BuildSdk:
|
||||
strategy:
|
||||
matrix:
|
||||
board: [
|
||||
{ id: generic-esp32, arch: esp32 },
|
||||
{ id: generic-esp32c6, arch: esp32c6 },
|
||||
{ id: generic-esp32p4, arch: esp32p4 },
|
||||
{ id: generic-esp32s3, arch: esp32s3 },
|
||||
]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: "Build SDK"
|
||||
uses: ./.github/actions/build-sdk
|
||||
with:
|
||||
board_id: ${{ matrix.board.id }}
|
||||
arch: ${{ matrix.board.arch }}
|
||||
BuildFirmware:
|
||||
strategy:
|
||||
matrix:
|
||||
board: [
|
||||
@ -52,30 +69,31 @@ jobs:
|
||||
{ id: waveshare-s3-touch-lcd-43, arch: esp32s3 }
|
||||
]
|
||||
runs-on: ubuntu-latest
|
||||
needs: [ BuildSdk ]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: "Build"
|
||||
- name: "Build Firmware"
|
||||
uses: ./.github/actions/build-firmware
|
||||
with:
|
||||
board_id: ${{ matrix.board.id }}
|
||||
arch: ${{ matrix.board.arch }}
|
||||
Bundle:
|
||||
BundleFirmware:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [ Build ]
|
||||
needs: [ BuildFirmware ]
|
||||
if: |
|
||||
(github.event_name == 'push' && github.ref == 'refs/heads/main') ||
|
||||
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v'))
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: "Bundle"
|
||||
- name: "Bundle Firmware"
|
||||
uses: ./.github/actions/bundle-firmware
|
||||
PublishSnapshot:
|
||||
PublishFirmwareSnapshot:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [ Bundle ]
|
||||
needs: [ BundleFirmware ]
|
||||
if: (github.event_name == 'push' && github.ref == 'refs/heads/main')
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: "Publish Snapshot"
|
||||
- name: "Publish Firmware Snapshot"
|
||||
env:
|
||||
CDN_ID: ${{ secrets.CDN_ID }}
|
||||
CDN_TOKEN_NAME: ${{ secrets.CDN_TOKEN_NAME }}
|
||||
@ -83,13 +101,13 @@ jobs:
|
||||
uses: ./.github/actions/publish-firmware
|
||||
with:
|
||||
cdn_version: snapshot
|
||||
PublishRelease:
|
||||
PublishFirmwareStable:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [ Bundle ]
|
||||
needs: [ BundleFirmware ]
|
||||
if: (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v'))
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: "Publish Stable"
|
||||
- name: "Publish Firmware Stable"
|
||||
env:
|
||||
CDN_ID: ${{ secrets.CDN_ID }}
|
||||
CDN_TOKEN_NAME: ${{ secrets.CDN_TOKEN_NAME }}
|
||||
@ -48,7 +48,11 @@ if (DEFINED ENV{ESP_IDF_VERSION})
|
||||
|
||||
set(EXCLUDE_COMPONENTS "Simulator")
|
||||
|
||||
idf_build_set_property(LINK_OPTIONS "-Wl,--wrap=esp_panic_handler" APPEND)
|
||||
# Panic handler wrapping is only available on Xtensa architecture
|
||||
if (CONFIG_IDF_TARGET_ARCH_XTENSA)
|
||||
idf_build_set_property(LINK_OPTIONS "-Wl,--wrap=esp_panic_handler" APPEND)
|
||||
endif ()
|
||||
|
||||
idf_build_set_property(LINK_OPTIONS "-Wl,--wrap=lv_button_create" APPEND)
|
||||
idf_build_set_property(LINK_OPTIONS "-Wl,--wrap=lv_dropdown_create" APPEND)
|
||||
idf_build_set_property(LINK_OPTIONS "-Wl,--wrap=lv_list_create" APPEND)
|
||||
|
||||
7
Devices/generic-esp32/CMakeLists.txt
Normal file
7
Devices/generic-esp32/CMakeLists.txt
Normal file
@ -0,0 +1,7 @@
|
||||
file(GLOB_RECURSE SOURCE_FILES Source/*.c*)
|
||||
|
||||
idf_component_register(
|
||||
SRCS ${SOURCE_FILES}
|
||||
INCLUDE_DIRS "Source"
|
||||
REQUIRES Tactility
|
||||
)
|
||||
3
Devices/generic-esp32/Source/Configuration.cpp
Normal file
3
Devices/generic-esp32/Source/Configuration.cpp
Normal file
@ -0,0 +1,3 @@
|
||||
#include <Tactility/hal/Configuration.h>
|
||||
|
||||
extern const tt::hal::Configuration hardwareConfiguration = {};
|
||||
9
Devices/generic-esp32/device.properties
Normal file
9
Devices/generic-esp32/device.properties
Normal file
@ -0,0 +1,9 @@
|
||||
[general]
|
||||
vendor=Generic
|
||||
name=ESP32
|
||||
|
||||
[hardware]
|
||||
target=ESP32
|
||||
flashSize=4MB
|
||||
spiRam=false
|
||||
|
||||
7
Devices/generic-esp32c6/CMakeLists.txt
Normal file
7
Devices/generic-esp32c6/CMakeLists.txt
Normal file
@ -0,0 +1,7 @@
|
||||
file(GLOB_RECURSE SOURCE_FILES Source/*.c*)
|
||||
|
||||
idf_component_register(
|
||||
SRCS ${SOURCE_FILES}
|
||||
INCLUDE_DIRS "Source"
|
||||
REQUIRES Tactility
|
||||
)
|
||||
3
Devices/generic-esp32c6/Source/Configuration.cpp
Normal file
3
Devices/generic-esp32c6/Source/Configuration.cpp
Normal file
@ -0,0 +1,3 @@
|
||||
#include <Tactility/hal/Configuration.h>
|
||||
|
||||
extern const tt::hal::Configuration hardwareConfiguration = {};
|
||||
9
Devices/generic-esp32c6/device.properties
Normal file
9
Devices/generic-esp32c6/device.properties
Normal file
@ -0,0 +1,9 @@
|
||||
[general]
|
||||
vendor=Generic
|
||||
name=ESP32-C6
|
||||
|
||||
[hardware]
|
||||
target=ESP32C6
|
||||
flashSize=4MB
|
||||
spiRam=false
|
||||
|
||||
7
Devices/generic-esp32p4/CMakeLists.txt
Normal file
7
Devices/generic-esp32p4/CMakeLists.txt
Normal file
@ -0,0 +1,7 @@
|
||||
file(GLOB_RECURSE SOURCE_FILES Source/*.c*)
|
||||
|
||||
idf_component_register(
|
||||
SRCS ${SOURCE_FILES}
|
||||
INCLUDE_DIRS "Source"
|
||||
REQUIRES Tactility
|
||||
)
|
||||
3
Devices/generic-esp32p4/Source/Configuration.cpp
Normal file
3
Devices/generic-esp32p4/Source/Configuration.cpp
Normal file
@ -0,0 +1,3 @@
|
||||
#include <Tactility/hal/Configuration.h>
|
||||
|
||||
extern const tt::hal::Configuration hardwareConfiguration = {};
|
||||
9
Devices/generic-esp32p4/device.properties
Normal file
9
Devices/generic-esp32p4/device.properties
Normal file
@ -0,0 +1,9 @@
|
||||
[general]
|
||||
vendor=Generic
|
||||
name=ESP32-P4
|
||||
|
||||
[hardware]
|
||||
target=ESP32P4
|
||||
flashSize=4MB
|
||||
spiRam=false
|
||||
|
||||
7
Devices/generic-esp32s3/CMakeLists.txt
Normal file
7
Devices/generic-esp32s3/CMakeLists.txt
Normal file
@ -0,0 +1,7 @@
|
||||
file(GLOB_RECURSE SOURCE_FILES Source/*.c*)
|
||||
|
||||
idf_component_register(
|
||||
SRCS ${SOURCE_FILES}
|
||||
INCLUDE_DIRS "Source"
|
||||
REQUIRES Tactility
|
||||
)
|
||||
3
Devices/generic-esp32s3/Source/Configuration.cpp
Normal file
3
Devices/generic-esp32s3/Source/Configuration.cpp
Normal file
@ -0,0 +1,3 @@
|
||||
#include <Tactility/hal/Configuration.h>
|
||||
|
||||
extern const tt::hal::Configuration hardwareConfiguration = {};
|
||||
9
Devices/generic-esp32s3/device.properties
Normal file
9
Devices/generic-esp32s3/device.properties
Normal file
@ -0,0 +1,9 @@
|
||||
[general]
|
||||
vendor=Generic
|
||||
name=ESP32-S3
|
||||
|
||||
[hardware]
|
||||
target=ESP32S3
|
||||
flashSize=4MB
|
||||
spiRam=false
|
||||
|
||||
@ -1,9 +1,21 @@
|
||||
dependencies:
|
||||
espressif/esp_lcd_ili9341: "2.0.1"
|
||||
atanisoft/esp_lcd_ili9488: "1.0.10"
|
||||
teriyakigod/esp_lcd_st7735: "0.0.1"
|
||||
espressif/esp_lcd_ili9341:
|
||||
version: "2.0.1"
|
||||
rules:
|
||||
- if: "target in [esp32, esp32s3]"
|
||||
atanisoft/esp_lcd_ili9488:
|
||||
version: "1.0.10"
|
||||
rules:
|
||||
- if: "target in [esp32, esp32s3]"
|
||||
teriyakigod/esp_lcd_st7735:
|
||||
version: "0.0.1"
|
||||
rules:
|
||||
- if: "target in [esp32, esp32s3]"
|
||||
espressif/esp_lcd_touch: "1.1.2"
|
||||
atanisoft/esp_lcd_touch_xpt2046: "1.0.5"
|
||||
atanisoft/esp_lcd_touch_xpt2046:
|
||||
version: "1.0.5"
|
||||
rules:
|
||||
- if: "target in [esp32, esp32s3]"
|
||||
espressif/esp_lcd_touch_cst816s: "1.0.3"
|
||||
espressif/esp_lcd_touch_gt911: "1.1.3"
|
||||
espressif/esp_lcd_touch_ft5x06: "1.0.6~1"
|
||||
@ -15,6 +27,8 @@ dependencies:
|
||||
- if: "target in [esp32s3, esp32p4]"
|
||||
espressif/esp_lcd_st7796:
|
||||
version: "1.3.4"
|
||||
rules:
|
||||
- if: "target in [esp32, esp32s3]"
|
||||
espressif/esp_lcd_gc9a01: "2.0.3"
|
||||
espressif/esp_lcd_panel_io_additions: "1.0.1"
|
||||
espressif/esp_tinyusb:
|
||||
|
||||
@ -1,5 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef ESP_PLATFORM
|
||||
#include <sdkconfig.h>
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ESP_WIFI_ENABLED
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
|
||||
@ -1,9 +1,13 @@
|
||||
#pragma once
|
||||
#ifdef ESP_PLATFORM
|
||||
|
||||
#include "Tactility/MessageQueue.h"
|
||||
#include "Tactility/service/Service.h"
|
||||
#include "Tactility/service/espnow/EspNow.h"
|
||||
#ifdef ESP_PLATFORM
|
||||
#include <sdkconfig.h>
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ESP_WIFI_ENABLED
|
||||
|
||||
#include <Tactility/service/Service.h>
|
||||
#include <Tactility/service/espnow/EspNow.h>
|
||||
|
||||
#include <Tactility/Mutex.h>
|
||||
|
||||
@ -13,8 +17,6 @@ namespace tt::service::espnow {
|
||||
|
||||
class EspNowService final : public Service {
|
||||
|
||||
private:
|
||||
|
||||
struct ReceiverSubscriptionData {
|
||||
ReceiverSubscription id;
|
||||
std::function<void(const esp_now_recv_info_t* receiveInfo, const uint8_t* data, int length)> onReceive;
|
||||
|
||||
@ -1,5 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef ESP_PLATFORM
|
||||
#include <sdkconfig.h>
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ESP_WIFI_ENABLED
|
||||
|
||||
#include "Tactility/service/espnow/EspNow.h"
|
||||
|
||||
namespace tt::service::espnow {
|
||||
@ -9,3 +15,5 @@ bool initWifi(const EspNowConfig& config);
|
||||
bool deinitWifi();
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@ -1,3 +1,7 @@
|
||||
#ifdef ESP_PLATFORM
|
||||
#include <sdkconfig.h>
|
||||
#endif
|
||||
|
||||
#include <Tactility/Tactility.h>
|
||||
#include <Tactility/TactilityConfig.h>
|
||||
|
||||
@ -38,6 +42,8 @@ namespace service {
|
||||
namespace sdcard { extern const ServiceManifest manifest; }
|
||||
#ifdef ESP_PLATFORM
|
||||
namespace development { extern const ServiceManifest manifest; }
|
||||
#endif
|
||||
#ifdef CONFIG_ESP_WIFI_ENABLED
|
||||
namespace espnow { extern const ServiceManifest manifest; }
|
||||
#endif
|
||||
// Secondary (UI)
|
||||
@ -64,7 +70,9 @@ namespace app {
|
||||
namespace applist { extern const AppManifest manifest; }
|
||||
namespace appsettings { extern const AppManifest manifest; }
|
||||
namespace boot { extern const AppManifest manifest; }
|
||||
#ifdef CONFIG_ESP_WIFI_ENABLED
|
||||
namespace chat { extern const AppManifest manifest; }
|
||||
#endif
|
||||
namespace development { extern const AppManifest manifest; }
|
||||
namespace display { extern const AppManifest manifest; }
|
||||
namespace files { extern const AppManifest manifest; }
|
||||
@ -135,8 +143,11 @@ static void registerInternalApps() {
|
||||
addAppManifest(app::screenshot::manifest);
|
||||
#endif
|
||||
|
||||
#ifdef ESP_PLATFORM
|
||||
#ifdef CONFIG_ESP_WIFI_ENABLED
|
||||
addAppManifest(app::chat::manifest);
|
||||
#endif
|
||||
|
||||
#ifdef ESP_PLATFORM
|
||||
addAppManifest(app::crashdiagnostics::manifest);
|
||||
addAppManifest(app::development::manifest);
|
||||
#endif
|
||||
@ -231,6 +242,9 @@ static void registerAndStartPrimaryServices() {
|
||||
addService(service::wifi::manifest);
|
||||
#ifdef ESP_PLATFORM
|
||||
addService(service::development::manifest);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ESP_WIFI_ENABLED
|
||||
addService(service::espnow::manifest);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -1,4 +1,8 @@
|
||||
#ifdef ESP_PLATFORM
|
||||
#include <sdkconfig.h>
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ESP_WIFI_ENABLED
|
||||
|
||||
#include <Tactility/app/AppManifest.h>
|
||||
#include <Tactility/lvgl/Toolbar.h>
|
||||
|
||||
@ -1,20 +1,29 @@
|
||||
#ifdef ESP_PLATFORM
|
||||
|
||||
#include "Tactility/app/crashdiagnostics/QrUrl.h"
|
||||
|
||||
#include <Tactility/app/crashdiagnostics/QrUrl.h>
|
||||
#include <Tactility/kernel/PanicHandler.h>
|
||||
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
|
||||
#if CONFIG_IDF_TARGET_ARCH_XTENSA
|
||||
#include <esp_cpu_utils.h>
|
||||
#else
|
||||
#include <esp_cpu.h>
|
||||
#endif
|
||||
|
||||
#include <sdkconfig.h>
|
||||
|
||||
std::string getUrlFromCrashData() {
|
||||
auto crash_data = getRtcCrashData();
|
||||
auto* stack_buffer = (uint32_t*) malloc(crash_data.callstackLength * 2 * sizeof(uint32_t));
|
||||
std::vector<uint32_t> stack_buffer(crash_data.callstackLength * 2);
|
||||
for (int i = 0; i < crash_data.callstackLength; ++i) {
|
||||
const CallstackFrame&frame = crash_data.callstack[i];
|
||||
#if CONFIG_IDF_TARGET_ARCH_XTENSA
|
||||
uint32_t pc = esp_cpu_process_stack_pc(frame.pc);
|
||||
#else
|
||||
uint32_t pc = frame.pc; // No processing needed on RISC-V
|
||||
#endif
|
||||
#if CRASH_DATA_INCLUDES_SP
|
||||
uint32_t sp = frame.sp;
|
||||
#endif
|
||||
@ -41,8 +50,6 @@ std::string getUrlFromCrashData() {
|
||||
#endif
|
||||
}
|
||||
|
||||
free(stack_buffer);
|
||||
|
||||
return stream.str();
|
||||
}
|
||||
|
||||
|
||||
@ -1,4 +1,8 @@
|
||||
#ifdef ESP_PLATFORM
|
||||
#include <soc/soc_caps.h>
|
||||
#endif
|
||||
|
||||
#if defined(ESP_PLATFORM) && defined(SOC_SDMMC_HOST_SUPPORTED)
|
||||
|
||||
#include <Tactility/hal/sdcard/SdmmcDevice.h>
|
||||
#include <Tactility/Log.h>
|
||||
|
||||
@ -1,4 +1,8 @@
|
||||
#ifdef ESP_PLATFORM
|
||||
#include <sdkconfig.h>
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ESP_WIFI_ENABLED
|
||||
|
||||
#include "Tactility/service/espnow/EspNow.h"
|
||||
#include "Tactility/service/espnow/EspNowService.h"
|
||||
|
||||
@ -1,4 +1,8 @@
|
||||
#ifdef ESP_PLATFORM
|
||||
#include <sdkconfig.h>
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ESP_WIFI_ENABLED
|
||||
|
||||
#include <Tactility/Tactility.h>
|
||||
#include <Tactility/service/espnow/EspNowService.h>
|
||||
|
||||
@ -1,4 +1,8 @@
|
||||
#ifdef ESP_PLATFORM
|
||||
#include <sdkconfig.h>
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ESP_WIFI_ENABLED
|
||||
|
||||
#include "Tactility/service/espnow/EspNow.h"
|
||||
#include "Tactility/service/wifi/Wifi.h"
|
||||
|
||||
@ -1,4 +1,8 @@
|
||||
#ifdef ESP_PLATFORM
|
||||
#include <sdkconfig.h>
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ESP_WIFI_ENABLED
|
||||
|
||||
#include <Tactility/service/wifi/Wifi.h>
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
#ifndef ESP_PLATFORM
|
||||
#ifndef CONFIG_ESP_WIFI_ENABLED
|
||||
|
||||
#include <Tactility/service/wifi/Wifi.h>
|
||||
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
#ifndef CONFIG_IDF_TARGET_ESP32P4
|
||||
|
||||
#include <private/elf_symbol.h>
|
||||
#include <cstddef>
|
||||
|
||||
@ -282,3 +284,5 @@ const esp_elfsym gcc_soft_float_symbols[] = {
|
||||
|
||||
ESP_ELFSYM_END
|
||||
};
|
||||
|
||||
#endif
|
||||
@ -28,10 +28,12 @@
|
||||
|
||||
#include "symbols/esp_event.h"
|
||||
#include "symbols/esp_http_client.h"
|
||||
#include "symbols/gcc_soft_float.h"
|
||||
#include "symbols/pthread.h"
|
||||
#include "symbols/stl.h"
|
||||
#include "symbols/cplusplus.h"
|
||||
#ifndef CONFIG_IDF_TARGET_ESP32P4
|
||||
#include "symbols/gcc_soft_float.h"
|
||||
#endif
|
||||
|
||||
#include <cstring>
|
||||
#include <ctype.h>
|
||||
@ -591,7 +593,9 @@ uintptr_t resolve_symbol(const esp_elfsym* source, const char* symbolName) {
|
||||
uintptr_t tt_symbol_resolver(const char* symbolName) {
|
||||
static const std::vector all_symbols = {
|
||||
main_symbols,
|
||||
#ifndef CONFIG_IDF_TARGET_ESP32P4
|
||||
gcc_soft_float_symbols,
|
||||
#endif
|
||||
stl_symbols,
|
||||
cplusplus_symbols,
|
||||
esp_event_symbols,
|
||||
|
||||
@ -1,3 +1,7 @@
|
||||
#ifdef ESP_PLATFORM
|
||||
#include <sdkconfig.h>
|
||||
#endif
|
||||
|
||||
#include "Tactility/CpuAffinity.h"
|
||||
|
||||
#include <Tactility/Check.h>
|
||||
@ -6,25 +10,39 @@ namespace tt {
|
||||
|
||||
#ifdef ESP_PLATFORM
|
||||
|
||||
#ifdef CONFIG_ESP_WIFI_ENABLED
|
||||
|
||||
static CpuAffinity getEspWifiAffinity() {
|
||||
#ifdef CONFIG_ESP32_WIFI_TASK_PINNED_TO_CORE_0
|
||||
#if CONFIG_FREERTOS_NUMBER_OF_CORES == 1
|
||||
return 0;
|
||||
#elif defined(CONFIG_ESP32_WIFI_TASK_PINNED_TO_CORE_1)
|
||||
#elif defined(CONFIG_ESP_WIFI_TASK_PINNED_TO_CORE_0)
|
||||
return 0;
|
||||
#elif defined(CONFIG_ESP_WIFI_TASK_PINNED_TO_CORE_1)
|
||||
return 1;
|
||||
#else // Assume core 0 (risky, but safer than "None")
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// Warning: Must watch ESP WiFi, as this task is used by WiFi
|
||||
static CpuAffinity getEspMainSchedulerAffinity() {
|
||||
#ifdef CONFIG_ESP32_WIFI_TASK_PINNED_TO_CORE_0
|
||||
#if CONFIG_FREERTOS_NUMBER_OF_CORES == 1
|
||||
return 0;
|
||||
#elif defined(CONFIG_ESP32_WIFI_TASK_PINNED_TO_CORE_1)
|
||||
#elif defined(CONFIG_ESP_WIFI_TASK_PINNED_TO_CORE_0)
|
||||
return 0;
|
||||
#elif defined(CONFIG_ESP_WIFI_TASK_PINNED_TO_CORE_1)
|
||||
return 1;
|
||||
#else
|
||||
return None;
|
||||
#endif
|
||||
}
|
||||
|
||||
static CpuAffinity getFreeRtosTimerAffinity() {
|
||||
#if defined(CONFIG_FREERTOS_TIMER_TASK_NO_AFFINITY)
|
||||
#if CONFIG_FREERTOS_NUMBER_OF_CORES == 1
|
||||
return 0;
|
||||
#elif defined(CONFIG_FREERTOS_TIMER_TASK_NO_AFFINITY)
|
||||
return None;
|
||||
#elif defined(CONFIG_FREERTOS_TIMER_TASK_AFFINITY_CPU0)
|
||||
return 0;
|
||||
@ -48,7 +66,11 @@ static const CpuAffinityConfiguration esp = {
|
||||
static const CpuAffinityConfiguration esp = {
|
||||
.system = 0,
|
||||
.graphics = 1,
|
||||
#ifdef CONFIG_ESP_WIFI_ENABLED
|
||||
.wifi = getEspWifiAffinity(),
|
||||
#else
|
||||
.wifi = 0,
|
||||
#endif
|
||||
.mainDispatcher = getEspMainSchedulerAffinity(),
|
||||
.apps = 1,
|
||||
.timer = getFreeRtosTimerAffinity()
|
||||
|
||||
@ -1,11 +1,13 @@
|
||||
#ifdef ESP_PLATFORM
|
||||
#if defined(ESP_PLATFORM) && defined(CONFIG_IDF_TARGET_ARCH_XTENSA)
|
||||
|
||||
#include "Tactility/kernel/PanicHandler.h"
|
||||
|
||||
#include <esp_debug_helpers.h>
|
||||
#include <esp_attr.h>
|
||||
#include <esp_memory_utils.h>
|
||||
#include <esp_cpu.h>
|
||||
#include <esp_cpu_utils.h>
|
||||
#include <xtensa/xtruntime.h>
|
||||
|
||||
extern "C" {
|
||||
|
||||
@ -35,10 +37,15 @@ void __wrap_esp_panic_handler(void* info) {
|
||||
#endif
|
||||
crashData.callstackLength++;
|
||||
|
||||
crashData.callstackCorrupted = !(esp_stack_ptr_is_sane(frame.sp) &&
|
||||
(esp_ptr_executable((void *)esp_cpu_process_stack_pc(frame.pc)) ||
|
||||
/* Ignore the first corrupted PC in case of InstrFetchProhibited */
|
||||
(frame.exc_frame && ((XtExcFrame *)frame.exc_frame)->exccause == EXCCAUSE_INSTR_PROHIBITED)));
|
||||
uint32_t processed_pc = esp_cpu_process_stack_pc(frame.pc);
|
||||
bool pc_is_valid = esp_ptr_executable((void *)processed_pc);
|
||||
|
||||
/* Ignore the first corrupted PC in case of InstrFetchProhibited on Xtensa */
|
||||
if (frame.exc_frame && ((XtExcFrame *)frame.exc_frame)->exccause == EXCCAUSE_INSTR_PROHIBITED) {
|
||||
pc_is_valid = true;
|
||||
}
|
||||
|
||||
crashData.callstackCorrupted = !(esp_stack_ptr_is_sane(frame.sp) && pc_is_valid);
|
||||
|
||||
while (
|
||||
frame.next_pc != 0 &&
|
||||
@ -46,6 +53,14 @@ void __wrap_esp_panic_handler(void* info) {
|
||||
&& crashData.callstackLength < CRASH_DATA_CALLSTACK_LIMIT
|
||||
) {
|
||||
if (esp_backtrace_get_next_frame(&frame)) {
|
||||
// Validate the current frame
|
||||
uint32_t processed_frame_pc = esp_cpu_process_stack_pc(frame.pc);
|
||||
bool frame_pc_is_valid = esp_ptr_executable((void *)processed_frame_pc);
|
||||
|
||||
if (!esp_stack_ptr_is_sane(frame.sp) || !frame_pc_is_valid) {
|
||||
crashData.callstackCorrupted = true;
|
||||
break;
|
||||
}
|
||||
crashData.callstack[crashData.callstackLength].pc = frame.pc;
|
||||
#if CRASH_DATA_INCLUDES_SP
|
||||
crashData.callstack[crashData.callstackLength].sp = frame.sp;
|
||||
@ -66,4 +81,15 @@ void __wrap_esp_panic_handler(void* info) {
|
||||
|
||||
const CrashData& getRtcCrashData() { return crashData; }
|
||||
|
||||
#elif defined(ESP_PLATFORM)
|
||||
|
||||
// Stub implementation for RISC-V and other architectures
|
||||
// TODO: Implement crash data collection for RISC-V using frame pointer or EH frame
|
||||
|
||||
#include <Tactility/kernel/PanicHandler.h>
|
||||
|
||||
static CrashData emptyCrashData = {};
|
||||
|
||||
const CrashData& getRtcCrashData() { return emptyCrashData; }
|
||||
|
||||
#endif
|
||||
17
device.py
17
device.py
@ -52,6 +52,9 @@ def read_device_properties(device_id):
|
||||
exit_with_error(f"Device file not found: {device_file_path}")
|
||||
return read_properties_file(device_file_path)
|
||||
|
||||
def has_group(properties: ConfigParser, group: str):
|
||||
return group in properties.sections()
|
||||
|
||||
def get_property_or_exit(properties: ConfigParser, group: str, key: str):
|
||||
if group not in properties.sections():
|
||||
exit_with_error(f"Device properties does not contain group: {group}")
|
||||
@ -171,13 +174,15 @@ def write_performance_improvements(output_file, device_properties: ConfigParser)
|
||||
output_file.write("CONFIG_ESP32S3_DATA_CACHE_LINE_64B=y\n")
|
||||
|
||||
def write_lvgl_variables(output_file, device_properties: ConfigParser):
|
||||
dpi = get_property_or_exit(device_properties, "display", "dpi")
|
||||
output_file.write("# LVGL\n")
|
||||
if has_group(device_properties, "display"):
|
||||
dpi = get_property_or_exit(device_properties, "display", "dpi")
|
||||
output_file.write(f"CONFIG_LV_DPI_DEF={dpi}\n")
|
||||
if has_group(device_properties, "lvgl"):
|
||||
color_depth = get_property_or_exit(device_properties, "lvgl", "colorDepth")
|
||||
output_file.write(f"CONFIG_LV_COLOR_DEPTH={color_depth}\n")
|
||||
output_file.write(f"CONFIG_LV_COLOR_DEPTH_{color_depth}=y\n")
|
||||
output_file.write("CONFIG_LV_DISP_DEF_REFR_PERIOD=10\n")
|
||||
output_file.write(f"CONFIG_LV_DPI_DEF={dpi}\n")
|
||||
color_depth = get_property_or_exit(device_properties, "lvgl", "colorDepth")
|
||||
output_file.write(f"CONFIG_LV_COLOR_DEPTH={color_depth}\n")
|
||||
output_file.write(f"CONFIG_LV_COLOR_DEPTH_{color_depth}=y\n")
|
||||
theme = get_property_or_none(device_properties, "lvgl", "theme")
|
||||
if theme is None or theme == "DefaultDark":
|
||||
output_file.write("CONFIG_LV_THEME_DEFAULT_DARK=y\n")
|
||||
@ -212,10 +217,10 @@ def write_properties(output_file, device_properties: ConfigParser, device_id: st
|
||||
write_flash_variables(output_file, device_properties)
|
||||
write_partition_table(output_file, device_properties, is_dev)
|
||||
write_spiram_variables(output_file, device_properties)
|
||||
write_lvgl_variables(output_file, device_properties)
|
||||
write_performance_improvements(output_file, device_properties)
|
||||
write_usb_variables(output_file, device_properties)
|
||||
write_custom_sdkconfig(output_file, device_properties)
|
||||
write_lvgl_variables(output_file, device_properties)
|
||||
|
||||
def main(device_id: str, is_dev: bool):
|
||||
device_properties_path = get_properties_file_path(device_id)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user