Add get top and limit functions for Spresense

This commit is contained in:
Kamil Tomaszewski 2019-10-18 11:10:22 +02:00
parent f3151bb6c4
commit 4338511b28
2 changed files with 9 additions and 3 deletions

View File

@ -90,6 +90,7 @@ INC += \
-I$(SPRESENSE_SDK)/nuttx/include \
-I$(SPRESENSE_SDK)/nuttx/arch \
-I$(SPRESENSE_SDK)/nuttx/arch/chip \
-I$(SPRESENSE_SDK)/nuttx/arch/os \
-I$(SPRESENSE_SDK)/sdk/bsp/include \
-I$(SPRESENSE_SDK)/sdk/bsp/include/sdk \
@ -124,7 +125,6 @@ LDFLAGS = \
--entry=__start \
-nostartfiles \
-nodefaultlibs \
--defsym __stack=_vectors+786432 \
-T$(SPRESENSE_SDK)/nuttx/build/ramconfig.ld \
--gc-sections \
-Map=$(BUILD)/output.map \

View File

@ -27,6 +27,8 @@
#include <stdint.h>
#include <sys/boardctl.h>
#include "sched/sched.h"
#include "boards/board.h"
#include "supervisor/port.h"
@ -68,11 +70,15 @@ void reset_to_bootloader(void) {
}
uint32_t *port_stack_get_limit(void) {
return &_ebss;
struct tcb_s *rtcb = this_task();
return rtcb->adj_stack_ptr - (uint32_t)rtcb->adj_stack_size;
}
uint32_t *port_stack_get_top(void) {
return &_estack;
struct tcb_s *rtcb = this_task();
return rtcb->adj_stack_ptr;
}
extern uint32_t _ebss;