11/*
2- * SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
2+ * SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
33 *
44 * SPDX-License-Identifier: Unlicense OR CC0-1.0
55 */
1818#include <stdlib.h>
1919#include <sys/param.h>
2020
21- #ifndef CONFIG_ESP_SYSTEM_MEMPROT_FEATURE
21+ #if !( CONFIG_ESP_SYSTEM_MEMPROT_FEATURE || CONFIG_ESP_SYSTEM_PMP_IDRAM_SPLIT )
2222TEST_CASE ("Capabilities allocator test" , "[heap]" )
2323{
2424 char * m1 , * m2 [10 ];
@@ -108,7 +108,7 @@ TEST_CASE("Capabilities allocator test", "[heap]")
108108 free (m1 );
109109 printf ("Done.\n" );
110110}
111- #endif // CONFIG_ESP_SYSTEM_MEMPROT_FEATURE
111+ #endif // !( CONFIG_ESP_SYSTEM_MEMPROT_FEATURE || CONFIG_ESP_SYSTEM_PMP_IDRAM_SPLIT)
112112
113113#ifdef CONFIG_ESP32_IRAM_AS_8BIT_ACCESSIBLE_MEMORY
114114TEST_CASE ("IRAM_8BIT capability test" , "[heap]" )
@@ -230,7 +230,7 @@ TEST_CASE("heap caps minimum free bytes fault cases", "[heap]")
230230/* Small function runs from IRAM to check that malloc/free/realloc
231231 all work OK when cache is disabled...
232232*/
233- #if !CONFIG_ESP_SYSTEM_MEMPROT_FEATURE && !CONFIG_HEAP_PLACE_FUNCTION_INTO_FLASH
233+ #if !( CONFIG_ESP_SYSTEM_MEMPROT_FEATURE || CONFIG_ESP_SYSTEM_PMP_IDRAM_SPLIT ) && !CONFIG_HEAP_PLACE_FUNCTION_INTO_FLASH
234234static IRAM_ATTR __attribute__((noinline )) bool iram_malloc_test (void )
235235{
236236 spi_flash_guard_get ()-> start (); // Disables flash cache
@@ -252,7 +252,7 @@ TEST_CASE("heap_caps_xxx functions work with flash cache disabled", "[heap]")
252252{
253253 TEST_ASSERT ( iram_malloc_test () );
254254}
255- #endif // CONFIG_ESP_SYSTEM_MEMPROT_FEATURE
255+ #endif // !( CONFIG_ESP_SYSTEM_MEMPROT_FEATURE || CONFIG_ESP_SYSTEM_PMP_IDRAM_SPLIT) && !CONFIG_HEAP_PLACE_FUNCTION_INTO_FLASH
256256
257257#ifdef CONFIG_HEAP_ABORT_WHEN_ALLOCATION_FAILS
258258TEST_CASE ("When enabled, allocation operation failure generates an abort" , "[heap][reset=abort,SW_CPU_RESET]" )
@@ -318,7 +318,7 @@ TEST_CASE("allocation with invalid capability should also trigger the alloc fail
318318 * In MR 16031, the priority of RTC memory has been adjusted to the lowest.
319319 * RTC memory will not be consumed a lot during the startup process.
320320 */
321- TEST_CASE ("RTC memory shoule be lowest priority and its free size should be big enough" , "[heap]" )
321+ TEST_CASE ("RTC memory should be lowest priority and its free size should be big enough" , "[heap]" )
322322{
323323 const size_t allocation_size = 1024 * 4 ;
324324 void * ptr = NULL ;
@@ -341,7 +341,7 @@ TEST_CASE("test memory protection features", "[heap][mem_prot]")
341341 // no memory is being allocated
342342 uint32_t * iram_ptr = heap_caps_malloc (4 , MALLOC_CAP_EXEC );
343343
344- #ifndef CONFIG_ESP_SYSTEM_MEMPROT_FEATURE
344+ #if !( CONFIG_ESP_SYSTEM_MEMPROT_FEATURE || CONFIG_ESP_SYSTEM_PMP_IDRAM_SPLIT )
345345 // System memory protection not active, check that iram_ptr is not null
346346 // Check that iram_ptr is in IRAM
347347 TEST_ASSERT_NOT_NULL (iram_ptr );
@@ -352,5 +352,5 @@ TEST_CASE("test memory protection features", "[heap][mem_prot]")
352352#else
353353 // System memory protection is active, DIRAM seen as DRAM, iram_ptr should be null
354354 TEST_ASSERT_NULL (iram_ptr );
355- #endif // CONFIG_ESP_SYSTEM_MEMPROT_FEATURE
355+ #endif // !( CONFIG_ESP_SYSTEM_MEMPROT_FEATURE || CONFIG_ESP_SYSTEM_PMP_IDRAM_SPLIT)
356356}
0 commit comments