diff --git a/.gitignore b/.gitignore
index aa4d9bb4ada1869788c8184b560ba03c0951d267..c45184958f04f20653625afcd69c4c3e4ab83d1e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,4 +8,5 @@
 *.hex
 *.bin
 *~
-*.d
\ No newline at end of file
+*.d
+*.directory
\ No newline at end of file
diff --git a/miosix/testsuite/build.sh b/miosix/testsuite/build.sh
index 8181e871d8599f2771b331c0e90795d54c88f0b9..f60111a150f859290883ff94f65fcd0ccd4e5af5 100755
--- a/miosix/testsuite/build.sh
+++ b/miosix/testsuite/build.sh
@@ -12,7 +12,7 @@ for i in $1_*/; do
 		
 		cd $i &&
 		make clean &&
-		make &&
+		make $2 "NAME=$name" &&
 		cp prog3.h "../$name.h" &&
 		cd ..
 	fi
diff --git a/miosix/testsuite/testsuite.cpp b/miosix/testsuite/testsuite.cpp
index e24ff01e349d0c3ecda58db8cf1646e09f09b74b..e2752e8f0b785dd4614046cc7ce95088e0fd2e68 100644
--- a/miosix/testsuite/testsuite.cpp
+++ b/miosix/testsuite/testsuite.cpp
@@ -52,6 +52,7 @@
 
 #include "testsuite_syscall.h"
 #include "testsuite_simple.h"
+#include "testsuite_sleep.h"
 
 using namespace miosix;
 
@@ -104,7 +105,8 @@ static void exception_test();
 #endif //__NO_EXCEPTIONS
 
 #ifdef WITH_PROCESSES
-void syscall_test_1();
+void syscall_test_files();
+void syscall_test_sleep();
 #endif
 //main(), calls all tests
 int main()
@@ -191,7 +193,8 @@ int main()
 			case 'y':
 				#ifdef WITH_PROCESSES
 				ledOn();
-				syscall_test_1();
+				syscall_test_files();
+				syscall_test_sleep();
 				ledOff();
 				#else
 				fail("Process not supported");
@@ -235,7 +238,13 @@ static void fail(const char *cause)
     reboot();
 }
 
-void syscall_test_1(){
+void syscall_test_sleep(){
+	ElfProgram prog(reinterpret_cast<const unsigned int*>(testsuite_sleep_elf),testsuite_sleep_len);
+	
+	long long time = getTick();
+}
+
+void syscall_test_files(){
 	test_name("System Call: open, read, write, seek, close, sytem");
 	
 	char msg[256] = {0};
diff --git a/miosix/testsuite/testsuite_file.h b/miosix/testsuite/testsuite_file.h
new file mode 100644
index 0000000000000000000000000000000000000000..3afa448a9872aa69c1c817b0c305bf7b555e38d5
--- /dev/null
+++ b/miosix/testsuite/testsuite_file.h
@@ -0,0 +1,33 @@
+const unsigned char __attribute__((aligned(8))) testsuite_file_elf[] = {
+  0x7f, 0x45, 0x4c, 0x46, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x28, 0x00, 0x01, 0x00, 0x00, 0x00,
+  0x99, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x02, 0x00, 0x00, 0x05, 0x34, 0x00, 0x20, 0x00, 0x03, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00,
+  0x98, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0x76, 0x00, 0x00, 0x00,
+  0x76, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+  0x01, 0x00, 0x00, 0x00, 0x10, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10,
+  0x00, 0x00, 0x00, 0x10, 0x50, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00,
+  0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+  0x1c, 0x01, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x10, 0x0c, 0x00, 0x00, 0x10,
+  0x28, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+  0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x02, 0xf8,
+  0x00, 0xf0, 0x2c, 0xf8, 0xf8, 0xb5, 0x13, 0x4f, 0x00, 0x24, 0x09, 0xeb,
+  0x07, 0x03, 0x13, 0xf8, 0x01, 0x5f, 0x01, 0x34, 0x00, 0x2d, 0xfa, 0xd1,
+  0x0f, 0x48, 0x40, 0xf2, 0x02, 0x41, 0x48, 0x44, 0x2a, 0x46, 0x00, 0xf0,
+  0x1d, 0xf8, 0xb0, 0xf1, 0xff, 0x3f, 0x06, 0x46, 0x0b, 0xd0, 0x09, 0xeb,
+  0x07, 0x01, 0x22, 0x46, 0x00, 0xf0, 0x1a, 0xf8, 0xa0, 0x42, 0x06, 0xd0,
+  0x30, 0x46, 0x00, 0xf0, 0x12, 0xf8, 0x02, 0x20, 0xf8, 0xbd, 0x01, 0x20,
+  0xfc, 0xe7, 0x30, 0x46, 0x00, 0xf0, 0x0b, 0xf8, 0x28, 0x46, 0xf7, 0xe7,
+  0x38, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x02, 0x23, 0x00, 0xdf,
+  0x06, 0x23, 0x00, 0xdf, 0x70, 0x47, 0x07, 0x23, 0x00, 0xdf, 0x70, 0x47,
+  0x03, 0x23, 0x00, 0xdf, 0x70, 0x47, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x10,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x40, 0x00, 0x00,
+  0x01, 0x00, 0x00, 0x10, 0x00, 0x08, 0x00, 0x00, 0x4d, 0x69, 0x6f, 0x73,
+  0x69, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x61, 0x73, 0x64, 0x00, 0x74, 0x65, 0x73, 0x74,
+  0x73, 0x75, 0x69, 0x74, 0x65, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x2e, 0x62,
+  0x69, 0x6e, 0x00, 0x00
+};
+unsigned int testsuite_file_elf_len = 352;
diff --git a/miosix/testsuite/testsuite_file/Makefile b/miosix/testsuite/testsuite_file/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..dc36819ff65a995e1d823fc124b8eca3df2819f2
--- /dev/null
+++ b/miosix/testsuite/testsuite_file/Makefile
@@ -0,0 +1,46 @@
+##
+## Makefile for writing PROGRAMS for the Miosix embedded OS
+## TFT:Terraneo Federico Technlogies
+##
+
+SRC := \
+main.c
+
+## Replaces both "foo.cpp"-->"foo.o" and "foo.c"-->"foo.o"
+OBJ := $(addsuffix .o, $(basename $(SRC)))
+ELF := $(addsuffix .elf, $(NAME))
+OUT_FILE := $(addsuffix .bin, $(NAME))
+
+AS  := arm-miosix-eabi-as
+CC  := arm-miosix-eabi-gcc
+CXX := arm-miosix-eabi-g++
+SZ  := arm-miosix-eabi-size
+
+AFLAGS   := -mcpu=cortex-m3 -mthumb
+CFLAGS   := -mcpu=cortex-m3 -mthumb -mfix-cortex-m3-ldrd -fpie -msingle-pic-base \
+            -ffunction-sections -O2 -Wall -c -DTEST_STRING='$(TEST_STRING)' -DTEST_FILE='"$(OUT_FILE)"'
+CXXFLAGS := $(CFLAGS)
+LFLAGS   := -mcpu=cortex-m3 -mthumb -mfix-cortex-m3-ldrd -fpie -msingle-pic-base \
+            -Wl,--gc-sections,-Map,test.map,-T./miosix.ld,-n,-pie,--spare-dynamic-tags,3 \
+            -O2 -nostdlib
+
+LINK_LIBS := -Wl,--start-group -lstdc++ -lc -lm -lgcc -Wl,--end-group
+
+all: $(OBJ) crt0.o
+	$(CXX) $(LFLAGS) -o $(ELF) $(OBJ) crt0.o $(LINK_LIBS)
+	$(SZ)  $(ELF)
+	@arm-miosix-eabi-objdump -Dslx $(ELF) > test.txt
+	@mx-postlinker $(ELF) --ramsize=16384 --stacksize=2048 --strip-sectheader
+	@xxd -i $(ELF) | sed 's/unsigned char/const unsigned char __attribute__((aligned(8)))/' > prog3.h
+
+clean:
+	-rm $(OBJ) crt0.o *.elf test.map test.txt
+
+%.o: %.s
+	$(AS) $(AFLAGS) $< -o $@
+
+%.o : %.c
+	$(CC) $(CFLAGS) $< -o $@
+
+%.o : %.cpp
+	$(CXX) $(CXXFLAGS) $< -o $@
diff --git a/miosix/testsuite/testsuite_file/crt0.s b/miosix/testsuite/testsuite_file/crt0.s
new file mode 100644
index 0000000000000000000000000000000000000000..9959b317dcafd42e8cb82c896b3eef2e0205f7cc
--- /dev/null
+++ b/miosix/testsuite/testsuite_file/crt0.s
@@ -0,0 +1,131 @@
+/*
+ * Startup script for writing PROGRAMS for the Miosix embedded OS
+ * TFT:Terraneo Federico Technlogies
+ */
+
+.syntax unified
+.cpu cortex-m3
+.thumb
+
+.section .text
+
+/**
+ * _start, program entry point
+ */
+.global _start
+.type _start, %function
+_start:
+	/* TODO: .ctor */
+	bl   main
+	/* TODO: .dtor */
+	bl   _exit
+
+/**
+ * _exit, terminate process
+ * \param v exit value 
+ */
+.section .text._exit
+.global _exit
+.type _exit, %function
+_exit:
+	movs r3, #2
+	svc  0
+
+/**
+ * open, open a file
+ * \param fd file descriptor
+ * \param file access mode
+ * \param xxx access permisions
+ * \return file descriptor or -1 if errors
+ */
+.section .text.open
+.global open
+.type open, %function
+open:
+	movs r3, #6
+	svc 0
+	bx lr
+
+/**
+ * close, close a file
+ * \param fd file descriptor
+ */
+.section .text.close
+.global close
+.type close, %function
+close:
+	movs r3, #7
+	svc 0
+	bx lr
+
+/**
+ * seek
+ * \param fd file descriptor
+ * \param pos moving offset
+ * \param start position, SEEK_SET, SEEK_CUR or SEEK_END
+*/
+.section .text.seek
+.global seek
+.type seek, %function
+seek:
+	movs r3, #8
+	svc 0
+	bx lr
+	
+
+/**
+ * system, fork and execture a program, blocking
+ * \param program to execute
+ */
+.section .text.system
+.global system
+.type system, %function
+system:
+	movs r3, #9
+	svc 0
+	bx lr
+	
+/**
+ * write, write to file
+ * \param fd file descriptor
+ * \param buf data to be written
+ * \param len buffer length
+ * \return number of written bytes or -1 if errors
+ */
+.section .text.write
+.global	write
+.type	write, %function
+write:
+    movs r3, #3
+    svc  0
+    bx   lr
+
+/**
+ * read, read from file
+ * \param fd file descriptor
+ * \param buf data to be read
+ * \param len buffer length
+ * \return number of read bytes or -1 if errors
+ */
+.section .text.read
+.global	read
+.type	read, %function
+read:
+    movs r3, #4
+    svc  0
+    bx   lr
+
+/**
+ * usleep, sleep a specified number of microseconds
+ * \param us number of microseconds to sleep
+ * \return 0 on success or -1 if errors
+ */
+.section .text.usleep
+.global	usleep
+.type	usleep, %function
+usleep:
+    movs r3, #5
+    svc  0
+    bx   lr
+
+.end
diff --git a/miosix/testsuite/testsuite_file/main.c b/miosix/testsuite/testsuite_file/main.c
new file mode 100644
index 0000000000000000000000000000000000000000..303edf287590a2e638e1c3a165e8b22446845c41
--- /dev/null
+++ b/miosix/testsuite/testsuite_file/main.c
@@ -0,0 +1,39 @@
+#include <unistd.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <stdio.h>
+
+#define error(x)	(x)
+
+#define SIZE 1024
+
+int mystrlen(const char *s){
+	int result=0;
+	while(*s++) result++;
+	return result;
+}
+
+void print(const char *s){
+	write(1, s, mystrlen(s));
+}
+
+int main(){
+	int len = mystrlen(TEST_STRING);
+	
+	int fd = open(TEST_FILE, O_RDWR|O_TRUNC, 0);
+	
+	if(fd == -1)
+		return 1;
+	
+	if(write(fd, TEST_STRING, len) != len){
+		close(fd);
+		return 2;
+	}
+	
+	close(fd);
+
+	return 0;
+}
diff --git a/miosix/testsuite/testsuite_file/miosix.ld b/miosix/testsuite/testsuite_file/miosix.ld
new file mode 100644
index 0000000000000000000000000000000000000000..c91c803e629040b14233a8f8251a7d9952f68910
--- /dev/null
+++ b/miosix/testsuite/testsuite_file/miosix.ld
@@ -0,0 +1,66 @@
+/*
+ * Linker script for writing PROGRAMS for the Miosix embedded OS
+ * TFT:Terraneo Federico Technlogies
+ */
+
+OUTPUT_FORMAT("elf32-littlearm")
+OUTPUT_ARCH(arm)
+ENTRY(_start)
+
+SECTIONS
+{
+    /* Here starts the first elf segment, that stays in flash */
+    . = 0 + SIZEOF_HEADERS;
+
+    .text : ALIGN(8)
+    {
+        *(.text)
+        *(.text.*)
+        *(.gnu.linkonce.t.*)
+    }
+
+    .rel.data : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) }
+    .rel.got  : { *(.rel.got) }
+
+    /* Here starts the second segment, that is copied in RAM and relocated */
+    . = 0x10000000;
+
+    .got      : { *(.got.plt) *(.igot.plt) *(.got) *(.igot) }
+
+    /* FIXME: If this is put in the other segment, it makes it writable */
+    .dynamic  : { *(.dynamic) }
+
+    /* FIXME: The compiler insists in addressing rodata relative to r9 */
+    .rodata : ALIGN(8)
+    {
+        *(.rodata)
+        *(.rodata.*)
+        *(.gnu.linkonce.r.*)
+    }
+
+    .data : ALIGN(8)
+    {
+        *(.data)
+        *(.data.*)
+        *(.gnu.linkonce.d.*)
+    }
+
+    .bss : ALIGN(8)
+    {
+        *(.bss)
+        *(.bss.*)
+        *(.gnu.linkonce.b.*)
+        *(COMMON)
+    }
+
+    /* These are removed since are unused and increase binary size */
+    /DISCARD/ :
+    {
+        *(.interp)
+        *(.dynsym)
+        *(.dynstr)
+        *(.hash)
+        *(.comment)
+        *(.ARM.attributes)
+    }
+}
diff --git a/miosix/testsuite/testsuite_file/prog3.h b/miosix/testsuite/testsuite_file/prog3.h
new file mode 100644
index 0000000000000000000000000000000000000000..3afa448a9872aa69c1c817b0c305bf7b555e38d5
--- /dev/null
+++ b/miosix/testsuite/testsuite_file/prog3.h
@@ -0,0 +1,33 @@
+const unsigned char __attribute__((aligned(8))) testsuite_file_elf[] = {
+  0x7f, 0x45, 0x4c, 0x46, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x28, 0x00, 0x01, 0x00, 0x00, 0x00,
+  0x99, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x02, 0x00, 0x00, 0x05, 0x34, 0x00, 0x20, 0x00, 0x03, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00,
+  0x98, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0x76, 0x00, 0x00, 0x00,
+  0x76, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+  0x01, 0x00, 0x00, 0x00, 0x10, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10,
+  0x00, 0x00, 0x00, 0x10, 0x50, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00,
+  0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+  0x1c, 0x01, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x10, 0x0c, 0x00, 0x00, 0x10,
+  0x28, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+  0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x02, 0xf8,
+  0x00, 0xf0, 0x2c, 0xf8, 0xf8, 0xb5, 0x13, 0x4f, 0x00, 0x24, 0x09, 0xeb,
+  0x07, 0x03, 0x13, 0xf8, 0x01, 0x5f, 0x01, 0x34, 0x00, 0x2d, 0xfa, 0xd1,
+  0x0f, 0x48, 0x40, 0xf2, 0x02, 0x41, 0x48, 0x44, 0x2a, 0x46, 0x00, 0xf0,
+  0x1d, 0xf8, 0xb0, 0xf1, 0xff, 0x3f, 0x06, 0x46, 0x0b, 0xd0, 0x09, 0xeb,
+  0x07, 0x01, 0x22, 0x46, 0x00, 0xf0, 0x1a, 0xf8, 0xa0, 0x42, 0x06, 0xd0,
+  0x30, 0x46, 0x00, 0xf0, 0x12, 0xf8, 0x02, 0x20, 0xf8, 0xbd, 0x01, 0x20,
+  0xfc, 0xe7, 0x30, 0x46, 0x00, 0xf0, 0x0b, 0xf8, 0x28, 0x46, 0xf7, 0xe7,
+  0x38, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x02, 0x23, 0x00, 0xdf,
+  0x06, 0x23, 0x00, 0xdf, 0x70, 0x47, 0x07, 0x23, 0x00, 0xdf, 0x70, 0x47,
+  0x03, 0x23, 0x00, 0xdf, 0x70, 0x47, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x10,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x40, 0x00, 0x00,
+  0x01, 0x00, 0x00, 0x10, 0x00, 0x08, 0x00, 0x00, 0x4d, 0x69, 0x6f, 0x73,
+  0x69, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x61, 0x73, 0x64, 0x00, 0x74, 0x65, 0x73, 0x74,
+  0x73, 0x75, 0x69, 0x74, 0x65, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x2e, 0x62,
+  0x69, 0x6e, 0x00, 0x00
+};
+unsigned int testsuite_file_elf_len = 352;
diff --git a/miosix/testsuite/testsuite_file/test.txt b/miosix/testsuite/testsuite_file/test.txt
new file mode 100644
index 0000000000000000000000000000000000000000..e5a14a87f83e458b3ee38de890843bcef3e16dfb
--- /dev/null
+++ b/miosix/testsuite/testsuite_file/test.txt
@@ -0,0 +1,151 @@
+
+testsuite_file.elf:     file format elf32-littlearm
+testsuite_file.elf
+architecture: arm, flags 0x00000050:
+HAS_SYMS, DYNAMIC
+start address 0x00000099
+
+Program Header:
+    LOAD off    0x00000098 vaddr 0x00000098 paddr 0x00000098 align 2**3
+         filesz 0x00000076 memsz 0x00000076 flags r-x
+    LOAD off    0x00000110 vaddr 0x10000000 paddr 0x10000000 align 2**3
+         filesz 0x00000050 memsz 0x00000050 flags rw-
+ DYNAMIC off    0x0000011c vaddr 0x1000000c paddr 0x1000000c align 2**2
+         filesz 0x00000028 memsz 0x00000028 flags rw-
+
+Dynamic Section:
+  DEBUG                0x00000000
+private flags = 5000002: [Version5 EABI] [has entry point]
+
+Sections:
+Idx Name          Size      VMA       LMA       File off  Algn
+  0 .text         00000076  00000098  00000098  00000098  2**3
+                  CONTENTS, ALLOC, LOAD, READONLY, CODE
+  1 .got          0000000c  10000000  10000000  00000110  2**2
+                  CONTENTS, ALLOC, LOAD, DATA
+  2 .dynamic      00000028  1000000c  1000000c  0000011c  2**2
+                  CONTENTS, ALLOC, LOAD, DATA
+  3 .rodata       00000018  10000038  10000038  00000148  2**3
+                  CONTENTS, ALLOC, LOAD, READONLY, DATA
+SYMBOL TABLE:
+00000098 l    d  .text	00000000 .text
+10000000 l    d  .got	00000000 .got
+1000000c l    d  .dynamic	00000000 .dynamic
+10000038 l    d  .rodata	00000000 .rodata
+00000000 l    df *ABS*	00000000 main.c
+1000000c l     O *ABS*	00000000 _DYNAMIC
+10000000 l     O *ABS*	00000000 _GLOBAL_OFFSET_TABLE_
+00000108 g     F .text	00000000 write
+00000098 g     F .text	00000000 _start
+000000a0 g     F .text	00000058 main
+000000f8 g     F .text	00000000 _exit
+000000fc g     F .text	00000000 open
+00000102 g     F .text	00000000 close
+
+
+Contents of section .text:
+ 0098 00f002f8 00f02cf8 f8b5134f 002409eb  ......,....O.$..
+ 00a8 070313f8 015f0134 002dfad1 0f4840f2  ....._.4.-...H@.
+ 00b8 02414844 2a4600f0 1df8b0f1 ff3f0646  .AHD*F.......?.F
+ 00c8 0bd009eb 07012246 00f01af8 a04206d0  ......"F.....B..
+ 00d8 304600f0 12f80220 f8bd0120 fce73046  0F..... ... ..0F
+ 00e8 00f00bf8 2846f7e7 38000000 3c000000  ....(F..8...<...
+ 00f8 022300df 062300df 70470723 00df7047  .#...#..pG.#..pG
+ 0108 032300df 7047                        .#..pG          
+Contents of section .got:
+ 10000000 0c000010 00000000 00000000           ............    
+Contents of section .dynamic:
+ 1000000c 15000000 00000000 00000000 00000000  ................
+ 1000001c 00000000 00000000 00000000 00000000  ................
+ 1000002c 00000000 00000000                    ........        
+Contents of section .rodata:
+ 10000038 61736400 74657374 73756974 655f6669  asd.testsuite_fi
+ 10000048 6c652e62 696e0000                    le.bin..        
+
+Disassembly of section .text:
+
+00000098 <_start>:
+_start():
+  98:	f000 f802 	bl	a0 <main>
+  9c:	f000 f82c 	bl	f8 <_exit>
+
+000000a0 <main>:
+main():
+  a0:	b5f8      	push	{r3, r4, r5, r6, r7, lr}
+  a2:	4f13      	ldr	r7, [pc, #76]	; (f0 <main+0x50>)
+  a4:	2400      	movs	r4, #0
+  a6:	eb09 0307 	add.w	r3, r9, r7
+  aa:	f813 5f01 	ldrb.w	r5, [r3, #1]!
+  ae:	3401      	adds	r4, #1
+  b0:	2d00      	cmp	r5, #0
+  b2:	d1fa      	bne.n	aa <main+0xa>
+  b4:	480f      	ldr	r0, [pc, #60]	; (f4 <main+0x54>)
+  b6:	f240 4102 	movw	r1, #1026	; 0x402
+  ba:	4448      	add	r0, r9
+  bc:	462a      	mov	r2, r5
+  be:	f000 f81d 	bl	fc <open>
+  c2:	f1b0 3fff 	cmp.w	r0, #4294967295	; 0xffffffff
+  c6:	4606      	mov	r6, r0
+  c8:	d00b      	beq.n	e2 <main+0x42>
+  ca:	eb09 0107 	add.w	r1, r9, r7
+  ce:	4622      	mov	r2, r4
+  d0:	f000 f81a 	bl	108 <write>
+  d4:	42a0      	cmp	r0, r4
+  d6:	d006      	beq.n	e6 <main+0x46>
+  d8:	4630      	mov	r0, r6
+  da:	f000 f812 	bl	102 <close>
+  de:	2002      	movs	r0, #2
+  e0:	bdf8      	pop	{r3, r4, r5, r6, r7, pc}
+  e2:	2001      	movs	r0, #1
+  e4:	e7fc      	b.n	e0 <main+0x40>
+  e6:	4630      	mov	r0, r6
+  e8:	f000 f80b 	bl	102 <close>
+  ec:	4628      	mov	r0, r5
+  ee:	e7f7      	b.n	e0 <main+0x40>
+  f0:	00000038 	andeq	r0, r0, r8, lsr r0
+  f4:	0000003c 	andeq	r0, r0, ip, lsr r0
+
+000000f8 <_exit>:
+_exit():
+  f8:	2302      	movs	r3, #2
+  fa:	df00      	svc	0
+
+000000fc <open>:
+open():
+  fc:	2306      	movs	r3, #6
+  fe:	df00      	svc	0
+ 100:	4770      	bx	lr
+
+00000102 <close>:
+close():
+ 102:	2307      	movs	r3, #7
+ 104:	df00      	svc	0
+ 106:	4770      	bx	lr
+
+00000108 <write>:
+write():
+ 108:	2303      	movs	r3, #3
+ 10a:	df00      	svc	0
+ 10c:	4770      	bx	lr
+
+Disassembly of section .got:
+
+10000000 <.got>:
+10000000:	1000000c 	andne	r0, r0, ip
+	...
+
+Disassembly of section .dynamic:
+
+1000000c <.dynamic>:
+1000000c:	00000015 	andeq	r0, r0, r5, lsl r0
+	...
+
+Disassembly of section .rodata:
+
+10000038 <.rodata>:
+10000038:	00647361 	rsbeq	r7, r4, r1, ror #6
+1000003c:	74736574 	ldrbtvc	r6, [r3], #-1396	; 0x574
+10000040:	74697573 	strbtvc	r7, [r9], #-1395	; 0x573
+10000044:	69665f65 	stmdbvs	r6!, {r0, r2, r5, r6, r8, r9, sl, fp, ip, lr}^
+10000048:	622e656c 	eorvs	r6, lr, #452984832	; 0x1b000000
+1000004c:	00006e69 	andeq	r6, r0, r9, ror #28
diff --git a/miosix/testsuite/testsuite_simple.h b/miosix/testsuite/testsuite_simple.h
index 66e912f2316697f61d77dd7f0875427307d5286b..8110e19342bb53b9f7bb65a5f8c44a8dc9679485 100644
--- a/miosix/testsuite/testsuite_simple.h
+++ b/miosix/testsuite/testsuite_simple.h
@@ -1,4 +1,4 @@
-const unsigned char __attribute__((aligned(8))) testsuit_simple[] = {
+const unsigned char __attribute__((aligned(8))) testsuite_simple_elf[] = {
   0x7f, 0x45, 0x4c, 0x46, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x28, 0x00, 0x01, 0x00, 0x00, 0x00,
   0x99, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -12,11 +12,11 @@ const unsigned char __attribute__((aligned(8))) testsuit_simple[] = {
   0xb4, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x10, 0x0c, 0x00, 0x00, 0x10,
   0x28, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
   0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x02, 0xf8,
-  0x00, 0xf0, 0x02, 0xf8, 0x7b, 0x20, 0x70, 0x47, 0x02, 0x23, 0x00, 0xdf,
+  0x00, 0xf0, 0x02, 0xf8, 0x02, 0x20, 0x70, 0x47, 0x02, 0x23, 0x00, 0xdf,
   0x0c, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10,
   0x00, 0x40, 0x00, 0x00, 0x01, 0x00, 0x00, 0x10, 0x00, 0x08, 0x00, 0x00,
   0x4d, 0x69, 0x6f, 0x73, 0x69, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x00, 0x00
 };
-unsigned int testsuit_simple_len = 220;
+unsigned int testsuite_simple_elf_len = 220;
diff --git a/miosix/testsuite/testsuite_simple/.h b/miosix/testsuite/testsuite_simple/.h
deleted file mode 100644
index df98510dd67244516ed59a2dac03e966446ff207..0000000000000000000000000000000000000000
--- a/miosix/testsuite/testsuite_simple/.h
+++ /dev/null
@@ -1,22 +0,0 @@
-const unsigned char __attribute__((aligned(8))) test_elf[] = {
-  0x7f, 0x45, 0x4c, 0x46, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x28, 0x00, 0x01, 0x00, 0x00, 0x00,
-  0x99, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x02, 0x00, 0x00, 0x05, 0x34, 0x00, 0x20, 0x00, 0x03, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00,
-  0x98, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
-  0x10, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
-  0x01, 0x00, 0x00, 0x00, 0xa8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10,
-  0x00, 0x00, 0x00, 0x10, 0x34, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00,
-  0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
-  0xb4, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x10, 0x0c, 0x00, 0x00, 0x10,
-  0x28, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
-  0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x02, 0xf8,
-  0x00, 0xf0, 0x02, 0xf8, 0x7b, 0x20, 0x70, 0x47, 0x02, 0x23, 0x00, 0xdf,
-  0x0c, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10,
-  0x00, 0x40, 0x00, 0x00, 0x01, 0x00, 0x00, 0x10, 0x00, 0x08, 0x00, 0x00,
-  0x4d, 0x69, 0x6f, 0x73, 0x69, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00
-};
-unsigned int test_elf_len = 220;
diff --git a/miosix/testsuite/testsuite_simple/Makefile b/miosix/testsuite/testsuite_simple/Makefile
index c822afb4cb16d48c51aa43891676386136b24e27..4f84bfef8faef0da502b49682e72369cb498ee1a 100644
--- a/miosix/testsuite/testsuite_simple/Makefile
+++ b/miosix/testsuite/testsuite_simple/Makefile
@@ -8,6 +8,7 @@ main.c
 
 ## Replaces both "foo.cpp"-->"foo.o" and "foo.c"-->"foo.o"
 OBJ := $(addsuffix .o, $(basename $(SRC)))
+ELF := $(addsuffix .elf, $(NAME))
 
 AS  := arm-miosix-eabi-as
 CC  := arm-miosix-eabi-gcc
@@ -16,7 +17,7 @@ SZ  := arm-miosix-eabi-size
 
 AFLAGS   := -mcpu=cortex-m3 -mthumb
 CFLAGS   := -mcpu=cortex-m3 -mthumb -mfix-cortex-m3-ldrd -fpie -msingle-pic-base \
-            -ffunction-sections -O2 -Wall -c
+            -ffunction-sections -O2 -Wall -c -DRETURN_VALUE=$(RET)
 CXXFLAGS := $(CFLAGS)
 LFLAGS   := -mcpu=cortex-m3 -mthumb -mfix-cortex-m3-ldrd -fpie -msingle-pic-base \
             -Wl,--gc-sections,-Map,test.map,-T./miosix.ld,-n,-pie,--spare-dynamic-tags,3 \
@@ -25,14 +26,14 @@ LFLAGS   := -mcpu=cortex-m3 -mthumb -mfix-cortex-m3-ldrd -fpie -msingle-pic-base
 LINK_LIBS := -Wl,--start-group -lstdc++ -lc -lm -lgcc -Wl,--end-group
 
 all: $(OBJ) crt0.o
-	$(CXX) $(LFLAGS) -o test.elf $(OBJ) crt0.o $(LINK_LIBS)
-	$(SZ)  test.elf
-	@arm-miosix-eabi-objdump -Dslx test.elf > test.txt
-	@mx-postlinker test.elf --ramsize=16384 --stacksize=2048 --strip-sectheader
-	@xxd -i test.elf | sed 's/unsigned char/const unsigned char __attribute__((aligned(8)))/' > prog3.h
+	$(CXX) $(LFLAGS) -o $(ELF) $(OBJ) crt0.o $(LINK_LIBS)
+	$(SZ)  $(ELF)
+	@arm-miosix-eabi-objdump -Dslx $(ELF) > test.txt
+	@mx-postlinker $(ELF) --ramsize=16384 --stacksize=2048 --strip-sectheader
+	@xxd -i $(ELF) | sed 's/unsigned char/const unsigned char __attribute__((aligned(8)))/' > prog3.h
 
 clean:
-	-rm $(OBJ) crt0.o test.elf test.map test.txt
+	-rm $(OBJ) crt0.o *.elf test.map test.txt
 
 %.o: %.s
 	$(AS) $(AFLAGS) $< -o $@
diff --git a/miosix/testsuite/testsuite_simple/log.txt b/miosix/testsuite/testsuite_simple/log.txt
deleted file mode 100644
index 947e1fa9d4717683daab64b97022cad93ce3738d..0000000000000000000000000000000000000000
--- a/miosix/testsuite/testsuite_simple/log.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-arm-miosix-eabi-g++ -mcpu=cortex-m3 -mthumb -mfix-cortex-m3-ldrd -fpie -msingle-pic-base -Wl,--gc-sections,-Map,main.map,-T./miosix.ld,-n,-pie,--spare-dynamic-tags,3 -O2 -nostdlib -fPIC -o main.elf main.o crt0.o -Wl,--start-group -lstdc++ -lc -lm -lgcc -Wl,--end-group
-/opt/arm-miosix-eabi/lib/gcc/arm-eabi/4.5.2/../../../../arm-eabi/bin/ld: /opt/arm-miosix-eabi/lib/gcc/arm-eabi/4.5.2/../../../../arm-eabi/lib/thumb/thumb2/libc.a(lib_a-syslseek.o): relocation R_ARM_THM_MOVW_ABS_NC against `_impure_ptr' can not be used when making a shared object; recompile with -fPIC
-/opt/arm-miosix-eabi/lib/gcc/arm-eabi/4.5.2/../../../../arm-eabi/lib/thumb/thumb2/libc.a: could not read symbols: Bad value
-collect2: ld returned 1 exit status
-make: *** [all] Error 1
diff --git a/miosix/testsuite/testsuite_simple/main.c b/miosix/testsuite/testsuite_simple/main.c
index 86f4bfa0e755bdffbe709a27609de9ea1c336399..7ccc8c5f1141937df01c8616d6be9d79c1e9b2e2 100644
--- a/miosix/testsuite/testsuite_simple/main.c
+++ b/miosix/testsuite/testsuite_simple/main.c
@@ -6,12 +6,6 @@
 #include <string.h>
 #include <stdio.h>
 
-inline int error(int idx){
-	return 1 << idx;
-}
-
-#define SIZE 1024
-
 int main(){
-	return 123;
+	return RETURN_VALUE;
 }
diff --git a/miosix/testsuite/testsuite_simple/prog3.h b/miosix/testsuite/testsuite_simple/prog3.h
index df98510dd67244516ed59a2dac03e966446ff207..8110e19342bb53b9f7bb65a5f8c44a8dc9679485 100644
--- a/miosix/testsuite/testsuite_simple/prog3.h
+++ b/miosix/testsuite/testsuite_simple/prog3.h
@@ -1,4 +1,4 @@
-const unsigned char __attribute__((aligned(8))) test_elf[] = {
+const unsigned char __attribute__((aligned(8))) testsuite_simple_elf[] = {
   0x7f, 0x45, 0x4c, 0x46, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x28, 0x00, 0x01, 0x00, 0x00, 0x00,
   0x99, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -12,11 +12,11 @@ const unsigned char __attribute__((aligned(8))) test_elf[] = {
   0xb4, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x10, 0x0c, 0x00, 0x00, 0x10,
   0x28, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
   0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x02, 0xf8,
-  0x00, 0xf0, 0x02, 0xf8, 0x7b, 0x20, 0x70, 0x47, 0x02, 0x23, 0x00, 0xdf,
+  0x00, 0xf0, 0x02, 0xf8, 0x02, 0x20, 0x70, 0x47, 0x02, 0x23, 0x00, 0xdf,
   0x0c, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10,
   0x00, 0x40, 0x00, 0x00, 0x01, 0x00, 0x00, 0x10, 0x00, 0x08, 0x00, 0x00,
   0x4d, 0x69, 0x6f, 0x73, 0x69, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x00, 0x00
 };
-unsigned int test_elf_len = 220;
+unsigned int testsuite_simple_elf_len = 220;
diff --git a/miosix/testsuite/testsuite_simple/test.txt b/miosix/testsuite/testsuite_simple/test.txt
index 6617dfce13a53544ef2bb22be4ceed47685781e1..24fe0e3357dc9a6b04829b10d494af838cb03cbe 100644
--- a/miosix/testsuite/testsuite_simple/test.txt
+++ b/miosix/testsuite/testsuite_simple/test.txt
@@ -1,6 +1,6 @@
 
-test.elf:     file format elf32-littlearm
-test.elf
+testsuite_simple.elf:     file format elf32-littlearm
+testsuite_simple.elf
 architecture: arm, flags 0x00000050:
 HAS_SYMS, DYNAMIC
 start address 0x00000099
@@ -39,7 +39,7 @@ SYMBOL TABLE:
 
 
 Contents of section .text:
- 0098 00f002f8 00f002f8 7b207047 022300df  ........{ pG.#..
+ 0098 00f002f8 00f002f8 02207047 022300df  ......... pG.#..
 Contents of section .got:
  10000000 0c000010 00000000 00000000           ............    
 Contents of section .dynamic:
@@ -56,7 +56,7 @@ _start():
 
 000000a0 <main>:
 main():
-  a0:	207b      	movs	r0, #123	; 0x7b
+  a0:	2002      	movs	r0, #2
   a2:	4770      	bx	lr
 
 000000a4 <_exit>:
diff --git a/miosix/testsuite/testsuite_sleep.h b/miosix/testsuite/testsuite_sleep.h
new file mode 100644
index 0000000000000000000000000000000000000000..bfe5d3e1198241e1f346f8b3bd858e3a792b007f
--- /dev/null
+++ b/miosix/testsuite/testsuite_sleep.h
@@ -0,0 +1,23 @@
+const unsigned char __attribute__((aligned(8))) testsuite_sleep_elf[] = {
+  0x7f, 0x45, 0x4c, 0x46, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x28, 0x00, 0x01, 0x00, 0x00, 0x00,
+  0x99, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x02, 0x00, 0x00, 0x05, 0x34, 0x00, 0x20, 0x00, 0x03, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00,
+  0x98, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00,
+  0x22, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+  0x01, 0x00, 0x00, 0x00, 0xbc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10,
+  0x00, 0x00, 0x00, 0x10, 0x34, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00,
+  0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+  0xc8, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x10, 0x0c, 0x00, 0x00, 0x10,
+  0x28, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+  0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x02, 0xf8,
+  0x00, 0xf0, 0x08, 0xf8, 0x44, 0xf6, 0x40, 0x30, 0x08, 0xb5, 0xc0, 0xf2,
+  0x4c, 0x00, 0x00, 0xf0, 0x03, 0xf8, 0x08, 0xbd, 0x02, 0x23, 0x00, 0xdf,
+  0x05, 0x23, 0x00, 0xdf, 0x70, 0x47, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x10,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x40, 0x00, 0x00,
+  0x01, 0x00, 0x00, 0x10, 0x00, 0x08, 0x00, 0x00, 0x4d, 0x69, 0x6f, 0x73,
+  0x69, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+unsigned int testsuite_sleep_elf_len = 240;
diff --git a/miosix/testsuite/testsuite_sleep/Makefile b/miosix/testsuite/testsuite_sleep/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..34f92e723fa43f571d53cbaaddcc9329cd32cb2b
--- /dev/null
+++ b/miosix/testsuite/testsuite_sleep/Makefile
@@ -0,0 +1,45 @@
+##
+## Makefile for writing PROGRAMS for the Miosix embedded OS
+## TFT:Terraneo Federico Technlogies
+##
+
+SRC := \
+main.c
+
+## Replaces both "foo.cpp"-->"foo.o" and "foo.c"-->"foo.o"
+OBJ := $(addsuffix .o, $(basename $(SRC)))
+ELF := $(addsuffix .elf, $(NAME))
+
+AS  := arm-miosix-eabi-as
+CC  := arm-miosix-eabi-gcc
+CXX := arm-miosix-eabi-g++
+SZ  := arm-miosix-eabi-size
+
+AFLAGS   := -mcpu=cortex-m3 -mthumb
+CFLAGS   := -mcpu=cortex-m3 -mthumb -mfix-cortex-m3-ldrd -fpie -msingle-pic-base \
+            -ffunction-sections -O2 -Wall -c
+CXXFLAGS := $(CFLAGS)
+LFLAGS   := -mcpu=cortex-m3 -mthumb -mfix-cortex-m3-ldrd -fpie -msingle-pic-base \
+            -Wl,--gc-sections,-Map,test.map,-T./miosix.ld,-n,-pie,--spare-dynamic-tags,3 \
+            -O2 -nostdlib
+
+LINK_LIBS := -Wl,--start-group -lstdc++ -lc -lm -lgcc -Wl,--end-group
+
+all: $(OBJ) crt0.o
+	$(CXX) $(LFLAGS) -o $(ELF) $(OBJ) crt0.o $(LINK_LIBS)
+	$(SZ)  $(ELF)
+	@arm-miosix-eabi-objdump -Dslx $(ELF) > test.txt
+	@mx-postlinker $(ELF) --ramsize=16384 --stacksize=2048 --strip-sectheader
+	@xxd -i $(ELF) | sed 's/unsigned char/const unsigned char __attribute__((aligned(8)))/' > prog3.h
+
+clean:
+	-rm $(OBJ) crt0.o *.elf test.map test.txt
+
+%.o: %.s
+	$(AS) $(AFLAGS) $< -o $@
+
+%.o : %.c
+	$(CC) $(CFLAGS) $< -o $@
+
+%.o : %.cpp
+	$(CXX) $(CXXFLAGS) $< -o $@
diff --git a/miosix/testsuite/testsuite_sleep/crt0.s b/miosix/testsuite/testsuite_sleep/crt0.s
new file mode 100644
index 0000000000000000000000000000000000000000..9959b317dcafd42e8cb82c896b3eef2e0205f7cc
--- /dev/null
+++ b/miosix/testsuite/testsuite_sleep/crt0.s
@@ -0,0 +1,131 @@
+/*
+ * Startup script for writing PROGRAMS for the Miosix embedded OS
+ * TFT:Terraneo Federico Technlogies
+ */
+
+.syntax unified
+.cpu cortex-m3
+.thumb
+
+.section .text
+
+/**
+ * _start, program entry point
+ */
+.global _start
+.type _start, %function
+_start:
+	/* TODO: .ctor */
+	bl   main
+	/* TODO: .dtor */
+	bl   _exit
+
+/**
+ * _exit, terminate process
+ * \param v exit value 
+ */
+.section .text._exit
+.global _exit
+.type _exit, %function
+_exit:
+	movs r3, #2
+	svc  0
+
+/**
+ * open, open a file
+ * \param fd file descriptor
+ * \param file access mode
+ * \param xxx access permisions
+ * \return file descriptor or -1 if errors
+ */
+.section .text.open
+.global open
+.type open, %function
+open:
+	movs r3, #6
+	svc 0
+	bx lr
+
+/**
+ * close, close a file
+ * \param fd file descriptor
+ */
+.section .text.close
+.global close
+.type close, %function
+close:
+	movs r3, #7
+	svc 0
+	bx lr
+
+/**
+ * seek
+ * \param fd file descriptor
+ * \param pos moving offset
+ * \param start position, SEEK_SET, SEEK_CUR or SEEK_END
+*/
+.section .text.seek
+.global seek
+.type seek, %function
+seek:
+	movs r3, #8
+	svc 0
+	bx lr
+	
+
+/**
+ * system, fork and execture a program, blocking
+ * \param program to execute
+ */
+.section .text.system
+.global system
+.type system, %function
+system:
+	movs r3, #9
+	svc 0
+	bx lr
+	
+/**
+ * write, write to file
+ * \param fd file descriptor
+ * \param buf data to be written
+ * \param len buffer length
+ * \return number of written bytes or -1 if errors
+ */
+.section .text.write
+.global	write
+.type	write, %function
+write:
+    movs r3, #3
+    svc  0
+    bx   lr
+
+/**
+ * read, read from file
+ * \param fd file descriptor
+ * \param buf data to be read
+ * \param len buffer length
+ * \return number of read bytes or -1 if errors
+ */
+.section .text.read
+.global	read
+.type	read, %function
+read:
+    movs r3, #4
+    svc  0
+    bx   lr
+
+/**
+ * usleep, sleep a specified number of microseconds
+ * \param us number of microseconds to sleep
+ * \return 0 on success or -1 if errors
+ */
+.section .text.usleep
+.global	usleep
+.type	usleep, %function
+usleep:
+    movs r3, #5
+    svc  0
+    bx   lr
+
+.end
diff --git a/miosix/testsuite/testsuite_sleep/main.c b/miosix/testsuite/testsuite_sleep/main.c
new file mode 100644
index 0000000000000000000000000000000000000000..5a9879272656419fc23edc5598860250a348a9c1
--- /dev/null
+++ b/miosix/testsuite/testsuite_sleep/main.c
@@ -0,0 +1,11 @@
+#include <unistd.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <stdio.h>
+
+int main(){
+	usleep(5000000);
+}
\ No newline at end of file
diff --git a/miosix/testsuite/testsuite_sleep/miosix.ld b/miosix/testsuite/testsuite_sleep/miosix.ld
new file mode 100644
index 0000000000000000000000000000000000000000..c91c803e629040b14233a8f8251a7d9952f68910
--- /dev/null
+++ b/miosix/testsuite/testsuite_sleep/miosix.ld
@@ -0,0 +1,66 @@
+/*
+ * Linker script for writing PROGRAMS for the Miosix embedded OS
+ * TFT:Terraneo Federico Technlogies
+ */
+
+OUTPUT_FORMAT("elf32-littlearm")
+OUTPUT_ARCH(arm)
+ENTRY(_start)
+
+SECTIONS
+{
+    /* Here starts the first elf segment, that stays in flash */
+    . = 0 + SIZEOF_HEADERS;
+
+    .text : ALIGN(8)
+    {
+        *(.text)
+        *(.text.*)
+        *(.gnu.linkonce.t.*)
+    }
+
+    .rel.data : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) }
+    .rel.got  : { *(.rel.got) }
+
+    /* Here starts the second segment, that is copied in RAM and relocated */
+    . = 0x10000000;
+
+    .got      : { *(.got.plt) *(.igot.plt) *(.got) *(.igot) }
+
+    /* FIXME: If this is put in the other segment, it makes it writable */
+    .dynamic  : { *(.dynamic) }
+
+    /* FIXME: The compiler insists in addressing rodata relative to r9 */
+    .rodata : ALIGN(8)
+    {
+        *(.rodata)
+        *(.rodata.*)
+        *(.gnu.linkonce.r.*)
+    }
+
+    .data : ALIGN(8)
+    {
+        *(.data)
+        *(.data.*)
+        *(.gnu.linkonce.d.*)
+    }
+
+    .bss : ALIGN(8)
+    {
+        *(.bss)
+        *(.bss.*)
+        *(.gnu.linkonce.b.*)
+        *(COMMON)
+    }
+
+    /* These are removed since are unused and increase binary size */
+    /DISCARD/ :
+    {
+        *(.interp)
+        *(.dynsym)
+        *(.dynstr)
+        *(.hash)
+        *(.comment)
+        *(.ARM.attributes)
+    }
+}
diff --git a/miosix/testsuite/testsuite_sleep/prog3.h b/miosix/testsuite/testsuite_sleep/prog3.h
new file mode 100644
index 0000000000000000000000000000000000000000..bfe5d3e1198241e1f346f8b3bd858e3a792b007f
--- /dev/null
+++ b/miosix/testsuite/testsuite_sleep/prog3.h
@@ -0,0 +1,23 @@
+const unsigned char __attribute__((aligned(8))) testsuite_sleep_elf[] = {
+  0x7f, 0x45, 0x4c, 0x46, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x28, 0x00, 0x01, 0x00, 0x00, 0x00,
+  0x99, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x02, 0x00, 0x00, 0x05, 0x34, 0x00, 0x20, 0x00, 0x03, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00,
+  0x98, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00,
+  0x22, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+  0x01, 0x00, 0x00, 0x00, 0xbc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10,
+  0x00, 0x00, 0x00, 0x10, 0x34, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00,
+  0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+  0xc8, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x10, 0x0c, 0x00, 0x00, 0x10,
+  0x28, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+  0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x02, 0xf8,
+  0x00, 0xf0, 0x08, 0xf8, 0x44, 0xf6, 0x40, 0x30, 0x08, 0xb5, 0xc0, 0xf2,
+  0x4c, 0x00, 0x00, 0xf0, 0x03, 0xf8, 0x08, 0xbd, 0x02, 0x23, 0x00, 0xdf,
+  0x05, 0x23, 0x00, 0xdf, 0x70, 0x47, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x10,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x40, 0x00, 0x00,
+  0x01, 0x00, 0x00, 0x10, 0x00, 0x08, 0x00, 0x00, 0x4d, 0x69, 0x6f, 0x73,
+  0x69, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+unsigned int testsuite_sleep_elf_len = 240;
diff --git a/miosix/testsuite/testsuite_sleep/test.txt b/miosix/testsuite/testsuite_sleep/test.txt
new file mode 100644
index 0000000000000000000000000000000000000000..c860216c5de5f69f8ca14ca07ced9e20b29fb21b
--- /dev/null
+++ b/miosix/testsuite/testsuite_sleep/test.txt
@@ -0,0 +1,88 @@
+
+testsuite_sleep.elf:     file format elf32-littlearm
+testsuite_sleep.elf
+architecture: arm, flags 0x00000050:
+HAS_SYMS, DYNAMIC
+start address 0x00000099
+
+Program Header:
+    LOAD off    0x00000098 vaddr 0x00000098 paddr 0x00000098 align 2**3
+         filesz 0x00000022 memsz 0x00000022 flags r-x
+    LOAD off    0x000000bc vaddr 0x10000000 paddr 0x10000000 align 2**2
+         filesz 0x00000034 memsz 0x00000034 flags rw-
+ DYNAMIC off    0x000000c8 vaddr 0x1000000c paddr 0x1000000c align 2**2
+         filesz 0x00000028 memsz 0x00000028 flags rw-
+
+Dynamic Section:
+  DEBUG                0x00000000
+private flags = 5000002: [Version5 EABI] [has entry point]
+
+Sections:
+Idx Name          Size      VMA       LMA       File off  Algn
+  0 .text         00000022  00000098  00000098  00000098  2**3
+                  CONTENTS, ALLOC, LOAD, READONLY, CODE
+  1 .got          0000000c  10000000  10000000  000000bc  2**2
+                  CONTENTS, ALLOC, LOAD, DATA
+  2 .dynamic      00000028  1000000c  1000000c  000000c8  2**2
+                  CONTENTS, ALLOC, LOAD, DATA
+SYMBOL TABLE:
+00000098 l    d  .text	00000000 .text
+10000000 l    d  .got	00000000 .got
+1000000c l    d  .dynamic	00000000 .dynamic
+00000000 l    df *ABS*	00000000 main.c
+1000000c l     O *ABS*	00000000 _DYNAMIC
+10000000 l     O *ABS*	00000000 _GLOBAL_OFFSET_TABLE_
+000000b4 g     F .text	00000000 usleep
+00000098 g     F .text	00000000 _start
+000000a0 g     F .text	00000010 main
+000000b0 g     F .text	00000000 _exit
+
+
+Contents of section .text:
+ 0098 00f002f8 00f008f8 44f64030 08b5c0f2  ........D.@0....
+ 00a8 4c0000f0 03f808bd 022300df 052300df  L........#...#..
+ 00b8 7047                                 pG              
+Contents of section .got:
+ 10000000 0c000010 00000000 00000000           ............    
+Contents of section .dynamic:
+ 1000000c 15000000 00000000 00000000 00000000  ................
+ 1000001c 00000000 00000000 00000000 00000000  ................
+ 1000002c 00000000 00000000                    ........        
+
+Disassembly of section .text:
+
+00000098 <_start>:
+_start():
+  98:	f000 f802 	bl	a0 <main>
+  9c:	f000 f808 	bl	b0 <_exit>
+
+000000a0 <main>:
+main():
+  a0:	f644 3040 	movw	r0, #19264	; 0x4b40
+  a4:	b508      	push	{r3, lr}
+  a6:	f2c0 004c 	movt	r0, #76	; 0x4c
+  aa:	f000 f803 	bl	b4 <usleep>
+  ae:	bd08      	pop	{r3, pc}
+
+000000b0 <_exit>:
+_exit():
+  b0:	2302      	movs	r3, #2
+  b2:	df00      	svc	0
+
+000000b4 <usleep>:
+usleep():
+  b4:	2305      	movs	r3, #5
+  b6:	df00      	svc	0
+  b8:	4770      	bx	lr
+
+Disassembly of section .got:
+
+10000000 <.got>:
+10000000:	1000000c 	andne	r0, r0, ip
+	...
+
+Disassembly of section .dynamic:
+
+1000000c <.dynamic>:
+1000000c:	00000015 	andeq	r0, r0, r5, lsl r0
+	...
diff --git a/miosix/testsuite/testsuite_syscall.h b/miosix/testsuite/testsuite_syscall.h
index 94e1ef64ef4bd1aedae711e1107ccbdb3dfbf7c4..6bc75f64bed8d4e853ba6e1b7a207d2bf45d80e2 100644
--- a/miosix/testsuite/testsuite_syscall.h
+++ b/miosix/testsuite/testsuite_syscall.h
@@ -4,45 +4,73 @@ const unsigned char __attribute__((aligned(8))) testsuite_syscall_elf[] = {
   0x99, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x02, 0x00, 0x00, 0x05, 0x34, 0x00, 0x20, 0x00, 0x03, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00,
-  0x98, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0x36, 0x01, 0x00, 0x00,
-  0x36, 0x01, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
-  0x01, 0x00, 0x00, 0x00, 0xd0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10,
-  0x00, 0x00, 0x00, 0x10, 0x48, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00,
+  0x98, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0xba, 0x01, 0x00, 0x00,
+  0xba, 0x01, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+  0x01, 0x00, 0x00, 0x00, 0x58, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10,
+  0x00, 0x00, 0x00, 0x10, 0x0c, 0x01, 0x00, 0x00, 0x0c, 0x01, 0x00, 0x00,
   0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
-  0xdc, 0x01, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x10, 0x0c, 0x00, 0x00, 0x10,
+  0x64, 0x02, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x10, 0x0c, 0x00, 0x00, 0x10,
   0x28, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
-  0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x02, 0xf8,
-  0x00, 0xf0, 0x86, 0xf8, 0x2d, 0xe9, 0xf0, 0x45, 0xad, 0xf5, 0x00, 0x6d,
-  0x81, 0xb0, 0x00, 0x24, 0x0d, 0xf5, 0x80, 0x65, 0x2c, 0x55, 0x01, 0x34,
-  0xb4, 0xf5, 0x80, 0x6f, 0xfa, 0xd1, 0x3b, 0x4f, 0x02, 0x21, 0x09, 0xeb,
-  0x07, 0x06, 0x00, 0x22, 0x30, 0x46, 0x00, 0xf0, 0x73, 0xf8, 0xb0, 0xf1,
-  0xff, 0x3f, 0x05, 0xd0, 0x00, 0x20, 0x01, 0xb0, 0x0d, 0xf5, 0x00, 0x6d,
-  0xbd, 0xe8, 0xf0, 0x85, 0x30, 0x46, 0x00, 0x22, 0x40, 0xf2, 0x02, 0x41,
-  0x00, 0xf0, 0x64, 0xf8, 0xb0, 0xf1, 0xff, 0x3f, 0x06, 0x46, 0x0c, 0xd0,
-  0x02, 0x28, 0x01, 0xd8, 0x02, 0x20, 0xec, 0xe7, 0x29, 0x46, 0x22, 0x46,
-  0x00, 0xf0, 0x61, 0xf8, 0xb0, 0xf5, 0x80, 0x6f, 0x03, 0xd0, 0x03, 0x20,
-  0xe3, 0xe7, 0x01, 0x20, 0xe1, 0xe7, 0x00, 0x21, 0x0a, 0x46, 0x30, 0x46,
-  0x00, 0xf0, 0x52, 0xf8, 0x30, 0x46, 0x69, 0x46, 0x22, 0x46, 0x00, 0xf0,
-  0x53, 0xf8, 0xb0, 0xf5, 0x80, 0x6f, 0xe8, 0x46, 0x01, 0xd0, 0x04, 0x20,
-  0xd1, 0xe7, 0x4f, 0xf0, 0x00, 0x0a, 0x02, 0xe0, 0xba, 0xf5, 0x80, 0x6f,
-  0x09, 0xd0, 0x15, 0xf8, 0x0a, 0x20, 0x18, 0xf8, 0x0a, 0x30, 0x0a, 0xf1,
-  0x01, 0x0a, 0x9a, 0x42, 0xf4, 0xd0, 0x05, 0x20, 0xc1, 0xe7, 0x30, 0x46,
-  0x00, 0xf0, 0x31, 0xf8, 0x06, 0x46, 0x08, 0xb1, 0x06, 0x20, 0xba, 0xe7,
-  0x02, 0x21, 0x09, 0xeb, 0x07, 0x00, 0x00, 0xf0, 0x25, 0xf8, 0x01, 0x28,
-  0x04, 0x46, 0x08, 0xdd, 0x69, 0x46, 0x52, 0x46, 0x00, 0xf0, 0x2a, 0xf8,
-  0xb0, 0xf5, 0x80, 0x6f, 0x03, 0xd0, 0x08, 0x20, 0xa9, 0xe7, 0x07, 0x20,
-  0xa7, 0xe7, 0xaa, 0x5d, 0x18, 0xf8, 0x06, 0x30, 0x01, 0x36, 0x9a, 0x42,
-  0x0a, 0xd1, 0xb6, 0xf5, 0x80, 0x6f, 0xf6, 0xd1, 0x20, 0x46, 0x00, 0xf0,
-  0x0e, 0xf8, 0x00, 0x28, 0x14, 0xbf, 0x0a, 0x20, 0x00, 0x20, 0x96, 0xe7,
-  0x09, 0x20, 0x94, 0xe7, 0x38, 0x00, 0x00, 0x00, 0x02, 0x23, 0x00, 0xdf,
+  0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x10, 0xf8,
+  0x00, 0xf0, 0xc8, 0xf8, 0x08, 0xb5, 0x02, 0x78, 0x01, 0x46, 0x22, 0xb1,
+  0x00, 0x22, 0x01, 0x32, 0x8b, 0x5c, 0x00, 0x2b, 0xfb, 0xd1, 0x01, 0x20,
+  0x00, 0xf0, 0xc7, 0xf8, 0x08, 0xbd, 0x00, 0xbf, 0x2d, 0xe9, 0xf0, 0x45,
+  0xad, 0xf5, 0x00, 0x6d, 0x81, 0xb0, 0x00, 0x24, 0x0d, 0xf5, 0x80, 0x65,
+  0x2c, 0x55, 0x01, 0x34, 0xb4, 0xf5, 0x80, 0x6f, 0xfa, 0xd1, 0x4d, 0x4f,
+  0x02, 0x21, 0x09, 0xeb, 0x07, 0x06, 0x00, 0x22, 0x30, 0x46, 0x00, 0xf0,
+  0xa7, 0xf8, 0xb0, 0xf1, 0xff, 0x3f, 0x05, 0xd0, 0x01, 0x20, 0x01, 0xb0,
+  0x0d, 0xf5, 0x00, 0x6d, 0xbd, 0xe8, 0xf0, 0x85, 0x45, 0x48, 0x48, 0x44,
+  0xff, 0xf7, 0xd0, 0xff, 0x30, 0x46, 0x00, 0x22, 0x40, 0xf2, 0x02, 0x41,
+  0x00, 0xf0, 0x94, 0xf8, 0xb0, 0xf1, 0xff, 0x3f, 0x06, 0x46, 0x11, 0xd0,
+  0x02, 0x28, 0x01, 0xd8, 0x03, 0x20, 0xe8, 0xe7, 0x3d, 0x48, 0x48, 0x44,
+  0xff, 0xf7, 0xbe, 0xff, 0x30, 0x46, 0x29, 0x46, 0x22, 0x46, 0x00, 0xf0,
+  0x8c, 0xf8, 0xb0, 0xf5, 0x80, 0x6f, 0x03, 0xd0, 0x04, 0x20, 0xda, 0xe7,
+  0x02, 0x20, 0xd8, 0xe7, 0x36, 0x48, 0xe8, 0x46, 0x48, 0x44, 0xff, 0xf7,
+  0xad, 0xff, 0x00, 0x21, 0x0a, 0x46, 0x30, 0x46, 0x00, 0xf0, 0x78, 0xf8,
+  0x30, 0x46, 0x69, 0x46, 0x22, 0x46, 0x00, 0xf0, 0x79, 0xf8, 0xb0, 0xf5,
+  0x80, 0x6f, 0x01, 0xd0, 0x05, 0x20, 0xc4, 0xe7, 0x4f, 0xf0, 0x00, 0x0a,
+  0x02, 0xe0, 0xba, 0xf5, 0x80, 0x6f, 0x09, 0xd0, 0x15, 0xf8, 0x0a, 0x20,
+  0x18, 0xf8, 0x0a, 0x30, 0x0a, 0xf1, 0x01, 0x0a, 0x9a, 0x42, 0xf4, 0xd0,
+  0x06, 0x20, 0xb4, 0xe7, 0x25, 0x48, 0x48, 0x44, 0xff, 0xf7, 0x8a, 0xff,
+  0x30, 0x46, 0x00, 0xf0, 0x54, 0xf8, 0x06, 0x46, 0x08, 0xb1, 0x07, 0x20,
+  0xa9, 0xe7, 0x21, 0x48, 0x48, 0x44, 0xff, 0xf7, 0x7f, 0xff, 0x02, 0x21,
+  0x09, 0xeb, 0x07, 0x00, 0x00, 0xf0, 0x44, 0xf8, 0x01, 0x28, 0x04, 0x46,
+  0x0d, 0xdd, 0x1c, 0x48, 0x48, 0x44, 0xff, 0xf7, 0x73, 0xff, 0x20, 0x46,
+  0x69, 0x46, 0x52, 0x46, 0x00, 0xf0, 0x44, 0xf8, 0xb0, 0xf5, 0x80, 0x6f,
+  0x03, 0xd0, 0x09, 0x20, 0x8f, 0xe7, 0x08, 0x20, 0x8d, 0xe7, 0xaa, 0x5d,
+  0x18, 0xf8, 0x06, 0x30, 0x01, 0x36, 0x9a, 0x42, 0x0d, 0xd1, 0xb6, 0xf5,
+  0x80, 0x6f, 0xf6, 0xd1, 0x10, 0x48, 0x48, 0x44, 0xff, 0xf7, 0x5a, 0xff,
+  0x20, 0x46, 0x00, 0xf0, 0x24, 0xf8, 0x04, 0x46, 0x18, 0xb1, 0x0b, 0x20,
+  0x79, 0xe7, 0x0a, 0x20, 0x77, 0xe7, 0x0b, 0x48, 0x48, 0x44, 0xff, 0xf7,
+  0x4d, 0xff, 0x20, 0x46, 0x71, 0xe7, 0x00, 0xbf, 0x38, 0x00, 0x00, 0x00,
+  0x48, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00,
+  0x98, 0x00, 0x00, 0x00, 0xa8, 0x00, 0x00, 0x00, 0xb8, 0x00, 0x00, 0x00,
+  0xdc, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x02, 0x23, 0x00, 0xdf,
   0x06, 0x23, 0x00, 0xdf, 0x70, 0x47, 0x07, 0x23, 0x00, 0xdf, 0x70, 0x47,
   0x08, 0x23, 0x00, 0xdf, 0x70, 0x47, 0x03, 0x23, 0x00, 0xdf, 0x70, 0x47,
-  0x04, 0x23, 0x00, 0xdf, 0x70, 0x47, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x10,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x40, 0x00, 0x00,
-  0x01, 0x00, 0x00, 0x10, 0x00, 0x08, 0x00, 0x00, 0x4d, 0x69, 0x6f, 0x73,
-  0x69, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x73, 0x75, 0x69,
-  0x74, 0x2e, 0x62, 0x69, 0x6e, 0x00, 0x00, 0x00
+  0x04, 0x23, 0x00, 0xdf, 0x70, 0x47, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x0c, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10,
+  0x00, 0x40, 0x00, 0x00, 0x01, 0x00, 0x00, 0x10, 0x00, 0x08, 0x00, 0x00,
+  0x4d, 0x69, 0x6f, 0x73, 0x69, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2f, 0x74, 0x65, 0x73,
+  0x74, 0x73, 0x75, 0x69, 0x74, 0x65, 0x2e, 0x62, 0x69, 0x6e, 0x00, 0x00,
+  0x27, 0x4f, 0x70, 0x65, 0x6e, 0x27, 0x20, 0x6f, 0x66, 0x20, 0x6e, 0x6f,
+  0x6e, 0x20, 0x65, 0x78, 0x69, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x20, 0x66,
+  0x69, 0x6c, 0x65, 0x3a, 0x20, 0x50, 0x41, 0x53, 0x53, 0x45, 0x44, 0x0a,
+  0x00, 0x00, 0x00, 0x00, 0x4f, 0x70, 0x65, 0x6e, 0x20, 0x66, 0x69, 0x6c,
+  0x65, 0x3a, 0x20, 0x50, 0x41, 0x53, 0x53, 0x45, 0x44, 0x0a, 0x00, 0x00,
+  0x57, 0x72, 0x69, 0x74, 0x65, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x3a, 0x20,
+  0x50, 0x41, 0x53, 0x53, 0x45, 0x44, 0x0a, 0x00, 0x52, 0x65, 0x61, 0x64,
+  0x3a, 0x20, 0x50, 0x41, 0x53, 0x53, 0x45, 0x44, 0x0a, 0x00, 0x00, 0x00,
+  0x63, 0x6c, 0x6f, 0x73, 0x65, 0x3a, 0x20, 0x50, 0x41, 0x53, 0x53, 0x45,
+  0x44, 0x0a, 0x00, 0x00, 0x4f, 0x70, 0x65, 0x6e, 0x20, 0x6f, 0x66, 0x20,
+  0x61, 0x6e, 0x20, 0x65, 0x78, 0x69, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x20,
+  0x66, 0x69, 0x6c, 0x65, 0x3a, 0x20, 0x50, 0x41, 0x53, 0x53, 0x45, 0x44,
+  0x0a, 0x00, 0x00, 0x00, 0x52, 0x65, 0x61, 0x64, 0x20, 0x64, 0x61, 0x74,
+  0x61, 0x20, 0x63, 0x6f, 0x72, 0x65, 0x63, 0x74, 0x6e, 0x65, 0x73, 0x73,
+  0x3a, 0x20, 0x50, 0x41, 0x53, 0x53, 0x45, 0x44, 0x0a, 0x00, 0x00, 0x00,
+  0x63, 0x6c, 0x6f, 0x73, 0x65, 0x3a, 0x20, 0x70, 0x61, 0x73, 0x73, 0x65,
+  0x64, 0x0a, 0x00, 0x00
 };
-unsigned int testsuite_syscall_len = 536;
+unsigned int testsuite_syscall_elf_len = 868;
diff --git a/miosix/testsuite/testsuite_syscall/.h b/miosix/testsuite/testsuite_syscall/.h
deleted file mode 100644
index dfc8d01c15d4a698bac7ee298b59583d21092875..0000000000000000000000000000000000000000
--- a/miosix/testsuite/testsuite_syscall/.h
+++ /dev/null
@@ -1,48 +0,0 @@
-const unsigned char __attribute__((aligned(8))) test_elf[] = {
-  0x7f, 0x45, 0x4c, 0x46, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x28, 0x00, 0x01, 0x00, 0x00, 0x00,
-  0x99, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x02, 0x00, 0x00, 0x05, 0x34, 0x00, 0x20, 0x00, 0x03, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00,
-  0x98, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0x36, 0x01, 0x00, 0x00,
-  0x36, 0x01, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
-  0x01, 0x00, 0x00, 0x00, 0xd0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10,
-  0x00, 0x00, 0x00, 0x10, 0x48, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00,
-  0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
-  0xdc, 0x01, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x10, 0x0c, 0x00, 0x00, 0x10,
-  0x28, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
-  0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x02, 0xf8,
-  0x00, 0xf0, 0x86, 0xf8, 0x2d, 0xe9, 0xf0, 0x45, 0xad, 0xf5, 0x00, 0x6d,
-  0x81, 0xb0, 0x00, 0x24, 0x0d, 0xf5, 0x80, 0x65, 0x2c, 0x55, 0x01, 0x34,
-  0xb4, 0xf5, 0x80, 0x6f, 0xfa, 0xd1, 0x3b, 0x4f, 0x02, 0x21, 0x09, 0xeb,
-  0x07, 0x06, 0x00, 0x22, 0x30, 0x46, 0x00, 0xf0, 0x73, 0xf8, 0xb0, 0xf1,
-  0xff, 0x3f, 0x05, 0xd0, 0x00, 0x20, 0x01, 0xb0, 0x0d, 0xf5, 0x00, 0x6d,
-  0xbd, 0xe8, 0xf0, 0x85, 0x30, 0x46, 0x00, 0x22, 0x40, 0xf2, 0x02, 0x41,
-  0x00, 0xf0, 0x64, 0xf8, 0xb0, 0xf1, 0xff, 0x3f, 0x06, 0x46, 0x0c, 0xd0,
-  0x02, 0x28, 0x01, 0xd8, 0x02, 0x20, 0xec, 0xe7, 0x29, 0x46, 0x22, 0x46,
-  0x00, 0xf0, 0x61, 0xf8, 0xb0, 0xf5, 0x80, 0x6f, 0x03, 0xd0, 0x03, 0x20,
-  0xe3, 0xe7, 0x01, 0x20, 0xe1, 0xe7, 0x00, 0x21, 0x0a, 0x46, 0x30, 0x46,
-  0x00, 0xf0, 0x52, 0xf8, 0x30, 0x46, 0x69, 0x46, 0x22, 0x46, 0x00, 0xf0,
-  0x53, 0xf8, 0xb0, 0xf5, 0x80, 0x6f, 0xe8, 0x46, 0x01, 0xd0, 0x04, 0x20,
-  0xd1, 0xe7, 0x4f, 0xf0, 0x00, 0x0a, 0x02, 0xe0, 0xba, 0xf5, 0x80, 0x6f,
-  0x09, 0xd0, 0x15, 0xf8, 0x0a, 0x20, 0x18, 0xf8, 0x0a, 0x30, 0x0a, 0xf1,
-  0x01, 0x0a, 0x9a, 0x42, 0xf4, 0xd0, 0x05, 0x20, 0xc1, 0xe7, 0x30, 0x46,
-  0x00, 0xf0, 0x31, 0xf8, 0x06, 0x46, 0x08, 0xb1, 0x06, 0x20, 0xba, 0xe7,
-  0x02, 0x21, 0x09, 0xeb, 0x07, 0x00, 0x00, 0xf0, 0x25, 0xf8, 0x01, 0x28,
-  0x04, 0x46, 0x08, 0xdd, 0x69, 0x46, 0x52, 0x46, 0x00, 0xf0, 0x2a, 0xf8,
-  0xb0, 0xf5, 0x80, 0x6f, 0x03, 0xd0, 0x08, 0x20, 0xa9, 0xe7, 0x07, 0x20,
-  0xa7, 0xe7, 0xaa, 0x5d, 0x18, 0xf8, 0x06, 0x30, 0x01, 0x36, 0x9a, 0x42,
-  0x0a, 0xd1, 0xb6, 0xf5, 0x80, 0x6f, 0xf6, 0xd1, 0x20, 0x46, 0x00, 0xf0,
-  0x0e, 0xf8, 0x00, 0x28, 0x14, 0xbf, 0x0a, 0x20, 0x00, 0x20, 0x96, 0xe7,
-  0x09, 0x20, 0x94, 0xe7, 0x38, 0x00, 0x00, 0x00, 0x02, 0x23, 0x00, 0xdf,
-  0x06, 0x23, 0x00, 0xdf, 0x70, 0x47, 0x07, 0x23, 0x00, 0xdf, 0x70, 0x47,
-  0x08, 0x23, 0x00, 0xdf, 0x70, 0x47, 0x03, 0x23, 0x00, 0xdf, 0x70, 0x47,
-  0x04, 0x23, 0x00, 0xdf, 0x70, 0x47, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x10,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x40, 0x00, 0x00,
-  0x01, 0x00, 0x00, 0x10, 0x00, 0x08, 0x00, 0x00, 0x4d, 0x69, 0x6f, 0x73,
-  0x69, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x73, 0x75, 0x69,
-  0x74, 0x2e, 0x62, 0x69, 0x6e, 0x00, 0x00, 0x00
-};
-unsigned int test_elf_len = 536;
diff --git a/miosix/testsuite/testsuite_syscall/Makefile b/miosix/testsuite/testsuite_syscall/Makefile
index c822afb4cb16d48c51aa43891676386136b24e27..34f92e723fa43f571d53cbaaddcc9329cd32cb2b 100644
--- a/miosix/testsuite/testsuite_syscall/Makefile
+++ b/miosix/testsuite/testsuite_syscall/Makefile
@@ -8,6 +8,7 @@ main.c
 
 ## Replaces both "foo.cpp"-->"foo.o" and "foo.c"-->"foo.o"
 OBJ := $(addsuffix .o, $(basename $(SRC)))
+ELF := $(addsuffix .elf, $(NAME))
 
 AS  := arm-miosix-eabi-as
 CC  := arm-miosix-eabi-gcc
@@ -25,14 +26,14 @@ LFLAGS   := -mcpu=cortex-m3 -mthumb -mfix-cortex-m3-ldrd -fpie -msingle-pic-base
 LINK_LIBS := -Wl,--start-group -lstdc++ -lc -lm -lgcc -Wl,--end-group
 
 all: $(OBJ) crt0.o
-	$(CXX) $(LFLAGS) -o test.elf $(OBJ) crt0.o $(LINK_LIBS)
-	$(SZ)  test.elf
-	@arm-miosix-eabi-objdump -Dslx test.elf > test.txt
-	@mx-postlinker test.elf --ramsize=16384 --stacksize=2048 --strip-sectheader
-	@xxd -i test.elf | sed 's/unsigned char/const unsigned char __attribute__((aligned(8)))/' > prog3.h
+	$(CXX) $(LFLAGS) -o $(ELF) $(OBJ) crt0.o $(LINK_LIBS)
+	$(SZ)  $(ELF)
+	@arm-miosix-eabi-objdump -Dslx $(ELF) > test.txt
+	@mx-postlinker $(ELF) --ramsize=16384 --stacksize=2048 --strip-sectheader
+	@xxd -i $(ELF) | sed 's/unsigned char/const unsigned char __attribute__((aligned(8)))/' > prog3.h
 
 clean:
-	-rm $(OBJ) crt0.o test.elf test.map test.txt
+	-rm $(OBJ) crt0.o *.elf test.map test.txt
 
 %.o: %.s
 	$(AS) $(AFLAGS) $< -o $@
diff --git a/miosix/testsuite/testsuite_syscall/log.txt b/miosix/testsuite/testsuite_syscall/log.txt
deleted file mode 100644
index 947e1fa9d4717683daab64b97022cad93ce3738d..0000000000000000000000000000000000000000
--- a/miosix/testsuite/testsuite_syscall/log.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-arm-miosix-eabi-g++ -mcpu=cortex-m3 -mthumb -mfix-cortex-m3-ldrd -fpie -msingle-pic-base -Wl,--gc-sections,-Map,main.map,-T./miosix.ld,-n,-pie,--spare-dynamic-tags,3 -O2 -nostdlib -fPIC -o main.elf main.o crt0.o -Wl,--start-group -lstdc++ -lc -lm -lgcc -Wl,--end-group
-/opt/arm-miosix-eabi/lib/gcc/arm-eabi/4.5.2/../../../../arm-eabi/bin/ld: /opt/arm-miosix-eabi/lib/gcc/arm-eabi/4.5.2/../../../../arm-eabi/lib/thumb/thumb2/libc.a(lib_a-syslseek.o): relocation R_ARM_THM_MOVW_ABS_NC against `_impure_ptr' can not be used when making a shared object; recompile with -fPIC
-/opt/arm-miosix-eabi/lib/gcc/arm-eabi/4.5.2/../../../../arm-eabi/lib/thumb/thumb2/libc.a: could not read symbols: Bad value
-collect2: ld returned 1 exit status
-make: *** [all] Error 1
diff --git a/miosix/testsuite/testsuite_syscall/main.c b/miosix/testsuite/testsuite_syscall/main.c
index eaebafa307410c6d52d4940e5026f7dea06b0af7..8200a7bcd023e203fbd780ee3668f07ea57ac2df 100644
--- a/miosix/testsuite/testsuite_syscall/main.c
+++ b/miosix/testsuite/testsuite_syscall/main.c
@@ -10,6 +10,16 @@
 
 #define SIZE 1024
 
+int mystrlen(const char *s){
+	int result=0;
+	while(*s++) result++;
+	return result;
+}
+
+void print(const char *s){
+	write(1, s, mystrlen(s));
+}
+
 int main(){
 	unsigned char buffer[SIZE],
 				  buffer2[SIZE];
@@ -23,8 +33,7 @@ int main(){
 	if(fd != -1)
 		return error(1);
 	
-	close(fd);
-	
+	print("'Open' of non existing file: PASSED\n");
 	fd = open("/testsuite.bin", O_RDWR|O_TRUNC, 0);
 	
 	if(fd == -1)
@@ -33,8 +42,12 @@ int main(){
 	if(fd >= 0 && fd <= 2)
 		return error(3);
 	
+	print("Open file: PASSED\n");
+	
 	if(write(fd, buffer, SIZE) != SIZE)
 		return error(4);
+	
+	print("Write file: PASSED\n");
 		
 	seek(fd, SEEK_SET, 0);
 		
@@ -44,15 +57,21 @@ int main(){
 	for(i = 0; i < SIZE; i++){
 		if(buffer[i] != buffer2[i])
 			return error(6);
-	}		
+	}
+	
+	print("Read: PASSED\n");
 		
 	if(close(fd) != 0)
 		return error(7);
 	
+	print("close: PASSED\n");
+	
 	fd = open("/testsuite.bin", O_RDWR);
 	
 	if(fd < 2)
 		return error(8);
+	
+	print("Open of an existing file: PASSED\n");
 		
 	if(read(fd, buffer2, SIZE) != SIZE)
 		return error(9);
@@ -62,8 +81,12 @@ int main(){
 			return error(10);
 	}
 	
+	print("Read data corectness: PASSED\n");
+	
 	if(close(fd))
 		return error(11);
 	
+	print("close: passed\n");
+	
 	return 0;
 }
diff --git a/miosix/testsuite/testsuite_syscall/prog3.h b/miosix/testsuite/testsuite_syscall/prog3.h
index dfc8d01c15d4a698bac7ee298b59583d21092875..6bc75f64bed8d4e853ba6e1b7a207d2bf45d80e2 100644
--- a/miosix/testsuite/testsuite_syscall/prog3.h
+++ b/miosix/testsuite/testsuite_syscall/prog3.h
@@ -1,48 +1,76 @@
-const unsigned char __attribute__((aligned(8))) test_elf[] = {
+const unsigned char __attribute__((aligned(8))) testsuite_syscall_elf[] = {
   0x7f, 0x45, 0x4c, 0x46, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x28, 0x00, 0x01, 0x00, 0x00, 0x00,
   0x99, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x02, 0x00, 0x00, 0x05, 0x34, 0x00, 0x20, 0x00, 0x03, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00,
-  0x98, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0x36, 0x01, 0x00, 0x00,
-  0x36, 0x01, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
-  0x01, 0x00, 0x00, 0x00, 0xd0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10,
-  0x00, 0x00, 0x00, 0x10, 0x48, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00,
+  0x98, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0xba, 0x01, 0x00, 0x00,
+  0xba, 0x01, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+  0x01, 0x00, 0x00, 0x00, 0x58, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10,
+  0x00, 0x00, 0x00, 0x10, 0x0c, 0x01, 0x00, 0x00, 0x0c, 0x01, 0x00, 0x00,
   0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
-  0xdc, 0x01, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x10, 0x0c, 0x00, 0x00, 0x10,
+  0x64, 0x02, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x10, 0x0c, 0x00, 0x00, 0x10,
   0x28, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
-  0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x02, 0xf8,
-  0x00, 0xf0, 0x86, 0xf8, 0x2d, 0xe9, 0xf0, 0x45, 0xad, 0xf5, 0x00, 0x6d,
-  0x81, 0xb0, 0x00, 0x24, 0x0d, 0xf5, 0x80, 0x65, 0x2c, 0x55, 0x01, 0x34,
-  0xb4, 0xf5, 0x80, 0x6f, 0xfa, 0xd1, 0x3b, 0x4f, 0x02, 0x21, 0x09, 0xeb,
-  0x07, 0x06, 0x00, 0x22, 0x30, 0x46, 0x00, 0xf0, 0x73, 0xf8, 0xb0, 0xf1,
-  0xff, 0x3f, 0x05, 0xd0, 0x00, 0x20, 0x01, 0xb0, 0x0d, 0xf5, 0x00, 0x6d,
-  0xbd, 0xe8, 0xf0, 0x85, 0x30, 0x46, 0x00, 0x22, 0x40, 0xf2, 0x02, 0x41,
-  0x00, 0xf0, 0x64, 0xf8, 0xb0, 0xf1, 0xff, 0x3f, 0x06, 0x46, 0x0c, 0xd0,
-  0x02, 0x28, 0x01, 0xd8, 0x02, 0x20, 0xec, 0xe7, 0x29, 0x46, 0x22, 0x46,
-  0x00, 0xf0, 0x61, 0xf8, 0xb0, 0xf5, 0x80, 0x6f, 0x03, 0xd0, 0x03, 0x20,
-  0xe3, 0xe7, 0x01, 0x20, 0xe1, 0xe7, 0x00, 0x21, 0x0a, 0x46, 0x30, 0x46,
-  0x00, 0xf0, 0x52, 0xf8, 0x30, 0x46, 0x69, 0x46, 0x22, 0x46, 0x00, 0xf0,
-  0x53, 0xf8, 0xb0, 0xf5, 0x80, 0x6f, 0xe8, 0x46, 0x01, 0xd0, 0x04, 0x20,
-  0xd1, 0xe7, 0x4f, 0xf0, 0x00, 0x0a, 0x02, 0xe0, 0xba, 0xf5, 0x80, 0x6f,
-  0x09, 0xd0, 0x15, 0xf8, 0x0a, 0x20, 0x18, 0xf8, 0x0a, 0x30, 0x0a, 0xf1,
-  0x01, 0x0a, 0x9a, 0x42, 0xf4, 0xd0, 0x05, 0x20, 0xc1, 0xe7, 0x30, 0x46,
-  0x00, 0xf0, 0x31, 0xf8, 0x06, 0x46, 0x08, 0xb1, 0x06, 0x20, 0xba, 0xe7,
-  0x02, 0x21, 0x09, 0xeb, 0x07, 0x00, 0x00, 0xf0, 0x25, 0xf8, 0x01, 0x28,
-  0x04, 0x46, 0x08, 0xdd, 0x69, 0x46, 0x52, 0x46, 0x00, 0xf0, 0x2a, 0xf8,
-  0xb0, 0xf5, 0x80, 0x6f, 0x03, 0xd0, 0x08, 0x20, 0xa9, 0xe7, 0x07, 0x20,
-  0xa7, 0xe7, 0xaa, 0x5d, 0x18, 0xf8, 0x06, 0x30, 0x01, 0x36, 0x9a, 0x42,
-  0x0a, 0xd1, 0xb6, 0xf5, 0x80, 0x6f, 0xf6, 0xd1, 0x20, 0x46, 0x00, 0xf0,
-  0x0e, 0xf8, 0x00, 0x28, 0x14, 0xbf, 0x0a, 0x20, 0x00, 0x20, 0x96, 0xe7,
-  0x09, 0x20, 0x94, 0xe7, 0x38, 0x00, 0x00, 0x00, 0x02, 0x23, 0x00, 0xdf,
+  0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x10, 0xf8,
+  0x00, 0xf0, 0xc8, 0xf8, 0x08, 0xb5, 0x02, 0x78, 0x01, 0x46, 0x22, 0xb1,
+  0x00, 0x22, 0x01, 0x32, 0x8b, 0x5c, 0x00, 0x2b, 0xfb, 0xd1, 0x01, 0x20,
+  0x00, 0xf0, 0xc7, 0xf8, 0x08, 0xbd, 0x00, 0xbf, 0x2d, 0xe9, 0xf0, 0x45,
+  0xad, 0xf5, 0x00, 0x6d, 0x81, 0xb0, 0x00, 0x24, 0x0d, 0xf5, 0x80, 0x65,
+  0x2c, 0x55, 0x01, 0x34, 0xb4, 0xf5, 0x80, 0x6f, 0xfa, 0xd1, 0x4d, 0x4f,
+  0x02, 0x21, 0x09, 0xeb, 0x07, 0x06, 0x00, 0x22, 0x30, 0x46, 0x00, 0xf0,
+  0xa7, 0xf8, 0xb0, 0xf1, 0xff, 0x3f, 0x05, 0xd0, 0x01, 0x20, 0x01, 0xb0,
+  0x0d, 0xf5, 0x00, 0x6d, 0xbd, 0xe8, 0xf0, 0x85, 0x45, 0x48, 0x48, 0x44,
+  0xff, 0xf7, 0xd0, 0xff, 0x30, 0x46, 0x00, 0x22, 0x40, 0xf2, 0x02, 0x41,
+  0x00, 0xf0, 0x94, 0xf8, 0xb0, 0xf1, 0xff, 0x3f, 0x06, 0x46, 0x11, 0xd0,
+  0x02, 0x28, 0x01, 0xd8, 0x03, 0x20, 0xe8, 0xe7, 0x3d, 0x48, 0x48, 0x44,
+  0xff, 0xf7, 0xbe, 0xff, 0x30, 0x46, 0x29, 0x46, 0x22, 0x46, 0x00, 0xf0,
+  0x8c, 0xf8, 0xb0, 0xf5, 0x80, 0x6f, 0x03, 0xd0, 0x04, 0x20, 0xda, 0xe7,
+  0x02, 0x20, 0xd8, 0xe7, 0x36, 0x48, 0xe8, 0x46, 0x48, 0x44, 0xff, 0xf7,
+  0xad, 0xff, 0x00, 0x21, 0x0a, 0x46, 0x30, 0x46, 0x00, 0xf0, 0x78, 0xf8,
+  0x30, 0x46, 0x69, 0x46, 0x22, 0x46, 0x00, 0xf0, 0x79, 0xf8, 0xb0, 0xf5,
+  0x80, 0x6f, 0x01, 0xd0, 0x05, 0x20, 0xc4, 0xe7, 0x4f, 0xf0, 0x00, 0x0a,
+  0x02, 0xe0, 0xba, 0xf5, 0x80, 0x6f, 0x09, 0xd0, 0x15, 0xf8, 0x0a, 0x20,
+  0x18, 0xf8, 0x0a, 0x30, 0x0a, 0xf1, 0x01, 0x0a, 0x9a, 0x42, 0xf4, 0xd0,
+  0x06, 0x20, 0xb4, 0xe7, 0x25, 0x48, 0x48, 0x44, 0xff, 0xf7, 0x8a, 0xff,
+  0x30, 0x46, 0x00, 0xf0, 0x54, 0xf8, 0x06, 0x46, 0x08, 0xb1, 0x07, 0x20,
+  0xa9, 0xe7, 0x21, 0x48, 0x48, 0x44, 0xff, 0xf7, 0x7f, 0xff, 0x02, 0x21,
+  0x09, 0xeb, 0x07, 0x00, 0x00, 0xf0, 0x44, 0xf8, 0x01, 0x28, 0x04, 0x46,
+  0x0d, 0xdd, 0x1c, 0x48, 0x48, 0x44, 0xff, 0xf7, 0x73, 0xff, 0x20, 0x46,
+  0x69, 0x46, 0x52, 0x46, 0x00, 0xf0, 0x44, 0xf8, 0xb0, 0xf5, 0x80, 0x6f,
+  0x03, 0xd0, 0x09, 0x20, 0x8f, 0xe7, 0x08, 0x20, 0x8d, 0xe7, 0xaa, 0x5d,
+  0x18, 0xf8, 0x06, 0x30, 0x01, 0x36, 0x9a, 0x42, 0x0d, 0xd1, 0xb6, 0xf5,
+  0x80, 0x6f, 0xf6, 0xd1, 0x10, 0x48, 0x48, 0x44, 0xff, 0xf7, 0x5a, 0xff,
+  0x20, 0x46, 0x00, 0xf0, 0x24, 0xf8, 0x04, 0x46, 0x18, 0xb1, 0x0b, 0x20,
+  0x79, 0xe7, 0x0a, 0x20, 0x77, 0xe7, 0x0b, 0x48, 0x48, 0x44, 0xff, 0xf7,
+  0x4d, 0xff, 0x20, 0x46, 0x71, 0xe7, 0x00, 0xbf, 0x38, 0x00, 0x00, 0x00,
+  0x48, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00,
+  0x98, 0x00, 0x00, 0x00, 0xa8, 0x00, 0x00, 0x00, 0xb8, 0x00, 0x00, 0x00,
+  0xdc, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x02, 0x23, 0x00, 0xdf,
   0x06, 0x23, 0x00, 0xdf, 0x70, 0x47, 0x07, 0x23, 0x00, 0xdf, 0x70, 0x47,
   0x08, 0x23, 0x00, 0xdf, 0x70, 0x47, 0x03, 0x23, 0x00, 0xdf, 0x70, 0x47,
-  0x04, 0x23, 0x00, 0xdf, 0x70, 0x47, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x10,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x40, 0x00, 0x00,
-  0x01, 0x00, 0x00, 0x10, 0x00, 0x08, 0x00, 0x00, 0x4d, 0x69, 0x6f, 0x73,
-  0x69, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x73, 0x75, 0x69,
-  0x74, 0x2e, 0x62, 0x69, 0x6e, 0x00, 0x00, 0x00
+  0x04, 0x23, 0x00, 0xdf, 0x70, 0x47, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x0c, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10,
+  0x00, 0x40, 0x00, 0x00, 0x01, 0x00, 0x00, 0x10, 0x00, 0x08, 0x00, 0x00,
+  0x4d, 0x69, 0x6f, 0x73, 0x69, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2f, 0x74, 0x65, 0x73,
+  0x74, 0x73, 0x75, 0x69, 0x74, 0x65, 0x2e, 0x62, 0x69, 0x6e, 0x00, 0x00,
+  0x27, 0x4f, 0x70, 0x65, 0x6e, 0x27, 0x20, 0x6f, 0x66, 0x20, 0x6e, 0x6f,
+  0x6e, 0x20, 0x65, 0x78, 0x69, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x20, 0x66,
+  0x69, 0x6c, 0x65, 0x3a, 0x20, 0x50, 0x41, 0x53, 0x53, 0x45, 0x44, 0x0a,
+  0x00, 0x00, 0x00, 0x00, 0x4f, 0x70, 0x65, 0x6e, 0x20, 0x66, 0x69, 0x6c,
+  0x65, 0x3a, 0x20, 0x50, 0x41, 0x53, 0x53, 0x45, 0x44, 0x0a, 0x00, 0x00,
+  0x57, 0x72, 0x69, 0x74, 0x65, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x3a, 0x20,
+  0x50, 0x41, 0x53, 0x53, 0x45, 0x44, 0x0a, 0x00, 0x52, 0x65, 0x61, 0x64,
+  0x3a, 0x20, 0x50, 0x41, 0x53, 0x53, 0x45, 0x44, 0x0a, 0x00, 0x00, 0x00,
+  0x63, 0x6c, 0x6f, 0x73, 0x65, 0x3a, 0x20, 0x50, 0x41, 0x53, 0x53, 0x45,
+  0x44, 0x0a, 0x00, 0x00, 0x4f, 0x70, 0x65, 0x6e, 0x20, 0x6f, 0x66, 0x20,
+  0x61, 0x6e, 0x20, 0x65, 0x78, 0x69, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x20,
+  0x66, 0x69, 0x6c, 0x65, 0x3a, 0x20, 0x50, 0x41, 0x53, 0x53, 0x45, 0x44,
+  0x0a, 0x00, 0x00, 0x00, 0x52, 0x65, 0x61, 0x64, 0x20, 0x64, 0x61, 0x74,
+  0x61, 0x20, 0x63, 0x6f, 0x72, 0x65, 0x63, 0x74, 0x6e, 0x65, 0x73, 0x73,
+  0x3a, 0x20, 0x50, 0x41, 0x53, 0x53, 0x45, 0x44, 0x0a, 0x00, 0x00, 0x00,
+  0x63, 0x6c, 0x6f, 0x73, 0x65, 0x3a, 0x20, 0x70, 0x61, 0x73, 0x73, 0x65,
+  0x64, 0x0a, 0x00, 0x00
 };
-unsigned int test_elf_len = 536;
+unsigned int testsuite_syscall_elf_len = 868;
diff --git a/miosix/testsuite/testsuite_syscall/test.txt b/miosix/testsuite/testsuite_syscall/test.txt
index c00167ca98453d9ef6192b4ffba220d539560116..145de2e5ac95035195437f752b43bc6bbaccf03e 100644
--- a/miosix/testsuite/testsuite_syscall/test.txt
+++ b/miosix/testsuite/testsuite_syscall/test.txt
@@ -1,16 +1,16 @@
 
-test.elf:     file format elf32-littlearm
-test.elf
+testsuite_syscall.elf:     file format elf32-littlearm
+testsuite_syscall.elf
 architecture: arm, flags 0x00000050:
 HAS_SYMS, DYNAMIC
 start address 0x00000099
 
 Program Header:
     LOAD off    0x00000098 vaddr 0x00000098 paddr 0x00000098 align 2**3
-         filesz 0x00000136 memsz 0x00000136 flags r-x
-    LOAD off    0x000001d0 vaddr 0x10000000 paddr 0x10000000 align 2**3
-         filesz 0x00000048 memsz 0x00000048 flags rw-
- DYNAMIC off    0x000001dc vaddr 0x1000000c paddr 0x1000000c align 2**2
+         filesz 0x000001ba memsz 0x000001ba flags r-x
+    LOAD off    0x00000258 vaddr 0x10000000 paddr 0x10000000 align 2**3
+         filesz 0x0000010c memsz 0x0000010c flags rw-
+ DYNAMIC off    0x00000264 vaddr 0x1000000c paddr 0x1000000c align 2**2
          filesz 0x00000028 memsz 0x00000028 flags rw-
 
 Dynamic Section:
@@ -19,13 +19,13 @@ private flags = 5000002: [Version5 EABI] [has entry point]
 
 Sections:
 Idx Name          Size      VMA       LMA       File off  Algn
-  0 .text         00000136  00000098  00000098  00000098  2**3
+  0 .text         000001ba  00000098  00000098  00000098  2**3
                   CONTENTS, ALLOC, LOAD, READONLY, CODE
-  1 .got          0000000c  10000000  10000000  000001d0  2**2
+  1 .got          0000000c  10000000  10000000  00000258  2**2
                   CONTENTS, ALLOC, LOAD, DATA
-  2 .dynamic      00000028  1000000c  1000000c  000001dc  2**2
+  2 .dynamic      00000028  1000000c  1000000c  00000264  2**2
                   CONTENTS, ALLOC, LOAD, DATA
-  3 .rodata       00000010  10000038  10000038  00000208  2**3
+  3 .rodata       000000d4  10000038  10000038  00000290  2**3
                   CONTENTS, ALLOC, LOAD, READONLY, DATA
 SYMBOL TABLE:
 00000098 l    d  .text	00000000 .text
@@ -35,37 +35,46 @@ SYMBOL TABLE:
 00000000 l    df *ABS*	00000000 main.c
 1000000c l     O *ABS*	00000000 _DYNAMIC
 10000000 l     O *ABS*	00000000 _GLOBAL_OFFSET_TABLE_
-000001c2 g     F .text	00000000 write
+000000a0 g     F .text	0000001a print
+00000246 g     F .text	00000000 write
 00000098 g     F .text	00000000 _start
-000001c8 g     F .text	00000000 read
-000000a0 g     F .text	0000010c main
-000001bc g     F .text	00000000 seek
-000001ac g     F .text	00000000 _exit
-000001b0 g     F .text	00000000 open
-000001b6 g     F .text	00000000 close
+0000024c g     F .text	00000000 read
+000000bc g     F .text	00000174 main
+00000240 g     F .text	00000000 seek
+00000230 g     F .text	00000000 _exit
+00000234 g     F .text	00000000 open
+0000023a g     F .text	00000000 close
 
 
 Contents of section .text:
- 0098 00f002f8 00f086f8 2de9f045 adf5006d  ........-..E...m
- 00a8 81b00024 0df58065 2c550134 b4f5806f  ...$...e,U.4...o
- 00b8 fad13b4f 022109eb 07060022 304600f0  ..;O.!....."0F..
- 00c8 73f8b0f1 ff3f05d0 002001b0 0df5006d  s....?... .....m
- 00d8 bde8f085 30460022 40f20241 00f064f8  ....0F."@..A..d.
- 00e8 b0f1ff3f 06460cd0 022801d8 0220ece7  ...?.F...(... ..
- 00f8 29462246 00f061f8 b0f5806f 03d00320  )F"F..a....o... 
- 0108 e3e70120 e1e70021 0a463046 00f052f8  ... ...!.F0F..R.
- 0118 30466946 224600f0 53f8b0f5 806fe846  0FiF"F..S....o.F
- 0128 01d00420 d1e74ff0 000a02e0 baf5806f  ... ..O........o
- 0138 09d015f8 0a2018f8 0a300af1 010a9a42  ..... ...0.....B
- 0148 f4d00520 c1e73046 00f031f8 064608b1  ... ..0F..1..F..
- 0158 0620bae7 022109eb 070000f0 25f80128  . ...!......%..(
- 0168 044608dd 69465246 00f02af8 b0f5806f  .F..iFRF..*....o
- 0178 03d00820 a9e70720 a7e7aa5d 18f80630  ... ... ...]...0
- 0188 01369a42 0ad1b6f5 806ff6d1 204600f0  .6.B.....o.. F..
- 0198 0ef80028 14bf0a20 002096e7 092094e7  ...(... . ... ..
- 01a8 38000000 022300df 062300df 70470723  8....#...#..pG.#
- 01b8 00df7047 082300df 70470323 00df7047  ..pG.#..pG.#..pG
- 01c8 042300df 7047                        .#..pG          
+ 0098 00f010f8 00f0c8f8 08b50278 014622b1  ...........x.F".
+ 00a8 00220132 8b5c002b fbd10120 00f0c7f8  .".2.\.+... ....
+ 00b8 08bd00bf 2de9f045 adf5006d 81b00024  ....-..E...m...$
+ 00c8 0df58065 2c550134 b4f5806f fad14d4f  ...e,U.4...o..MO
+ 00d8 022109eb 07060022 304600f0 a7f8b0f1  .!....."0F......
+ 00e8 ff3f05d0 012001b0 0df5006d bde8f085  .?... .....m....
+ 00f8 45484844 fff7d0ff 30460022 40f20241  EHHD....0F."@..A
+ 0108 00f094f8 b0f1ff3f 064611d0 022801d8  .......?.F...(..
+ 0118 0320e8e7 3d484844 fff7beff 30462946  . ..=HHD....0F)F
+ 0128 224600f0 8cf8b0f5 806f03d0 0420dae7  "F.......o... ..
+ 0138 0220d8e7 3648e846 4844fff7 adff0021  . ..6H.FHD.....!
+ 0148 0a463046 00f078f8 30466946 224600f0  .F0F..x.0FiF"F..
+ 0158 79f8b0f5 806f01d0 0520c4e7 4ff0000a  y....o... ..O...
+ 0168 02e0baf5 806f09d0 15f80a20 18f80a30  .....o..... ...0
+ 0178 0af1010a 9a42f4d0 0620b4e7 25484844  .....B... ..%HHD
+ 0188 fff78aff 304600f0 54f80646 08b10720  ....0F..T..F... 
+ 0198 a9e72148 4844fff7 7fff0221 09eb0700  ..!HHD.....!....
+ 01a8 00f044f8 01280446 0ddd1c48 4844fff7  ..D..(.F...HHD..
+ 01b8 73ff2046 69465246 00f044f8 b0f5806f  s. FiFRF..D....o
+ 01c8 03d00920 8fe70820 8de7aa5d 18f80630  ... ... ...]...0
+ 01d8 01369a42 0dd1b6f5 806ff6d1 10484844  .6.B.....o...HHD
+ 01e8 fff75aff 204600f0 24f80446 18b10b20  ..Z. F..$..F... 
+ 01f8 79e70a20 77e70b48 4844fff7 4dff2046  y.. w..HHD..M. F
+ 0208 71e700bf 38000000 48000000 70000000  q...8...H...p...
+ 0218 84000000 98000000 a8000000 b8000000  ................
+ 0228 dc000000 fc000000 022300df 062300df  .........#...#..
+ 0238 70470723 00df7047 082300df 70470323  pG.#..pG.#..pG.#
+ 0248 00df7047 042300df 7047               ..pG.#..pG      
 Contents of section .got:
  10000000 0c000010 00000000 00000000           ............    
 Contents of section .dynamic:
@@ -73,155 +82,220 @@ Contents of section .dynamic:
  1000001c 00000000 00000000 00000000 00000000  ................
  1000002c 00000000 00000000                    ........        
 Contents of section .rodata:
- 10000038 2f746573 74737569 742e6269 6e000000  /testsuit.bin...
+ 10000038 2f746573 74737569 74652e62 696e0000  /testsuite.bin..
+ 10000048 274f7065 6e27206f 66206e6f 6e206578  'Open' of non ex
+ 10000058 69737469 6e672066 696c653a 20504153  isting file: PAS
+ 10000068 5345440a 00000000 4f70656e 2066696c  SED.....Open fil
+ 10000078 653a2050 41535345 440a0000 57726974  e: PASSED...Writ
+ 10000088 65206669 6c653a20 50415353 45440a00  e file: PASSED..
+ 10000098 52656164 3a205041 53534544 0a000000  Read: PASSED....
+ 100000a8 636c6f73 653a2050 41535345 440a0000  close: PASSED...
+ 100000b8 4f70656e 206f6620 616e2065 78697374  Open of an exist
+ 100000c8 696e6720 66696c65 3a205041 53534544  ing file: PASSED
+ 100000d8 0a000000 52656164 20646174 6120636f  ....Read data co
+ 100000e8 72656374 6e657373 3a205041 53534544  rectness: PASSED
+ 100000f8 0a000000 636c6f73 653a2070 61737365  ....close: passe
+ 10000108 640a0000                             d...            
 
 Disassembly of section .text:
 
 00000098 <_start>:
 _start():
-  98:	f000 f802 	bl	a0 <main>
-  9c:	f000 f886 	bl	1ac <_exit>
+  98:	f000 f810 	bl	bc <main>
+  9c:	f000 f8c8 	bl	230 <_exit>
 
-000000a0 <main>:
+000000a0 <print>:
+print():
+  a0:	b508      	push	{r3, lr}
+  a2:	7802      	ldrb	r2, [r0, #0]
+  a4:	4601      	mov	r1, r0
+  a6:	b122      	cbz	r2, b2 <print+0x12>
+  a8:	2200      	movs	r2, #0
+  aa:	3201      	adds	r2, #1
+  ac:	5c8b      	ldrb	r3, [r1, r2]
+  ae:	2b00      	cmp	r3, #0
+  b0:	d1fb      	bne.n	aa <print+0xa>
+  b2:	2001      	movs	r0, #1
+  b4:	f000 f8c7 	bl	246 <write>
+  b8:	bd08      	pop	{r3, pc}
+  ba:	bf00      	nop
+
+000000bc <main>:
 main():
-  a0:	e92d 45f0 	stmdb	sp!, {r4, r5, r6, r7, r8, sl, lr}
-  a4:	f5ad 6d00 	sub.w	sp, sp, #2048	; 0x800
-  a8:	b081      	sub	sp, #4
-  aa:	2400      	movs	r4, #0
-  ac:	f50d 6580 	add.w	r5, sp, #1024	; 0x400
-  b0:	552c      	strb	r4, [r5, r4]
-  b2:	3401      	adds	r4, #1
-  b4:	f5b4 6f80 	cmp.w	r4, #1024	; 0x400
-  b8:	d1fa      	bne.n	b0 <main+0x10>
-  ba:	4f3b      	ldr	r7, [pc, #236]	; (1a8 <main+0x108>)
-  bc:	2102      	movs	r1, #2
-  be:	eb09 0607 	add.w	r6, r9, r7
-  c2:	2200      	movs	r2, #0
-  c4:	4630      	mov	r0, r6
-  c6:	f000 f873 	bl	1b0 <open>
-  ca:	f1b0 3fff 	cmp.w	r0, #4294967295	; 0xffffffff
-  ce:	d005      	beq.n	dc <main+0x3c>
-  d0:	2000      	movs	r0, #0
-  d2:	b001      	add	sp, #4
-  d4:	f50d 6d00 	add.w	sp, sp, #2048	; 0x800
-  d8:	e8bd 85f0 	ldmia.w	sp!, {r4, r5, r6, r7, r8, sl, pc}
-  dc:	4630      	mov	r0, r6
+  bc:	e92d 45f0 	stmdb	sp!, {r4, r5, r6, r7, r8, sl, lr}
+  c0:	f5ad 6d00 	sub.w	sp, sp, #2048	; 0x800
+  c4:	b081      	sub	sp, #4
+  c6:	2400      	movs	r4, #0
+  c8:	f50d 6580 	add.w	r5, sp, #1024	; 0x400
+  cc:	552c      	strb	r4, [r5, r4]
+  ce:	3401      	adds	r4, #1
+  d0:	f5b4 6f80 	cmp.w	r4, #1024	; 0x400
+  d4:	d1fa      	bne.n	cc <main+0x10>
+  d6:	4f4d      	ldr	r7, [pc, #308]	; (20c <main+0x150>)
+  d8:	2102      	movs	r1, #2
+  da:	eb09 0607 	add.w	r6, r9, r7
   de:	2200      	movs	r2, #0
-  e0:	f240 4102 	movw	r1, #1026	; 0x402
-  e4:	f000 f864 	bl	1b0 <open>
-  e8:	f1b0 3fff 	cmp.w	r0, #4294967295	; 0xffffffff
-  ec:	4606      	mov	r6, r0
-  ee:	d00c      	beq.n	10a <main+0x6a>
-  f0:	2802      	cmp	r0, #2
-  f2:	d801      	bhi.n	f8 <main+0x58>
-  f4:	2002      	movs	r0, #2
-  f6:	e7ec      	b.n	d2 <main+0x32>
-  f8:	4629      	mov	r1, r5
-  fa:	4622      	mov	r2, r4
-  fc:	f000 f861 	bl	1c2 <write>
- 100:	f5b0 6f80 	cmp.w	r0, #1024	; 0x400
- 104:	d003      	beq.n	10e <main+0x6e>
- 106:	2003      	movs	r0, #3
- 108:	e7e3      	b.n	d2 <main+0x32>
- 10a:	2001      	movs	r0, #1
- 10c:	e7e1      	b.n	d2 <main+0x32>
- 10e:	2100      	movs	r1, #0
- 110:	460a      	mov	r2, r1
- 112:	4630      	mov	r0, r6
- 114:	f000 f852 	bl	1bc <seek>
- 118:	4630      	mov	r0, r6
- 11a:	4669      	mov	r1, sp
- 11c:	4622      	mov	r2, r4
- 11e:	f000 f853 	bl	1c8 <read>
- 122:	f5b0 6f80 	cmp.w	r0, #1024	; 0x400
- 126:	46e8      	mov	r8, sp
- 128:	d001      	beq.n	12e <main+0x8e>
- 12a:	2004      	movs	r0, #4
- 12c:	e7d1      	b.n	d2 <main+0x32>
- 12e:	f04f 0a00 	mov.w	sl, #0
- 132:	e002      	b.n	13a <main+0x9a>
- 134:	f5ba 6f80 	cmp.w	sl, #1024	; 0x400
- 138:	d009      	beq.n	14e <main+0xae>
- 13a:	f815 200a 	ldrb.w	r2, [r5, sl]
- 13e:	f818 300a 	ldrb.w	r3, [r8, sl]
- 142:	f10a 0a01 	add.w	sl, sl, #1
- 146:	429a      	cmp	r2, r3
- 148:	d0f4      	beq.n	134 <main+0x94>
- 14a:	2005      	movs	r0, #5
- 14c:	e7c1      	b.n	d2 <main+0x32>
- 14e:	4630      	mov	r0, r6
- 150:	f000 f831 	bl	1b6 <close>
- 154:	4606      	mov	r6, r0
- 156:	b108      	cbz	r0, 15c <main+0xbc>
- 158:	2006      	movs	r0, #6
- 15a:	e7ba      	b.n	d2 <main+0x32>
- 15c:	2102      	movs	r1, #2
- 15e:	eb09 0007 	add.w	r0, r9, r7
- 162:	f000 f825 	bl	1b0 <open>
- 166:	2801      	cmp	r0, #1
- 168:	4604      	mov	r4, r0
- 16a:	dd08      	ble.n	17e <main+0xde>
- 16c:	4669      	mov	r1, sp
- 16e:	4652      	mov	r2, sl
- 170:	f000 f82a 	bl	1c8 <read>
- 174:	f5b0 6f80 	cmp.w	r0, #1024	; 0x400
- 178:	d003      	beq.n	182 <main+0xe2>
- 17a:	2008      	movs	r0, #8
- 17c:	e7a9      	b.n	d2 <main+0x32>
- 17e:	2007      	movs	r0, #7
- 180:	e7a7      	b.n	d2 <main+0x32>
- 182:	5daa      	ldrb	r2, [r5, r6]
- 184:	f818 3006 	ldrb.w	r3, [r8, r6]
- 188:	3601      	adds	r6, #1
- 18a:	429a      	cmp	r2, r3
- 18c:	d10a      	bne.n	1a4 <main+0x104>
- 18e:	f5b6 6f80 	cmp.w	r6, #1024	; 0x400
- 192:	d1f6      	bne.n	182 <main+0xe2>
- 194:	4620      	mov	r0, r4
- 196:	f000 f80e 	bl	1b6 <close>
- 19a:	2800      	cmp	r0, #0
- 19c:	bf14      	ite	ne
- 19e:	200a      	movne	r0, #10
- 1a0:	2000      	moveq	r0, #0
- 1a2:	e796      	b.n	d2 <main+0x32>
- 1a4:	2009      	movs	r0, #9
- 1a6:	e794      	b.n	d2 <main+0x32>
- 1a8:	00000038 	andeq	r0, r0, r8, lsr r0
-
-000001ac <_exit>:
+  e0:	4630      	mov	r0, r6
+  e2:	f000 f8a7 	bl	234 <open>
+  e6:	f1b0 3fff 	cmp.w	r0, #4294967295	; 0xffffffff
+  ea:	d005      	beq.n	f8 <main+0x3c>
+  ec:	2001      	movs	r0, #1
+  ee:	b001      	add	sp, #4
+  f0:	f50d 6d00 	add.w	sp, sp, #2048	; 0x800
+  f4:	e8bd 85f0 	ldmia.w	sp!, {r4, r5, r6, r7, r8, sl, pc}
+  f8:	4845      	ldr	r0, [pc, #276]	; (210 <main+0x154>)
+  fa:	4448      	add	r0, r9
+  fc:	f7ff ffd0 	bl	a0 <print>
+ 100:	4630      	mov	r0, r6
+ 102:	2200      	movs	r2, #0
+ 104:	f240 4102 	movw	r1, #1026	; 0x402
+ 108:	f000 f894 	bl	234 <open>
+ 10c:	f1b0 3fff 	cmp.w	r0, #4294967295	; 0xffffffff
+ 110:	4606      	mov	r6, r0
+ 112:	d011      	beq.n	138 <main+0x7c>
+ 114:	2802      	cmp	r0, #2
+ 116:	d801      	bhi.n	11c <main+0x60>
+ 118:	2003      	movs	r0, #3
+ 11a:	e7e8      	b.n	ee <main+0x32>
+ 11c:	483d      	ldr	r0, [pc, #244]	; (214 <main+0x158>)
+ 11e:	4448      	add	r0, r9
+ 120:	f7ff ffbe 	bl	a0 <print>
+ 124:	4630      	mov	r0, r6
+ 126:	4629      	mov	r1, r5
+ 128:	4622      	mov	r2, r4
+ 12a:	f000 f88c 	bl	246 <write>
+ 12e:	f5b0 6f80 	cmp.w	r0, #1024	; 0x400
+ 132:	d003      	beq.n	13c <main+0x80>
+ 134:	2004      	movs	r0, #4
+ 136:	e7da      	b.n	ee <main+0x32>
+ 138:	2002      	movs	r0, #2
+ 13a:	e7d8      	b.n	ee <main+0x32>
+ 13c:	4836      	ldr	r0, [pc, #216]	; (218 <main+0x15c>)
+ 13e:	46e8      	mov	r8, sp
+ 140:	4448      	add	r0, r9
+ 142:	f7ff ffad 	bl	a0 <print>
+ 146:	2100      	movs	r1, #0
+ 148:	460a      	mov	r2, r1
+ 14a:	4630      	mov	r0, r6
+ 14c:	f000 f878 	bl	240 <seek>
+ 150:	4630      	mov	r0, r6
+ 152:	4669      	mov	r1, sp
+ 154:	4622      	mov	r2, r4
+ 156:	f000 f879 	bl	24c <read>
+ 15a:	f5b0 6f80 	cmp.w	r0, #1024	; 0x400
+ 15e:	d001      	beq.n	164 <main+0xa8>
+ 160:	2005      	movs	r0, #5
+ 162:	e7c4      	b.n	ee <main+0x32>
+ 164:	f04f 0a00 	mov.w	sl, #0
+ 168:	e002      	b.n	170 <main+0xb4>
+ 16a:	f5ba 6f80 	cmp.w	sl, #1024	; 0x400
+ 16e:	d009      	beq.n	184 <main+0xc8>
+ 170:	f815 200a 	ldrb.w	r2, [r5, sl]
+ 174:	f818 300a 	ldrb.w	r3, [r8, sl]
+ 178:	f10a 0a01 	add.w	sl, sl, #1
+ 17c:	429a      	cmp	r2, r3
+ 17e:	d0f4      	beq.n	16a <main+0xae>
+ 180:	2006      	movs	r0, #6
+ 182:	e7b4      	b.n	ee <main+0x32>
+ 184:	4825      	ldr	r0, [pc, #148]	; (21c <main+0x160>)
+ 186:	4448      	add	r0, r9
+ 188:	f7ff ff8a 	bl	a0 <print>
+ 18c:	4630      	mov	r0, r6
+ 18e:	f000 f854 	bl	23a <close>
+ 192:	4606      	mov	r6, r0
+ 194:	b108      	cbz	r0, 19a <main+0xde>
+ 196:	2007      	movs	r0, #7
+ 198:	e7a9      	b.n	ee <main+0x32>
+ 19a:	4821      	ldr	r0, [pc, #132]	; (220 <main+0x164>)
+ 19c:	4448      	add	r0, r9
+ 19e:	f7ff ff7f 	bl	a0 <print>
+ 1a2:	2102      	movs	r1, #2
+ 1a4:	eb09 0007 	add.w	r0, r9, r7
+ 1a8:	f000 f844 	bl	234 <open>
+ 1ac:	2801      	cmp	r0, #1
+ 1ae:	4604      	mov	r4, r0
+ 1b0:	dd0d      	ble.n	1ce <main+0x112>
+ 1b2:	481c      	ldr	r0, [pc, #112]	; (224 <main+0x168>)
+ 1b4:	4448      	add	r0, r9
+ 1b6:	f7ff ff73 	bl	a0 <print>
+ 1ba:	4620      	mov	r0, r4
+ 1bc:	4669      	mov	r1, sp
+ 1be:	4652      	mov	r2, sl
+ 1c0:	f000 f844 	bl	24c <read>
+ 1c4:	f5b0 6f80 	cmp.w	r0, #1024	; 0x400
+ 1c8:	d003      	beq.n	1d2 <main+0x116>
+ 1ca:	2009      	movs	r0, #9
+ 1cc:	e78f      	b.n	ee <main+0x32>
+ 1ce:	2008      	movs	r0, #8
+ 1d0:	e78d      	b.n	ee <main+0x32>
+ 1d2:	5daa      	ldrb	r2, [r5, r6]
+ 1d4:	f818 3006 	ldrb.w	r3, [r8, r6]
+ 1d8:	3601      	adds	r6, #1
+ 1da:	429a      	cmp	r2, r3
+ 1dc:	d10d      	bne.n	1fa <main+0x13e>
+ 1de:	f5b6 6f80 	cmp.w	r6, #1024	; 0x400
+ 1e2:	d1f6      	bne.n	1d2 <main+0x116>
+ 1e4:	4810      	ldr	r0, [pc, #64]	; (228 <main+0x16c>)
+ 1e6:	4448      	add	r0, r9
+ 1e8:	f7ff ff5a 	bl	a0 <print>
+ 1ec:	4620      	mov	r0, r4
+ 1ee:	f000 f824 	bl	23a <close>
+ 1f2:	4604      	mov	r4, r0
+ 1f4:	b118      	cbz	r0, 1fe <main+0x142>
+ 1f6:	200b      	movs	r0, #11
+ 1f8:	e779      	b.n	ee <main+0x32>
+ 1fa:	200a      	movs	r0, #10
+ 1fc:	e777      	b.n	ee <main+0x32>
+ 1fe:	480b      	ldr	r0, [pc, #44]	; (22c <main+0x170>)
+ 200:	4448      	add	r0, r9
+ 202:	f7ff ff4d 	bl	a0 <print>
+ 206:	4620      	mov	r0, r4
+ 208:	e771      	b.n	ee <main+0x32>
+ 20a:	bf00      	nop
+ 20c:	00000038 	andeq	r0, r0, r8, lsr r0
+ 210:	00000048 	andeq	r0, r0, r8, asr #32
+ 214:	00000070 	andeq	r0, r0, r0, ror r0
+ 218:	00000084 	andeq	r0, r0, r4, lsl #1
+ 21c:	00000098 	muleq	r0, r8, r0
+ 220:	000000a8 	andeq	r0, r0, r8, lsr #1
+ 224:	000000b8 	strheq	r0, [r0], -r8
+ 228:	000000dc 	ldrdeq	r0, [r0], -ip
+ 22c:	000000fc 	strdeq	r0, [r0], -ip
+
+00000230 <_exit>:
 _exit():
- 1ac:	2302      	movs	r3, #2
- 1ae:	df00      	svc	0
+ 230:	2302      	movs	r3, #2
+ 232:	df00      	svc	0
 
-000001b0 <open>:
+00000234 <open>:
 open():
- 1b0:	2306      	movs	r3, #6
- 1b2:	df00      	svc	0
- 1b4:	4770      	bx	lr
+ 234:	2306      	movs	r3, #6
+ 236:	df00      	svc	0
+ 238:	4770      	bx	lr
 
-000001b6 <close>:
+0000023a <close>:
 close():
- 1b6:	2307      	movs	r3, #7
- 1b8:	df00      	svc	0
- 1ba:	4770      	bx	lr
+ 23a:	2307      	movs	r3, #7
+ 23c:	df00      	svc	0
+ 23e:	4770      	bx	lr
 
-000001bc <seek>:
+00000240 <seek>:
 seek():
- 1bc:	2308      	movs	r3, #8
- 1be:	df00      	svc	0
- 1c0:	4770      	bx	lr
+ 240:	2308      	movs	r3, #8
+ 242:	df00      	svc	0
+ 244:	4770      	bx	lr
 
-000001c2 <write>:
+00000246 <write>:
 write():
- 1c2:	2303      	movs	r3, #3
- 1c4:	df00      	svc	0
- 1c6:	4770      	bx	lr
+ 246:	2303      	movs	r3, #3
+ 248:	df00      	svc	0
+ 24a:	4770      	bx	lr
 
-000001c8 <read>:
+0000024c <read>:
 read():
- 1c8:	2304      	movs	r3, #4
- 1ca:	df00      	svc	0
- 1cc:	4770      	bx	lr
+ 24c:	2304      	movs	r3, #4
+ 24e:	df00      	svc	0
+ 250:	4770      	bx	lr
 
 Disassembly of section .got:
 
@@ -240,5 +314,54 @@ Disassembly of section .rodata:
 10000038 <.rodata>:
 10000038:	7365742f 	cmnvc	r5, #788529152	; 0x2f000000
 1000003c:	69757374 	ldmdbvs	r5!, {r2, r4, r5, r6, r8, r9, ip, sp, lr}^
-10000040:	69622e74 	stmdbvs	r2!, {r2, r4, r5, r6, r9, sl, fp, sp}^
-10000044:	0000006e 	andeq	r0, r0, lr, rrx
+10000040:	622e6574 	eorvs	r6, lr, #486539264	; 0x1d000000
+10000044:	00006e69 	andeq	r6, r0, r9, ror #28
+10000048:	65704f27 	ldrbvs	r4, [r0, #-3879]!	; 0xf27
+1000004c:	6f20276e 	svcvs	0x0020276e
+10000050:	6f6e2066 	svcvs	0x006e2066
+10000054:	7865206e 	stmdavc	r5!, {r1, r2, r3, r5, r6, sp}^
+10000058:	69747369 	ldmdbvs	r4!, {r0, r3, r5, r6, r8, r9, ip, sp, lr}^
+1000005c:	6620676e 	strtvs	r6, [r0], -lr, ror #14
+10000060:	3a656c69 	bcc	1195b20c <_DYNAMIC+0x195b200>
+10000064:	53415020 	movtpl	r5, #4128	; 0x1020
+10000068:	0a444553 	beq	111115bc <_DYNAMIC+0x11115b0>
+1000006c:	00000000 	andeq	r0, r0, r0
+10000070:	6e65704f 	cdpvs	0, 6, cr7, cr5, cr15, {2}
+10000074:	6c696620 	stclvs	6, cr6, [r9], #-128	; 0xffffff80
+10000078:	50203a65 	eorpl	r3, r0, r5, ror #20
+1000007c:	45535341 	ldrbmi	r5, [r3, #-833]	; 0x341
+10000080:	00000a44 	andeq	r0, r0, r4, asr #20
+10000084:	74697257 	strbtvc	r7, [r9], #-599	; 0x257
+10000088:	69662065 	stmdbvs	r6!, {r0, r2, r5, r6, sp}^
+1000008c:	203a656c 	eorscs	r6, sl, ip, ror #10
+10000090:	53534150 	cmppl	r3, #20
+10000094:	000a4445 	andeq	r4, sl, r5, asr #8
+10000098:	64616552 	strbtvs	r6, [r1], #-1362	; 0x552
+1000009c:	4150203a 	cmpmi	r0, sl, lsr r0
+100000a0:	44455353 	strbmi	r5, [r5], #-851	; 0x353
+100000a4:	0000000a 	andeq	r0, r0, sl
+100000a8:	736f6c63 	cmnvc	pc, #25344	; 0x6300
+100000ac:	50203a65 	eorpl	r3, r0, r5, ror #20
+100000b0:	45535341 	ldrbmi	r5, [r3, #-833]	; 0x341
+100000b4:	00000a44 	andeq	r0, r0, r4, asr #20
+100000b8:	6e65704f 	cdpvs	0, 6, cr7, cr5, cr15, {2}
+100000bc:	20666f20 	rsbcs	r6, r6, r0, lsr #30
+100000c0:	65206e61 	strvs	r6, [r0, #-3681]!	; 0xe61
+100000c4:	74736978 	ldrbtvc	r6, [r3], #-2424	; 0x978
+100000c8:	20676e69 	rsbcs	r6, r7, r9, ror #28
+100000cc:	656c6966 	strbvs	r6, [ip, #-2406]!	; 0x966
+100000d0:	4150203a 	cmpmi	r0, sl, lsr r0
+100000d4:	44455353 	strbmi	r5, [r5], #-851	; 0x353
+100000d8:	0000000a 	andeq	r0, r0, sl
+100000dc:	64616552 	strbtvs	r6, [r1], #-1362	; 0x552
+100000e0:	74616420 	strbtvc	r6, [r1], #-1056	; 0x420
+100000e4:	6f632061 	svcvs	0x00632061
+100000e8:	74636572 	strbtvc	r6, [r3], #-1394	; 0x572
+100000ec:	7373656e 	cmnvc	r3, #461373440	; 0x1b800000
+100000f0:	4150203a 	cmpmi	r0, sl, lsr r0
+100000f4:	44455353 	strbmi	r5, [r5], #-851	; 0x353
+100000f8:	0000000a 	andeq	r0, r0, sl
+100000fc:	736f6c63 	cmnvc	pc, #25344	; 0x6300
+10000100:	70203a65 	eorvc	r3, r0, r5, ror #20
+10000104:	65737361 	ldrbvs	r7, [r3, #-865]!	; 0x361
+10000108:	00000a64 	andeq	r0, r0, r4, ror #20