Revert "cpu/msp430_common: set top of heap for sbrk"
This reverts commit 55f433103b477bbb139ff0992f69ce6782d6603a.
This commit is contained in:
parent
5b6534e02d
commit
0268a772ed
@ -126,8 +126,6 @@ void msp430_cpu_init(void)
|
|||||||
|
|
||||||
#define STACK_EXTRA 32
|
#define STACK_EXTRA 32
|
||||||
|
|
||||||
extern char __stack; /* provided by linker script */
|
|
||||||
char *__heap_end = NULL; /* top of heap */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Allocate memory from the heap. Check that we don't collide with the
|
* Allocate memory from the heap. Check that we don't collide with the
|
||||||
@ -137,15 +135,12 @@ char *__heap_end = NULL; /* top of heap */
|
|||||||
*/
|
*/
|
||||||
void *sbrk(int incr)
|
void *sbrk(int incr)
|
||||||
{
|
{
|
||||||
char *__heap_top = __heap_end;
|
char *stack_pointer;
|
||||||
|
|
||||||
if (!__heap_top) {
|
asmv("mov r1, %0" : "=r"(stack_pointer));
|
||||||
/* set __heap_top to stack pointer if we are not in thread mode */
|
stack_pointer -= STACK_EXTRA;
|
||||||
asmv("mov r1, %0" : "=r"(__heap_top));
|
|
||||||
__heap_top -= STACK_EXTRA;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (incr > (__heap_top - cur_break)) {
|
if (incr > (stack_pointer - cur_break)) {
|
||||||
return (void *) - 1; /* ENOMEM */
|
return (void *) - 1; /* ENOMEM */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -26,13 +26,6 @@
|
|||||||
|
|
||||||
extern void board_init(void);
|
extern void board_init(void);
|
||||||
|
|
||||||
/**
|
|
||||||
* Leave some extra space in the stack to allows us to finish the kernel
|
|
||||||
* initialization procedure. __heap_end is set the current stack, minus
|
|
||||||
* STACK_EXTRA since there is still code to execute.
|
|
||||||
*/
|
|
||||||
#define STACK_EXTRA 32
|
|
||||||
|
|
||||||
__attribute__((constructor)) static void startup(void)
|
__attribute__((constructor)) static void startup(void)
|
||||||
{
|
{
|
||||||
/* use putchar so the linker links it in: */
|
/* use putchar so the linker links it in: */
|
||||||
@ -42,10 +35,5 @@ __attribute__((constructor)) static void startup(void)
|
|||||||
|
|
||||||
LOG_INFO("RIOT MSP430 hardware initialization complete.\n");
|
LOG_INFO("RIOT MSP430 hardware initialization complete.\n");
|
||||||
|
|
||||||
/* save current stack pointer as top of heap before enter the thread mode */
|
|
||||||
extern char *__heap_end;
|
|
||||||
__asm__ __volatile__("mov r1, %0" : "=r"(__heap_end));
|
|
||||||
__heap_end -= STACK_EXTRA;
|
|
||||||
|
|
||||||
kernel_init();
|
kernel_init();
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user