Skip to content

Commit 4338511

Browse files
committed
Add get top and limit functions for Spresense
1 parent f3151bb commit 4338511

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

ports/cxd56/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ INC += \
9090
-I$(SPRESENSE_SDK)/nuttx/include \
9191
-I$(SPRESENSE_SDK)/nuttx/arch \
9292
-I$(SPRESENSE_SDK)/nuttx/arch/chip \
93+
-I$(SPRESENSE_SDK)/nuttx/arch/os \
9394
-I$(SPRESENSE_SDK)/sdk/bsp/include \
9495
-I$(SPRESENSE_SDK)/sdk/bsp/include/sdk \
9596

@@ -124,7 +125,6 @@ LDFLAGS = \
124125
--entry=__start \
125126
-nostartfiles \
126127
-nodefaultlibs \
127-
--defsym __stack=_vectors+786432 \
128128
-T$(SPRESENSE_SDK)/nuttx/build/ramconfig.ld \
129129
--gc-sections \
130130
-Map=$(BUILD)/output.map \

ports/cxd56/supervisor/port.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
#include <stdint.h>
2828
#include <sys/boardctl.h>
2929

30+
#include "sched/sched.h"
31+
3032
#include "boards/board.h"
3133

3234
#include "supervisor/port.h"
@@ -68,11 +70,15 @@ void reset_to_bootloader(void) {
6870
}
6971

7072
uint32_t *port_stack_get_limit(void) {
71-
return &_ebss;
73+
struct tcb_s *rtcb = this_task();
74+
75+
return rtcb->adj_stack_ptr - (uint32_t)rtcb->adj_stack_size;
7276
}
7377

7478
uint32_t *port_stack_get_top(void) {
75-
return &_estack;
79+
struct tcb_s *rtcb = this_task();
80+
81+
return rtcb->adj_stack_ptr;
7682
}
7783

7884
extern uint32_t _ebss;

0 commit comments

Comments
 (0)