summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ports/atmel-samd/supervisor/port.c8
-rw-r--r--ports/cxd56/supervisor/port.c8
-rw-r--r--ports/nrf/supervisor/port.c8
-rw-r--r--ports/stm32f4/supervisor/port.c8
-rw-r--r--supervisor/port.h6
5 files changed, 38 insertions, 0 deletions
diff --git a/ports/atmel-samd/supervisor/port.c b/ports/atmel-samd/supervisor/port.c
index 512fd8eb8..e962281c1 100644
--- a/ports/atmel-samd/supervisor/port.c
+++ b/ports/atmel-samd/supervisor/port.c
@@ -271,6 +271,14 @@ void reset_cpu(void) {
reset();
}
+uint32_t *port_stack_get_limit(void) {
+ return &_ebss;
+}
+
+uint32_t *port_stack_get_top(void) {
+ return &_estack;
+}
+
// Place the word to save 8k from the end of RAM so we and the bootloader don't clobber it.
#ifdef SAMD21
uint32_t* safe_word = (uint32_t*) (HMCRAMC0_ADDR + HMCRAMC0_SIZE - 0x2000);
diff --git a/ports/cxd56/supervisor/port.c b/ports/cxd56/supervisor/port.c
index 3fddfe52c..9688cf233 100644
--- a/ports/cxd56/supervisor/port.c
+++ b/ports/cxd56/supervisor/port.c
@@ -67,6 +67,14 @@ void reset_port(void) {
void reset_to_bootloader(void) {
}
+uint32_t *port_stack_get_limit(void) {
+ return &_ebss;
+}
+
+uint32_t *port_stack_get_top(void) {
+ return &_estack;
+}
+
extern uint32_t _ebss;
// Place the word to save just after our BSS section that gets blanked.
diff --git a/ports/nrf/supervisor/port.c b/ports/nrf/supervisor/port.c
index c69101070..af858aa4a 100644
--- a/ports/nrf/supervisor/port.c
+++ b/ports/nrf/supervisor/port.c
@@ -146,6 +146,14 @@ void reset_cpu(void) {
NVIC_SystemReset();
}
+uint32_t *port_stack_get_limit(void) {
+ return &_ebss;
+}
+
+uint32_t *port_stack_get_top(void) {
+ return &_estack;
+}
+
extern uint32_t _ebss;
// Place the word to save just after our BSS section that gets blanked.
void port_set_saved_word(uint32_t value) {
diff --git a/ports/stm32f4/supervisor/port.c b/ports/stm32f4/supervisor/port.c
index df7a6ca42..502202f52 100644
--- a/ports/stm32f4/supervisor/port.c
+++ b/ports/stm32f4/supervisor/port.c
@@ -67,6 +67,14 @@ void reset_cpu(void) {
NVIC_SystemReset();
}
+uint32_t *port_stack_get_limit(void) {
+ return &_ebss;
+}
+
+uint32_t *port_stack_get_top(void) {
+ return &_estack;
+}
+
extern uint32_t _ebss;
// Place the word to save just after our BSS section that gets blanked.
void port_set_saved_word(uint32_t value) {
diff --git a/supervisor/port.h b/supervisor/port.h
index 1430c6a50..c8a011978 100644
--- a/supervisor/port.h
+++ b/supervisor/port.h
@@ -54,6 +54,12 @@ void reset_board(void);
// Reset to the bootloader
void reset_to_bootloader(void);
+// Get stack limit address
+uint32_t *port_stack_get_limit(void);
+
+// Get stack top address
+uint32_t *port_stack_get_top(void);
+
// Save and retrieve a word from memory that is preserved over reset. Used for safe mode.
void port_set_saved_word(uint32_t);
uint32_t port_get_saved_word(void);