mirror of
https://github.com/ByteWelder/Tactility.git
synced 2026-10-19 20:05:06 +00:00
idf 6.1 initial updates for T-Deck
This commit is contained in:
parent
3d71ba5407
commit
5d2ca3188a
@ -6,7 +6,7 @@
|
|||||||
#include <tactility/bindings/esp32_ble.h>
|
#include <tactility/bindings/esp32_ble.h>
|
||||||
#include <tactility/bindings/esp32_gpio.h>
|
#include <tactility/bindings/esp32_gpio.h>
|
||||||
#include <tactility/bindings/esp32_grove.h>
|
#include <tactility/bindings/esp32_grove.h>
|
||||||
#include <tactility/bindings/esp32_i2c.h>
|
#include <tactility/bindings/esp32_i2c_master.h>
|
||||||
#include <tactility/bindings/esp32_i2s.h>
|
#include <tactility/bindings/esp32_i2s.h>
|
||||||
#include <tactility/bindings/esp32_pwm_ledc.h>
|
#include <tactility/bindings/esp32_pwm_ledc.h>
|
||||||
#include <tactility/bindings/pwm_backlight.h>
|
#include <tactility/bindings/pwm_backlight.h>
|
||||||
@ -95,7 +95,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
i2c_internal: i2c0 {
|
i2c_internal: i2c0 {
|
||||||
compatible = "espressif,esp32-i2c";
|
compatible = "espressif,esp32-i2c-master";
|
||||||
port = <I2C_NUM_0>;
|
port = <I2C_NUM_0>;
|
||||||
clock-frequency = <100000>;
|
clock-frequency = <100000>;
|
||||||
pin-sda = <&gpio0 18 GPIO_FLAG_NONE>;
|
pin-sda = <&gpio0 18 GPIO_FLAG_NONE>;
|
||||||
|
|||||||
@ -5,7 +5,6 @@
|
|||||||
#include <tactility/check.h>
|
#include <tactility/check.h>
|
||||||
#include <tactility/device.h>
|
#include <tactility/device.h>
|
||||||
#include <tactility/driver.h>
|
#include <tactility/driver.h>
|
||||||
#include <tactility/drivers/esp32_i2c.h>
|
|
||||||
#include <tactility/drivers/esp32_i2c_master.h>
|
#include <tactility/drivers/esp32_i2c_master.h>
|
||||||
#include <tactility/drivers/gpio_controller.h>
|
#include <tactility/drivers/gpio_controller.h>
|
||||||
#include <tactility/drivers/i2c_controller.h>
|
#include <tactility/drivers/i2c_controller.h>
|
||||||
@ -87,14 +86,10 @@ static esp_err_t create_io_handle(Device* parent, esp_lcd_panel_io_handle_t* out
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto* parent_driver = device_get_driver(parent);
|
auto* parent_driver = device_get_driver(parent);
|
||||||
if (driver_is_compatible(parent_driver, "espressif,esp32-i2c")) {
|
|
||||||
auto port = static_cast<const Esp32I2cConfig*>(parent->config)->port;
|
|
||||||
return esp_lcd_new_panel_io_i2c_v1(port, &io_config, out_handle);
|
|
||||||
}
|
|
||||||
if (driver_is_compatible(parent_driver, "espressif,esp32-i2c-master")) {
|
if (driver_is_compatible(parent_driver, "espressif,esp32-i2c-master")) {
|
||||||
auto bus = esp32_i2c_master_get_bus_handle(parent);
|
auto bus = esp32_i2c_master_get_bus_handle(parent);
|
||||||
io_config.scl_speed_hz = esp32_i2c_master_get_clock_frequency(parent);
|
io_config.scl_speed_hz = esp32_i2c_master_get_clock_frequency(parent);
|
||||||
return esp_lcd_new_panel_io_i2c_v2(bus, &io_config, out_handle);
|
return esp_lcd_new_panel_io_i2c(bus, &io_config, out_handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_E(TAG, "Unsupported I2C driver");
|
LOG_E(TAG, "Unsupported I2C driver");
|
||||||
|
|||||||
@ -7,5 +7,5 @@ file(GLOB_RECURSE SOURCE_FILES "source/*.c*")
|
|||||||
tactility_add_module(lilygo-module
|
tactility_add_module(lilygo-module
|
||||||
SRCS ${SOURCE_FILES}
|
SRCS ${SOURCE_FILES}
|
||||||
INCLUDE_DIRS include/
|
INCLUDE_DIRS include/
|
||||||
REQUIRES TactilityKernel lvgl driver
|
REQUIRES TactilityKernel lvgl driver esp_driver_gpio
|
||||||
)
|
)
|
||||||
|
|||||||
@ -83,8 +83,8 @@ static error_t start(Device* device) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
esp_lcd_panel_io_spi_config_t io_config = {
|
esp_lcd_panel_io_spi_config_t io_config = {
|
||||||
.cs_gpio_num = pin_or_unused(cs_pin),
|
.cs_gpio_num = static_cast<gpio_num_t>(pin_or_unused(cs_pin)),
|
||||||
.dc_gpio_num = pin_or_unused(config->pin_dc),
|
.dc_gpio_num = static_cast<gpio_num_t>(pin_or_unused(config->pin_dc)),
|
||||||
.spi_mode = 0,
|
.spi_mode = 0,
|
||||||
.pclk_hz = config->pixel_clock_hz,
|
.pclk_hz = config->pixel_clock_hz,
|
||||||
.trans_queue_depth = config->transaction_queue_depth,
|
.trans_queue_depth = config->transaction_queue_depth,
|
||||||
@ -115,13 +115,13 @@ static error_t start(Device* device) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
esp_lcd_panel_dev_config_t panel_config = {
|
esp_lcd_panel_dev_config_t panel_config = {
|
||||||
.reset_gpio_num = pin_or_unused(config->pin_reset),
|
|
||||||
.rgb_ele_order = config->bgr_order ? LCD_RGB_ELEMENT_ORDER_BGR : LCD_RGB_ELEMENT_ORDER_RGB,
|
.rgb_ele_order = config->bgr_order ? LCD_RGB_ELEMENT_ORDER_BGR : LCD_RGB_ELEMENT_ORDER_RGB,
|
||||||
.data_endian = LCD_RGB_DATA_ENDIAN_LITTLE,
|
.data_endian = LCD_RGB_DATA_ENDIAN_LITTLE,
|
||||||
.bits_per_pixel = config->bits_per_pixel,
|
.bits_per_pixel = config->bits_per_pixel,
|
||||||
|
.reset_gpio_num = static_cast<gpio_num_t>(pin_or_unused(config->pin_reset)),
|
||||||
|
.vendor_config = nullptr,
|
||||||
// ST7789's reset line is fixed active-low in hardware.
|
// ST7789's reset line is fixed active-low in hardware.
|
||||||
.flags = { .reset_active_high = false },
|
.flags = { .reset_active_high = false },
|
||||||
.vendor_config = nullptr,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
ret = esp_lcd_new_panel_st7789(internal->io_handle, &panel_config, &internal->panel_handle);
|
ret = esp_lcd_new_panel_st7789(internal->io_handle, &panel_config, &internal->panel_handle);
|
||||||
|
|||||||
@ -37,7 +37,7 @@
|
|||||||
#ifndef __QRCODE_H_
|
#ifndef __QRCODE_H_
|
||||||
#define __QRCODE_H_
|
#define __QRCODE_H_
|
||||||
|
|
||||||
#ifndef __cplusplus
|
#if !defined(__cplusplus) && (!defined(__STDC_VERSION__) || __STDC_VERSION__ < 202311L)
|
||||||
typedef unsigned char bool;
|
typedef unsigned char bool;
|
||||||
static const bool false = 0;
|
static const bool false = 0;
|
||||||
static const bool true = 1;
|
static const bool true = 1;
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
Subproject commit daca7a3979c22da155ec9dce49ab1abf3b65d3a9
|
Subproject commit 0a8fda272a5a0abef3b47c91bed37185d5a726b1
|
||||||
@ -22,3 +22,7 @@ tactility_add_module(crypt-module
|
|||||||
INCLUDE_DIRS include/
|
INCLUDE_DIRS include/
|
||||||
REQUIRES ${REQUIRES_LIST}
|
REQUIRES ${REQUIRES_LIST}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (NOT DEFINED ENV{ESP_IDF_VERSION})
|
||||||
|
target_include_directories(crypt-module PRIVATE "${CMAKE_CURRENT_LIST_DIR}/../../Libraries/mbedtls/tf-psa-crypto/drivers/builtin/include")
|
||||||
|
endif ()
|
||||||
|
|||||||
@ -4,9 +4,14 @@
|
|||||||
#include <tactility/check.h>
|
#include <tactility/check.h>
|
||||||
#include <tactility/log.h>
|
#include <tactility/log.h>
|
||||||
|
|
||||||
#include <mbedtls/aes.h>
|
#ifdef ESP_PLATFORM
|
||||||
|
#include <aes/esp_aes.h>
|
||||||
|
#else
|
||||||
|
#define MBEDTLS_DECLARE_PRIVATE_IDENTIFIERS
|
||||||
|
#include <mbedtls/private/aes.h>
|
||||||
|
#endif
|
||||||
|
#include <psa/crypto.h>
|
||||||
#include <mbedtls/platform_util.h>
|
#include <mbedtls/platform_util.h>
|
||||||
#include <mbedtls/sha256.h>
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
@ -22,6 +27,9 @@ constexpr auto* TAG = "crypt";
|
|||||||
|
|
||||||
#define TT_NVS_NAMESPACE "tt_secure"
|
#define TT_NVS_NAMESPACE "tt_secure"
|
||||||
|
|
||||||
|
constexpr int AES_MODE_ENCRYPT = 1;
|
||||||
|
constexpr int AES_MODE_DECRYPT = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fills a buffer with cryptographically secure random bytes.
|
* Fills a buffer with cryptographically secure random bytes.
|
||||||
* @param[out] out output buffer
|
* @param[out] out output buffer
|
||||||
@ -145,9 +153,22 @@ static void getKey(uint8_t key[32]) {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// psa_crypto_init() is safe to call more than once (subsequent calls are a cheap no-op); ESP-IDF
|
||||||
|
// calls it during startup already, but the simulator has no equivalent, so call it here too
|
||||||
|
// rather than depend on init order across callers.
|
||||||
|
static void ensure_psa_crypto_init() {
|
||||||
|
static bool initialized = false;
|
||||||
|
if (!initialized) {
|
||||||
|
psa_crypto_init();
|
||||||
|
initialized = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void crypt_get_iv(const void* data, size_t dataLength, uint8_t iv[16]) {
|
void crypt_get_iv(const void* data, size_t dataLength, uint8_t iv[16]) {
|
||||||
|
ensure_psa_crypto_init();
|
||||||
uint8_t hash[32];
|
uint8_t hash[32];
|
||||||
mbedtls_sha256(static_cast<const unsigned char*>(data), dataLength, hash, 0);
|
size_t hash_length;
|
||||||
|
psa_hash_compute(PSA_ALG_SHA_256, static_cast<const uint8_t*>(data), dataLength, hash, sizeof(hash), &hash_length);
|
||||||
memcpy(iv, hash, 16);
|
memcpy(iv, hash, 16);
|
||||||
mbedtls_platform_zeroize(hash, sizeof(hash));
|
mbedtls_platform_zeroize(hash, sizeof(hash));
|
||||||
}
|
}
|
||||||
@ -170,15 +191,23 @@ static int aes256CryptCbc(
|
|||||||
return -1; // TODO: Proper error code from mbed lib?
|
return -1; // TODO: Proper error code from mbed lib?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef ESP_PLATFORM
|
||||||
|
esp_aes_context master;
|
||||||
|
esp_aes_init(&master);
|
||||||
|
esp_aes_setkey(&master, key, 256);
|
||||||
|
int result = esp_aes_crypt_cbc(&master, mode, length, iv, input, output);
|
||||||
|
esp_aes_free(&master);
|
||||||
|
#else
|
||||||
mbedtls_aes_context master;
|
mbedtls_aes_context master;
|
||||||
mbedtls_aes_init(&master);
|
mbedtls_aes_init(&master);
|
||||||
if (mode == MBEDTLS_AES_ENCRYPT) {
|
if (mode == AES_MODE_ENCRYPT) {
|
||||||
mbedtls_aes_setkey_enc(&master, key, 256);
|
mbedtls_aes_setkey_enc(&master, key, 256);
|
||||||
} else {
|
} else {
|
||||||
mbedtls_aes_setkey_dec(&master, key, 256);
|
mbedtls_aes_setkey_dec(&master, key, 256);
|
||||||
}
|
}
|
||||||
int result = mbedtls_aes_crypt_cbc(&master, mode, length, iv, input, output);
|
int result = mbedtls_aes_crypt_cbc(&master, mode, length, iv, input, output);
|
||||||
mbedtls_aes_free(&master);
|
mbedtls_aes_free(&master);
|
||||||
|
#endif
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -190,7 +219,7 @@ int crypt_encrypt(const uint8_t iv[16], const uint8_t* inData, uint8_t* outData,
|
|||||||
uint8_t iv_copy[16];
|
uint8_t iv_copy[16];
|
||||||
memcpy(iv_copy, iv, sizeof(iv_copy));
|
memcpy(iv_copy, iv, sizeof(iv_copy));
|
||||||
|
|
||||||
int result = aes256CryptCbc(key, MBEDTLS_AES_ENCRYPT, dataLength, iv_copy, inData, outData);
|
int result = aes256CryptCbc(key, AES_MODE_ENCRYPT, dataLength, iv_copy, inData, outData);
|
||||||
mbedtls_platform_zeroize(key, sizeof(key));
|
mbedtls_platform_zeroize(key, sizeof(key));
|
||||||
mbedtls_platform_zeroize(iv_copy, sizeof(iv_copy));
|
mbedtls_platform_zeroize(iv_copy, sizeof(iv_copy));
|
||||||
return result;
|
return result;
|
||||||
@ -204,7 +233,7 @@ int crypt_decrypt(const uint8_t iv[16], const uint8_t* inData, uint8_t* outData,
|
|||||||
uint8_t iv_copy[16];
|
uint8_t iv_copy[16];
|
||||||
memcpy(iv_copy, iv, sizeof(iv_copy));
|
memcpy(iv_copy, iv, sizeof(iv_copy));
|
||||||
|
|
||||||
int result = aes256CryptCbc(key, MBEDTLS_AES_DECRYPT, dataLength, iv_copy, inData, outData);
|
int result = aes256CryptCbc(key, AES_MODE_DECRYPT, dataLength, iv_copy, inData, outData);
|
||||||
mbedtls_platform_zeroize(key, sizeof(key));
|
mbedtls_platform_zeroize(key, sizeof(key));
|
||||||
mbedtls_platform_zeroize(iv_copy, sizeof(iv_copy));
|
mbedtls_platform_zeroize(iv_copy, sizeof(iv_copy));
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@ -1,42 +1,20 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
#include <mbedtls/module.h>
|
#include <mbedtls/module.h>
|
||||||
|
|
||||||
#include <mbedtls/ctr_drbg.h>
|
// mbedTLS 4.x removed or privatized most legacy primitives with no public replacement (ctr_drbg,
|
||||||
#include <mbedtls/entropy.h>
|
// entropy, cipher, bignum, rsa, most of pk, ecp, ecdsa, ecdh - PSA Crypto is the sanctioned
|
||||||
#include <mbedtls/cipher.h>
|
// replacement now). True on both ESP-IDF's bundled mbedTLS and the simulator's vendored
|
||||||
|
// Libraries/mbedtls, now the same major version. Nothing in this repo consumes any of these
|
||||||
|
// symbols directly - this table is speculative ABI surface for side-loaded ELF apps - so it
|
||||||
|
// shrinks to what's still genuinely public: plain message-digest hashing and error strings.
|
||||||
|
// See ESP_IDF_6.1_BREAKING_CHANGES.md §6.1.
|
||||||
#include <mbedtls/md.h>
|
#include <mbedtls/md.h>
|
||||||
#include <mbedtls/bignum.h>
|
|
||||||
#include <mbedtls/rsa.h>
|
|
||||||
#include <mbedtls/pk.h>
|
|
||||||
#include <mbedtls/ecp.h>
|
|
||||||
#include <mbedtls/ecdsa.h>
|
|
||||||
#include <mbedtls/ecdh.h>
|
|
||||||
#include <mbedtls/error.h>
|
#include <mbedtls/error.h>
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
||||||
static const ModuleSymbol SYMBOLS[] = {
|
static const ModuleSymbol SYMBOLS[] = {
|
||||||
// CTR_DRBG (random number generation)
|
// Message digest
|
||||||
DEFINE_MODULE_SYMBOL(mbedtls_ctr_drbg_init),
|
|
||||||
DEFINE_MODULE_SYMBOL(mbedtls_ctr_drbg_free),
|
|
||||||
DEFINE_MODULE_SYMBOL(mbedtls_ctr_drbg_seed),
|
|
||||||
DEFINE_MODULE_SYMBOL(mbedtls_ctr_drbg_random),
|
|
||||||
// Entropy
|
|
||||||
DEFINE_MODULE_SYMBOL(mbedtls_entropy_init),
|
|
||||||
DEFINE_MODULE_SYMBOL(mbedtls_entropy_free),
|
|
||||||
DEFINE_MODULE_SYMBOL(mbedtls_entropy_func),
|
|
||||||
// Cipher
|
|
||||||
DEFINE_MODULE_SYMBOL(mbedtls_cipher_init),
|
|
||||||
DEFINE_MODULE_SYMBOL(mbedtls_cipher_free),
|
|
||||||
DEFINE_MODULE_SYMBOL(mbedtls_cipher_setup),
|
|
||||||
DEFINE_MODULE_SYMBOL(mbedtls_cipher_setkey),
|
|
||||||
DEFINE_MODULE_SYMBOL(mbedtls_cipher_set_iv),
|
|
||||||
DEFINE_MODULE_SYMBOL(mbedtls_cipher_reset),
|
|
||||||
DEFINE_MODULE_SYMBOL(mbedtls_cipher_update),
|
|
||||||
DEFINE_MODULE_SYMBOL(mbedtls_cipher_finish),
|
|
||||||
DEFINE_MODULE_SYMBOL(mbedtls_cipher_get_block_size),
|
|
||||||
DEFINE_MODULE_SYMBOL(mbedtls_cipher_info_from_type),
|
|
||||||
// Message digest / HMAC
|
|
||||||
DEFINE_MODULE_SYMBOL(mbedtls_md),
|
DEFINE_MODULE_SYMBOL(mbedtls_md),
|
||||||
DEFINE_MODULE_SYMBOL(mbedtls_md_init),
|
DEFINE_MODULE_SYMBOL(mbedtls_md_init),
|
||||||
DEFINE_MODULE_SYMBOL(mbedtls_md_free),
|
DEFINE_MODULE_SYMBOL(mbedtls_md_free),
|
||||||
@ -44,54 +22,7 @@ static const ModuleSymbol SYMBOLS[] = {
|
|||||||
DEFINE_MODULE_SYMBOL(mbedtls_md_starts),
|
DEFINE_MODULE_SYMBOL(mbedtls_md_starts),
|
||||||
DEFINE_MODULE_SYMBOL(mbedtls_md_update),
|
DEFINE_MODULE_SYMBOL(mbedtls_md_update),
|
||||||
DEFINE_MODULE_SYMBOL(mbedtls_md_finish),
|
DEFINE_MODULE_SYMBOL(mbedtls_md_finish),
|
||||||
DEFINE_MODULE_SYMBOL(mbedtls_md_hmac_starts),
|
|
||||||
DEFINE_MODULE_SYMBOL(mbedtls_md_hmac_update),
|
|
||||||
DEFINE_MODULE_SYMBOL(mbedtls_md_hmac_finish),
|
|
||||||
DEFINE_MODULE_SYMBOL(mbedtls_md_info_from_type),
|
DEFINE_MODULE_SYMBOL(mbedtls_md_info_from_type),
|
||||||
// Bignum (MPI)
|
|
||||||
DEFINE_MODULE_SYMBOL(mbedtls_mpi_init),
|
|
||||||
DEFINE_MODULE_SYMBOL(mbedtls_mpi_free),
|
|
||||||
DEFINE_MODULE_SYMBOL(mbedtls_mpi_read_binary),
|
|
||||||
DEFINE_MODULE_SYMBOL(mbedtls_mpi_write_binary),
|
|
||||||
DEFINE_MODULE_SYMBOL(mbedtls_mpi_size),
|
|
||||||
DEFINE_MODULE_SYMBOL(mbedtls_mpi_bitlen),
|
|
||||||
DEFINE_MODULE_SYMBOL(mbedtls_mpi_lset),
|
|
||||||
DEFINE_MODULE_SYMBOL(mbedtls_mpi_set_bit),
|
|
||||||
DEFINE_MODULE_SYMBOL(mbedtls_mpi_fill_random),
|
|
||||||
DEFINE_MODULE_SYMBOL(mbedtls_mpi_exp_mod),
|
|
||||||
// RSA
|
|
||||||
DEFINE_MODULE_SYMBOL(mbedtls_rsa_init),
|
|
||||||
DEFINE_MODULE_SYMBOL(mbedtls_rsa_free),
|
|
||||||
DEFINE_MODULE_SYMBOL(mbedtls_rsa_copy),
|
|
||||||
DEFINE_MODULE_SYMBOL(mbedtls_rsa_get_len),
|
|
||||||
DEFINE_MODULE_SYMBOL(mbedtls_rsa_check_pubkey),
|
|
||||||
DEFINE_MODULE_SYMBOL(mbedtls_rsa_check_privkey),
|
|
||||||
DEFINE_MODULE_SYMBOL(mbedtls_rsa_pkcs1_sign),
|
|
||||||
DEFINE_MODULE_SYMBOL(mbedtls_rsa_pkcs1_verify),
|
|
||||||
// Public key abstraction
|
|
||||||
DEFINE_MODULE_SYMBOL(mbedtls_pk_init),
|
|
||||||
DEFINE_MODULE_SYMBOL(mbedtls_pk_free),
|
|
||||||
DEFINE_MODULE_SYMBOL(mbedtls_pk_get_type),
|
|
||||||
DEFINE_MODULE_SYMBOL(mbedtls_pk_parse_key),
|
|
||||||
DEFINE_MODULE_SYMBOL(mbedtls_pk_parse_keyfile),
|
|
||||||
// ECP (elliptic curves)
|
|
||||||
DEFINE_MODULE_SYMBOL(mbedtls_ecp_group_load),
|
|
||||||
DEFINE_MODULE_SYMBOL(mbedtls_ecp_point_init),
|
|
||||||
DEFINE_MODULE_SYMBOL(mbedtls_ecp_point_free),
|
|
||||||
DEFINE_MODULE_SYMBOL(mbedtls_ecp_point_read_binary),
|
|
||||||
DEFINE_MODULE_SYMBOL(mbedtls_ecp_point_write_binary),
|
|
||||||
DEFINE_MODULE_SYMBOL(mbedtls_ecp_check_pubkey),
|
|
||||||
DEFINE_MODULE_SYMBOL(mbedtls_ecp_check_privkey),
|
|
||||||
DEFINE_MODULE_SYMBOL(mbedtls_ecp_mul),
|
|
||||||
// ECDSA
|
|
||||||
DEFINE_MODULE_SYMBOL(mbedtls_ecdsa_init),
|
|
||||||
DEFINE_MODULE_SYMBOL(mbedtls_ecdsa_free),
|
|
||||||
DEFINE_MODULE_SYMBOL(mbedtls_ecdsa_genkey),
|
|
||||||
DEFINE_MODULE_SYMBOL(mbedtls_ecdsa_from_keypair),
|
|
||||||
DEFINE_MODULE_SYMBOL(mbedtls_ecdsa_sign),
|
|
||||||
DEFINE_MODULE_SYMBOL(mbedtls_ecdsa_verify),
|
|
||||||
// ECDH
|
|
||||||
DEFINE_MODULE_SYMBOL(mbedtls_ecdh_compute_shared),
|
|
||||||
// Error strings
|
// Error strings
|
||||||
DEFINE_MODULE_SYMBOL(mbedtls_strerror),
|
DEFINE_MODULE_SYMBOL(mbedtls_strerror),
|
||||||
MODULE_SYMBOL_TERMINATOR,
|
MODULE_SYMBOL_TERMINATOR,
|
||||||
|
|||||||
@ -16,7 +16,7 @@ idf_component_register(
|
|||||||
SRCS ${SOURCES}
|
SRCS ${SOURCES}
|
||||||
INCLUDE_DIRS "include/"
|
INCLUDE_DIRS "include/"
|
||||||
PRIV_INCLUDE_DIRS "private/"
|
PRIV_INCLUDE_DIRS "private/"
|
||||||
REQUIRES TactilityKernel TactilityKernelCpp driver esp_adc esp_driver_i2c esp_lcd vfs fatfs esp_wifi esp_netif esp_event
|
REQUIRES TactilityKernel TactilityKernelCpp driver esp_adc esp_driver_i2c esp_driver_i2s esp_driver_ledc esp_driver_uart esp_lcd vfs fatfs esp_wifi esp_netif esp_event
|
||||||
PRIV_REQUIRES ${PRIV_REQUIRES_LIST}
|
PRIV_REQUIRES ${PRIV_REQUIRES_LIST}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@ -3,5 +3,5 @@
|
|||||||
struct FirmwareOps;
|
struct FirmwareOps;
|
||||||
|
|
||||||
/** @return the esp_hosted co-processor FirmwareOps implementation. Only declared/linked when
|
/** @return the esp_hosted co-processor FirmwareOps implementation. Only declared/linked when
|
||||||
* CONFIG_SLAVE_SOC_WIFI_SUPPORTED - callers (esp32_wifi.cpp) must guard with the same #if. */
|
* CONFIG_ESP_HOSTED_ENABLED - callers (esp32_wifi.cpp) must guard with the same #if. */
|
||||||
const FirmwareOps* esp32_esp_hosted_ota_get_ops();
|
const FirmwareOps* esp32_esp_hosted_ota_get_ops();
|
||||||
|
|||||||
@ -10,7 +10,7 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct Esp32I2sConfig {
|
struct Esp32I2sConfig {
|
||||||
i2s_port_t port;
|
int port;
|
||||||
struct GpioPinSpec pin_bclk;
|
struct GpioPinSpec pin_bclk;
|
||||||
struct GpioPinSpec pin_ws;
|
struct GpioPinSpec pin_ws;
|
||||||
struct GpioPinSpec pin_data_out;
|
struct GpioPinSpec pin_data_out;
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
#include <sdkconfig.h>
|
#include <sdkconfig.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_SLAVE_SOC_WIFI_SUPPORTED)
|
#if defined(CONFIG_ESP_HOSTED_ENABLED)
|
||||||
|
|
||||||
#include <tactility/drivers/esp32_esp_hosted_ota.h>
|
#include <tactility/drivers/esp32_esp_hosted_ota.h>
|
||||||
#include <tactility/drivers/wifi.h>
|
#include <tactility/drivers/wifi.h>
|
||||||
@ -251,4 +251,4 @@ const FirmwareOps* esp32_esp_hosted_ota_get_ops() {
|
|||||||
return &firmwareOps;
|
return &firmwareOps;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // CONFIG_SLAVE_SOC_WIFI_SUPPORTED
|
#endif // CONFIG_ESP_HOSTED_ENABLED
|
||||||
|
|||||||
@ -110,8 +110,7 @@ static error_t start(Device* device) {
|
|||||||
},
|
},
|
||||||
.bus_width = 8,
|
.bus_width = 8,
|
||||||
.max_transfer_bytes = static_cast<size_t>(config->max_transfer_bytes),
|
.max_transfer_bytes = static_cast<size_t>(config->max_transfer_bytes),
|
||||||
.psram_trans_align = 64,
|
.dma_burst_size = 64,
|
||||||
.sram_trans_align = 4
|
|
||||||
};
|
};
|
||||||
|
|
||||||
esp_err_t ret = esp_lcd_new_i80_bus(&bus_cfg, &data->bus_handle);
|
esp_err_t ret = esp_lcd_new_i80_bus(&bus_cfg, &data->bus_handle);
|
||||||
|
|||||||
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
#include <TactilityCpp/Allocator.h>
|
#include <TactilityCpp/Allocator.h>
|
||||||
|
|
||||||
#if defined(CONFIG_SLAVE_SOC_WIFI_SUPPORTED)
|
#if defined(CONFIG_ESP_HOSTED_ENABLED)
|
||||||
#include <tactility/drivers/esp32_esp_hosted_ota.h>
|
#include <tactility/drivers/esp32_esp_hosted_ota.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -81,8 +81,6 @@ WifiAuthenticationType to_wifi_authentication_type(wifi_auth_mode_t mode) {
|
|||||||
case WIFI_AUTH_WAPI_PSK: return WIFI_AUTHENTICATION_TYPE_WAPI_PSK;
|
case WIFI_AUTH_WAPI_PSK: return WIFI_AUTHENTICATION_TYPE_WAPI_PSK;
|
||||||
case WIFI_AUTH_OWE: return WIFI_AUTHENTICATION_TYPE_OWE;
|
case WIFI_AUTH_OWE: return WIFI_AUTHENTICATION_TYPE_OWE;
|
||||||
case WIFI_AUTH_WPA3_ENT_192: return WIFI_AUTHENTICATION_TYPE_WPA3_ENT_192;
|
case WIFI_AUTH_WPA3_ENT_192: return WIFI_AUTHENTICATION_TYPE_WPA3_ENT_192;
|
||||||
case WIFI_AUTH_WPA3_EXT_PSK: return WIFI_AUTHENTICATION_TYPE_WPA3_EXT_PSK;
|
|
||||||
case WIFI_AUTH_WPA3_EXT_PSK_MIXED_MODE: return WIFI_AUTHENTICATION_TYPE_WPA3_EXT_PSK_MIXED_MODE;
|
|
||||||
default: return WIFI_AUTHENTICATION_TYPE_OPEN;
|
default: return WIFI_AUTHENTICATION_TYPE_OPEN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -585,7 +583,7 @@ error_t api_get_firmware_ops(Device* /*device*/, const FirmwareOps** ops, void**
|
|||||||
if (ops == nullptr || ctx == nullptr) {
|
if (ops == nullptr || ctx == nullptr) {
|
||||||
return ERROR_INVALID_ARGUMENT;
|
return ERROR_INVALID_ARGUMENT;
|
||||||
}
|
}
|
||||||
#if defined(CONFIG_SLAVE_SOC_WIFI_SUPPORTED)
|
#if defined(CONFIG_ESP_HOSTED_ENABLED)
|
||||||
// Only meaningful on a hosted board (P4+C6/C5 etc.) - this wifi device is backed by a real
|
// Only meaningful on a hosted board (P4+C6/C5 etc.) - this wifi device is backed by a real
|
||||||
// co-processor with its own updatable firmware there. On a native (non-hosted) chip, this
|
// co-processor with its own updatable firmware there. On a native (non-hosted) chip, this
|
||||||
// device's "radio" is the chip's own built-in WiFi, nothing to update via this interface.
|
// device's "radio" is the chip's own built-in WiFi, nothing to update via this interface.
|
||||||
|
|||||||
@ -66,7 +66,7 @@ if (DEFINED ENV{ESP_IDF_VERSION})
|
|||||||
esp_http_client
|
esp_http_client
|
||||||
esp-tls
|
esp-tls
|
||||||
esp_wifi
|
esp_wifi
|
||||||
json # Effectively cJSON
|
espressif__cjson
|
||||||
nvs_flash
|
nvs_flash
|
||||||
spiffs
|
spiffs
|
||||||
vfs
|
vfs
|
||||||
|
|||||||
@ -25,6 +25,7 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
#include <format>
|
#include <format>
|
||||||
|
#include <string_view>
|
||||||
|
|
||||||
namespace tt::app::apphub {
|
namespace tt::app::apphub {
|
||||||
|
|
||||||
@ -125,7 +126,7 @@ void showApps(Context* ctx) {
|
|||||||
std::erase_if(ctx->entries, [](const AppHubEntry& entry) {
|
std::erase_if(ctx->entries, [](const AppHubEntry& entry) {
|
||||||
#ifdef ESP_PLATFORM
|
#ifdef ESP_PLATFORM
|
||||||
return !entry.targetPlatforms.empty() &&
|
return !entry.targetPlatforms.empty() &&
|
||||||
std::ranges::find(entry.targetPlatforms, CONFIG_IDF_TARGET) == entry.targetPlatforms.end();
|
std::ranges::find(entry.targetPlatforms, std::string_view(CONFIG_IDF_TARGET)) == entry.targetPlatforms.end();
|
||||||
#else
|
#else
|
||||||
(void)entry;
|
(void)entry;
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
#include <sdkconfig.h>
|
#include <sdkconfig.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_SLAVE_SOC_WIFI_SUPPORTED)
|
#if defined(CONFIG_ESP_HOSTED_ENABLED)
|
||||||
|
|
||||||
#include <Tactility/service/espnow/EspNowBackend.h>
|
#include <Tactility/service/espnow/EspNowBackend.h>
|
||||||
#include <Tactility/service/espnow/EspNowHostedTransport.h>
|
#include <Tactility/service/espnow/EspNowHostedTransport.h>
|
||||||
@ -310,4 +310,4 @@ uint32_t getVersion() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // CONFIG_SLAVE_SOC_WIFI_SUPPORTED
|
#endif // CONFIG_ESP_HOSTED_ENABLED
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
#include <sdkconfig.h>
|
#include <sdkconfig.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_SOC_WIFI_SUPPORTED) && !defined(CONFIG_SLAVE_SOC_WIFI_SUPPORTED)
|
#if defined(CONFIG_SOC_WIFI_SUPPORTED) && !defined(CONFIG_ESP_HOSTED_ENABLED)
|
||||||
|
|
||||||
#include <Tactility/service/espnow/EspNowBackend.h>
|
#include <Tactility/service/espnow/EspNowBackend.h>
|
||||||
#include <Tactility/service/wifi/Wifi.h>
|
#include <Tactility/service/wifi/Wifi.h>
|
||||||
@ -205,4 +205,4 @@ uint32_t getVersion() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // CONFIG_SOC_WIFI_SUPPORTED && !CONFIG_SLAVE_SOC_WIFI_SUPPORTED
|
#endif // CONFIG_SOC_WIFI_SUPPORTED && !CONFIG_ESP_HOSTED_ENABLED
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
dependencies:
|
dependencies:
|
||||||
|
espressif/cjson: "^1.7.19"
|
||||||
espressif/esp_codec_dev: "1.5.10"
|
espressif/esp_codec_dev: "1.5.10"
|
||||||
espressif/esp_video:
|
espressif/esp_video:
|
||||||
version: "2.2.0"
|
version: "2.2.0"
|
||||||
@ -17,11 +18,11 @@ dependencies:
|
|||||||
rules:
|
rules:
|
||||||
- if: "target in [esp32, esp32s3]"
|
- if: "target in [esp32, esp32s3]"
|
||||||
atanisoft/esp_lcd_ili9488:
|
atanisoft/esp_lcd_ili9488:
|
||||||
version: "1.0.10"
|
version: "1.1.1"
|
||||||
rules:
|
rules:
|
||||||
- if: "target in [esp32, esp32s3]"
|
- if: "target in [esp32, esp32s3]"
|
||||||
teriyakigod/esp_lcd_st7735:
|
waveshare/esp_lcd_st7735:
|
||||||
version: "0.0.1"
|
version: "2.0.0"
|
||||||
rules:
|
rules:
|
||||||
- if: "target in [esp32, esp32s3]"
|
- if: "target in [esp32, esp32s3]"
|
||||||
espressif/elf_loader: "1.3.3"
|
espressif/elf_loader: "1.3.3"
|
||||||
@ -36,16 +37,16 @@ dependencies:
|
|||||||
espressif/esp_lcd_axs15231b: "2.0.2"
|
espressif/esp_lcd_axs15231b: "2.0.2"
|
||||||
lambage/esp_lcd_touch_ft6336u: "1.0.8"
|
lambage/esp_lcd_touch_ft6336u: "1.0.8"
|
||||||
espressif/esp_lcd_st7701:
|
espressif/esp_lcd_st7701:
|
||||||
version: "1.1.3"
|
version: "2.0.2~2"
|
||||||
rules:
|
rules:
|
||||||
- if: "target in [esp32s3, esp32p4]"
|
- if: "target in [esp32s3, esp32p4]"
|
||||||
espressif/esp_lcd_st7796:
|
espressif/esp_lcd_st7796:
|
||||||
version: "1.3.4"
|
version: "1.3.4"
|
||||||
rules:
|
rules:
|
||||||
- if: "target in [esp32, esp32s3]"
|
- if: "target in [esp32, esp32s3]"
|
||||||
espressif/esp_lcd_gc9a01: "2.0.3"
|
espressif/esp_lcd_gc9a01: "2.0.4"
|
||||||
espressif/esp_lcd_jd9165:
|
espressif/esp_lcd_jd9165:
|
||||||
version: "1.0.3"
|
version: "2.0.2"
|
||||||
rules:
|
rules:
|
||||||
# More hardware seems to be supported - enable as needed
|
# More hardware seems to be supported - enable as needed
|
||||||
- if: "target in [esp32p4]"
|
- if: "target in [esp32p4]"
|
||||||
@ -91,8 +92,8 @@ dependencies:
|
|||||||
rules:
|
rules:
|
||||||
- if: "target in [esp32s3, esp32p4]"
|
- if: "target in [esp32s3, esp32p4]"
|
||||||
jgromes/radiolib:
|
jgromes/radiolib:
|
||||||
version: "7.3.0"
|
version: "7.7.1"
|
||||||
rules:
|
rules:
|
||||||
- if: "target in [esp32, esp32s3, esp32p4]"
|
- if: "target in [esp32, esp32s3, esp32p4]"
|
||||||
idf: '5.5.2'
|
idf: '6.1.0'
|
||||||
|
|
||||||
|
|||||||
18
device.py
18
device.py
@ -150,6 +150,13 @@ def write_core_variables(output_file, device_properties: dict):
|
|||||||
idf_target = get_property_or_exit(device_properties, "hardware.target").lower()
|
idf_target = get_property_or_exit(device_properties, "hardware.target").lower()
|
||||||
output_file.write("# Target\n")
|
output_file.write("# Target\n")
|
||||||
output_file.write(f"CONFIG_IDF_TARGET=\"{idf_target}\"\n")
|
output_file.write(f"CONFIG_IDF_TARGET=\"{idf_target}\"\n")
|
||||||
|
# ESP-IDF 6.x defaults default warnings (incl. -Wmissing-field-initializers) to errors;
|
||||||
|
# this codebase's designated initializers rely on the old warn-only behavior.
|
||||||
|
output_file.write("CONFIG_COMPILER_DISABLE_DEFAULT_ERRORS=y\n")
|
||||||
|
# ESP-IDF 6.x defaults to Picolibc, which drops per-task stdio redirection and some
|
||||||
|
# newlib-internal symbols (_ctype_, __getreent) this repo's ELF-loader ABI exports.
|
||||||
|
# Stay on Newlib rather than re-auditing every per-task stdio assumption.
|
||||||
|
output_file.write("CONFIG_LIBC_NEWLIB=y\n")
|
||||||
output_file.write("# CPU\n")
|
output_file.write("# CPU\n")
|
||||||
output_file.write("CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y\n")
|
output_file.write("CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y\n")
|
||||||
output_file.write("CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ=240\n")
|
output_file.write("CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ=240\n")
|
||||||
@ -157,8 +164,8 @@ def write_core_variables(output_file, device_properties: dict):
|
|||||||
output_file.write(f"CONFIG_{idf_target.upper()}_DEFAULT_CPU_FREQ_MHZ=240\n")
|
output_file.write(f"CONFIG_{idf_target.upper()}_DEFAULT_CPU_FREQ_MHZ=240\n")
|
||||||
if idf_target != "esp32": # Not available on original ESP32
|
if idf_target != "esp32": # Not available on original ESP32
|
||||||
output_file.write("# Enable usage of MALLOC_CAP_EXEC on IRAM:\n")
|
output_file.write("# Enable usage of MALLOC_CAP_EXEC on IRAM:\n")
|
||||||
output_file.write("CONFIG_ESP_SYSTEM_MEMPROT_FEATURE=n\n")
|
output_file.write("CONFIG_ESP_SYSTEM_MEMPROT=n\n")
|
||||||
output_file.write("CONFIG_ESP_SYSTEM_MEMPROT_FEATURE_LOCK=n\n")
|
output_file.write("CONFIG_ESP_SYSTEM_MEMPROT_PMS_LOCK=n\n")
|
||||||
else:
|
else:
|
||||||
# Original ESP32 has very limited IRAM (~328KB shared with Wi-Fi/BT).
|
# Original ESP32 has very limited IRAM (~328KB shared with Wi-Fi/BT).
|
||||||
# Disable Wi-Fi IRAM optimizations to free ~27KB; throughput impact is
|
# Disable Wi-Fi IRAM optimizations to free ~27KB; throughput impact is
|
||||||
@ -181,6 +188,13 @@ def write_flash_variables(output_file, device_properties: dict):
|
|||||||
esptool_flash_freq = get_property_or_none(device_properties, "hardware.esptoolFlashFreq")
|
esptool_flash_freq = get_property_or_none(device_properties, "hardware.esptoolFlashFreq")
|
||||||
if esptool_flash_freq is not None:
|
if esptool_flash_freq is not None:
|
||||||
output_file.write(f"CONFIG_ESPTOOLPY_FLASHFREQ_{esptool_flash_freq}=y\n")
|
output_file.write(f"CONFIG_ESPTOOLPY_FLASHFREQ_{esptool_flash_freq}=y\n")
|
||||||
|
if esptool_flash_freq == "120M":
|
||||||
|
# >80MHz flash needs HPM; HPM-DC (dummy-cycle auto-tuning) requires a bootloader
|
||||||
|
# built with BOOTLOADER_FLASH_DC_AWARE, which existing units in the field don't have -
|
||||||
|
# disable it rather than force a bootloader reflash.
|
||||||
|
output_file.write("CONFIG_SPI_FLASH_HPM_ENA=y\n")
|
||||||
|
output_file.write("# CONFIG_SPI_FLASH_HPM_AUTO is not set\n")
|
||||||
|
output_file.write("CONFIG_SPI_FLASH_HPM_DC_DISABLE=y\n")
|
||||||
|
|
||||||
def write_spiram_variables(output_file, device_properties: dict):
|
def write_spiram_variables(output_file, device_properties: dict):
|
||||||
idf_target = get_property_or_exit(device_properties, "hardware.target").lower()
|
idf_target = get_property_or_exit(device_properties, "hardware.target").lower()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user