Commit Graph

341 Commits

Author SHA1 Message Date
Guillaume Souchere
27a78278a6 fix(heap): Patch tlsf_check_pool in ROM heap
The integrity_walker now calls the integrity check hook to control
free AND used blocks of memory in the TLSF pool. This integrity walker
function is called from tlsf_check_pool.

This commit creates a patch of integrity_walker function to update the
outdated implementation in the ROM.
2023-12-08 03:19:04 +00:00
Guillaume Souchere
6ac25c9324 fix(heap): Fixed integrity check on used blocks by the tlsf component
This commit updates the tlsf submodule to include the modification made in the component
aiming to perform integrity check on all blocks (not only the free ones).
Added test to test the fix in test_apps/heap_tests.

Fixes https://github.com/espressif/esp-idf/issues/12231
2023-12-08 03:19:04 +00:00
wuzhenghui
2302bc4862 fix(heap): fix memory caps defination in memory_layout
fix the issue on esp32c3 where retention memory was exhausted
prematurely and preventing the CPU from powering down because
all of the last level of RAM is retention dma accessible on
esp32c3.
2023-10-12 11:57:49 +08:00
Guillaume Souchere
8181da4fee heap: remove exclusion of esp32h2 as a target for no/light/comprehensive_poisoning tests 2023-07-04 11:08:59 +08:00
Marius Vikhammer
1bf26b2def Merge branch 'bugfix/incorrect_time_after_ota_v5.1' into 'release/v5.1'
esp_hw_support: Fix invalid system time if s_esp_rtc_time_us & s_rtc_last_ticks were moved around (v5.1)

See merge request espressif/esp-idf!24408
2023-07-03 20:37:40 +08:00
KonstantinKondrashov
6d0d2366f7 esp_hw_support: Fix invalid system time if s_esp_rtc_time_us & s_rtc_last_ticks were moved around
The commit fixes the case:
If variables in RTC RAM have been moved around by the linker,
they will be filled with garbage data. Any reset other than OTA would work fine
because the variables would still be initialized from the initial bootup.

So now system time will be valid even after OTA.

Closes https://github.com/espressif/esp-idf/issues/9448
2023-06-26 18:12:30 +08:00
Marius Vikhammer
c337759e24 core-system/linux-target: fixed heap_caps_realloc not correctly allocating the requested number of bytes
Closes https://github.com/espressif/esp-idf/issues/11523
2023-05-30 13:27:46 +08:00
Marius Vikhammer
e35897db33 Merge branch 'feature/heap-in-flash_v5.1' into 'release/v5.1'
heap: Add a configuration that places all the heap component in flash (v5.1)

See merge request espressif/esp-idf!23377
2023-05-12 15:57:31 +08:00
Marius Vikhammer
19a2e42770 ci: fix invalid kconfig options in system test apps 2023-05-10 09:42:12 +08:00
laokaiyao
954a6a2cff esp32h4: removed esp32h4 related codes 2023-04-26 18:53:12 +08:00
laokaiyao
cae47ce37e esp32h4: removed esp32h4 related files 2023-04-26 18:53:12 +08:00
Guillaume Souchere
d7b344c97a heap: Add a configuration that places all the heap component and related functionalities in flash when enabled
Add test configuration to run all tests with heap component in the flash.
Add reference to this new configuration in performance section of the documentation.
2023-04-25 01:12:10 +00:00
Marius Vikhammer
34fea0d38f system: add kconfig option for using parts of SRAM1 for IRAM
Using parts of SRAM1 for IRAM allows apps with more statically allocated IRAM

Closes https://github.com/espressif/esp-idf/issues/9824
2023-04-24 09:54:47 +08:00
Jakob Hasse
dac64725af esp_system, heap: increase host test timeout for CI 2023-04-06 10:23:44 +08:00
Guillaume Souchere
14fa303bbc heap: Use linked list in hashmap table to reduce collision, RAM usage and speed up the code 2023-04-05 07:44:29 +02:00
Guillaume Souchere
bdfc348ab3 heap: Add trace hash map config
- and place all added functions and vairables related to the hashmap in RAM
when the config is enabled only.

- add number of hash map entry as a Kconfig value and remove the hash map init function.
This prevents the user from allocating the hash map in flash and pass the pointer to the
init function (as the heap trace manipulate the hash map from functions placed in IRAM).

- add max linear value to the KConfig to make it configurable by the users.

- protect access to static variable "tracing"

- remove unecessary field in heap_trace_hashmap_entry_t
2023-04-05 07:44:29 +02:00
Chip Weinberger
b699033ab3 [Heap Trace] Perf: use hash map to speed up leaks mode 2023-04-05 07:44:29 +02:00
Marius Vikhammer
f627506f6b ci: update driver tests to use run_all_single_board_cases() 2023-03-28 17:05:50 +08:00
Marius Vikhammer
914bb81b95 ci: move linux host tests to test app folder 2023-03-27 17:41:44 +08:00
Guillaume Souchere
2f982107dc heap: Wrap the function hook feature under a configuration
also update heap_debug.rst and mem_alloc.rst to provide information about the feature
2023-03-23 04:50:49 +00:00
Guillaume Souchere
5a1f0cd63c heap: Make weak declaration for the alloc and free callbacks
- Fix "test get allocated size"
- Add tests for the free / alloc hooks
- Call alloc function hook on malloc/realloc/calloc base functions
- Add caps parameter to the allocation hook function
2023-03-23 04:50:49 +00:00
Chip Weinberger
1588c61c7b [Heap] new api for user heap trace callbacks 2023-03-23 04:50:49 +00:00
Zim Kalinowski
f6fc5e3c31 heap: fix and re-enable no-format warnings 2023-03-12 21:45:11 +01:00
Darian Leung
4069a62629 freertos(IDF): Remove usage of xPortGetFreeHeapSize() outside FreeRTOS
After heap_idf.c has been added (where the FreeRTOS heap is a subset of the
ESP-IDF heap), xPortGetFreeHeapSize() was updated to only returns the free
size of the FreeRTOS heap and not the entire ESP-IDF heap.

This commit replaces calls of xPortGetFreeHeapSize() with
esp_get_free_heap_size() in places outside of FreeRTOS.
2023-03-07 02:02:28 +08:00
Alexey Lapshin
4b54c49203 heap: fix gcc-12 compile errors 2023-02-22 05:33:03 +00:00
Guillaume Souchere
b1f9d7a8ee Merge branch 'feature/use-linked-list-for-heap-trace-records' into 'master'
heap: fix Leaks perf on large records by using doubly linked list

Closes IDFGH-9121 and IDF-1244

See merge request espressif/esp-idf!22009
2023-02-15 15:14:19 +08:00
Cao Sen Miao
fd3e0b0b18 esp32h2(ci): enable target test 2023-02-15 10:20:43 +08:00
Guillaume Souchere
2cf9236f6c heap trace standalone: Fix initialization of the unused linked list, update tests
- Call TAILQ_INSERT_TAIL in linked_list_setup to add unused records from the tail of the list
- Fix test "heap trace leak check" to expect that after a free, the record is zeroed instead of checking that
  the whole list of records is moved by one index in the array.
- Use esp_rom_printf() under lock instead of printf() since it does not rely on interrupts.
2023-02-14 09:48:14 +01:00
Marius Vikhammer
f9c1a2b791 Merge branch 'feature/core_c6_component_tests' into 'master'
ci: update idf-core related tests for C6

Closes IDF-6888

See merge request espressif/esp-idf!22282
2023-02-14 16:47:52 +08:00
Guillaume Souchere
a630f06132 Merge branch 'feature/verbose-alloc-failure-abort' into 'master'
heap: print size and caps when malloc fails before calling system abort

Closes IDFGH-9267

See merge request espressif/esp-idf!22192
2023-02-13 15:26:24 +08:00
Marius Vikhammer
25abc7f6d8 ci: update idf-core related tests for C6 2023-02-13 13:01:57 +08:00
Guillaume Souchere
65c946f1f2 heap: Fix priority in shex() bit shift 2023-02-10 07:43:32 +01:00
Chip Weinberger
f11256d9da [Logs] print size and caps when malloc fails 2023-02-09 06:49:34 -08:00
Guillaume Souchere
ba1d7f8d1c heap: Fix erroneous value returned by heap_caps_get_allocated_size() when poisoning is enabled
When light (or comprehensive) poisoning is enabled, the size requested by the user for allocation
is extended by a few bytes to store the canary header and footer. heap_caps_get_allocated_size() should
return the original size asked by the user (without the additional canary bytes).

test_malloc.c extended with a new test assuring that  heap_caps_get_allocated_size() returns the proper size
regardless of the degree of poisoning.
2023-02-01 10:04:38 +01:00
Guillaume Souchere
6382f28998 heap: Modify the memory type of the memory used as startup stack when memory protection is enabled
If memory protection is enabled on esp32c3 and esp32s3, we don't want to the heap component to see
the startup stack memory as D/IRAM but as DRAM only. Introduce a new type to make this possible in
the same fashion the regular D/IRAM regions are handled.
2023-01-26 10:52:34 +01:00
Guillaume Souchere
a26ecafa0d Merge branch 'fix/malloc_cap_exec_on_esp32c6' into 'master'
heap: Fix allocation issue when trying to allocate in IRAM on esp32c6

Closes IDF-6306

See merge request espressif/esp-idf!22077
2023-01-26 17:45:23 +08:00
Guillaume Souchere
fb9a7f36d4 heap: replace usage of bzero() with memset() across the component
See https://github.com/espressif/esp-idf/issues/5095
2023-01-25 09:28:56 +01:00
Guillaume Souchere
11f99ef649 heap: Add memory protection activation test
Check that when trying to allocate in IRAM with the system memory protection enabled,
null pointer is returned, or that an address in IRAM is returned if the memory protection
is disabled.
2023-01-25 07:20:57 +01:00
Guillaume Souchere
a5d6f62e7e heap: Prevent alloc from IRAM to call dram_alloc_to_iram() on esp32c6 target
Since DRAM and IRAM are superposed on esp32c6 it is not necessary to convert a freshly allocated
DRAM addr to its IRAM equivalent when MALLOC_CAP_EXEC is passed to heap_caps_malloc(). Instead,
proceed with a default allocation since the address returned by multi_heap_malloc() already belongs
to the IRAM region.

Applies for esp32c6 and every boards with superposed DRAM and IRAM addresses.
2023-01-23 07:42:20 +01:00
Chip Weinberger
a555563558 [Heap Trace Standalone] speed up sequential access 2023-01-18 08:48:28 +01:00
Cao Sen Miao
94120b82c2 esp32h2: add build test 2023-01-17 10:29:04 +08:00
Fu Hanxi
b02687a6c4 test: migrate linux target host test jobs into pytest-embedded 2023-01-16 10:25:55 +08:00
Chip Weinberger
26a5117870 [Heap Trace Standalone] fix terrible Leaks perf on large records by using doubly linked list 2023-01-13 11:43:09 +01:00
Martin Vychodil
1da27eb6fe Merge branch 'feature/storage_esp_partition_linux' into 'master'
esp_partition: added missing functions for linux target

See merge request espressif/esp-idf!21762
2023-01-13 02:04:54 +08:00
Chip Weinberger
8b2b430d68 [Heap Trace Standalone] fix terrible Leaks perf on large records by using doubly linked list 2023-01-10 21:01:11 -08:00
radek.tandler
9e191bad52 esp_partition/linux target: Add functions supporting host tests
Added statistics and wear simulation functions to support migration of
remaining storage related host tests from fixture to linux implementation
of esp_partition.
2023-01-10 14:10:14 +01:00
Guillaume Souchere
6dffac74e9 heap: Fix IRAM level 2 starting address
The IRAM level 2 address should start at the same address as DRAM level 2 and not DRAM level 3.
2023-01-06 09:30:36 +00:00
wuzhenghui
05e37ba214 esp32h2 memory: update esp32h2 memory layout 2023-01-06 05:30:24 +00:00
Guillaume Souchere
b5bacffbd3 esp_hw_support: allow writing in IRAM when CONFIG_ESP_SYSTEM_PMP_IDRAM_SPLIT is not set for esp32C2
when CONFIG_ESP_SYSTEM_PMP_IDRAM_SPLIT is not set, the PMP rule for esp32c2 shoud allow write access.
Fix esp_cpu_configure_region_protection() in cpu.c accordingly.
2023-01-02 08:41:16 +01:00
Guillaume Souchere
a218139d25 heap: RE-enable ESP32C2 test in test_apps 2023-01-02 08:40:59 +01:00