diff options
Diffstat (limited to 'stmhal')
| -rw-r--r-- | stmhal/main.c | 6 | ||||
| -rw-r--r-- | stmhal/stm32f405.ld | 8 |
2 files changed, 7 insertions, 7 deletions
diff --git a/stmhal/main.c b/stmhal/main.c index 6aa7b082d..05b097b7b 100644 --- a/stmhal/main.c +++ b/stmhal/main.c @@ -174,9 +174,9 @@ static const char fresh_readme_txt[] = int main(void) { // TODO disable JTAG - // Stack limit should be less than real stack size, so we - // had chance to recover from limit hit. - mp_stack_set_limit(&_ram_end - &_heap_end - 512); + // Stack limit should be less than real stack size, so we have a chance + // to recover from limit hit. (Limit is measured in bytes.) + mp_stack_set_limit((char*)&_ram_end - (char*)&_heap_end - 1024); /* STM32F4xx HAL library initialization: - Configure the Flash prefetch, instruction and Data caches diff --git a/stmhal/stm32f405.ld b/stmhal/stm32f405.ld index 9d9d4d508..5af1d3299 100644 --- a/stmhal/stm32f405.ld +++ b/stmhal/stm32f405.ld @@ -16,10 +16,10 @@ MEMORY _minimum_stack_size = 2K; _minimum_heap_size = 16K; -/* top end of the stack */ - -/*_stack_end = ORIGIN(RAM) + LENGTH(RAM);*/ -_estack = ORIGIN(RAM) + LENGTH(RAM) - 1; +/* Define tho top end of the stack. The stack is full descending so begins just + above last byte of RAM. Note that EABI requires the stack to be 8-byte + aligned for a call. */ +_estack = ORIGIN(RAM) + LENGTH(RAM); /* RAM extents for the garbage collector */ _ram_end = ORIGIN(RAM) + LENGTH(RAM); |
