diff --git a/boards/msba2-common/Makefile.include b/boards/msba2-common/Makefile.include index 0c6f878063..e3c6a3c90a 100644 --- a/boards/msba2-common/Makefile.include +++ b/boards/msba2-common/Makefile.include @@ -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 diff --git a/cpu/arm7_common/Makefile.include b/cpu/arm7_common/Makefile.include index b7ee75e03d..6706e4cf53 100644 --- a/cpu/arm7_common/Makefile.include +++ b/cpu/arm7_common/Makefile.include @@ -1,3 +1 @@ INCLUDES += -I$(RIOTBASE)/cpu/arm7_common/include/ - -export UNDEF += $(BINDIR)arm7_common/syscalls.o diff --git a/cpu/arm7_common/bootloader.c b/cpu/arm7_common/bootloader.c index 0ecf5d59df..22bd950b95 100644 --- a/cpu/arm7_common/bootloader.c +++ b/cpu/arm7_common/bootloader.c @@ -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 } /** @} */ diff --git a/cpu/lpc2387/ldscripts/lpc2387.ld b/cpu/lpc2387/ldscripts/lpc2387.ld index 858e1b2e3d..faaa14edf1 100644 --- a/cpu/lpc2387/ldscripts/lpc2387.ld +++ b/cpu/lpc2387/ldscripts/lpc2387.ld @@ -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 /* diff --git a/cpu/lpc2387/lpc_syscalls.c b/cpu/lpc2387/lpc_syscalls.c deleted file mode 100644 index 84e178852e..0000000000 --- a/cpu/lpc2387/lpc_syscalls.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * syscalls.c - MCU dependent syscall implementation for LPCXXXX - * Copyright (C) 2013 Oliver Hahm - * - * 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 -#include -#include -#include -#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; -} diff --git a/cpu/mc1322x/Makefile.include b/cpu/mc1322x/Makefile.include index 08b43efe59..3e773fdc4d 100644 --- a/cpu/mc1322x/Makefile.include +++ b/cpu/mc1322x/Makefile.include @@ -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 diff --git a/cpu/arm7_common/syscalls.c b/cpu/mc1322x/syscalls.c similarity index 100% rename from cpu/arm7_common/syscalls.c rename to cpu/mc1322x/syscalls.c