Kenji Arai / mbed-os_TYBLE16

Dependents:   TYBLE16_simple_data_logger TYBLE16_MP3_Air

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers mbed_printf_armlink_overrides.c Source File

mbed_printf_armlink_overrides.c

00001 /* mbed Microcontroller Library
00002  * Copyright (c) 2019 ARM Limited
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00017 /**
00018  * Arm Compiler uses dedicated functions for each format specifier used by
00019  * [sn/v/vsn]printf. When minimal-printf overwrites [sn/v/vsn]printf the
00020  * linker is unable to remove unused functions related to printf.
00021  *
00022  * The following stubs replace the built-in functions and helps the linker
00023  * to resolve dependencies and correctly remove unused functions.
00024  */
00025 
00026 #ifdef MBED_MINIMAL_PRINTF
00027 
00028 #if defined(TOOLCHAIN_ARM)
00029 
00030 #include "mbed_printf_implementation.h"
00031 
00032 #include <limits.h>
00033 #include <stdio.h>
00034 #include <stdarg.h>
00035 
00036 /**
00037  * Arm Compiler uses __2[s/sn/vsn]printf internally.
00038  */
00039 int $Sub$$__2printf(const char *format, ...)
00040 {
00041     va_list arguments;
00042     va_start(arguments, format);
00043     int result = mbed_minimal_formatted_string(NULL, LONG_MAX, format, arguments, stdout);
00044     va_end(arguments);
00045 
00046     return result;
00047 }
00048 
00049 int $Sub$$__2sprintf(char *buffer, const char *format, ...)
00050 {
00051     va_list arguments;
00052     va_start(arguments, format);
00053     int result = mbed_minimal_formatted_string(buffer, LONG_MAX, format, arguments, NULL);
00054     va_end(arguments);
00055 
00056     return result;
00057 }
00058 
00059 int $Sub$$__2snprintf(char *buffer, size_t length, const char *format, ...)
00060 {
00061     va_list arguments;
00062     va_start(arguments, format);
00063     int result = mbed_minimal_formatted_string(buffer, length, format, arguments, NULL);
00064     va_end(arguments);
00065 
00066     return result;
00067 }
00068 
00069 int $Sub$$__2vprintf(char *buffer, const char *format, ...)
00070 {
00071     va_list arguments;
00072     va_start(arguments, format);
00073     int result = mbed_minimal_formatted_string(buffer, LONG_MAX, format, arguments, stdout);
00074     va_end(arguments);
00075 
00076     return result;
00077 }
00078 
00079 int $Sub$$__2vsnprintf(char *buffer, size_t length, const char *format, va_list arguments)
00080 {
00081     return mbed_minimal_formatted_string(buffer, length, format, arguments, NULL);
00082 }
00083 
00084 /**
00085  * Replace the built-in functions which the linker is unable to prune with dummy stubs
00086  * that take up less space.
00087  */
00088 int $Sub$$_printf_a(const char *format, ...)
00089 {
00090     return 0;
00091 }
00092 
00093 int $Sub$$_printf_c(const char *format, ...)
00094 {
00095     return 0;
00096 }
00097 
00098 int $Sub$$_printf_char(const char *format, ...)
00099 {
00100     return 0;
00101 }
00102 
00103 int $Sub$$_printf_char_common(const char *format, ...)
00104 {
00105     return 0;
00106 }
00107 
00108 int $Sub$$_printf_char_file_locked(const char *format, ...)
00109 {
00110     return 0;
00111 }
00112 
00113 int $Sub$$_printf_charcount(const char *format, ...)
00114 {
00115     return 0;
00116 }
00117 
00118 int $Sub$$_printf_cs_common(const char *format, ...)
00119 {
00120     return 0;
00121 }
00122 
00123 int $Sub$$_printf_d(const char *format, ...)
00124 {
00125     return 0;
00126 }
00127 
00128 int $Sub$$_printf_dec(const char *format, ...)
00129 {
00130     return 0;
00131 }
00132 
00133 int $Sub$$_printf_e(const char *format, ...)
00134 {
00135     return 0;
00136 }
00137 
00138 int $Sub$$_printf_f(const char *format, ...)
00139 {
00140     return 0;
00141 }
00142 
00143 int $Sub$$_printf_fp_dec(const char *format, ...)
00144 {
00145     return 0;
00146 }
00147 
00148 int $Sub$$_printf_fp_dec_real(const char *format, ...)
00149 {
00150     return 0;
00151 }
00152 
00153 int $Sub$$_printf_fp_hex(const char *format, ...)
00154 {
00155     return 0;
00156 }
00157 
00158 int $Sub$$_printf_fp_hex_real(const char *format, ...)
00159 {
00160     return 0;
00161 }
00162 
00163 int $Sub$$_printf_fp_infnan(const char *format, ...)
00164 {
00165     return 0;
00166 }
00167 
00168 int $Sub$$_printf_g(const char *format, ...)
00169 {
00170     return 0;
00171 }
00172 
00173 int $Sub$$_printf_hex_int_ll_ptr(const char *format, ...)
00174 {
00175     return 0;
00176 }
00177 
00178 int $Sub$$_printf_hex_ptr(const char *format, ...)
00179 {
00180     return 0;
00181 }
00182 
00183 int $Sub$$_printf_i(const char *format, ...)
00184 {
00185     return 0;
00186 }
00187 
00188 int $Sub$$_printf_int_common(const char *format, ...)
00189 {
00190     return 0;
00191 }
00192 
00193 int $Sub$$_printf_int_dec(const char *format, ...)
00194 {
00195     return 0;
00196 }
00197 
00198 int $Sub$$_printf_int_hex(const char *format, ...)
00199 {
00200     return 0;
00201 }
00202 
00203 int $Sub$$_printf_int_oct(const char *format, ...)
00204 {
00205     return 0;
00206 }
00207 
00208 int $Sub$$_printf_l(const char *format, ...)
00209 {
00210     return 0;
00211 }
00212 
00213 int $Sub$$_printf_lc(const char *format, ...)
00214 {
00215     return 0;
00216 }
00217 
00218 int $Sub$$_printf_lcs_common(const char *format, ...)
00219 {
00220     return 0;
00221 }
00222 
00223 int $Sub$$_printf_ll(const char *format, ...)
00224 {
00225     return 0;
00226 }
00227 
00228 int $Sub$$_printf_ll_hex(const char *format, ...)
00229 {
00230     return 0;
00231 }
00232 
00233 int $Sub$$_printf_ll_oct(const char *format, ...)
00234 {
00235     return 0;
00236 }
00237 
00238 int $Sub$$_printf_lld(const char *format, ...)
00239 {
00240     return 0;
00241 }
00242 
00243 int $Sub$$_printf_lli(const char *format, ...)
00244 {
00245     return 0;
00246 }
00247 
00248 int $Sub$$_printf_llo(const char *format, ...)
00249 {
00250     return 0;
00251 }
00252 
00253 int $Sub$$_printf_llu(const char *format, ...)
00254 {
00255     return 0;
00256 }
00257 
00258 int $Sub$$_printf_llx(const char *format, ...)
00259 {
00260     return 0;
00261 }
00262 
00263 int $Sub$$_printf_longlong_dec(const char *format, ...)
00264 {
00265     return 0;
00266 }
00267 
00268 int $Sub$$_printf_longlong_hex(const char *format, ...)
00269 {
00270     return 0;
00271 }
00272 
00273 int $Sub$$_printf_longlong_oct(const char *format, ...)
00274 {
00275     return 0;
00276 }
00277 
00278 int $Sub$$_printf_ls(const char *format, ...)
00279 {
00280     return 0;
00281 }
00282 
00283 int $Sub$$_printf_n(const char *format, ...)
00284 {
00285     return 0;
00286 }
00287 
00288 int $Sub$$_printf_o(const char *format, ...)
00289 {
00290     return 0;
00291 }
00292 
00293 int $Sub$$_printf_oct_int_ll(const char *format, ...)
00294 {
00295     return 0;
00296 }
00297 
00298 int $Sub$$_printf_p(const char *format, ...)
00299 {
00300     return 0;
00301 }
00302 
00303 int $Sub$$_printf_pad(const char *format, ...)
00304 {
00305     return 0;
00306 }
00307 
00308 int $Sub$$_printf_percent(const char *format, ...)
00309 {
00310     return 0;
00311 }
00312 
00313 int $Sub$$_printf_percent_end(const char *format, ...)
00314 {
00315     return 0;
00316 }
00317 
00318 int $Sub$$_printf_s(const char *format, ...)
00319 {
00320     return 0;
00321 }
00322 
00323 int $Sub$$_printf_str(const char *format, ...)
00324 {
00325     return 0;
00326 }
00327 
00328 int $Sub$$_printf_string(const char *format, ...)
00329 {
00330     return 0;
00331 }
00332 
00333 int $Sub$$_printf_truncate(const char *format, ...)
00334 {
00335     return 0;
00336 }
00337 
00338 int $Sub$$_printf_truncate_signed(const char *format, ...)
00339 {
00340     return 0;
00341 }
00342 
00343 int $Sub$$_printf_truncate_unsigned(const char *format, ...)
00344 {
00345     return 0;
00346 }
00347 
00348 int $Sub$$_printf_u(const char *format, ...)
00349 {
00350     return 0;
00351 }
00352 
00353 int $Sub$$_printf_wchar(const char *format, ...)
00354 {
00355     return 0;
00356 }
00357 
00358 int $Sub$$_printf_wctomb(const char *format, ...)
00359 {
00360     return 0;
00361 }
00362 
00363 int $Sub$$_printf_wstring(const char *format, ...)
00364 {
00365     return 0;
00366 }
00367 
00368 int $Sub$$_printf_x(const char *format, ...)
00369 {
00370     return 0;
00371 }
00372 
00373 #endif
00374 
00375 #endif // MBED_MINIMAL_PRINTF