Commit graph

155 commits

Author SHA1 Message Date
Felipe Neves 6f5e43e26a heap: added alloc failed hook and configuration options
heap/test: added alloc failed hook tests

docs: added alloc failed hook documentation

heap: add function to register allocation failed hook

docs: allocation failed hook docs improvements
2020-05-04 10:58:38 -03:00
Angus Gratton 9300615a13 Merge branch 'bugfix/heap_psram_fill' into 'master'
heap: Only fill new heaps with FREE_FILL_PATTERN if Comprehensive poisoning is on

See merge request espressif/esp-idf!8210
2020-04-27 14:20:41 +08:00
Martin Vychodil 7491ea677a esp32s2: IRAM/DRAM memory protection
* new mem_prot API
* mem_prot on & locked by default (see Kconfig)
* feature activated in start_cpu0_default()

JIRA IDF-1355
2020-04-21 15:10:58 +02:00
Angus Gratton 100578a9e9 heap: Only fill new heaps with FREE_FILL_PATTERN if Comprehensive poisoning is on
Significantly speeds up heap initialization at startup when default "Light" heap
poisoning is enabled.

Tip via reddit user LinkeSeitentasche https://www.reddit.com/r/esp32/comments/fnj51a/a_guide_to_improving_esp32_boot_speed/
2020-04-15 07:16:08 +00:00
Ivan Grokhotkov e94288da31 global: use '/usr/bin/env bash' instead of '/usr/bin/bash' in shebangs
Using the method from @cemeyer
(https://github.com/espressif/esp-idf/pull/3166):

find . -name \*.sh -exec sed -i "" -e 's|^#!.*bin/bash|#!/usr/bin/env bash|' {} +

Closes https://github.com/espressif/esp-idf/pull/3166.
2020-04-03 01:10:02 +02:00
Angus Gratton dd8d1deacb Merge branch 'bugfix/malloc_zero_return_null' into 'master'
bugfix/multi_heap: fix malloc(0) returning valid pointer in some poisoning configurations

Closes IDF-1482

See merge request espressif/esp-idf!8012
2020-03-26 16:19:39 +08:00
Renz Bagaporo 3d0967a58a test: declare requirements and include dirs private 2020-03-23 10:58:50 +08:00
Felipe Neves 481379f14d multi_heap: ensure that malloc(0) return NULL pointer in any poisoning configuration 2020-03-20 14:33:49 +00:00
Felipe Neves d495f175d5 heap: pushed down all the aligned_alloc / free implementation 2020-03-05 11:02:19 -03:00
Felipe Neves 98e561b79a heap: added aligned alloc implementation on multi_heap layer 2020-02-28 13:17:34 -03:00
Mahavir Jain 5f897fd33c Merge branch 'feat/secure_boot_v2_v41' into 'master'
feat/secure_boot_v2: Adding secure boot v2 support to ESP32-ECO3

Closes IDF-799

See merge request espressif/esp-idf!6778
2020-02-27 18:54:08 +08:00
Angus Gratton d40c69375c bootloader: Add fault injection resistance to Secure Boot bootloader verification
Goal is that multiple faults would be required to bypass a boot-time signature check.

- Also strengthens some address range checks for safe app memory addresses
- Change pre-enable logic to also check the bootloader signature before enabling SBV2 on ESP32

Add some additional checks for invalid sections:

- Sections only partially in DRAM or IRAM are invalid
- If a section is in D/IRAM, allow the possibility only some is in D/IRAM
- Only pass sections that are entirely in the same type of RTC memory region
2020-02-27 14:37:19 +05:30
Sachin Parekh 301dacfb33 Exception handlers for LoadStoreError and LoadStoreAlignmentError
Configurable option to use IRAM as byte accessible memory (in single core mode) using
load-store (non-word aligned and non-word size IRAM access specific) exception handlers.
This allows to use IRAM for use-cases where certain performance penalty
(upto 170 cpu cycles per load or store operation) is acceptable. Additional configuration
option has been provided to redirect mbedTLS specific in-out content length buffers to
IRAM (in single core mode), allows to save 20KB per TLS connection.
2020-02-26 20:21:59 +08:00
morris e30cd361a8 global: rename esp32s2beta to esp32s2 2020-01-22 12:14:38 +08:00
Felipe Neves 6a307ee70f heap: removed ptr check in diram area since aligned allocator does not support data allocated from IRAM 2020-01-10 10:15:32 -03:00
Felipe Neves 0d8a5ebec7 heap: added aligned calloc function plus tests 2020-01-10 10:05:28 -03:00
Felipe Neves 45766daa4f test_multi_heap_host/test_multi_heap: fix undefined reference error when testing aligned_alloc with no heap poisoning 2020-01-10 10:05:28 -03:00
Felipe Neves a2db437c46 heap/heap_caps: Added tests for align allocation on both internal and external ram 2020-01-10 10:05:28 -03:00
Felipe Neves 7fbf4c74d7 heap/heap_caps: added initial, top level heap_caps_aligned_alloc and heap_caps_aligned_free 2020-01-10 10:05:27 -03:00
Felipe Neves f31b8a8ab8 heap/multi_heap_poisoning: aligned alloc now working togheter with heap poisining code 2020-01-10 10:05:27 -03:00
Felipe Neves 8bd09429d3 heap/test_multi_heap_host: added initial tests for heap aligned alloc 2020-01-10 10:05:27 -03:00
Felipe Neves d26ddaa644 heap/multi_heap: added initial implementation of aligned alloc function 2020-01-10 10:05:27 -03:00
michael 4220752aed ut: Move tests back from "esp32" subfolder
DISABLED_FOR_TARGETS macros are used

Partly revert "ci: disable unavailable tests for esp32s2beta"

This partly reverts commit 76a3a5fb48.

Partly revert "ci: disable UTs for esp32s2beta without runners"

This partly reverts commit eb158e9a22.

Partly revert "fix unit test and examples for s2beta"

This partly reverts commit 9baa7826be.

Partly revert "efuse: Add support for esp32s2beta"

This partly reverts commit db84ba868c.
2020-01-06 17:13:53 +08:00
Ivan Grokhotkov 52f8aa2adb Merge branch 'feature/heap_non_os_build' into 'master'
heap: make compatible with non-OS builds, remove target dependence

Closes IDF-1236

See merge request espressif/esp-idf!7051
2020-01-03 17:12:51 +08:00
Ivan Grokhotkov b4aba189ab heap: recognize 0x40000000 as an address terminating the backtrace
On Xtensa, backtrace can not recover the two most significant bits of
the address, as the window call size is encoded in these bits.
Because of this, __builtin_return_address modifies these MSBs to
match those of the callee, "fixing" the address. An unfortunate side
effect is that the zero return address, which usually terminates the
backtrace, gets converted to 0x40000000. While there is a valid
instruction at this address, its occurrence in the backtrace is
highly unlikely: this is the first instruction of WindowOverflow4
vector, and IDF apps switch VECBASE to an IRAM location very early at
startup.
2020-01-02 18:42:46 +01:00
Ivan Grokhotkov 3285ed116d heap: make compatible with non-OS builds, remove target dependence 2019-12-27 12:40:06 +01:00
Felipe Neves 8795b2681c heap: added test case for realloc to verify if successive realloc in IRAM still ends there. 2019-12-20 13:48:09 -03:00
Felipe Neves 4909fdfe02 heap_caps: small fixes on comments plus cleaning 2019-12-20 13:35:56 -03:00
Felipe Neves 31145f38fa heap_caps: added special case for realloc when previous area is an diram_iram ptr, this will force a malloc/copy/free 2019-12-20 13:35:56 -03:00
Felipe Neves ce9f84fba9 heap_caps: enable check of pointer on diram_iram for both S2 and non-S2 platform 2019-12-20 13:35:56 -03:00
Felipe Neves d9ab33118e heap/multi_heap_poisoning: include heap_private.h only when no host heap tests 2019-12-20 13:35:56 -03:00
Felipe Neves 4a392932f1 heap/heap_caps: added special case for esp32s2 when handling memory allocated (and aliased) from IRAM 2019-12-20 13:35:56 -03:00
Felipe Neves ecc4955c68 heap/test_malloc_caps: changed malloc caps test to deal with esp32 and esp32s2 memory differencies. 2019-12-20 13:35:56 -03:00
Felipe Neves cf95ea40d4 heap/test_leak: changed requested memory on leak checks to match the threshold 2019-12-20 13:35:56 -03:00
Alexey Gerenkov 884717fb2f apptrace: Adds support for converting SystemView traces to JSON format 2019-12-04 18:04:07 +03:00
Alexey Gerenkov 5909d3676c esp32s2: Adds apptrace support
Closes IDF-510.
Closes IDF-1032.
2019-11-13 15:24:01 +03:00
Angus Gratton 7ce75a42c7 Merge branch 'master' into feature/esp32s2beta_merge 2019-10-25 15:13:52 +11:00
Angus Gratton 04dbe663be Merge branch 'feature/heap_caps_get_size_free' into 'master'
add heap_caps_get_allocated_size

See merge request espressif/esp-idf!6375
2019-10-23 14:02:50 +08:00
Angus Gratton 8675a818f9 Merge branch 'master' into feature/esp32s2beta_merge 2019-10-22 13:51:49 +11:00
zhanghu 341ef5e8b2 add heap_caps_get_size_free 2019-10-21 16:47:36 +08:00
Kewal d3020b217d Add api to get total heap size in bytes for given capability 2019-10-21 14:55:58 +08:00
Angus Gratton adfc06a530 Merge branch 'master' into feature/esp32s2beta_merge 2019-09-20 10:28:37 +10:00
Angus Gratton 438d513a95 Merge branch 'master' into feature/esp32s2beta_merge 2019-09-16 16:18:48 +10:00
Angus Gratton b022527da7 heap: Remove esp_heap_alloc_caps header
Deprecated in ESP-IDF V3.1
2019-09-13 09:44:07 +10:00
Darian Leung e52c0d0da2 heap: Fix printf usage in heap poisoning
This commit fixes the bug where printf() is used in
verify_allocated_region() when ets_printf() should be used.
2019-09-09 21:56:39 +08:00
Angus Gratton 35147119f1 Merge branch 'feature/support_ut_esp32s2beta' into 'feature/esp32s2beta'
ci: support build and run UT for esp32s2beta

See merge request espressif/esp-idf!5702
2019-09-09 08:34:16 +08:00
Li Shuai bd29202520 1. Fix backtrace is incomplete
2. Optimization code style
2019-09-05 18:40:33 +08:00
Michael (XIAO Xufeng) 76a3a5fb48 ci: disable unavailable tests for esp32s2beta 2019-09-04 10:53:25 +10:00
Michael (XIAO Xufeng) 9baa7826be fix unit test and examples for s2beta 2019-09-04 10:53:25 +10:00
Angus Gratton 04ae56806c Merge branch 'master' into feature/esp32s2beta_update 2019-08-08 15:26:58 +10:00