Commit Graph

331 Commits

Author SHA1 Message Date
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
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
Cao Sen Miao
4713a9a7f2 ESP32H2: Introduce new chip target esp32h2, hello_world example supported 2022-12-29 12:29:14 +08:00
Guillaume Souchere
a74ae7fba7 Merge branch 'feature/heap-trace-improve-spi-ram-support' into 'master'
heap_trace: improvements to formatting, code, comments of heap trace standalone

Closes IDFGH-8699

See merge request espressif/esp-idf!21506
2022-12-28 15:07:30 +08:00
Guillaume Souchere
89c0a259ee heap-trace: Add missing tests for heap_trace_summary() and heap_trace_dump_caps()
Note: the checks for the tests marked as [test-dump] are done in the pytest function
test_heap_trace_dump() since they are relying on the content of the heap_trace_dump_caps()
output.
2022-12-27 10:24:14 +01:00
Guillaume Souchere
c39a9de344 heap_trace: unify API to pass caps param to heap_trace_dump() 2022-12-27 10:23:30 +01:00
Guillaume Souchere
c92f2394f2 Merge branch 'fix/stack-check-fail-in-flash' into 'master'
esp_system: fix placement of __stack_chk_fail from flash to RAM

See merge request espressif/esp-idf!21465
2022-12-09 18:08:57 +08:00
Chip Weinberger
9afc386dd2 [Heap Trace Standalone] improvements to formatting, code, comments 2022-12-08 00:47:02 -08:00
Guillaume Souchere
4d16f46a88 esp_system: fix placement of __stack_chk_fail from flash to RAM
When stack check is enabled, certain functions (sometimes placed in RAM)
are being decorated with stack guards and a call to __stask_chk_fail() in
case ofr stack corruption. For this reason, __stack_chk_fail() must be
placed in RAM too.

Add stack check config in heap tests on all targets to find eventual flash to RAM
calls due to stack checks when running callgraph_check.py
2022-12-07 08:49:12 +01:00
Marius Vikhammer
36cb08c379 heap: add linux target support
Add wrappers for public heap API for the linux target.
2022-12-06 10:49:59 +08:00
Song Ruo Jing
1575b9e43a ci: Disable all currently failed target tests for esp32c6 2022-11-28 12:09:08 +08:00
Guillaume Souchere
1d16ca6a26 Merge branch 'feature/lower-iram-utilization-of-heap-component' into 'master'
heap: lower the utilization of IRAM by the heap component binary

Closes IDF-2282 and IDFGH-6233

See merge request espressif/esp-idf!20926
2022-11-25 15:22:05 +08:00