diff options
author | Ambroise Vincent <ambroise.vincent@arm.com> | 2019-04-10 12:50:27 +0100 |
---|---|---|
committer | Ambroise Vincent <ambroise.vincent@arm.com> | 2019-04-12 09:52:52 +0100 |
commit | 2374ab1799bedae1acc17fde0205d272f8111836 (patch) | |
tree | e77aaebfce13cde27630120b0e5f58c8526d7272 /docs | |
parent | e5be1f95e54d076279e39b0c2ad04685391cf8b9 (diff) | |
download | platform_external_arm-trusted-firmware-2374ab1799bedae1acc17fde0205d272f8111836.tar.gz platform_external_arm-trusted-firmware-2374ab1799bedae1acc17fde0205d272f8111836.tar.bz2 platform_external_arm-trusted-firmware-2374ab1799bedae1acc17fde0205d272f8111836.zip |
Mbed TLS: Remove weak heap implementation
The implementation of the heap function plat_get_mbedtls_heap() becomes
mandatory for platforms supporting TRUSTED_BOARD_BOOT.
The shared Mbed TLS heap default weak function implementation is
converted to a helper function get_mbedtls_heap_helper() which can be
used by the platforms for their own function implementation.
Change-Id: Ic8f2994e25e3d9fcd371a21ac459fdcafe07433e
Signed-off-by: Ambroise Vincent <ambroise.vincent@arm.com>
Diffstat (limited to 'docs')
-rw-r--r-- | docs/porting-guide.rst | 50 |
1 files changed, 27 insertions, 23 deletions
diff --git a/docs/porting-guide.rst b/docs/porting-guide.rst index 3ea86b04f..6244a6387 100644 --- a/docs/porting-guide.rst +++ b/docs/porting-guide.rst @@ -841,6 +841,33 @@ utilize the C runtime environment. For further details about how TF-A represents the power domain topology and how this relates to the linear CPU index, please refer `Power Domain Topology Design`_. +Function : plat_get_mbedtls_heap() [when TRUSTED_BOARD_BOOT == 1] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +:: + + Arguments : void **heap_addr, size_t *heap_size + Return : int + +This function is invoked during Mbed TLS library initialisation to get a heap, +by means of a starting address and a size. This heap will then be used +internally by the Mbed TLS library. Hence, each BL stage that utilises Mbed TLS +must be able to provide a heap to it. + +A helper function can be found in `drivers/auth/mbedtls/mbedtls_common.c` in +which a heap is statically reserved during compile time inside every image +(i.e. every BL stage) that utilises Mbed TLS. In this default implementation, +the function simply returns the address and size of this "pre-allocated" heap. +For a platform to use this default implementation, only a call to the helper +from inside plat_get_mbedtls_heap() body is enough and nothing else is needed. + +However, by writting their own implementation, platforms have the potential to +optimise memory usage. For example, on some Arm platforms, the Mbed TLS heap is +shared between BL1 and BL2 stages and, thus, the necessary space is not reserved +twice. + +On success the function should return 0 and a negative error code otherwise. + Common optional modifications ----------------------------- @@ -1054,29 +1081,6 @@ can override the common implementation to define a different prefix string for the log output. The implementation should be robust to future changes that increase the number of log levels. -Function : plat_get_mbedtls_heap() -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -:: - - Arguments : void **heap_addr, size_t *heap_size - Return : int - -This function is invoked during Mbed TLS library initialisation to get -a heap, by means of a starting address and a size. This heap will then be used -internally by the Mbed TLS library. The heap is requested from the current BL -stage, i.e. the current BL image inside which Mbed TLS is used. - -In the default implementation a heap is statically allocated inside every image -(i.e. every BL stage) that utilises Mbed TLS. So, in this case, the function -simply returns the address and size of this "pre-allocated" heap. However, by -overriding the default implementation, platforms have the potential to optimise -memory usage. For example, on some Arm platforms, the Mbed TLS heap is shared -between BL1 and BL2 stages and, thus, the necessary space is not reserved -twice. - -On success the function should return 0 and a negative error code otherwise. - Modifications specific to a Boot Loader stage --------------------------------------------- |