This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
[PATCH] Make memory check consistent.
- From: "David Ho" <davidkwho at gmail dot com>
- To: ecos-discuss at ecos dot sourceware dot org
- Date: Tue, 25 Jul 2006 10:07:32 -0400
- Subject: [ECOS] [PATCH] Make memory check consistent.
I noticed the memory check routines in flash.c is out of sync with the
functions used in load.c. Hence, I have this message when I issued a
fis command.
** WARNING: RAM address: 0x10000000 may be invalid
The following code makes the check consistent.
I will post a formal patch to the patch list if you guys are happy with this.
David
---
diff --git a/packages/redboot/current/src/flash.c
b/packages/redboot/current/src/flash.c
index 9ba7fd3..0f565c3 100644
--- a/packages/redboot/current/src/flash.c
+++ b/packages/redboot/current/src/flash.c
@@ -972,8 +972,7 @@ fis_create(int argc, char *argv[])
}
}
}
- if (!mem_addr_set && (load_address >= (CYG_ADDRESS)ram_start) &&
- (load_address_end) < (CYG_ADDRESS)ram_end) {
+ if (!mem_addr_set && valid_address(load_address)) {
mem_addr = load_address;
mem_addr_set = true;
defaults_assumed = true;
@@ -1037,11 +1036,8 @@ #endif
return;
}
if (!no_copy) {
- if ((mem_addr < (CYG_ADDRESS)ram_start) ||
- ((mem_addr+img_size) >= (CYG_ADDRESS)ram_end)) {
+ if (!valid_address(mem_addr))
diag_printf("** WARNING: RAM address: %p may be
invalid\n", (void *)mem_addr);
- diag_printf(" valid range is %p-%p\n", (void
*)ram_start, (void *)ram_end);
- }
if (!flash_addr_set && !fis_find_free(&flash_addr, length)) {
diag_printf("Can't locate %lx(%ld) bytes free in
FLASH\n", length, length);
return;
@@ -1367,11 +1363,8 @@ #endif
diag_printf(" must be 0x%x aligned\n", flash_block_size);
return;
}
- if ((mem_addr < (CYG_ADDRESS)ram_start) ||
- ((mem_addr+length) >= (CYG_ADDRESS)ram_end)) {
+ if (!valid_address(mem_addr))
diag_printf("** WARNING: RAM address: %p may be invalid\n",
(void *)mem_addr);
- diag_printf(" valid range is %p-%p\n", (void *)ram_start,
(void *)ram_end);
- }
// Safety check - make sure the address range is not within the
code we're running
if (flash_code_overlaps((void *)flash_addr, (void
*)(flash_addr+length-1))) {
diag_printf("Can't program this region - contains code in use!\n");
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss