Merge branch 'fix/twai_psram' into 'master'

test(twai): with malloc comes from PSRAM by default

Closes IDF-13045

See merge request espressif/esp-idf!39246
This commit is contained in:
morris
2025-05-20 10:30:53 +08:00
3 changed files with 5 additions and 3 deletions

View File

@ -579,8 +579,8 @@ esp_err_t twai_new_node_onchip(const twai_onchip_node_config_t *node_config, twa
ESP_RETURN_ON_FALSE(node_config->tx_queue_depth > 0, ESP_ERR_INVALID_ARG, TAG, "tx_queue_depth at least 1");
ESP_RETURN_ON_FALSE(!node_config->intr_priority || (BIT(node_config->intr_priority) & ESP_INTR_FLAG_LOWMED), ESP_ERR_INVALID_ARG, TAG, "Invalid intr_priority level");
// Allocate TWAI node object memory
twai_onchip_ctx_t *node = heap_caps_calloc(1, sizeof(twai_onchip_ctx_t) + twai_hal_get_mem_requirment(), TWAI_MALLOC_CAPS);
// Allocate TWAI node from internal memory because it contains atomic variable
twai_onchip_ctx_t *node = heap_caps_calloc(1, sizeof(twai_onchip_ctx_t) + twai_hal_get_mem_requirment(), MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT);
ESP_RETURN_ON_FALSE(node, ESP_ERR_NO_MEM, TAG, "No mem");
node->ctrlr_id = -1;
// Acquire controller

View File

@ -10,6 +10,6 @@ endif()
idf_component_register(
SRCS ${srcs}
PRIV_REQUIRES esp_driver_twai esp_timer esp_driver_uart
PRIV_REQUIRES esp_driver_twai esp_timer esp_driver_uart esp_psram
WHOLE_ARCHIVE
)

View File

@ -0,0 +1,2 @@
CONFIG_SPIRAM=y
CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL=0