aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLedion Daja <ledion.daja@arm.com>2022-12-12 14:02:40 +0100
committerLedion Daja <ledion.daja@arm.com>2022-12-14 13:05:35 +0100
commit213f3ce922c8cdf6fc884d57a6769c7e0fbff26f (patch)
treebaa3ca36c7ab76a8513ff5763ea38aead654250c
parent3ca50e262dd2c22012d4fd3e3199a648183f2edb (diff)
downloadethos-u-core-platform-213f3ce922c8cdf6fc884d57a6769c7e0fbff26f.tar.gz
Add minimal implementation of syscalls in retarget file.
The nonsys specification of the newlib library, supplied with the Arm GNU toolchain provides stubbed version of several system calls, in order to allow linking with libc. Amongst such subroutines are _fstat, _getpid, _isatty ,_kill, _lseek, for which the GNU toolchain also generates a linker warning. Patch retargets these subroutines by adding a minimal implementation. Change-Id: I74db7ab77f49ce8c909eb24691b96d5e7b36692a
-rw-r--r--targets/corstone-300/retarget.c37
-rw-r--r--targets/corstone-310/retarget.c37
-rw-r--r--targets/demo/retarget.c37
3 files changed, 111 insertions, 0 deletions
diff --git a/targets/corstone-300/retarget.c b/targets/corstone-300/retarget.c
index 9d71da0..0ddf042 100644
--- a/targets/corstone-300/retarget.c
+++ b/targets/corstone-300/retarget.c
@@ -19,6 +19,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#if !defined(__ARMCC_VERSION)
+#include <sys/stat.h>
+#endif
#include <time.h>
#include "uart_stdout.h"
@@ -222,6 +225,40 @@ void RETARGET(_exit)(int return_code) {
while (1) {}
}
+#if !defined(__ARMCC_VERSION)
+int RETARGET(_fstat)(FILEHANDLE fh, struct stat *st) {
+ (void)fh;
+ (void)st;
+
+ return -1;
+}
+
+int RETARGET(_getpid)(void) {
+ return -1;
+}
+
+int RETARGET(_isatty)(FILEHANDLE fh) {
+ (void)fh;
+
+ return 0;
+}
+
+int RETARGET(_kill)(int pid, int sig) {
+ (void)pid;
+ (void)sig;
+
+ return -1;
+}
+
+int RETARGET(_lseek)(FILEHANDLE fh, int ptr, int dir) {
+ (void)fh;
+ (void)ptr;
+ (void)dir;
+
+ return -1;
+}
+#endif
+
int system(const char *cmd) {
(void)cmd;
diff --git a/targets/corstone-310/retarget.c b/targets/corstone-310/retarget.c
index 00772e2..760273d 100644
--- a/targets/corstone-310/retarget.c
+++ b/targets/corstone-310/retarget.c
@@ -19,6 +19,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#if !defined(__ARMCC_VERSION)
+#include <sys/stat.h>
+#endif
#include <time.h>
#include "uart_stdout.h"
@@ -222,6 +225,40 @@ void RETARGET(_exit)(int return_code) {
while (1) {}
}
+#if !defined(__ARMCC_VERSION)
+int RETARGET(_fstat)(FILEHANDLE fh, struct stat *st) {
+ (void)fh;
+ (void)st;
+
+ return -1;
+}
+
+int RETARGET(_getpid)(void) {
+ return -1;
+}
+
+int RETARGET(_isatty)(FILEHANDLE fh) {
+ (void)fh;
+
+ return 0;
+}
+
+int RETARGET(_kill)(int pid, int sig) {
+ (void)pid;
+ (void)sig;
+
+ return -1;
+}
+
+int RETARGET(_lseek)(FILEHANDLE fh, int ptr, int dir) {
+ (void)fh;
+ (void)ptr;
+ (void)dir;
+
+ return -1;
+}
+#endif
+
int system(const char *cmd) {
(void)cmd;
diff --git a/targets/demo/retarget.c b/targets/demo/retarget.c
index 7c53ba1..9ab40eb 100644
--- a/targets/demo/retarget.c
+++ b/targets/demo/retarget.c
@@ -19,6 +19,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#if !defined(__ARMCC_VERSION)
+#include <sys/stat.h>
+#endif
#include <time.h>
#include "uart_stdout.h"
@@ -222,6 +225,40 @@ void RETARGET(_exit)(int return_code) {
while (1) {}
}
+#if !defined(__ARMCC_VERSION)
+int RETARGET(_fstat)(FILEHANDLE fh, struct stat *st) {
+ (void)fh;
+ (void)st;
+
+ return -1;
+}
+
+int RETARGET(_getpid)(void) {
+ return -1;
+}
+
+int RETARGET(_isatty)(FILEHANDLE fh) {
+ (void)fh;
+
+ return 0;
+}
+
+int RETARGET(_kill)(int pid, int sig) {
+ (void)pid;
+ (void)sig;
+
+ return -1;
+}
+
+int RETARGET(_lseek)(FILEHANDLE fh, int ptr, int dir) {
+ (void)fh;
+ (void)ptr;
+ (void)dir;
+
+ return -1;
+}
+#endif
+
int system(const char *cmd) {
(void)cmd;