cpu: lpc2387: switch to newlib module
This commit is contained in:
parent
4dd63dd24e
commit
a03ff202cf
@ -1,9 +1,12 @@
|
||||
## the cpu to build for
|
||||
export CPU = lpc2387
|
||||
|
||||
# Target triple for the build. Use arm-none-eabi if you are unsure.
|
||||
export TARGET_TRIPLE ?= arm-none-eabi
|
||||
|
||||
# toolchain config
|
||||
export PREFIX = arm-none-eabi-
|
||||
#export PREFIX = arm-elf-
|
||||
export PREFIX = $(if $(TARGET_TRIPLE),$(TARGET_TRIPLE)-)
|
||||
|
||||
export CC = $(PREFIX)gcc
|
||||
export CXX = $(PREFIX)g++
|
||||
export AR = $(PREFIX)ar
|
||||
|
||||
@ -1,3 +1 @@
|
||||
INCLUDES += -I$(RIOTBASE)/cpu/arm7_common/include/
|
||||
|
||||
export UNDEF += $(BINDIR)arm7_common/syscalls.o
|
||||
|
||||
@ -79,7 +79,6 @@ void abtorigin(const char *vector, u_long *lnk_ptr1)
|
||||
printf("#!%s abort at %p (0x%08lX) originating from %p (0x%08lX) in mode 0x%X\n",
|
||||
vector, (void *)lnk_ptr1, *(lnk_ptr1), (void *)lnk_ptr2, *(lnk_ptr2), spsr
|
||||
);
|
||||
stdio_flush();
|
||||
|
||||
exit(1);
|
||||
}
|
||||
@ -178,10 +177,10 @@ void bootloader(void)
|
||||
/* board specific setup of i/o pins */
|
||||
bl_init_ports();
|
||||
|
||||
/* UART setup */
|
||||
bl_uart_init();
|
||||
|
||||
puts("Board initialized.");
|
||||
#ifdef MODULE_NEWLIB
|
||||
extern void __libc_init_array(void);
|
||||
__libc_init_array();
|
||||
#endif
|
||||
}
|
||||
|
||||
/** @} */
|
||||
|
||||
@ -237,9 +237,9 @@ SECTIONS
|
||||
__heap1_size = ORIGIN(ram) + LENGTH(ram) - . - __stack_size;
|
||||
.heap1 (NOLOAD) :
|
||||
{
|
||||
PROVIDE(__heap1_start = .);
|
||||
PROVIDE(_sheap = .);
|
||||
. = . + __heap1_size;
|
||||
PROVIDE(__heap1_max = .);
|
||||
PROVIDE(_eheap = .);
|
||||
} > ram
|
||||
|
||||
/*
|
||||
|
||||
@ -1,68 +0,0 @@
|
||||
/*
|
||||
* syscalls.c - MCU dependent syscall implementation for LPCXXXX
|
||||
* Copyright (C) 2013 Oliver Hahm <oliver.hahm@inria.fr>
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser
|
||||
* General Public License v2.1. See the file LICENSE in the top level
|
||||
* directory for more details.
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdint.h>
|
||||
#include <sys/unistd.h>
|
||||
#include <stdio.h>
|
||||
#include "irq.h"
|
||||
|
||||
/**
|
||||
* @name Heaps (defined in linker script)
|
||||
* @{
|
||||
*/
|
||||
#define NUM_HEAPS 3
|
||||
|
||||
extern uintptr_t __heap1_start; ///< start of heap memory space
|
||||
extern uintptr_t __heap1_max; ///< maximum for end of heap memory space
|
||||
extern uintptr_t __heap2_start; ///< start of heap memory space
|
||||
extern uintptr_t __heap2_max; ///< maximum for end of heap memory space
|
||||
extern uintptr_t __heap3_start; ///< start of heap memory space
|
||||
extern uintptr_t __heap3_max; ///< maximum for end of heap memory space
|
||||
|
||||
/// current position in heap
|
||||
static caddr_t heap[NUM_HEAPS] = {(caddr_t)&__heap1_start,(caddr_t)&__heap3_start,(caddr_t)&__heap2_start}; // add heap3 before heap2 cause Heap3 address is lower then addr of heap2
|
||||
/// maximum position in heap
|
||||
static const caddr_t heap_max[NUM_HEAPS] = {(caddr_t)&__heap1_max,(caddr_t)&__heap3_max,(caddr_t)&__heap2_max};
|
||||
// start position in heap
|
||||
static const caddr_t heap_start[NUM_HEAPS] = {(caddr_t)&__heap1_start,(caddr_t)&__heap3_start,(caddr_t)&__heap2_start};
|
||||
|
||||
/** @} */
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
void heap_stats(void)
|
||||
{
|
||||
for(int i = 0; i < NUM_HEAPS; i++)
|
||||
printf("# heap %i: %p -- %p -> %p (%li of %li free)\n", i, heap_start[i], heap[i], heap_max[i],
|
||||
(uint32_t)heap_max[i] - (uint32_t)heap[i], (uint32_t)heap_max[i] - (uint32_t)heap_start[i]);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
caddr_t _sbrk_r(struct _reent *r, ptrdiff_t incr)
|
||||
{
|
||||
uint32_t cpsr = disableIRQ();
|
||||
|
||||
/* check all heaps for a chunk of the requested size */
|
||||
for (volatile uint8_t iUsedHeap = 0; iUsedHeap < NUM_HEAPS; iUsedHeap++ ) {
|
||||
caddr_t new_heap = heap[iUsedHeap] + incr;
|
||||
|
||||
if( new_heap <= heap_max[iUsedHeap] ) {
|
||||
caddr_t prev_heap = heap[iUsedHeap];
|
||||
heap[iUsedHeap] = new_heap;
|
||||
|
||||
r->_errno = 0;
|
||||
restoreIRQ(cpsr);
|
||||
return prev_heap;
|
||||
}
|
||||
}
|
||||
restoreIRQ(cpsr);
|
||||
|
||||
r->_errno = ENOMEM;
|
||||
return NULL;
|
||||
}
|
||||
@ -3,6 +3,6 @@ INCLUDES += -I$(RIOTCPU)/$(CPU)/maca/include
|
||||
|
||||
include $(RIOTCPU)/arm7_common/Makefile.include
|
||||
|
||||
export UNDEF += $(BINDIR)cpu/mc1322x_syscalls.o
|
||||
export UNDEF += $(BINDIR)cpu/mc1322x_syscalls.o $(BINDIR)cpu/syscalls.o
|
||||
|
||||
export USEMODULE += arm7_common
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user