Skip to content

Commit 1db4e46

Browse files
author
Michael Schwarcz
committed
mbed_retarget changes
- Avoid compiling user_setup_stackheap for TF-M secure targets - Align sbrk for TF-M
1 parent 5dbb8fe commit 1db4e46

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

platform/mbed_retarget.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
*/
17+
1718
#include <time.h>
1819
#include "platform/platform.h"
1920
#include "platform/FilePath.h"
@@ -904,6 +905,9 @@ extern "C" long PREFIX(_flen)(FILEHANDLE fh)
904905
return size;
905906
}
906907

908+
// Do not compile this code for TFM secure target
909+
#if !defined(COMPONENT_SPE) || !defined(TARGET_TFM)
910+
907911
extern "C" char Image$$RW_IRAM1$$ZI$$Limit[];
908912

909913
extern "C" MBED_WEAK __value_in_regs struct __initial_stackheap _mbed_user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3)
@@ -924,6 +928,8 @@ extern "C" __value_in_regs struct __initial_stackheap __user_setup_stackheap(uin
924928
return _mbed_user_setup_stackheap(R0, R1, R2, R3);
925929
}
926930

931+
#endif // !defined(COMPONENT_SPE) || !defined(TARGET_TFM)
932+
927933
#endif
928934

929935

@@ -1205,7 +1211,7 @@ extern "C" WEAK void __cxa_pure_virtual(void)
12051211
// SP. This make it compatible with RTX RTOS thread stacks.
12061212
#if defined(TOOLCHAIN_GCC_ARM)
12071213

1208-
#if defined(TARGET_CORTEX_A)
1214+
#if defined(TARGET_CORTEX_A) || (defined(TARGET_TFM) && defined(COMPONENT_SPE))
12091215
extern "C" uint32_t __HeapLimit;
12101216
#endif
12111217

@@ -1234,7 +1240,7 @@ extern "C" WEAK caddr_t _sbrk(int incr)
12341240
unsigned char *prev_heap = heap;
12351241
unsigned char *new_heap = heap + incr;
12361242

1237-
#if defined(TARGET_CORTEX_A)
1243+
#if defined(TARGET_CORTEX_A) || (defined(TARGET_TFM) && defined(COMPONENT_SPE))
12381244
if (new_heap >= (unsigned char *)&__HeapLimit) { /* __HeapLimit is end of heap section */
12391245
#else
12401246
if (new_heap >= (unsigned char *)__get_MSP()) {

0 commit comments

Comments
 (0)