Files
OpenCellular/chip/g/loader/main.c
Bill Richardson 92386dd91c Cr50: Tweak debug message for clarity
Until we update the naming for our various images in the
Makefiles, let's change the bootloader message slighty, so that
instead of seeing two "RO" images:

  CR50 RO, 20151104_41733@78962
  Valid image found at 0x00044000, jumping

  --- UART initialized after reboot ---
  [Reset cause: power-on]
  [Image: RO, cr50_v1.1.4008-957a842 2015-11-07 00:28:37 wfrichar@wintermute4.mtv.
  corp.google.com]
  [0.000897 Verifying RW image...]

we see the bootloader, and then what we've been calling the RO
image, and then the RW image:

  cr50 bootloader, 20151104_41733@78962
  Valid image found at 0x00044000, jumping

  --- UART initialized after reboot ---
  [Reset cause: power-on]
  [Image: RO, cr50_v1.1.4008-957a842 2015-11-07 00:28:37 wfrichar@wintermute4.mtv.
  corp.google.com]
  [0.000897 Verifying RW image...]

BUG=none
BRANCH=none
TEST=make buildall, try it

No new functionality, just a different message on the console.

Change-Id: Ia8dce600c7d159416dc6dabbbf0c0cc4129a988d
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/311831
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2015-11-10 22:40:05 +00:00

107 lines
2.0 KiB
C

/* Copyright 2015 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 "common.h"
#include "debug_printf.h"
#include "printf.h"
#include "registers.h"
#include "setup.h"
#include "system.h"
#include "trng.h"
#include "uart.h"
/*
* This file is a proof of concept stub which will be extended and split into
* appropriate pieces sortly, when full blown support for cr50 bootrom is
* introduced.
*/
uint32_t sleep_mask;
timestamp_t get_time(void)
{
timestamp_t ret;
ret.val = 0;
return ret;
}
static int panic_txchar(void *context, int c)
{
if (c == '\n')
panic_txchar(context, '\r');
/* Wait for space in transmit FIFO */
while (!uart_tx_ready())
;
/* Write the character directly to the transmit FIFO */
uart_write_char(c);
return 0;
}
void panic_puts(const char *outstr)
{
/* Put all characters in the output buffer */
while (*outstr)
panic_txchar(NULL, *outstr++);
}
void panic_printf(const char *format, ...)
{
va_list args;
va_start(args, format);
vfnprintf(panic_txchar, NULL, format, args);
va_end(args);
}
int main(void)
{
init_trng();
uart_init();
debug_printf("\n\n%s bootloader, %8u_%u@%u\n",
STRINGIFY(BOARD), GREG32(SWDP, BUILD_DATE),
GREG32(SWDP, BUILD_TIME), GREG32(SWDP, P4_LAST_SYNC));
unlockFlashForRW();
/* Trying RW A only for now */
tryLaunch(CONFIG_PROGRAM_MEMORY_BASE + CONFIG_RW_MEM_OFF,
CONFIG_FLASH_SIZE/2 - CONFIG_RW_MEM_OFF);
debug_printf("No valid image found, not sure what to do...\n");
halt();
return 1;
}
void panic_reboot(void)
{
panic_puts("\n\nRebooting...\n");
system_reset(0);
}
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);
}