[U-Boot] [PATCH 3/3 v2] Replace CONFIG_SYS_GBL_DATA_SIZE by auto-generated value

Wolfgang Denk wd at denx.de
Tue Oct 26 16:52:10 CEST 2010


CONFIG_SYS_GBL_DATA_SIZE has always been just a bad workarond for not
being able to use "sizeof(struct global_data)" in assembler files.
Recent experience has shown that manual synchronization is not
reliable enough.  This patch renames CONFIG_SYS_GBL_DATA_SIZE into
GENERATED_GBL_DATA_SIZE which gets automatically generated by the
asm-offsets tool.  In the result, all definitions of this value can be
deleted from the board config files.  We have to make sure that all
files that reference such data include the new <asm-offsets.h> file.

No other changes have been done yet, but it is obvious that similar
changes / simplifications can be done for other, related macro
definitions as well.

Signed-off-by: Wolfgang Denk <wd at denx.de>
---
v2: round global data size up to a multiple of 16 to guarantee
    sufficient alignment of the initial stack.

 ... [other files unchanged, suppressed to reduce size] ...
 lib/asm-offsets.c                          |    4 ++++
 560 files changed, 519 insertions(+), 955 deletions(-)

... [other files unchanged, suppressed to reduce size] ...

diff --git a/lib/asm-offsets.c b/lib/asm-offsets.c
index 4eb6174..0bc70ab 100644
--- a/lib/asm-offsets.c
+++ b/lib/asm-offsets.c
@@ -21,5 +21,9 @@
 
 int main(void)
 {
+	/* Round up to make sure size gives nice stack alignment */
+	DEFINE(GENERATED_GBL_DATA_SIZE,
+		(sizeof(struct global_data)+15) & ~15);
+
 	return 0;
 }
-- 
1.7.2.3



More information about the U-Boot mailing list