Browse Source

Revert "Fix malloc corrupting the stack. Added new function reserve_stack() to adjust the amount of memory reserved for the stack."

Different version applied upstream.

This reverts commit c5bdda910b.
main
Tilo Nitzsche 7 years ago
parent
commit
91190e6cf4
2 changed files with 0 additions and 18 deletions
  1. +0
    -5
      teensy3/kinetis.h
  2. +0
    -13
      teensy3/mk20dx128.c

+ 0
- 5
teensy3/kinetis.h View File

@@ -5794,11 +5794,6 @@ extern void software_isr(void);
extern void (* _VectorsRam[NVIC_NUM_INTERRUPTS+16])(void);
extern void (* const _VectorsFlash[NVIC_NUM_INTERRUPTS+16])(void);

// Reserve stack memory. This is the amount of memory malloc will leave alone
// for the stack. The stack can grow larger than this limit (growing towards /
// into the heap). 512 bytes are reserved by default.
extern void reserve_stack(int size);

#ifdef __cplusplus
}
#endif

+ 0
- 13
teensy3/mk20dx128.c View File

@@ -32,7 +32,6 @@
#include "core_pins.h" // testing only
#include "ser_print.h" // testing only

#include <errno.h>

// Flash Security Setting. On Teensy 3.2, you can lock the MK20 chip to prevent
// anyone from reading your code. You CAN still reprogram your Teensy while
@@ -1138,20 +1137,8 @@ void ResetHandler(void)

char *__brkval = (char *)&_ebss;

int reserved_stack_size = 512;

void reserve_stack(int size)
{
reserved_stack_size = size;
}

void * _sbrk(int incr)
{
if(__brkval + incr >= (char*) &_estack - reserved_stack_size)
{
errno = ENOMEM;
return (void*) -1;
}
char *prev = __brkval;
__brkval += incr;
return prev;

Loading…
Cancel
Save