basecmd: Avoid calling malloc() from main code

Introduce a new board function alloc_chunk() to allocate dynamic
memory.  This allows the board code to implement memory allocations
without using the standard malloc() interface.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor
2017-05-06 22:29:08 -04:00
parent 8f1d0c2a7c
commit f331936969
6 changed files with 66 additions and 45 deletions

View File

@@ -16,7 +16,8 @@ LDFLAGS-y += --specs=nano.specs --specs=nosys.specs
# Add source files
src-y += sam3x8e/main.c sam3x8e/timer.c sam3x8e/gpio.c
src-y += generic/crc16_ccitt.c generic/armcm_irq.c generic/timer_irq.c
src-y += generic/crc16_ccitt.c generic/alloc.c
src-y += generic/armcm_irq.c generic/timer_irq.c
src-y += ../lib/cmsis-sam3x8e/source/system_sam3xa.c
src-y += ../lib/cmsis-sam3x8e/source/gcc/startup_sam3xa.c
src-$(CONFIG_SERIAL) += sam3x8e/serial.c

View File

@@ -1,6 +1,6 @@
// Main starting point for SAM3x8e boards.
//
// Copyright (C) 2016 Kevin O'Connor <kevin@koconnor.net>
// Copyright (C) 2016,2017 Kevin O'Connor <kevin@koconnor.net>
//
// This file may be distributed under the terms of the GNU GPLv3 license.
@@ -43,12 +43,6 @@ command_reset(uint32_t *args)
}
DECL_COMMAND_FLAGS(command_reset, HF_IN_SHUTDOWN, "reset");
size_t
alloc_maxsize(size_t reqsize)
{
return reqsize;
}
void * __visible
_sbrk(int nbytes)
{