Commit Graph

224 Commits

Author SHA1 Message Date
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
wuzhenghui
8d33d54af7 heap: update RTC memory heap caps 2021-11-15 10:56:08 +08:00
Li Shuai
e8188e5d8f ci: replacing old header with new SPDX header style 2021-10-20 11:36:23 +08:00
Li Shuai
44da7d27ef heap: add a new heap caps attribute for RTC fast memory 2021-10-20 11:36:22 +08:00
Li Shuai
9298db641e deep sleep: fix some rtc fast memory definition errors in esp32s3 2021-10-19 21:47:27 +08:00
gaoxiaojie
191a494e08 support dcache 64Byte and 16k 2021-09-02 02:27:40 +08:00
Michael (XIAO Xufeng)
064f12cb90 idf_size.py: fixed diram counted twice issue, and improve display
Currently static RAM usage are listed under corresponding physical
memory.

ld: fix linker script for C3 and S3
2021-08-11 17:51:50 +02:00
Omar Chebib
a7b6ec85b8 Merge branch 'feature/move_memory_layout_to_heap' into 'master'
G0: Memory layouts are now part of heap components

Closes IDF-1264

See merge request espressif/esp-idf!14028
2021-07-19 06:23:19 +00:00
Omar Chebib
c4f57af6c9 G0: Memory layouts are now part of heap components 2021-07-15 11:38:23 +10:00
Mahavir Jain
9ac9b69087 heap: use hal specific API to get cpu cycles count
This fixes compilation issue of heap tracing feature for RISC-V
architecture.
2021-06-22 14:14:10 +08:00
Angus Gratton
d6f4d99d93 core system: Fix warnings in compilation when assertions are disabled
Adds a CI config for hello world that sets this, to catch future regressions
2021-03-03 10:26:57 +11:00
Omar Chebib
c4dc3acba9 heap: add light poisoning configuration to the tests.
Relates to IDF-2653
2021-02-01 11:58:42 +08:00
Omar Chebib
d902b4e7db heap: fix unaligned memory bug when poisoning is enabled.
Poisoned memory is now aligned as requested by the user.
Closes IDF-2653
2021-02-01 11:58:42 +08:00