Add functions to get top and limit stack

crypto-aes
Kamil Tomaszewski 3 years ago
parent 30c9ad2b2a
commit 96756b3945
  1. 8
      ports/atmel-samd/supervisor/port.c
  2. 8
      ports/cxd56/supervisor/port.c
  3. 8
      ports/nrf/supervisor/port.c
  4. 8
      ports/stm32f4/supervisor/port.c
  5. 6
      supervisor/port.h

@ -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);

@ -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.

@ -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) {

@ -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) {

@ -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);

Loading…
Cancel
Save