From 17a4a2527d5580f1fe36d823f6fd8839b0a46a5b Mon Sep 17 00:00:00 2001 From: Jeroen Domburg Date: Thu, 9 Mar 2017 19:59:09 +0800 Subject: [PATCH] MR things --- components/esp32/heap_alloc_caps.c | 10 +++++----- components/esp32/include/esp_heap_alloc_caps.h | 7 ++++--- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/components/esp32/heap_alloc_caps.c b/components/esp32/heap_alloc_caps.c index 6597ca7f0..1c6df9491 100644 --- a/components/esp32/heap_alloc_caps.c +++ b/components/esp32/heap_alloc_caps.c @@ -206,15 +206,15 @@ void heap_alloc_caps_init() { after the scheduler has started, the ROM stack is not used anymore by anything. We handle it instead by not allowing any mallocs from tag 1 (the IRAM/DRAM region) until the scheduler has started. - The 0x3ffe0000 region also contains static RAM for various ROM functions. The following lines knocks - out the regions for UART and ETSC, so these functions are usable. Libraries like xtos, which are + The 0x3ffe0000 region also contains static RAM for various ROM functions. The following lines + reserve the regions for UART and ETSC, so these functions are usable. Libraries like xtos, which are not usable in FreeRTOS anyway, are commented out in the linker script so they cannot be used; we do not disable their memory regions here and they will be used as general purpose heap memory. Enabling the heap allocator for this region but disabling allocation here until FreeRTOS is started up - is a somewhat risky action in theory, because on initializing the allocator, it will go and write linked - list entries at the start and end of all regions. For the ESP32, these linked list entries happen to end - up in a region that is not touched by the stack; they can be placed safely there.*/ + is a somewhat risky action in theory, because on initializing the allocator, vPortDefineHeapRegionsTagged + will go and write linked list entries at the start and end of all regions. For the ESP32, these linked + list entries happen to end up in a region that is not touched by the stack; they can be placed safely there.*/ disable_mem_region((void*)0x3ffe0000, (void*)0x3ffe0440); //Reserve ROM PRO data region disable_mem_region((void*)0x3ffe4000, (void*)0x3ffe4350); //Reserve ROM APP data region diff --git a/components/esp32/include/esp_heap_alloc_caps.h b/components/esp32/include/esp_heap_alloc_caps.h index 7a9844d16..e1021c30b 100644 --- a/components/esp32/include/esp_heap_alloc_caps.h +++ b/components/esp32/include/esp_heap_alloc_caps.h @@ -41,9 +41,10 @@ void heap_alloc_caps_init(); /** * @brief Enable the memory region where the startup stacks are located for allocation * - * On startup, the pro/app CPUs have a certain stack frame, so we cannot do allocations - * in the regions these stack frames are. When FreeRTOS is completely started, they do - * not use that memory anymore and allocation there can be re-enabled. + * On startup, the pro/app CPUs have a certain memory region they use as stack, so we + * cannot do allocations in the regions these stack frames are. When FreeRTOS is + * completely started, they do not use that memory anymore and allocation there can + * be re-enabled. */ void heap_alloc_enable_nonos_stack_tag();