aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAndre Przywara <andre.przywara@arm.com>2016-07-19 11:56:00 +0530
committerLokesh Vutla <lokeshvutla@ti.com>2016-07-21 13:47:19 +0530
commit22143099db51b504a0993627ea0a3eccf564df39 (patch)
tree553443e62e075b56005650e172d4e2319042a6b6 /lib
parentf9211f2b177ba5d1057403961141314afe083a3d (diff)
downloadjacinto6evm-22143099db51b504a0993627ea0a3eccf564df39.tar.gz
SPL: tiny-printf: avoid any BSS usage
As printf calls may be executed quite early, we should avoid using any BSS stored variables, since some boards put BSS in DRAM, which may not have been initialised yet. Explicitly mark those "static global" variables as belonging to the .data section, to keep tiny-printf clear of any BSS usage. Signed-off-by: Andre Przywara <andre.przywara@arm.com> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/tiny-printf.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/tiny-printf.c b/lib/tiny-printf.c
index 451f4f7a67..b334f053cc 100644
--- a/lib/tiny-printf.c
+++ b/lib/tiny-printf.c
@@ -13,11 +13,16 @@
#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)
{