mirror of
https://github.com/espressif/esp-idf.git
synced 2026-08-18 06:35:35 +03:00
feat(pthread): Pthread can now use PSRAM as stack
Closes https://github.com/espressif/esp-idf/pull/10623 Closes https://github.com/espressif/esp-idf/issues/8662 Thanks to f-hoepfinger-hr-agrartechnik for the contribution in https://github.com/espressif/esp-idf/pull/10623
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
*/
|
||||
@@ -13,6 +13,33 @@
|
||||
|
||||
#include "unity.h"
|
||||
|
||||
TEST_CASE("esp_pthread_get_default_config creates correct stack memory capabilities", "[set_cfg]")
|
||||
{
|
||||
esp_pthread_cfg_t default_config = esp_pthread_get_default_config();
|
||||
|
||||
// The default must always be internal, 8-bit accessible RAM
|
||||
TEST_ASSERT_EQUAL_HEX(MALLOC_CAP_8BIT | MALLOC_CAP_INTERNAL, default_config.stack_alloc_caps);
|
||||
}
|
||||
|
||||
TEST_CASE("wrong heap caps are rejected", "[set_cfg]")
|
||||
{
|
||||
esp_pthread_cfg_t default_config = esp_pthread_get_default_config();
|
||||
|
||||
default_config.stack_alloc_caps = MALLOC_CAP_32BIT;
|
||||
TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, esp_pthread_set_cfg(&default_config));
|
||||
|
||||
default_config.stack_alloc_caps = MALLOC_CAP_32BIT | MALLOC_CAP_INTERNAL;
|
||||
TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, esp_pthread_set_cfg(&default_config));
|
||||
}
|
||||
|
||||
TEST_CASE("correct memory is accepted", "[set_cfg]")
|
||||
{
|
||||
esp_pthread_cfg_t default_config = esp_pthread_get_default_config();
|
||||
|
||||
default_config.stack_alloc_caps = MALLOC_CAP_8BIT | MALLOC_CAP_INTERNAL;
|
||||
TEST_ASSERT_EQUAL(ESP_OK, esp_pthread_set_cfg(&default_config));
|
||||
}
|
||||
|
||||
static void *compute_square(void *arg)
|
||||
{
|
||||
int *num = (int *) arg;
|
||||
|
||||
Reference in New Issue
Block a user