The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

mbed 2

This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.

Revision:
170:e95d10626187
Parent:
158:1c57384330a6
Child:
172:65be27845400
--- a/platform/mbed_semihost_api.h	Fri Jun 22 15:38:59 2018 +0100
+++ b/platform/mbed_semihost_api.h	Thu Sep 06 13:39:34 2018 +0100
@@ -29,8 +29,9 @@
 #if !defined(__CC_ARM) && !defined(__ARMCC_VERSION)
 
 #if defined(__ICCARM__)
-static inline int __semihost(int reason, const void *arg) {
-    return __semihosting(reason, (void*)arg);
+static inline int __semihost(int reason, const void *arg)
+{
+    return __semihosting(reason, (void *)arg);
 }
 #else
 
@@ -44,17 +45,18 @@
 #   define AngelSWIAsm          swi
 #endif
 
-static inline int __semihost(int reason, const void *arg) {
+static inline int __semihost(int reason, const void *arg)
+{
     int value;
 
-    asm volatile (
-       "mov r0, %1"          "\n\t"
-       "mov r1, %2"          "\n\t"
-       AngelSWIInsn " %a3"   "\n\t"
-       "mov %0, r0"
-       : "=r" (value)                                         /* output operands             */
-       : "r" (reason), "r" (arg), "i" (AngelSWI)              /* input operands              */
-       : "r0", "r1", "r2", "r3", "ip", "lr", "memory", "cc"   /* list of clobbered registers */
+    asm volatile(
+        "mov r0, %1"          "\n\t"
+        "mov r1, %2"          "\n\t"
+        AngelSWIInsn " %a3"   "\n\t"
+        "mov %0, r0"
+        : "=r"(value)                                          /* output operands             */
+        : "r"(reason), "r"(arg), "i"(AngelSWI)                 /* input operands              */
+        : "r0", "r1", "r2", "r3", "ip", "lr", "memory", "cc"   /* list of clobbered registers */
     );
 
     return value;
@@ -63,14 +65,14 @@
 #endif
 
 #if DEVICE_LOCALFILESYSTEM
-FILEHANDLE semihost_open(const char* name, int openmode);
-int semihost_close (FILEHANDLE fh);
-int semihost_read  (FILEHANDLE fh, unsigned char* buffer, unsigned int length, int mode);
-int semihost_write (FILEHANDLE fh, const unsigned char* buffer, unsigned int length, int mode);
+FILEHANDLE semihost_open(const char *name, int openmode);
+int semihost_close(FILEHANDLE fh);
+int semihost_read(FILEHANDLE fh, unsigned char *buffer, unsigned int length, int mode);
+int semihost_write(FILEHANDLE fh, const unsigned char *buffer, unsigned int length, int mode);
 int semihost_ensure(FILEHANDLE fh);
-long semihost_flen (FILEHANDLE fh);
-int semihost_seek  (FILEHANDLE fh, long position);
-int semihost_istty (FILEHANDLE fh);
+long semihost_flen(FILEHANDLE fh);
+int semihost_seek(FILEHANDLE fh, long position);
+int semihost_istty(FILEHANDLE fh);
 
 int semihost_remove(const char *name);
 int semihost_rename(const char *old_name, const char *new_name);