From 5020b9ad3b2d0b1268afc42faaa2ff3908ac6cc0 Mon Sep 17 00:00:00 2001 From: Emilio Monti Date: Mon, 8 Jul 2013 17:31:04 +0100 Subject: [PATCH] Stop using the patched microlib --- libraries/mbed/common/stdio.cpp | 10 +++++++++- workspace_tools/toolchains/arm.py | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/libraries/mbed/common/stdio.cpp b/libraries/mbed/common/stdio.cpp index e588ce60ef..116dff5130 100644 --- a/libraries/mbed/common/stdio.cpp +++ b/libraries/mbed/common/stdio.cpp @@ -120,6 +120,13 @@ static inline int openmode_to_posix(int openmode) { } extern "C" FILEHANDLE PREFIX(_open)(const char* name, int openmode) { + #if defined(__MICROLIB) && (__ARMCC_VERSION>5030000) + // Before version 5.03, we were using a patched version of microlib with proper names + // This is the workaround that the microlib author suggested us + static int n = 0; + if (!std::strcmp(name, ":tt")) return n++; + + #else /* Use the posix convention that stdin,out,err are filehandles 0,1,2. */ if (std::strcmp(name, __stdin_name) == 0) { @@ -132,7 +139,8 @@ extern "C" FILEHANDLE PREFIX(_open)(const char* name, int openmode) { init_serial(); return 2; } - + #endif + // find the first empty slot in filehandles unsigned int fh_i; for (fh_i = 0; fh_i < sizeof(filehandles)/sizeof(*filehandles); fh_i++) { diff --git a/workspace_tools/toolchains/arm.py b/workspace_tools/toolchains/arm.py index 6d80d7d025..55cde033a7 100644 --- a/workspace_tools/toolchains/arm.py +++ b/workspace_tools/toolchains/arm.py @@ -98,7 +98,7 @@ class ARM_STD(ARM): class ARM_MICRO(ARM): - PATCHED_LIBRARY = True + PATCHED_LIBRARY = False def __init__(self, target, options=None, notify=None): ARM.__init__(self, target, notify)