Skip to content

Commit 904fdae

Browse files
committed
Add the lacked definitions to mbed_rtx.h
I added the below definitions for working "Dynamic Stack" and "Dynamic heap" on Mbed OS by referencing with the codes of Cortex-M target board. "ISR_STACK_START", "ISR_STACK_SIZE", "INITIAL_SP", "HEAP_START" and "HEAP_SIZE"
1 parent 2d11d6e commit 904fdae

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

targets/TARGET_RENESAS/mbed_rtx.h

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,32 @@
1616
#ifndef MBED_MBED_RTX_H
1717
#define MBED_MBED_RTX_H
1818

19-
#endif // MBED_MBED_RTX_H
19+
#include <stdint.h>
20+
21+
#define OS_IDLE_THREAD_STACK_SIZE 512
22+
23+
#if defined(__CC_ARM)
24+
extern char Image$$ARM_LIB_STACK$$Base[];
25+
extern char Image$$ARM_LIB_STACK$$ZI$$Limit[];
26+
extern char Image$$ARM_LIB_HEAP$$Base[];
27+
#define ISR_STACK_START ((unsigned char*)Image$$ARM_LIB_STACK$$Base)
28+
#define ISR_STACK_SIZE ((uint32_t)((uint32_t)Image$$ARM_LIB_STACK$$ZI$$Limit - (uint32_t)Image$$ARM_LIB_STACK$$Base))
29+
#define INITIAL_SP (Image$$ARM_LIB_STACK$$ZI$$Limit)
30+
#define HEAP_START ((unsigned char*)Image$$ARM_LIB_HEAP$$Base)
31+
#define HEAP_SIZE ((uint32_t)((uint32_t)ISR_STACK_START - (uint32_t)HEAP_START))
32+
#elif defined(__GNUC__)
33+
extern uint32_t __StackTop;
34+
extern uint32_t __StackLimit;
35+
extern uint32_t __end__;
36+
#define ISR_STACK_START ((unsigned char*)&__StackLimit)
37+
#define ISR_STACK_SIZE ((uint32_t)((uint32_t)&__StackTop - (uint32_t)&__StackLimit))
38+
#define INITIAL_SP (&__StackTop)
39+
#define HEAP_START ((unsigned char*)&__end__)
40+
#define HEAP_SIZE ((uint32_t)((uint32_t)ISR_STACK_START - (uint32_t)HEAP_START))
41+
#elif defined(__ICCARM__)
42+
/* No region declarations needed */
43+
#else
44+
#error "no toolchain defined"
45+
#endif
46+
47+
#endif // MBED_MBED_RTX_H

0 commit comments

Comments
 (0)