mbed library sources. Supersedes mbed-src.
Dependents: Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more
Diff: platform/mbed_retarget.cpp
- Revision:
- 189:f392fc9709a3
- Parent:
- 188:bcfe06ba3d64
diff -r bcfe06ba3d64 -r f392fc9709a3 platform/mbed_retarget.cpp --- a/platform/mbed_retarget.cpp Thu Nov 08 11:46:34 2018 +0000 +++ b/platform/mbed_retarget.cpp Wed Feb 20 22:31:08 2019 +0000 @@ -1,5 +1,6 @@ /* mbed Microcontroller Library * Copyright (c) 2006-2015 ARM Limited + * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -1250,6 +1251,8 @@ #if MBED_CONF_PLATFORM_STDIO_FLUSH_AT_EXIT fflush(stdout); fflush(stderr); + fsync(STDOUT_FILENO); + fsync(STDERR_FILENO); #endif #endif @@ -1345,38 +1348,6 @@ #endif } -int mbed_getc(std::FILE *_file) -{ -#if defined(__IAR_SYSTEMS_ICC__ ) && (__VER__ < 8000000) - /*This is only valid for unbuffered streams*/ - int res = std::fgetc(_file); - if (res >= 0) { - _file->_Mode = (unsigned short)(_file->_Mode & ~ 0x1000);/* Unset read mode */ - _file->_Rend = _file->_Wend; - _file->_Next = _file->_Wend; - } - return res; -#else - return std::fgetc(_file); -#endif -} - -char *mbed_gets(char *s, int size, std::FILE *_file) -{ -#if defined(__IAR_SYSTEMS_ICC__ ) && (__VER__ < 8000000) - /*This is only valid for unbuffered streams*/ - char *str = fgets(s, size, _file); - if (str != NULL) { - _file->_Mode = (unsigned short)(_file->_Mode & ~ 0x1000);/* Unset read mode */ - _file->_Rend = _file->_Wend; - _file->_Next = _file->_Wend; - } - return str; -#else - return std::fgets(s, size, _file); -#endif -} - } // namespace mbed #if defined (__ICCARM__) @@ -1469,7 +1440,7 @@ #endif -#if MBED_MEM_TRACING_ENABLED && (defined(__CC_ARM) || defined(__ICCARM__) || (defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050))) +#if defined(MBED_MEM_TRACING_ENABLED) && (defined(__CC_ARM) || defined(__ICCARM__) || (defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050))) // If the memory tracing is enabled, the wrappers in mbed_alloc_wrappers.cpp // provide the implementation for these. Note: this needs to use the wrappers @@ -1515,7 +1486,7 @@ free_wrapper(ptr, MBED_CALLER_ADDR()); } -#elif MBED_MEM_TRACING_ENABLED && defined(__GNUC__) +#elif defined(MBED_MEM_TRACING_ENABLED) && defined(__GNUC__) #include <reent.h>