mirror of https://github.com/ARMmbed/mbed-os.git
parent
5480969d14
commit
8701e0f4c4
File diff suppressed because it is too large
Load Diff
|
@ -1,21 +1,21 @@
|
||||||
{
|
{
|
||||||
"name": "minimal-printf",
|
"name": "minimal-printf",
|
||||||
"config": {
|
"config": {
|
||||||
"enable-floating-point": {
|
"enable-floating-point": {
|
||||||
"help": "Enable floating point printing",
|
"help": "Enable floating point printing",
|
||||||
"value": false
|
"value": false
|
||||||
},
|
},
|
||||||
"set-floating-point-max-decimals": {
|
"set-floating-point-max-decimals": {
|
||||||
"help": "Maximum number of decimals to be printed",
|
"help": "Maximum number of decimals to be printed",
|
||||||
"value": 6
|
"value": 6
|
||||||
},
|
},
|
||||||
"enable-64-bit": {
|
"enable-64-bit": {
|
||||||
"help": "Enable printing 64 bit integers",
|
"help": "Enable printing 64 bit integers",
|
||||||
"value": true
|
"value": true
|
||||||
},
|
},
|
||||||
"console-output": {
|
"console-output": {
|
||||||
"help": "Console output. Options: UART, SWO",
|
"help": "Console output. Options: UART, SWO",
|
||||||
"value": "UART"
|
"value": "UART"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,59 +1,59 @@
|
||||||
/* mbed Microcontroller Library
|
/* mbed Microcontroller Library
|
||||||
* Copyright (c) 2016 ARM Limited
|
* Copyright (c) 2016 ARM Limited
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef MBED_PRINTF_H
|
#ifndef MBED_PRINTF_H
|
||||||
#define MBED_PRINTF_H
|
#define MBED_PRINTF_H
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Minimal printf
|
* Minimal printf
|
||||||
*
|
*
|
||||||
* Prints directly to stdio/UART without using malloc.
|
* Prints directly to stdio/UART without using malloc.
|
||||||
*/
|
*/
|
||||||
int mbed_printf(const char *format, ...);
|
int mbed_printf(const char *format, ...);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Minimal snprintf
|
* Minimal snprintf
|
||||||
*
|
*
|
||||||
* Prints directly to buffer without using malloc.
|
* Prints directly to buffer without using malloc.
|
||||||
*/
|
*/
|
||||||
int mbed_snprintf(char* buffer, size_t length, const char* format, ...);
|
int mbed_snprintf(char* buffer, size_t length, const char* format, ...);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Minimal printf
|
* Minimal printf
|
||||||
*
|
*
|
||||||
* Prints directly to stdio/UART without using malloc.
|
* Prints directly to stdio/UART without using malloc.
|
||||||
*/
|
*/
|
||||||
int mbed_vprintf(const char* format, va_list arguments);
|
int mbed_vprintf(const char* format, va_list arguments);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Minimal snprintf
|
* Minimal snprintf
|
||||||
*
|
*
|
||||||
* Prints directly to buffer without using malloc.
|
* Prints directly to buffer without using malloc.
|
||||||
*/
|
*/
|
||||||
int mbed_vsnprintf(char* buffer, size_t length, const char* format, va_list arguments);
|
int mbed_vsnprintf(char* buffer, size_t length, const char* format, va_list arguments);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // MBED_PRINTF_H
|
#endif // MBED_PRINTF_H
|
||||||
|
|
|
@ -1,20 +1,20 @@
|
||||||
/* mbed Microcontroller Library
|
/* mbed Microcontroller Library
|
||||||
* Copyright (c) 2017 ARM Limited
|
* Copyright (c) 2017 ARM Limited
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
int mbed_minimal_formatted_string(char* buffer, size_t length, const char* format, va_list arguments);
|
int mbed_minimal_formatted_string(char* buffer, size_t length, const char* format, va_list arguments);
|
||||||
|
|
|
@ -1,79 +1,79 @@
|
||||||
/* mbed Microcontroller Library
|
/* mbed Microcontroller Library
|
||||||
* Copyright (c) 2017 ARM Limited
|
* Copyright (c) 2017 ARM Limited
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "mbed_printf_implementation.h"
|
#include "mbed_printf_implementation.h"
|
||||||
|
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
#if defined(TOOLCHAIN_GCC)
|
#if defined(TOOLCHAIN_GCC)
|
||||||
#define SUB_PRINTF __wrap_printf
|
#define SUB_PRINTF __wrap_printf
|
||||||
#define SUB_SNPRINTF __wrap_snprintf
|
#define SUB_SNPRINTF __wrap_snprintf
|
||||||
#define SUB_SPRINTF __wrap_sprintf
|
#define SUB_SPRINTF __wrap_sprintf
|
||||||
#define SUB_VSNPRINTF __wrap_vsnprintf
|
#define SUB_VSNPRINTF __wrap_vsnprintf
|
||||||
#elif defined(TOOLCHAIN_ARM)
|
#elif defined(TOOLCHAIN_ARM)
|
||||||
#define SUPER_PRINTF $Super$$printf
|
#define SUPER_PRINTF $Super$$printf
|
||||||
#define SUB_PRINTF $Sub$$printf
|
#define SUB_PRINTF $Sub$$printf
|
||||||
#define SUPER_SNPRINTF $Super$$snprintf
|
#define SUPER_SNPRINTF $Super$$snprintf
|
||||||
#define SUB_SNPRINTF $Sub$$snprintf
|
#define SUB_SNPRINTF $Sub$$snprintf
|
||||||
#define SUPER_SPRINTF $Super$$sprintf
|
#define SUPER_SPRINTF $Super$$sprintf
|
||||||
#define SUB_SPRINTF $Sub$$sprintf
|
#define SUB_SPRINTF $Sub$$sprintf
|
||||||
#define SUPER_VSNPRINTF $Super$$vsnprintf
|
#define SUPER_VSNPRINTF $Super$$vsnprintf
|
||||||
#define SUB_VSNPRINTF $Sub$$vsnprintf
|
#define SUB_VSNPRINTF $Sub$$vsnprintf
|
||||||
#elif defined(__ICCARM__)
|
#elif defined(__ICCARM__)
|
||||||
#define SUPER_PRINTF $Super$$__iar_printf
|
#define SUPER_PRINTF $Super$$__iar_printf
|
||||||
#define SUB_PRINTF $Sub$$__iar_printf
|
#define SUB_PRINTF $Sub$$__iar_printf
|
||||||
#define SUPER_SNPRINTF $Super$$__iar_snprintf
|
#define SUPER_SNPRINTF $Super$$__iar_snprintf
|
||||||
#define SUB_SNPRINTF $Sub$$__iar_snprintf
|
#define SUB_SNPRINTF $Sub$$__iar_snprintf
|
||||||
#define SUPER_SPRINTF $Super$$__iar_sprintf
|
#define SUPER_SPRINTF $Super$$__iar_sprintf
|
||||||
#define SUB_SPRINTF $Sub$$__iar_sprintf
|
#define SUB_SPRINTF $Sub$$__iar_sprintf
|
||||||
#define SUPER_VSNPRINTF $Super$$__iar_vsnprintf
|
#define SUPER_VSNPRINTF $Super$$__iar_vsnprintf
|
||||||
#define SUB_VSNPRINTF $Sub$$__iar_vsnprintf
|
#define SUB_VSNPRINTF $Sub$$__iar_vsnprintf
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int SUB_PRINTF(const char *format, ...)
|
int SUB_PRINTF(const char *format, ...)
|
||||||
{
|
{
|
||||||
va_list arguments;
|
va_list arguments;
|
||||||
va_start(arguments, format);
|
va_start(arguments, format);
|
||||||
int result = mbed_minimal_formatted_string(NULL, LONG_MAX, format, arguments);
|
int result = mbed_minimal_formatted_string(NULL, LONG_MAX, format, arguments);
|
||||||
va_end(arguments);
|
va_end(arguments);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SUB_SNPRINTF(char* buffer, size_t length, const char* format, ...)
|
int SUB_SNPRINTF(char* buffer, size_t length, const char* format, ...)
|
||||||
{
|
{
|
||||||
va_list arguments;
|
va_list arguments;
|
||||||
va_start(arguments, format);
|
va_start(arguments, format);
|
||||||
int result = mbed_minimal_formatted_string(buffer, length, format, arguments);
|
int result = mbed_minimal_formatted_string(buffer, length, format, arguments);
|
||||||
va_end(arguments);
|
va_end(arguments);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SUB_SPRINTF(char* buffer, const char* format, ...)
|
int SUB_SPRINTF(char* buffer, const char* format, ...)
|
||||||
{
|
{
|
||||||
va_list arguments;
|
va_list arguments;
|
||||||
va_start(arguments, format);
|
va_start(arguments, format);
|
||||||
int result = mbed_minimal_formatted_string(buffer, LONG_MAX, format, arguments);
|
int result = mbed_minimal_formatted_string(buffer, LONG_MAX, format, arguments);
|
||||||
va_end(arguments);
|
va_end(arguments);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SUB_VSNPRINTF(char* buffer, size_t length, const char* format, va_list arguments)
|
int SUB_VSNPRINTF(char* buffer, size_t length, const char* format, va_list arguments)
|
||||||
{
|
{
|
||||||
return mbed_minimal_formatted_string(buffer, length, format, arguments);
|
return mbed_minimal_formatted_string(buffer, length, format, arguments);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue