mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-10 17:41:54 +00:00
Using minimal runtime to fit the charger flash and RAM size. It is currently more an experiment than the final layout written in the stone. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=none TEST=run on STM32F051 Discovery with limited RAM and Flash to mimic STM32F031. Change-Id: I10ee1decfd1f1448edbc909f0e997367921c4b53 Reviewed-on: https://chromium-review.googlesource.com/189405 Reviewed-by: Vic Yang <victoryang@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org>
42 lines
780 B
C
42 lines
780 B
C
/* Copyright (c) 2014 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.
|
|
*/
|
|
/* Synchronous UART debug printf */
|
|
|
|
#include "common.h"
|
|
#include "printf.h"
|
|
#include "registers.h"
|
|
#include "util.h"
|
|
|
|
static int debug_txchar(void *context, int c)
|
|
{
|
|
if (c == '\n') {
|
|
while (!(STM32_USART_SR(UARTN) & STM32_USART_SR_TXE))
|
|
;
|
|
STM32_USART_TDR(UARTN) = '\r';
|
|
}
|
|
|
|
/* Wait for space to transmit */
|
|
while (!(STM32_USART_SR(UARTN) & STM32_USART_SR_TXE))
|
|
;
|
|
STM32_USART_TDR(UARTN) = c;
|
|
|
|
return 0;
|
|
}
|
|
|
|
|
|
|
|
void debug_printf(const char *format, ...)
|
|
{
|
|
va_list args;
|
|
|
|
va_start(args, format);
|
|
vfnprintf(debug_txchar, NULL, format, args);
|
|
va_end(args);
|
|
}
|
|
|
|
void panic(const char *msg)
|
|
{
|
|
}
|