[PATCH 2/9] memory: fix size address calculation
alex.aring at gmail.com
Sun Jan 13 12:42:16 EST 2013
Fix size address calculation.
Global variables from <asm/sections.h> which are defined
in linker script *.lds files for end addresses has already
a +1 calculation.
stext = 0x100 with a size about 0x50 will result a etext = 0x150.
In this case a correct size calculation is (etext - stext) = 0x50.
In function 'request_sdram_region' the end address will be
calculated with (start + size - 1) which result a correct
end address of 0x149 in this example.
Signed-off-by: Alexander Aring <alex.aring at gmail.com>
common/memory.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/common/memory.c b/common/memory.c
index 2674002..7dd1384 100644
@@ -74,11 +74,11 @@ static int mem_malloc_resource(void)
(unsigned long)&_etext -
- (unsigned long)&_stext + 1);
+ (unsigned long)&_stext);
(unsigned long)&__bss_stop -
- (unsigned long)&__bss_start + 1);
+ (unsigned long)&__bss_start);
request_sdram_region("stack", STACK_BASE, STACK_SIZE);
More information about the barebox