Wykres commitów

236 Commity (674f322b8709a953e04085c0b03cb307debab6b5)

Autor SHA1 Wiadomość Data
Guillaume Souchere 3b9450b59d 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-11-08 04:18:21 +00:00
Guillaume Souchere f4ab9a440a 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-22 07:32:49 +01:00
Guillaume Souchere c8e469b78d heap: Fix priority in shex() bit shift 2023-02-13 09:10:06 +01:00
Chip Weinberger 62d57edbc9 [Logs] print size and caps when malloc fails 2023-02-13 09:10:03 +01:00
Zim Kalinowski 2dec69fa82 Merge branch 'feature/lower-iram-utilization-of-heap-component_v4.4' into 'release/v4.4'
heap: lower the utilization of IRAM by the heap component binary (backport v4.4)

See merge request espressif/esp-idf!21237
2023-02-07 16:54:58 +08:00
Guillaume Souchere 85193654f0 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-31 07:57:02 +01:00
Guillaume Souchere 43ba878870 heap: fix linker issues and remove spi flash dependencies 2022-12-14 12:57:08 +01:00
Guillaume Souchere b78193700a feat: remove tlsf_fls and tlsf_ffs from linker as they are inlined. 2022-12-14 12:57:08 +01:00
Guillaume Souchere e0c92b3e04 tools: update list of references to not include symbold used by __assert_func calls
On xtensa architecture, the call to __assert_func uses a reference to __func__ that can
sometimes be placed in flash. Since the __asert_func can be called from functions in IRAM
the check_callgraph script can report an error when checking for invalid calls from IRAM
to flash sections. However, the __asert_func prevents this scenario at runtime so the
check_callgraph script reports a 'flas positive' situation. For this reasson, all references
to __func__$x found prior to a call to __assert_func are droped in the parsing of the rtl files.
2022-12-14 12:57:08 +01:00
Guillaume Souchere 9ec87993c8 heap: add check for usage of flash content from iram
this commits:
- adds build-time test to check that no call to flash regions are done from IRAM functions

- resolves problems related to IRAM function using content in flash memory

- update heap_caps_alloc_failed to use a default function name in DRAM
  when necessary instead of creating a function name variable in DRAM for
  each call of heap_caps_alloc_failed. This allows to save some extra bytes
  in RAM.
2022-12-14 12:57:08 +01:00
Guillaume Souchere 125609963e heap: add documentation about the function placement in IRAM and its usage in ISR
This commits adds a internal.md file in the heap directory to clarify the idea behind
which functions is placed in IRAM or in flash.

A section in mem_alloc.rst documentation is added to specify which functions from the
heap component API can be used in interrupt handlers.
2022-12-14 12:57:08 +01:00
Guillaume Souchere 6141600b61 heap: add selective placement of function in IRAM
This commit aims to place in the IRAM section only the functions that
are relevent for performance instead of placing the entire content of
multi_heap.c, mullti_heap_poisoning.c and tlsf.c in the IRAM.
2022-12-14 12:57:08 +01:00
Omar Chebib 049d21bb12 C/Cxx: unify static assertions with the macro ESP_STATIC_ASSERT
Closes https://github.com/espressif/esp-idf/issues/9938
2022-12-05 18:16:08 +08:00
Guillaume Souchere 75e1c4d0fb heap: Update host tests after incorporation of the new TLSF implementation 2022-10-27 09:36:17 +02:00
Guillaume Souchere d4de73cd2c heap: update the calculation of fl index max and use bitfield in control_t
The calculation of fl index max is changed to always be the smallest
number that includes the size of the registered memory.

The control_construct() function now checks for minimum size as the control structure
parameters are calculated.

There is no longer a minimum configuration for fl index max so the tlsf_config
enum is striped down to remove unecessary compile time values.

the tlsf_size() function will fail if no tlsf pointer is passed as parameter since there
is no way to calculate a default tlsf size anymore.

bitfields are now used in control_t when possible which reduces the size of the structure
from 56 bytes to 36 bytes.
2022-10-27 09:36:17 +02:00
Guillaume Souchere a1ca11551f Revert "tlsf control's structure should remain opaque"
This reverts commit 7010314c4a.
2022-09-20 08:58:04 +02:00
Philippe 6dae07d137 add host test with multiple heap size 2022-09-20 07:55:24 +02:00
Philippe ffcc115e8b clarify parameter usage in tslf_create 2022-09-19 14:31:47 +02:00
Philippe 7010314c4a tlsf control's structure should remain opaque 2022-09-19 14:31:05 +02:00
Philippe 8325aff3c9 dynamic control block per heap 2022-09-19 14:28:11 +02:00
Zim Kalinowski a29f770c7a Merge branch 'feature/mem-corruption-check-when-comprehensif-poisoning-v4.4' into 'release/v4.4'
heap: Provide memory corruption check when poisoning is active (V4.4)

See merge request espressif/esp-idf!19778
2022-09-13 20:41:48 +08:00
Marius Vikhammer b6248014b9 heap: remove misleading info about malloc being equivalent to heap_caps_malloc(p, MALLOC_CAP_8BIT)
The actual memory allocated for malloc() depends on a lot of factors, see heap_caps_malloc_default()

Closes https://github.com/espressif/esp-idf/issues/7659
2022-09-01 14:33:03 +08:00
Guillaume Souchere 55a2b55bdb heap: Add test to check that the corruption of free memory is detected
This commit extends the heap test set by adding a test to check corruption
detection in free memory block.

For each byte of the free block memory, the test changes the value of the byte,
call multi_heap_check(), make sure that the function returns 'corruption detected'
only when comprehensive poisoning is set, restore the good value of the byte, calls
multi_heap_check() again and make sure that it returns 'OK'.
2022-08-26 07:51:29 +02:00
Guillaume Souchere 6536e51a32 heap: Provide tlsf_check_hook() mechanism to check for memory corruption
Add a call to tlsf_check_hook() in tlsf_check() that calls
multi_heap_internal_check_block_poisoning() and check the memory
of every free blocks when heap poisoning is active.
2022-08-26 07:51:22 +02:00
Jiang Jiang Jian 34fbb676c7 Merge branch 'feature/optimize_chips_memory_allocation_backport_v4.4' into 'release/v4.4'
system: Optimize chips bootloader and heap memory allocation(backport v4.4)

See merge request espressif/esp-idf!19472
2022-08-12 11:19:06 +08:00
Omar Chebib 6906c34319 heap: add a unit test for malloc(0) and slightly optimize heap_caps_malloc_prefer 2022-08-10 11:41:01 +08:00
tgotic b43e777e0a fix malloc(0) and heap_caps_alloc_failed()
Don't call heap_caps_alloc_failed() for malloc(0) and calloc(0), because it is not an error.
Improve handling of malloc(0) and calloc(0).

Merges https://github.com/espressif/esp-idf/pull/9517
2022-08-10 11:40:53 +08:00
Omar Chebib 05575cc246 Heap: heap_caps_*_prefer functions now properly call alloc_failed callback
heap_caps_*_prefer functions will now only call heaps_caps_alloc_failed
callback if all attempts to allocation memory fail (and not after each attempt
anymore).

* Closes https://github.com/espressif/esp-idf/issues/9086
2022-08-10 11:40:32 +08:00
wuzhenghui e3979eb14b bugfix: DCache data memory is dma accessible but not retention dma accessible 2022-08-09 20:56:51 +08:00
wuzhenghui decb47bb5d use enum and designated initializers in soc_memory_type define 2022-08-09 20:54:01 +08:00
wuzhenghui 103b952525 ci: fix ci 2022-08-09 20:34:25 +08:00
wuzhenghui 9b7bed2243 Clean IRAM and DRAM address space conversion macros 2022-08-09 20:33:26 +08:00
wuzhenghui 41bbc39669 stack/dram is also IRAM0 accessible 2022-08-09 20:28:29 +08:00
wuzhenghui 62ac5364e0 Use the entire sharedbuffer space as the heap of the D/IRAM attribute 2022-08-09 20:27:38 +08:00
FanhuaCloud dc626195f0
Add missing comma
Add missing comma when CONFIG_ESP32S3_DATA_CACHE_16KB is enabled
2022-08-01 09:17:40 +05:30
jingli 41a0757bcc fix param passed to assert_valid_block, should be block not ptr 2022-06-23 21:43:53 +08:00
Omar Chebib 751c546a68 Heap: fix typos in test and component 2022-04-28 05:59:31 +00:00
Omar Chebib bf8fd5f42c Heap: fix free bytes calculation for TLSF heap
* Closes https://github.com/espressif/esp-idf/issues/8270
2022-04-28 05:59:31 +00:00
Zim Kalinowski a8c073c1cc fixed trailing whitespace 2022-02-18 12:58:53 +08:00
Chip Weinberger 9cc4c2f34d SPIRAM: 'Abort on allocation failure' should not trigger when there is available SPI ram
(cherry picked from commit 8dcdb2f363fd3fa00bd77e4bd75e7c73d6c7d0fb)
2022-02-17 22:22:26 +08:00
Mahavir Jain 7d9b93e2e0 Merge branch 'bugfix/MR16031_v4.4' into 'release/v4.4'
heap: adjust the order of RTC memory heap caps and regions(backport v4.4)

See merge request espressif/esp-idf!16704
2022-01-27 05:30:02 +00:00
jingli 23ec015d75 adjust the order of RTC memory heap caps and regions 2022-01-08 16:19:35 +08:00
Alexey Gerenkov 8c2990fcea trax: Adds ESP32-S3 support 2022-01-05 19:34:28 +01:00
Alexey Gerenkov 18cd2ea3e6 apptrace: Adds ESP32-S3 support 2022-01-05 19:26:33 +01:00
Omar Chebib 155de9c49e Heap: Add a target test to check that TLFS allocates the requested size 2021-12-22 14:06:41 +08:00
Omar Chebib 09db8845c6 Heap: Fix a possible bug in the TLSF allocator
Fix a bug that could return a chunk of memory smaller than requested,
easily leading to a memory corruption, when the required memory alignment
passed to the allocator is 4.
2021-12-22 14:06:41 +08:00
Jiang Jiang Jian bd650062ca Merge branch 'feature/update_rtc_memory_heap_caps' into 'release/v4.4'
heap: update RTC memory heap caps (backport v4.4)

See merge request espressif/esp-idf!15941
2021-12-08 13:35:18 +00:00
Jiang Jiang Jian 67fcfc2e02 Merge branch 'feature/freertos_try_enter_critical_v4.4' into 'release/v4.4'
freertos: Add portTRY_ENTRY_CRITICAL() and deprecate legacy spinlock fucntions (v4.4)

See merge request espressif/esp-idf!16040
2021-12-08 10:10:17 +00:00
gaoxiaojie 666218d753 heap: fix multi_heap_get_info_impl 2021-11-25 10:34:06 +08:00
Darian Leung c5efb55d43 freertos: Add portTRY_ENTRY_CRITICAL() and deprecate legacy spinlock fucntions
Add TRY_ENTRY_CRITICAL() API to all for timeouts when entering critical sections.
The following port API were added:
- portTRY_ENTER_CRITICAL()
- portTRY_ENTER_CRITICAL_ISR()
- portTRY_ENTER_CRITICAL_SAFE()

Deprecated legacy spinlock API in favor of spinlock.h. The following API were deprecated:
- vPortCPUInitializeMutex()
- vPortCPUAcquireMutex()
- vPortCPUAcquireMutexTimeout()
- vPortCPUReleaseMutex()

Other Changes:
- Added portMUX_INITIALIZE() to replace vPortCPUInitializeMutex()
- The assembly of the critical section functions ends up being about 50 instructions longer,
  thus the spinlock test pass threshold had to be increased to account for the extra runtime.

Closes https://github.com/espressif/esp-idf/issues/5301
2021-11-22 18:42:10 +08:00