dm: Add a panic_str() function to reduce code size

The printf() in panic() adds about 1.5KB of code size to SPL when compiled
with Thumb-2. Provide a smaller version that does not support printf()-style
arguments and use it in two commonly compiled places.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass 2015-02-27 22:06:32 -07:00
parent 7f9875e733
commit 66312374dc
4 changed files with 47 additions and 9 deletions

View file

@ -842,13 +842,11 @@ int sprintf(char *buf, const char *fmt, ...)
return i;
}
void panic(const char *fmt, ...)
static void panic_finish(void) __attribute__ ((noreturn));
static void panic_finish(void)
{
va_list args;
va_start(args, fmt);
vprintf(fmt, args);
putc('\n');
va_end(args);
#if defined(CONFIG_PANIC_HANG)
hang();
#else
@ -859,6 +857,21 @@ void panic(const char *fmt, ...)
;
}
void panic_str(const char *str)
{
puts(str);
panic_finish();
}
void panic(const char *fmt, ...)
{
va_list args;
va_start(args, fmt);
vprintf(fmt, args);
va_end(args);
panic_finish();
}
void __assert_fail(const char *assertion, const char *file, unsigned line,
const char *function)
{