From dba97a5ecb9797e0184cacd0e218595797feec85 Mon Sep 17 00:00:00 2001 From: Stefan Hepp Date: Mon, 17 Mar 2014 13:03:28 +0100 Subject: [PATCH 1/3] Removed invalid flush asm instruction --- c/src/lib/libcpu/patmos/cache/cache.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/c/src/lib/libcpu/patmos/cache/cache.c b/c/src/lib/libcpu/patmos/cache/cache.c index a5ca88ca95..41ac33085c 100755 --- a/c/src/lib/libcpu/patmos/cache/cache.c +++ b/c/src/lib/libcpu/patmos/cache/cache.c @@ -10,12 +10,13 @@ #if defined(HAS_INSTRUCTION_CACHE) +/* XXX these need to be addressed */ void _CPU_cache_invalidate_entire_instruction ( void ) { - asm volatile ("flush"); + // No flush instruction at the moment + //asm volatile ("flush"); } -/* XXX these need to be addressed */ void _CPU_cache_freeze_instruction ( void ) { } From cc1ea883df6416f80338aaff985963a95c20ff1e Mon Sep 17 00:00:00 2001 From: Stefan Hepp Date: Tue, 18 Mar 2014 12:32:16 +0100 Subject: [PATCH 2/3] Added _fstat_r and _isatty_r to llvm.used as they are defined by RTEMS and used by newlib which is linked after RTEMS. --- c/src/lib/libbsp/patmos/shared/libsyms.ll | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/c/src/lib/libbsp/patmos/shared/libsyms.ll b/c/src/lib/libbsp/patmos/shared/libsyms.ll index d3aecb854f..6cd4911c06 100755 --- a/c/src/lib/libbsp/patmos/shared/libsyms.ll +++ b/c/src/lib/libbsp/patmos/shared/libsyms.ll @@ -3,6 +3,7 @@ target datalayout = "E-S32-p:32:32:32-i8:8:8-i16:16:16-i32:32:32-i64:32:32-f64:3 target triple = "patmos-unknown-rtems" %struct._reent = type opaque +%struct.stat = type opaque declare i32 @rtems_termios_write(i8* nocapture %arg) nounwind declare i32 @rtems_io_register_name(i8* nocapture %device_name, i32 %major, i32 %minor) nounwind @@ -23,8 +24,11 @@ declare i32 @getdents(i32 %dd_fd, i32 %dd_buf, i32 %dd_len) nounwind declare i32 @_rename_r(%struct._reent* nocapture %ptr, i32 %old, i32 %new) nounwind declare i32 @rtems_clock_set_nanoseconds_extension(i32 ()* nocapture %routine) nounwind declare i32 @rtems_clock_tick() nounwind +declare i32 @_fstat_r(%struct._reent*, i32, %struct.stat*) +declare i32 @_isatty_r(%struct._reent*, i32) -@llvm.used = appending global [19 x i8*] [ + +@llvm.used = appending global [21 x i8*] [ i8* bitcast (i32 (i8*)* @rtems_termios_write to i8*), i8* bitcast (i32 (i8*, i32, i32)* @rtems_io_register_name to i8*), i8* bitcast (void ()* @libc_init to i8*), @@ -43,7 +47,9 @@ i8* bitcast (i32 (i32, i8**, i8**)* @boot_card to i8*), i8* bitcast (i32 (i32, i32, i32)* @getdents to i8*), i8* bitcast (i32 (%struct._reent*, i32, i32)* @_rename_r to i8*), i8* bitcast (i32 (i32()*)* @rtems_clock_set_nanoseconds_extension to i8*), -i8* bitcast (i32 ()* @rtems_clock_tick to i8*) +i8* bitcast (i32 ()* @rtems_clock_tick to i8*), +i8* bitcast (i32 (%struct._reent*, i32, %struct.stat*)* @_fstat_r to i8*), +i8* bitcast (i32 (%struct._reent*, i32)* @_isatty_r to i8*) ], section "llvm.metadata" -; End of libsyms.ll \ No newline at end of file +; End of libsyms.ll From 0524f11f213c4b1a72cf113f24422977a9bae877 Mon Sep 17 00:00:00 2001 From: Stefan Hepp Date: Tue, 18 Mar 2014 12:33:53 +0100 Subject: [PATCH 3/3] Removed -disable-internalize when linking executables, otherwise library symbols are defined multiple times --- c/src/lib/libbsp/patmos/pasim/make/custom/pasim.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c/src/lib/libbsp/patmos/pasim/make/custom/pasim.cfg b/c/src/lib/libbsp/patmos/pasim/make/custom/pasim.cfg index 727b441f7a..d6bac255b4 100755 --- a/c/src/lib/libbsp/patmos/pasim/make/custom/pasim.cfg +++ b/c/src/lib/libbsp/patmos/pasim/make/custom/pasim.cfg @@ -20,4 +20,4 @@ CFLAGS_OPTIMIZE_V = -O2 -g -Xllc -trap-func=abort_trap # We need the optimized register allocator here, the fast register allocator at -O0 wants to introduce spill code in naked functions. CFLAGS_DEBUG_V = -O0 -Xllc -optimize-regalloc -LINK_LIBS += $(PROJECT_RELEASE)/lib/start.o $(PROJECT_RELEASE)/lib/libsyms.ll -l=c -l=rtemscpu -l=rtemsbsp -nostartfiles -Xgold -Map -Xgold map.map -Xgold --script=$(PROJECT_RELEASE)/lib/linkcmds -Xopt -disable-internalize +LINK_LIBS += $(PROJECT_RELEASE)/lib/start.o $(PROJECT_RELEASE)/lib/libsyms.ll -l=c -l=rtemscpu -l=rtemsbsp -nostartfiles -Xgold -Map -Xgold map.map -Xgold --script=$(PROJECT_RELEASE)/lib/linkcmds