mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-05-08 18:41:22 +00:00
Create a library file for libc
TF Makefile was linking all the objects files generated for the c library instead of creating a static library that could be used in the linking stage. Change-Id: I721daea097e9b13cbb42c9f8eaa2af8fea0799cf Signed-off-by: Roberto Vargas <roberto.vargas@arm.com>
This commit is contained in:
parent
fec3648478
commit
61f72a3425
46 changed files with 10 additions and 10 deletions
36
lib/libc/printf.c
Normal file
36
lib/libc/printf.c
Normal file
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* Copyright (c) 2013-2014, ARM Limited and Contributors. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
/* Choose max of 128 chars for now. */
|
||||
#define PRINT_BUFFER_SIZE 128
|
||||
int printf(const char *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
char buf[PRINT_BUFFER_SIZE];
|
||||
int count;
|
||||
|
||||
va_start(args, fmt);
|
||||
vsnprintf(buf, sizeof(buf) - 1, fmt, args);
|
||||
va_end(args);
|
||||
|
||||
/* Use putchar directly as 'puts()' adds a newline. */
|
||||
buf[PRINT_BUFFER_SIZE - 1] = '\0';
|
||||
count = 0;
|
||||
while (buf[count])
|
||||
{
|
||||
if (putchar(buf[count]) != EOF) {
|
||||
count++;
|
||||
} else {
|
||||
count = EOF;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue