Merge branch 'master' of git://www.denx.de/git/u-boot-imx
[platform/kernel/u-boot.git] / lib / tiny-printf.c
index 3c65fc9..1aa43ab 100644 (file)
 #include <stdarg.h>
 #include <serial.h>
 
-static char *bf;
-static char zs;
+/*
+ * This code in here may execute before the DRAM is initialised, so
+ * we should make sure that it doesn't touch BSS, which some boards
+ * put in DRAM.
+ */
+static char *bf __attribute__ ((section(".data")));
+static char zs __attribute__ ((section(".data")));
 
 /* Current position in sprintf() output string */
-static char *outstr;
+static char *outstr __attribute__ ((section(".data")));
 
 static void out(char c)
 {
@@ -130,6 +135,11 @@ abort:
        return 0;
 }
 
+int vprintf(const char *fmt, va_list va)
+{
+       return _vprintf(fmt, va, putc);
+}
+
 int printf(const char *fmt, ...)
 {
        va_list va;
@@ -175,3 +185,12 @@ int snprintf(char *buf, size_t size, const char *fmt, ...)
 
        return ret;
 }
+
+void __assert_fail(const char *assertion, const char *file, unsigned line,
+                  const char *function)
+{
+       /* This will not return */
+       printf("%s:%u: %s: Assertion `%s' failed.", file, line, function,
+              assertion);
+       hang();
+}