mirror of
https://github.com/u-boot/u-boot.git
synced 2025-05-09 03:21:51 +00:00
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:
parent
7f9875e733
commit
66312374dc
4 changed files with 47 additions and 9 deletions
|
@ -39,9 +39,32 @@ int strict_strtoul(const char *cp, unsigned int base, unsigned long *res);
|
|||
unsigned long long simple_strtoull(const char *cp, char **endp,
|
||||
unsigned int base);
|
||||
long simple_strtol(const char *cp, char **endp, unsigned int base);
|
||||
|
||||
/**
|
||||
* panic() - Print a message and reset/hang
|
||||
*
|
||||
* Prints a message on the console(s) and then resets. If CONFIG_PANIC_HANG is
|
||||
* defined, then it will hang instead of reseting.
|
||||
*
|
||||
* @param fmt: printf() format string for message, which should not include
|
||||
* \n, followed by arguments
|
||||
*/
|
||||
void panic(const char *fmt, ...)
|
||||
__attribute__ ((format (__printf__, 1, 2), noreturn));
|
||||
|
||||
/**
|
||||
* panic_str() - Print a message and reset/hang
|
||||
*
|
||||
* Prints a message on the console(s) and then resets. If CONFIG_PANIC_HANG is
|
||||
* defined, then it will hang instead of reseting.
|
||||
*
|
||||
* This function can be used instead of panic() when your board does not
|
||||
* already use printf(), * to keep code size small.
|
||||
*
|
||||
* @param fmt: string to display, which should not include \n
|
||||
*/
|
||||
void panic_str(const char *str) __attribute__ ((noreturn));
|
||||
|
||||
/**
|
||||
* Format a string and place it in a buffer
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue