Add functions to get top and limit stack

This commit is contained in:
Kamil Tomaszewski 2019-10-18 11:00:09 +02:00
parent 30c9ad2b2a
commit 96756b3945
5 changed files with 38 additions and 0 deletions

View File

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

View File

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

View File

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

View File

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

View File

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