ARM/IntegratorCP: Build for compiler toolchains with and without newlib/startup code by making newlib syscalls and _mainCRTStartup() weak linkage. Also add missing test modules to Makefile.

This commit is contained in:
Kelvin Lawson
2013-02-26 22:13:14 +00:00
parent 5e56576b2d
commit 06684c94ce
3 changed files with 18 additions and 1 deletions

View File

@@ -16,7 +16,7 @@ AS = arm-none-eabi-gcc
CFLAGS := $(CFLAGS) -Wall -g -c -mcpu=arm926ej-s -ffreestanding
AFLAGS := $(CFLAGS) -Wall -g -c -mcpu=arm926ej-s -ffreestanding
LFLAGS := $(LFLAGS) -Wall -mcpu=arm926ej-s -Wl,-Map=system.map,--verbose -Tsystem.ld
LFLAGS := $(LFLAGS) -Wall -mcpu=arm926ej-s -Wl,-Map=system.map -Tsystem.ld
CDEFS := $(CDEFS) -DATOMTHREADS_TEST='"$(TEST_NAME)"'
ADEFS := $(ADEFS)
@@ -26,6 +26,7 @@ LLIBS := $(LLIBS)
SRCS := $(SRCS) \
modules.c \
syscalls.c \
main.c \
$(ATOMTHREADS)/tests/$(TEST_NAME).c
@@ -64,6 +65,7 @@ all_tests:
make run_test "TEST_NAME=timer1"
make run_test "TEST_NAME=timer2"
make run_test "TEST_NAME=timer3"
make run_test "TEST_NAME=timer4"
make run_test "TEST_NAME=timer5"
make run_test "TEST_NAME=timer6"
make run_test "TEST_NAME=timer7"
@@ -76,6 +78,7 @@ all_tests:
make run_test "TEST_NAME=queue7"
make run_test "TEST_NAME=queue8"
make run_test "TEST_NAME=queue9"
make run_test "TEST_NAME=queue10"
make run_test "TEST_NAME=sem1"
make run_test "TEST_NAME=sem2"
make run_test "TEST_NAME=sem3"

View File

@@ -76,6 +76,7 @@ dbg_format_msg (char *format, ...)
* May be provided by the compiler toolchain in some cases.
*
*/
extern void _mainCRTStartup (void) __attribute__((weak));
void _mainCRTStartup(void)
{
unsigned long *src;

View File

@@ -11,6 +11,19 @@ enum {
#define UART_DR(baseaddr) (*(unsigned int *)(baseaddr))
#define UART_FR(baseaddr) (*(((unsigned int *)(baseaddr))+6))
/**
* Define all functions as weak in case the compiler toolchain provides them
*/
extern int _close(int file) __attribute__((weak));
extern int _fstat(int file, struct stat *st) __attribute__((weak));
extern int _isatty(int file) __attribute__((weak));
extern int _lseek(int file, int ptr, int dir) __attribute__((weak));
extern int _open(const char *name, int flags, int mode) __attribute__((weak));
extern int _read(int file, char *ptr, int len) __attribute__((weak));
extern caddr_t _sbrk(int incr) __attribute__((weak));
extern int _write(int file, char *ptr, int len) __attribute__((weak));
int _close(int file) { return -1; }
int _fstat(int file, struct stat *st) {