|
|
|
|
|
|
|
|
#include "core_pins.h" // testing only |
|
|
#include "core_pins.h" // testing only |
|
|
#include "ser_print.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 |
|
|
// 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 |
|
|
// anyone from reading your code. You CAN still reprogram your Teensy while |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
char *__brkval = (char *)&_ebss; |
|
|
char *__brkval = (char *)&_ebss; |
|
|
|
|
|
|
|
|
int reserved_stack_size = 512; |
|
|
|
|
|
|
|
|
|
|
|
void reserve_stack(int size) |
|
|
|
|
|
{ |
|
|
|
|
|
reserved_stack_size = size; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void * _sbrk(int incr) |
|
|
void * _sbrk(int incr) |
|
|
{ |
|
|
{ |
|
|
if(__brkval + incr >= (char*) &_estack - reserved_stack_size) |
|
|
|
|
|
{ |
|
|
|
|
|
errno = ENOMEM; |
|
|
|
|
|
return (void*) -1; |
|
|
|
|
|
} |
|
|
|
|
|
char *prev = __brkval; |
|
|
char *prev = __brkval; |
|
|
__brkval += incr; |
|
|
__brkval += incr; |
|
|
return prev; |
|
|
return prev; |