Commit graph

104 commits

Author SHA1 Message Date
Darian Leung
a389312750 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-10-11 03:10:56 +00:00
Angus Gratton
d139c851f3 heap: Remove esp_heap_alloc_caps header
Deprecated in ESP-IDF V3.1
2019-09-19 18:49:37 +10:00
Renz Christian Bagaporo
9b350f9ecc cmake: some formatting fixes
Do not include bootloader in flash target when secure boot is enabled.
Emit signing warning on all cases where signed apps are enabled (secure
boot and signed images)
Follow convention of capital letters for SECURE_BOOT_SIGNING_KEY
variable, since it is
relevant to other components, not just bootloader.
Pass signing key and verification key via config, not requiring
bootloader to know parent app dir.
Misc. variables name corrections
2019-06-21 19:53:29 +08:00
Renz Christian Bagaporo
9eccd7c082 components: use new component registration api 2019-06-21 19:53:29 +08:00
Darian Leung
037c079e9a esp32: Refactor backtrace and add esp_backtrace_print()
This commit refactors backtracing within the panic handler so that a common
function esp_backtrace_get_next_frame() is used iteratively to traverse a
callstack.

A esp_backtrace_print() function has also be added that allows the printing
of a backtrace at runtime. The esp_backtrace_print() function allows unity to
print the backtrace of failed test cases and jump back to the main test menu
without the need reset the chip. esp_backtrace_print() can also be used as a
debugging function by users.

- esp_stack_ptr_is_sane() moved to soc_memory_layout.h
- removed uncessary includes of "esp_debug_helpers.h"
2019-06-19 18:30:18 +08:00
Renz Christian Bagaporo
3882e48e8a cmake: use new signature form of target_link_library to link components
!4452 used setting LINK_LIBRARIES and INTERFACE_LINK_LIBRARIES to link
components built under ESP-IDF build system. However, LINK_LIBRARIES does
not produce behavior same as linking PRIVATE. This MR uses the new
signature for target_link_libraries directly instead. This also moves
setting dependencies during component registration rather than after all
components have been processed.

The consequence is that internally, components have to use the new
signature form as well. This does not affect linking the components to
external targets, such as with idf_as_lib example. This only affects
linking additional libraries to ESP-IDF libraries outside component processing (after
idf_build_process), which is not even possible for CMake<v3.13 as
target_link_libraries is not valid for targets not created in current
directory. See https://cmake.org/cmake/help/v3.13/policy/CMP0079.html#policy:CMP0079
2019-06-11 18:09:26 +08:00
Konstantin Kondrashov
399d2d2605 all: Using xxx_periph.h
Using xxx_periph.h in whole IDF instead of xxx_reg.h, xxx_struct.h, xxx_channel.h ... .

Cleaned up header files from unnecessary headers (releated to soc/... headers).
2019-06-03 14:15:08 +08:00
Roland Dobai
c5000c83d2 Rename Kconfig options (root) 2019-05-21 09:09:01 +02:00
Renz Christian Bagaporo
ffec9d4947 components: update with build system changes 2019-05-13 19:59:17 +08:00
Michael (XIAO Xufeng)
562af8f65e global: move the soc component out of the common list
This MR removes the common dependency from every IDF components to the SOC component.

Currently, in the ``idf_functions.cmake`` script, we include the header path of SOC component by default for all components.
But for better code organization (or maybe also benifits to the compiling speed), we may remove the dependency to SOC components for most components except the driver and kernel related components.

In CMAKE, we have two kinds of header visibilities (set by include path visibility):

(Assume component A --(depends on)--> B, B is the current component)

1. public (``COMPONENT_ADD_INCLUDEDIRS``): means this path is visible to other depending components (A) (visible to A and B)
2. private (``COMPONENT_PRIV_INCLUDEDIRS``): means this path is only visible to source files inside the component (visible to B only)

and we have two kinds of depending ways:

(Assume component A --(depends on)--> B --(depends on)--> C, B is the current component)

1. public (```COMPONENT_REQUIRES```): means B can access to public include path of C. All other components rely on you (A) will also be available for the public headers. (visible to A, B)
2. private (``COMPONENT_PRIV_REQUIRES``): means B can access to public include path of C, but don't propagate this relation to other components (A). (visible to B)

1. remove the common requirement in ``idf_functions.cmake``, this makes the SOC components invisible to all other components by default.
2. if a component (for example, DRIVER) really needs the dependency to SOC, add a private dependency to SOC for it.
3. some other components that don't really depends on the SOC may still meet some errors saying "can't find header soc/...", this is because it's depended component (DRIVER) incorrectly include the header of SOC in its public headers. Moving all this kind of #include into source files, or private headers
4. Fix the include requirements for some file which miss sufficient #include directives. (Previously they include some headers by the long long long header include link)

This is a breaking change. Previous code may depends on the long include chain.
You may need to include the following headers for some files after this commit:

- soc/soc.h
- soc/soc_memory_layout.h
- driver/gpio.h
- esp_sleep.h

The major broken include chain includes:

1. esp_system.h no longer includes esp_sleep.h. The latter includes driver/gpio.h and driver/touch_pad.h.
2. ets_sys.h no longer includes soc/soc.h
3. freertos/portmacro.h no longer includes soc/soc_memory_layout.h

some peripheral headers no longer includes their hw related headers, e.g. rom/gpio.h no longer includes soc/gpio_pins.h and soc/gpio_reg.h

BREAKING CHANGE
2019-04-16 13:21:15 +08:00
Konstantin Kondrashov
5021129e71 Add support a [leaks] tag for UT 2019-04-12 09:31:23 +08:00
Renz Christian Bagaporo
90ee405afd ldgen: update component linker fragment files 2019-04-04 15:57:34 +08:00
morris
f5b03c9ea3 misc adjustment of esp32 component 2019-04-03 19:57:46 +08:00
Alexey Gerenkov
335576013e heap: Separate standalone and common part of tracing module 2019-04-01 15:56:15 +03:00
morris
c159984264 separate rom from esp32 component to esp_rom
1. separate rom include files and linkscript to esp_rom
2. modefiy "include rom/xxx.h" to "include esp32/rom/xxx.h"
3. Forward compatible
4. update mqtt
2019-03-21 18:51:45 +08:00
Angus Gratton
2dd3344342 heap: Add integer overflow checks on MALLOC_CAP_32BIT & MALLOC_CAP_EXEC 2019-03-18 01:41:58 +00:00
Darian Leung
59d1ecc78b esp32: Remove trialing semicolon from function-like macros
This commit removes trailing semicolons following a while(0) from
function-like macros in IDF. This will force those macros to be called
with a semicolon when called.
2019-02-28 21:58:47 +08:00
Roland Dobai
37126d3451 Correct Kconfigs according to the coding style 2019-01-29 13:37:01 +01:00
Angus Gratton
b1f3586f7e multi_heap: Fix bug when start of heap is unaligned
Alignment was accounted for in one place only.

TW27954
2018-12-20 01:40:05 +00:00
Angus Gratton
769bd4a4af linker: When using section type attributes, create unique sections
* Prevents section type conflict errors if (say) const & non-const data
  is put into the same section (ie with DRAM_ATTR)

* Allows linker --gc-sections to remove unused custom sections
2018-12-19 04:42:04 +00:00
Ivan Grokhotkov
3150920cb4 heap: __builtin_return_address argument has to be a literal value
Clang does not accept const int as an argument of __builtin_return_address.

Ref LLVM-14
2018-12-06 16:14:14 +08:00
Mahavir Jain
907b1a9032 mbedtls: align CMake build with corresponding component.mk 2018-11-29 16:23:06 +05:30
Renz Christian Bagaporo
37d30c7a6e cmake: separate app from idf lib project
mbedtls: import mbedtls using unmodified cmake file
2018-11-27 13:59:24 +08:00
Ivan Grokhotkov
a46b884a14 Merge branch 'feature/unit_test_example' into 'master'
Move Unity into components, add unit test example

See merge request idf/esp-idf!3562
2018-11-19 18:35:54 +08:00
Ivan Grokhotkov
6091021e83 unity: separate common and IDF specific functionality
New unity component can be used for testing other applications.
Upstream version of Unity is included as a submodule.
Utilities specific to ESP-IDF unit tests (partitions, leak checking
setup/teardown functions, etc) are kept only in unit-test-app.
Kconfig options are added to allow disabling certain Unity features.
2018-11-19 12:36:31 +08:00
Renz Bagaporo
63411fc556 tools: implement linker script generation 2018-11-16 12:42:02 +08:00
Paul Reimer
b358581ab8 heap: Compile heap_task_info.c conditionally on CONFIG_HEAP_TASK_TRACKING in heap CMakeLists.txt
Merges https://github.com/espressif/esp-idf/pull/2498
2018-11-08 15:57:11 +05:30
Renz Bagaporo
cc774111bf cmake: Add support for test build 2018-10-20 12:07:24 +08:00
Renz Christian Bagaporo
944014f9f2 cmake: fix source list issues 2018-09-13 08:56:59 +08:00
Renz Christian Bagaporo
d9939cedd9 cmake: make main a component again 2018-09-11 09:44:12 +08:00
Angus Gratton
b355854d4d Merge branch 'master' into feature/cmake 2018-09-05 10:35:04 +08:00
Jiang Jiang Jian
b91cf5a33f Merge branch 'bugfix/esp_bt_mem_release' into 'master'
components/bt: Fix broken API esp_bt_mem_release() for parameter ESP_BT_MODE_BTDM

See merge request idf/esp-idf!3121
2018-09-04 14:17:10 +08:00
Angus Gratton
6976f5671c Merge branch 'bugfix/heap_dma_pool_fixes' into 'master'
heap: Fixes around DMA reserved pool

See merge request idf/esp-idf!3034
2018-09-03 15:43:01 +08:00
Angus Gratton
5f1844a0c8 Merge branch 'bugfix/heap_poison_swap_check' into 'master'
heap: When verifying & swapping a fill pattern, stop swapping if verification fails

See merge request idf/esp-idf!2890
2018-09-03 11:19:16 +08:00
Hrishikesh Dhayagude
4abe47437f components/bt: Fix broken API esp_bt_mem_release() for parameter ESP_BT_MODE_BTDM
Problem:
The new API esp_bt_mem_release() that was added freed BTDM data to heap from esp_bt_controller_mem_release().
Now with the BT memory optimization commit ee787085f9,
the BTDM data is optimized and reduced to only 32 bytes which is not sufficient amount to be added to heap.
So, using the API leads to assert saying that the region is too small.

Solution:
Modify heap_caps_add_region_with_caps to return ESP_ERR_INVALID_SIZE in case the range is too small to create a new heap.
Do not assert if return value is ESP_ERR_INVALID_SIZE

This also fixes using API esp_bt_controller_mem_release() with ESP_BT_MODE_BTDM

Signed-off-by: Hrishikesh Dhayagude <hrishi@espressif.com>
2018-08-31 14:28:23 +00:00
Angus Gratton
a9c4ed7139 Merge branch 'master' into feature/cmake 2018-08-30 18:51:01 +08:00
Angus Gratton
776c57e0ac heap: When adding a new heap, allocate its metadata block from internal memory only 2018-08-30 06:18:18 +00:00
Ivan Grokhotkov
ed546797d0 heap: test: don’t warn about oversized mallocs 2018-08-29 14:40:28 +08:00
Angus Gratton
ff2404a272 Merge branch 'master' into feature/cmake 2018-08-16 17:14:17 +10:00
Angus Gratton
383a3f788d Merge branch 'doc/heap_tracing' into 'master'
heap docs: Fix some bad links & errors in the heap docs

See merge request idf/esp-idf!2942
2018-08-10 16:46:52 +08:00
Angus Gratton
c9cbc6b30c heap docs: Fix some bad links & errors in the heap docs
Also add a note about printf() sometimes causing on-demand allocations.
2018-08-10 15:54:58 +10:00
Angus Gratton
a5ae5ac4b3 soc: Allow components to reserve fixed memory ranges that they need
No longer necessary to keep all reserved addresses in 'soc'.

Means 'soc' does not need to know about 'bt', for example.

Also means that Bluetooth can be enabled in config without any memory being reserved for BT
controller. Only if code calling the BT controller is linked in, will this memory be reserved...
2018-08-06 01:37:55 +00:00
Angus Gratton
8cbd12b9b7 heap: When verifying & swapping a fill pattern, stop swapping if verification fails
Avoids situation where data has been overwritten during any post-mortem analysis
(core dump, gdbstub, etc).

As reported via forum https://esp32.com/viewtopic.php?f=2&t=6471&p=27790
2018-07-31 14:53:24 +10:00
Angus Gratton
ae59d7522a heap: heap_caps_malloc(..., MALLOC_CAP_32_BIT) should always align a 32-bit aligned size
Fixes crash in heap poisoning code if a non-32bit-aligned size is specified.
2018-07-31 14:29:31 +10:00
Angus Gratton
bfc6bb97c0 heap: Fix heap metadata test to account for background memory allocations 2018-07-30 11:41:30 +10:00
Ivan Grokhotkov
9a2583122c heap/tests: make IRAM allocation size divisible by 4
heap_caps_malloc will fail to poison a block in IRAM with size not
divisible by 4. The proper fix will be to make poisoning code
smarter, or to disallow allocations from IRAM with size not aligned
by 4.
2018-07-25 09:45:39 +03:00
Ivan Grokhotkov
a981e73e22 heap: move get_all_caps to IRAM, used in unit test 2018-07-24 09:56:40 +03:00
Ivan Grokhotkov
7a154d6a4e heap: fix unit test for the case when less than 10k of IRAM is available 2018-07-24 09:56:40 +03:00
Konstantin Kondrashov
899fa2dc55 assert: Fix. Move useful functions from wrapped assert functions
Moved useful functions from wrapped assert functions, because option `CONFIG_OPTIMIZATION_ASSERTIONS_DISABLED=y` will remove this functions.

Closes https://github.com/espressif/esp-idf/issues/2068
2018-06-22 15:17:55 +05:00
Angus Gratton
fd88d6d89c heap: Add integer overflow checks 2018-06-19 23:31:37 +00:00