mbed library sources. Supersedes mbed-src.

Dependents:   BREAK_SENSOR_LED

Fork of mbed-dev by mbed official

Revision:
174:b96e65c34a4d
Parent:
172:7d866c31b3c5
Child:
175:af195413fb11
diff -r e131a1973e81 -r b96e65c34a4d platform/mbed_retarget.cpp
--- a/platform/mbed_retarget.cpp	Fri Sep 15 14:59:18 2017 +0100
+++ b/platform/mbed_retarget.cpp	Mon Oct 02 15:33:19 2017 +0100
@@ -34,7 +34,12 @@
 #include "platform/mbed_retarget.h"
 
 #if defined(__ARMCC_VERSION)
+#   if __ARMCC_VERSION >= 6010050
+#      include <arm_compat.h>
+#   endif
 #   include <rt_sys.h>
+#   include <rt_misc.h>
+#   include <stdint.h>
 #   define PREFIX(x)    _sys##x
 #   define OPEN_MAX     _SYS_OPEN
 #   ifdef __MICROLIB
@@ -334,6 +339,16 @@
 #endif
 }
 
+#if defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
+extern "C" void PREFIX(_exit)(int return_code) {
+    while(1) {}
+}
+
+extern "C" void _ttywrch(int ch) {
+    serial_putc(&stdio_uart, ch);
+}
+#endif
+
 #if defined(__ICCARM__)
 extern "C" size_t    __read (int        fh, unsigned char *buffer, size_t       length) {
 #else
@@ -497,6 +512,26 @@
     }
     return size;
 }
+
+extern "C" char Image$$RW_IRAM1$$ZI$$Limit[];
+
+extern "C" MBED_WEAK __value_in_regs struct __initial_stackheap _mbed_user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3)
+{
+    uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit;
+    uint32_t sp_limit = __current_sp();
+
+    zi_limit = (zi_limit + 7) & ~0x7;    // ensure zi_limit is 8-byte aligned
+
+    struct __initial_stackheap r;
+    r.heap_base = zi_limit;
+    r.heap_limit = sp_limit;
+    return r;
+}
+
+extern "C" __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) {
+    return _mbed_user_setup_stackheap(R0, R1, R2, R3);
+}
+
 #endif
 
 
@@ -843,7 +878,7 @@
 }
 
 int mbed_getc(std::FILE *_file){
-#if defined (__ICCARM__)
+#if defined(__IAR_SYSTEMS_ICC__ ) && (__VER__ < 8000000)
     /*This is only valid for unbuffered streams*/
     int res = std::fgetc(_file);
     if (res>=0){
@@ -858,7 +893,7 @@
 }
 
 char* mbed_gets(char*s, int size, std::FILE *_file){
-#if defined (__ICCARM__)
+#if defined(__IAR_SYSTEMS_ICC__ ) && (__VER__ < 8000000)
     /*This is only valid for unbuffered streams*/
     char *str = fgets(s,size,_file);
     if (str!=NULL){
@@ -884,6 +919,9 @@
 extern "C" WEAK void __iar_file_Mtxdst(__iar_Rmtx *mutex) {}
 extern "C" WEAK void __iar_file_Mtxlock(__iar_Rmtx *mutex) {}
 extern "C" WEAK void __iar_file_Mtxunlock(__iar_Rmtx *mutex) {}
+#if defined(__IAR_SYSTEMS_ICC__ ) && (__VER__ >= 8000000)
+extern "C" WEAK void *__aeabi_read_tp (void) { return NULL ;}
+#endif
 #elif defined(__CC_ARM)
 // Do nothing
 #elif defined (__GNUC__)