summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2015-02-27 22:06:32 -0700
committerSimon Glass <sjg@chromium.org>2015-04-23 09:05:52 -0600
commit66312374dca86e77fc9b08f774546e62b6cd1aa7 (patch)
tree2a26f0695511a13329ca8469fcadfcf417003f79 /include
parent7f9875e733b79556ade508b88f88ac1f8a2c7e3c (diff)
downloadu-boot-imx-66312374dca86e77fc9b08f774546e62b6cd1aa7.zip
u-boot-imx-66312374dca86e77fc9b08f774546e62b6cd1aa7.tar.gz
u-boot-imx-66312374dca86e77fc9b08f774546e62b6cd1aa7.tar.bz2
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>
Diffstat (limited to 'include')
-rw-r--r--include/vsprintf.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/include/vsprintf.h b/include/vsprintf.h
index 5624482..09c8abd 100644
--- a/include/vsprintf.h
+++ b/include/vsprintf.h
@@ -39,10 +39,33 @@ 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
*
* @param buf The buffer to place the result into