forked from espressif/esp-idf
refactor(flash): spilt flash cap in esp_rom
This commit is contained in:
@@ -55,6 +55,10 @@ config ESP_ROM_HAS_SPI_FLASH
|
||||
bool
|
||||
default y
|
||||
|
||||
config ESP_ROM_HAS_SPI_FLASH_MMAP
|
||||
bool
|
||||
default y
|
||||
|
||||
config ESP_ROM_HAS_NEWLIB
|
||||
bool
|
||||
default y
|
||||
|
@@ -19,6 +19,7 @@
|
||||
#define ESP_ROM_MULTI_HEAP_WALK_PATCH (1) // ROM does not contain the patch of multi_heap_walk()
|
||||
#define ESP_ROM_HAS_LAYOUT_TABLE (1) // ROM has the layout table
|
||||
#define ESP_ROM_HAS_SPI_FLASH (1) // ROM has the implementation of SPI Flash driver
|
||||
#define ESP_ROM_HAS_SPI_FLASH_MMAP (1) // ROM has the implementation of SPI Flash mmap driver
|
||||
#define ESP_ROM_HAS_NEWLIB (1) // ROM has newlib (at least parts of it) functions included
|
||||
#define ESP_ROM_HAS_NEWLIB_NANO_FORMAT (1) // ROM has the newlib nano version of formatting functions
|
||||
#define ESP_ROM_NEEDS_SET_CACHE_MMU_SIZE (1) // ROM needs to set cache MMU size according to instruction and rodata for flash mmap
|
||||
|
@@ -55,6 +55,10 @@ config ESP_ROM_HAS_SPI_FLASH
|
||||
bool
|
||||
default y
|
||||
|
||||
config ESP_ROM_HAS_SPI_FLASH_MMAP
|
||||
bool
|
||||
default y
|
||||
|
||||
config ESP_ROM_HAS_ETS_PRINTF_BUG
|
||||
bool
|
||||
default y
|
||||
|
@@ -19,6 +19,7 @@
|
||||
#define ESP_ROM_NEEDS_SWSETUP_WORKAROUND (1) // ROM uses 32-bit time_t. A workaround is required to prevent printf functions from crashing
|
||||
#define ESP_ROM_HAS_LAYOUT_TABLE (1) // ROM has the layout table
|
||||
#define ESP_ROM_HAS_SPI_FLASH (1) // ROM has the implementation of SPI Flash driver
|
||||
#define ESP_ROM_HAS_SPI_FLASH_MMAP (1) // ROM has the implementation of SPI Flash mmap driver
|
||||
#define ESP_ROM_HAS_ETS_PRINTF_BUG (1) // ROM has ets_printf bug when disable the ROM log either by eFuse or RTC storage register
|
||||
#define ESP_ROM_HAS_NEWLIB (1) // ROM has newlib (at least parts of it) functions included
|
||||
#define ESP_ROM_HAS_NEWLIB_NANO_FORMAT (1) // ROM has the newlib nano version of formatting functions
|
||||
|
@@ -63,6 +63,10 @@ config ESP_ROM_HAS_SPI_FLASH
|
||||
bool
|
||||
default y
|
||||
|
||||
config ESP_ROM_HAS_SPI_FLASH_MMAP
|
||||
bool
|
||||
default y
|
||||
|
||||
config ESP_ROM_WITHOUT_REGI2C
|
||||
bool
|
||||
default y
|
||||
|
@@ -21,6 +21,7 @@
|
||||
#define ESP_ROM_MULTI_HEAP_WALK_PATCH (1) // ROM does not contain the patch of multi_heap_walk()
|
||||
#define ESP_ROM_HAS_LAYOUT_TABLE (1) // ROM has the layout table
|
||||
#define ESP_ROM_HAS_SPI_FLASH (1) // ROM has the implementation of SPI Flash driver
|
||||
#define ESP_ROM_HAS_SPI_FLASH_MMAP (1) // ROM has the implementation of SPI Flash mmap driver
|
||||
#define ESP_ROM_WITHOUT_REGI2C (1) // ROM has no regi2c APIs TODO: IDF-10110 need refactor
|
||||
#define ESP_ROM_HAS_NEWLIB (1) // ROM has newlib (at least parts of it) functions included
|
||||
#define ESP_ROM_HAS_NEWLIB_NORMAL_FORMAT (1) // ROM has the newlib normal/full version of formatting functions (as opposed to the nano versions)
|
||||
|
@@ -63,6 +63,10 @@ config ESP_ROM_HAS_SPI_FLASH
|
||||
bool
|
||||
default y
|
||||
|
||||
config ESP_ROM_HAS_SPI_FLASH_MMAP
|
||||
bool
|
||||
default y
|
||||
|
||||
config ESP_ROM_HAS_REGI2C_BUG
|
||||
bool
|
||||
default y
|
||||
|
@@ -21,6 +21,7 @@
|
||||
#define ESP_ROM_MULTI_HEAP_WALK_PATCH (1) // ROM does not contain the patch of multi_heap_walk()
|
||||
#define ESP_ROM_HAS_LAYOUT_TABLE (1) // ROM has the layout table
|
||||
#define ESP_ROM_HAS_SPI_FLASH (1) // ROM has the implementation of SPI Flash driver
|
||||
#define ESP_ROM_HAS_SPI_FLASH_MMAP (1) // ROM has the implementation of SPI Flash mmap driver
|
||||
#define ESP_ROM_HAS_REGI2C_BUG (1) // ROM has the regi2c bug
|
||||
#define ESP_ROM_HAS_NEWLIB (1) // ROM has newlib (at least parts of it) functions included
|
||||
#define ESP_ROM_HAS_NEWLIB_NORMAL_FORMAT (1) // ROM has the newlib normal/full version of formatting functions (as opposed to the nano versions)
|
||||
|
@@ -63,6 +63,10 @@ config ESP_ROM_HAS_SPI_FLASH
|
||||
bool
|
||||
default y
|
||||
|
||||
config ESP_ROM_HAS_SPI_FLASH_MMAP
|
||||
bool
|
||||
default y
|
||||
|
||||
config ESP_ROM_WITHOUT_REGI2C
|
||||
bool
|
||||
default y
|
||||
|
@@ -21,6 +21,7 @@
|
||||
#define ESP_ROM_MULTI_HEAP_WALK_PATCH (1) // ROM does not contain the patch of multi_heap_walk()
|
||||
#define ESP_ROM_HAS_LAYOUT_TABLE (1) // ROM has the layout table
|
||||
#define ESP_ROM_HAS_SPI_FLASH (1) // ROM has the implementation of SPI Flash driver
|
||||
#define ESP_ROM_HAS_SPI_FLASH_MMAP (1) // ROM has the implementation of SPI Flash mmap driver
|
||||
#define ESP_ROM_WITHOUT_REGI2C (1) // ROM has no regi2c APIs TODO: IDF-10110 need refactor
|
||||
#define ESP_ROM_HAS_NEWLIB (1) // ROM has newlib (at least parts of it) functions included
|
||||
#define ESP_ROM_HAS_NEWLIB_NANO_FORMAT (1) // ROM has the newlib nano version of formatting functions
|
||||
|
@@ -55,6 +55,10 @@ config ESP_ROM_HAS_SPI_FLASH
|
||||
bool
|
||||
default y
|
||||
|
||||
config ESP_ROM_HAS_SPI_FLASH_MMAP
|
||||
bool
|
||||
default y
|
||||
|
||||
config ESP_ROM_WITHOUT_REGI2C
|
||||
bool
|
||||
default y
|
||||
|
@@ -19,6 +19,7 @@
|
||||
#define ESP_ROM_MULTI_HEAP_WALK_PATCH (1) // ROM does not contain the patch of multi_heap_walk()
|
||||
#define ESP_ROM_HAS_LAYOUT_TABLE (1) // ROM has the layout table
|
||||
#define ESP_ROM_HAS_SPI_FLASH (1) // ROM has the implementation of SPI Flash driver
|
||||
#define ESP_ROM_HAS_SPI_FLASH_MMAP (1) // ROM has the implementation of SPI Flash mmap driver
|
||||
#define ESP_ROM_WITHOUT_REGI2C (1) // ROM has no regi2c APIs
|
||||
#define ESP_ROM_HAS_NEWLIB (1) // ROM has newlib (at least parts of it) functions included
|
||||
#define ESP_ROM_HAS_NEWLIB_NANO_FORMAT (1) // ROM has the newlib nano versions of formatting functions
|
||||
|
@@ -51,6 +51,10 @@ config ESP_ROM_HAS_SPI_FLASH
|
||||
bool
|
||||
default y
|
||||
|
||||
config ESP_ROM_HAS_SPI_FLASH_MMAP
|
||||
bool
|
||||
default y
|
||||
|
||||
config ESP_ROM_WITHOUT_REGI2C
|
||||
bool
|
||||
default y
|
||||
|
@@ -18,6 +18,7 @@
|
||||
#define ESP_ROM_MULTI_HEAP_WALK_PATCH (1) // ROM does not contain the patch of multi_heap_walk()
|
||||
#define ESP_ROM_HAS_LAYOUT_TABLE (1) // ROM has the layout table
|
||||
#define ESP_ROM_HAS_SPI_FLASH (1) // ROM has the implementation of SPI Flash driver
|
||||
#define ESP_ROM_HAS_SPI_FLASH_MMAP (1) // ROM has the implementation of SPI Flash mmap driver
|
||||
#define ESP_ROM_WITHOUT_REGI2C (1) // ROM has no regi2c APIs
|
||||
#define ESP_ROM_HAS_NEWLIB (1) // ROM has newlib (at least parts of it) functions included
|
||||
#define ESP_ROM_HAS_NEWLIB_NANO_FORMAT (1) // ROM has the newlib nano versions of formatting functions
|
||||
|
@@ -47,6 +47,10 @@ config ESP_ROM_HAS_LAYOUT_TABLE
|
||||
bool
|
||||
default y
|
||||
|
||||
config ESP_ROM_HAS_SPI_FLASH
|
||||
bool
|
||||
default y
|
||||
|
||||
config ESP_ROM_WITHOUT_REGI2C
|
||||
bool
|
||||
default y
|
||||
|
@@ -17,6 +17,7 @@
|
||||
#define ESP_ROM_HAS_HEAP_TLSF (1) // ROM has the implementation of the tlsf and multi-heap library
|
||||
#define ESP_ROM_MULTI_HEAP_WALK_PATCH (1) // ROM does not contain the patch of multi_heap_walk()
|
||||
#define ESP_ROM_HAS_LAYOUT_TABLE (1) // ROM has the layout table
|
||||
#define ESP_ROM_HAS_SPI_FLASH (1) // ROM has the implementation of SPI Flash driver
|
||||
#define ESP_ROM_WITHOUT_REGI2C (1) // ROM has the regi2c bug or rom does not support regi2c function
|
||||
#define ESP_ROM_HAS_NEWLIB (1) // ROM has newlib (at least parts of it) functions included
|
||||
#define ESP_ROM_HAS_NEWLIB_NANO_FORMAT (1) // ROM has the newlib nano versions of formatting functions
|
||||
|
@@ -63,6 +63,10 @@ config ESP_ROM_HAS_SPI_FLASH
|
||||
bool
|
||||
default y
|
||||
|
||||
config ESP_ROM_HAS_SPI_FLASH_MMAP
|
||||
bool
|
||||
default y
|
||||
|
||||
config ESP_ROM_HAS_ETS_PRINTF_BUG
|
||||
bool
|
||||
default y
|
||||
|
@@ -21,6 +21,7 @@
|
||||
#define ESP_ROM_NEEDS_SWSETUP_WORKAROUND (1) // ROM uses 32-bit time_t. A workaround is required to prevent printf functions from crashing
|
||||
#define ESP_ROM_HAS_LAYOUT_TABLE (1) // ROM has the layout table
|
||||
#define ESP_ROM_HAS_SPI_FLASH (1) // ROM has the implementation of SPI Flash driver
|
||||
#define ESP_ROM_HAS_SPI_FLASH_MMAP (1) // ROM has the implementation of SPI Flash mmap driver
|
||||
#define ESP_ROM_HAS_ETS_PRINTF_BUG (1) // ROM has ets_printf bug when disable the ROM log either by eFuse or RTC storage register
|
||||
#define ESP_ROM_HAS_NEWLIB (1) // ROM has newlib (at least parts of it) functions included
|
||||
#define ESP_ROM_HAS_NEWLIB_NANO_FORMAT (1) // ROM has the newlib nano version of formatting functions
|
||||
|
@@ -48,7 +48,7 @@ extern char _rodata_reserved_start;
|
||||
extern char _rodata_reserved_end;
|
||||
#endif
|
||||
|
||||
#if !CONFIG_SPI_FLASH_ROM_IMPL
|
||||
#if !ESP_ROM_HAS_SPI_FLASH_MMAP || !CONFIG_SPI_FLASH_ROM_IMPL
|
||||
|
||||
|
||||
typedef struct mmap_block_t {
|
||||
@@ -324,9 +324,9 @@ IRAM_ATTR bool spi_flash_check_and_flush_cache(size_t start_addr, size_t length)
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
#endif //!CONFIG_SPI_FLASH_ROM_IMPL
|
||||
#endif // !ESP_ROM_HAS_SPI_FLASH_MMAP || !CONFIG_SPI_FLASH_ROM_IMPL
|
||||
|
||||
#if !CONFIG_SPI_FLASH_ROM_IMPL || CONFIG_SPIRAM_FETCH_INSTRUCTIONS || CONFIG_SPIRAM_RODATA
|
||||
#if !ESP_ROM_HAS_SPI_FLASH_MMAP || !CONFIG_SPI_FLASH_ROM_IMPL || CONFIG_SPIRAM_FETCH_INSTRUCTIONS || CONFIG_SPIRAM_RODATA
|
||||
//The ROM implementation returns physical address of the PSRAM when the .text or .rodata is in the PSRAM.
|
||||
//Always patch it when SPIRAM_FETCH_INSTRUCTIONS or SPIRAM_RODATA is set.
|
||||
size_t spi_flash_cache2phys(const void *cached)
|
||||
@@ -401,4 +401,4 @@ const void * spi_flash_phys2cache(size_t phys_offs, spi_flash_mmap_memory_t memo
|
||||
assert(ret == ESP_OK);
|
||||
return (const void *)ptr;
|
||||
}
|
||||
#endif //!CONFIG_SPI_FLASH_ROM_IMPL || CONFIG_SPIRAM_FETCH_INSTRUCTIONS || CONFIG_SPIRAM_RODATA
|
||||
#endif //!ESP_ROM_HAS_SPI_FLASH_MMAP || !CONFIG_SPI_FLASH_ROM_IMPL || CONFIG_SPIRAM_FETCH_INSTRUCTIONS || CONFIG_SPIRAM_RODATA
|
||||
|
@@ -54,6 +54,7 @@
|
||||
#include "bootloader_flash_config.h"
|
||||
#include "esp_compiler.h"
|
||||
#include "esp_rom_efuse.h"
|
||||
#include "esp_rom_caps.h"
|
||||
#include "soc/chip_revision.h"
|
||||
#include "hal/efuse_hal.h"
|
||||
#if CONFIG_SPIRAM
|
||||
@@ -129,12 +130,14 @@ void IRAM_ATTR spi_flash_rom_impl_init(void)
|
||||
{
|
||||
spi_flash_guard_set(&g_flash_guard_default_ops);
|
||||
|
||||
#if ESP_ROM_HAS_SPI_FLASH_MMAP
|
||||
/* These two functions are in ROM only */
|
||||
extern void spi_flash_mmap_os_func_set(void *(*func1)(size_t size), void (*func2)(void *p));
|
||||
spi_flash_mmap_os_func_set(spi_flash_malloc_internal, heap_caps_free);
|
||||
|
||||
extern esp_err_t spi_flash_mmap_page_num_init(uint32_t page_num);
|
||||
spi_flash_mmap_page_num_init(128);
|
||||
#endif // ESP_ROM_HAS_SPI_FLASH_MMAP
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@@ -1,39 +0,0 @@
|
||||
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-C61 | ESP32-H2 | ESP32-H21 | ESP32-H4 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
|
||||
| ----------------- | ----- | -------- | -------- | -------- | -------- | --------- | -------- | --------- | -------- | -------- | -------- | -------- |
|
||||
|
||||
# Heap Task Tracking Example
|
||||
|
||||
## Overview
|
||||
|
||||
The example creates a task which allocates random amount of memory in each iteration and demonstrates use of internal API to get heap info on per task basis running in a system.
|
||||
|
||||
Heap task tracking feature has dependency on some of the internal heap debugging features (e.g. heap poisoning) which allows to store task control block in metadata of each heap block.
|
||||
|
||||
This adds small memory overhead on per heap block and hence this feature should be used for debugging purpose only.
|
||||
|
||||
### Configure the project
|
||||
|
||||
To change the `Heap Corruption Detection level`, open the project configuration menu (`idf.py menuconfig`).
|
||||
|
||||
Navigate to `Component config -> Heap memory debugging` menu. In `Heap corruption detection` menu select either "Light Impact" or "Comprehensive".
|
||||
|
||||
**Note:** Enabling “Comprehensive” detection has a substantial runtime performance impact.
|
||||
|
||||
### Build and Flash
|
||||
|
||||
Run `idf.py -p PORT flash monitor` to build and flash the project..
|
||||
|
||||
(To exit the serial monitor, type ``Ctrl-]``.)
|
||||
|
||||
See the [Getting Started Guide](https://docs.espressif.com/projects/esp-idf/en/latest/get-started/index.html) for full steps to configure and use ESP-IDF to build projects.
|
||||
|
||||
## Example Output
|
||||
|
||||
```
|
||||
Task: Pre-Scheduler allocs -> CAP_8BIT: 5360 CAP_32BIT: 0
|
||||
Task: esp_timer -> CAP_8BIT: 1724 CAP_32BIT: 0
|
||||
Task: ipc0 -> CAP_8BIT: 8316 CAP_32BIT: 0
|
||||
Task: main -> CAP_8BIT: 3480 CAP_32BIT: 0
|
||||
Task: ipc1 -> CAP_8BIT: 12 CAP_32BIT: 0
|
||||
Task: example_task -> CAP_8BIT: 696 CAP_32BIT: 0
|
||||
```
|
Reference in New Issue
Block a user