basecmd: Move low-level alloc code into basecmd.c

Implement new dynmem_start() and dynmem_end() functions instead of
alloc_chunk() and alloc_chunks() in the board code.  This simplifies
the board code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor
2017-07-19 23:10:08 -04:00
parent 2ee42997e4
commit 649d26e093
6 changed files with 74 additions and 90 deletions

View File

@@ -4,7 +4,6 @@
//
// This file may be distributed under the terms of the GNU GPLv3 license.
#include "board/misc.h" // alloc_maxsize
#include "command.h" // DECL_CONSTANT
#include "sam3x8e.h" // WDT
#include "sched.h" // sched_main
@@ -43,16 +42,6 @@ command_reset(uint32_t *args)
}
DECL_COMMAND_FLAGS(command_reset, HF_IN_SHUTDOWN, "reset");
void * __visible
_sbrk(int nbytes)
{
extern char _end;
static void *heap_ptr = (void *)&_end;
void *pos = heap_ptr;
heap_ptr = pos + nbytes;
return pos;
}
// Main entry point
int
main(void)