diff options
-rw-r--r-- | chip/g/build.mk | 1 | ||||
-rw-r--r-- | chip/g/loader/debug_printf.c | 28 | ||||
-rw-r--r-- | chip/g/loader/main.c | 18 |
3 files changed, 29 insertions, 18 deletions
diff --git a/chip/g/build.mk b/chip/g/build.mk index 12c3c9079d..d7e7b02cc3 100644 --- a/chip/g/build.mk +++ b/chip/g/build.mk @@ -78,6 +78,7 @@ ifneq ($(CONFIG_CUSTOMIZED_RO),) custom-ro_objs-y = chip/g/clock.o custom-ro_objs-y += chip/g/dcrypto/sha256.o custom-ro_objs-y += chip/g/loader/key_ladder.o +custom-ro_objs-y += chip/g/loader/debug_printf.o custom-ro_objs-y += chip/g/loader/launch.o custom-ro_objs-y += chip/g/loader/main.o custom-ro_objs-y += chip/g/loader/rom_flash.o diff --git a/chip/g/loader/debug_printf.c b/chip/g/loader/debug_printf.c new file mode 100644 index 0000000000..4d7e67b7ec --- /dev/null +++ b/chip/g/loader/debug_printf.c @@ -0,0 +1,28 @@ +/* Copyright 2016 The Chromium OS Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ +#include "debug_printf.h" + +#include "printf.h" +#include "uart.h" + +#include "stddef.h" + +static int printchar(void *context, int c) +{ + if (c == '\n') + uart_write_char('\r'); + uart_write_char(c); + + return 0; +} + +void debug_printf(const char *format, ...) +{ + va_list args; + + va_start(args, format); + vfnprintf(printchar, NULL, format, args); + va_end(args); +} diff --git a/chip/g/loader/main.c b/chip/g/loader/main.c index 985aa34a19..7381e52471 100644 --- a/chip/g/loader/main.c +++ b/chip/g/loader/main.c @@ -131,21 +131,3 @@ void interrupt_disable(void) { asm("cpsid i"); } - -static int printchar(void *context, int c) -{ - if (c == '\n') - uart_write_char('\r'); - uart_write_char(c); - - return 0; -} - -void debug_printf(const char *format, ...) -{ - va_list args; - - va_start(args, format); - vfnprintf(printchar, NULL, format, args); - va_end(args); -} |