Skip to content

Commit 815be94

Browse files
committed
Add defined for GCC_ARM to pass heap and stack tests
1 parent f551255 commit 815be94

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

targets/TARGET_STM/mbed_rtx.h

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,15 @@
1919

2020
#ifndef INITIAL_SP
2121

22-
#if (defined(TARGET_STM32F051R8) ||\
22+
#if (defined(TARGET_STM32L475VG))
23+
/* only GCC_ARM and IAR toolchain have the stack on SRAM2 */
24+
#if (defined(TOOLCHAIN_GCC_ARM) || defined(TOOLCHAIN_GCC_CR) || defined(__IAR_SYSTEMS_ICC__ ))
25+
#define INITIAL_SP (0x10008000UL)
26+
#else
27+
#define INITIAL_SP (0x20018000UL)
28+
#endif /* toolchains */
29+
30+
#elif (defined(TARGET_STM32F051R8) ||\
2331
defined(TARGET_STM32F100RB) ||\
2432
defined(TARGET_STM32L031K6) ||\
2533
defined(TARGET_STM32L053C8) ||\
@@ -69,7 +77,6 @@
6977
#define INITIAL_SP (0x20014000UL)
7078

7179
#elif (defined(TARGET_STM32F401RE) ||\
72-
defined(TARGET_STM32L475VG) ||\
7380
defined(TARGET_STM32L476RG) ||\
7481
defined(TARGET_STM32L476JG) ||\
7582
defined(TARGET_STM32L476VG) ||\
@@ -110,5 +117,17 @@
110117
#endif
111118

112119
#endif // INITIAL_SP
120+
#if defined(TOOLCHAIN_GCC_ARM) || defined(TOOLCHAIN_GCC_CR)
121+
extern uint32_t __StackLimit[];
122+
extern uint32_t __StackTop[];
123+
extern uint32_t __end__[];
124+
extern uint32_t __HeapLimit[];
125+
#define HEAP_START ((unsigned char*)__end__)
126+
#define HEAP_SIZE ((uint32_t)((uint32_t)__HeapLimit - (uint32_t)HEAP_START))
127+
#define ISR_STACK_START ((unsigned char*)__StackLimit)
128+
#define ISR_STACK_SIZE ((uint32_t)((uint32_t)__StackTop - (uint32_t)__StackLimit))
129+
#elif defined(__ICCARM__)
130+
/* No region declarations needed */
131+
#endif
113132

114133
#endif // MBED_MBED_RTX_H

0 commit comments

Comments
 (0)