* AW: contributing a failsafe update meachanism for FIS from within ecos applications
@ 2004-10-20 16:14 Neundorf, Alexander
2004-10-22 19:14 ` Andrew Lunn
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Neundorf, Alexander @ 2004-10-20 16:14 UTC (permalink / raw)
To: Andrew Lunn; +Cc: ecos-devel
[-- Attachment #1: Type: text/plain, Size: 636 bytes --]
Hi,
so here comes a patch with all these changes, including a cdl-entry.
In fis_init() I didn't find the correct place where to erase the additional flash block, there I'd need help.
Main change:
#define EFIS_MAGIC_LENGTH 10
#define EFIS_MAGIC ".FisValid" //exactly 10 bytes
#define EFIS_VALID (0xa5a5)
#define EFIS_IN_PROGRESS (0xfdfd)
#define EFIS_EMPTY (0xffff)
struct fis_valid_info
{
unsigned char magic_name[EFIS_MAGIC_LENGTH];
unsigned short valid_flag;
unsigned long version_count;
};
So it fits again completely in the 16 bytes for the name.
Please comment :-)
Bye
Alex
[-- Attachment #2: fis.fail_save-3.patch --]
[-- Type: application/octet-stream, Size: 8961 bytes --]
diff -rbup current.orig/cdl/redboot.cdl current/cdl/redboot.cdl
--- current.orig/cdl/redboot.cdl Sun Sep 19 19:49:59 2004
+++ current/cdl/redboot.cdl Wed Oct 20 18:06:18 2004
@@ -623,6 +623,17 @@ cdl_package CYGPKG_REDBOOT {
determine what's free and what's not."
}
+ cdl_option CYGOPT_REDBOOT_ENHANCED_FIS {
+ display "RedBoot Enhanced Flash Image System support"
+ default_value 0
+ doc ref/flash-image-system.html
+ description "
+ This option enables the Enhanced Flash Image System commands
+ and support within RedBoot. If enabled a flash block will be
+ reserved for a second copy of the fis table.
+ "
+ }
+
cdl_component CYGPKG_REDBOOT_FIS_CONTENTS {
display "Flash Image System default directory contents"
active_if CYGOPT_REDBOOT_FIS
@@ -632,6 +643,18 @@ cdl_package CYGPKG_REDBOOT {
display "Flash block containing the Directory"
flavor data
default_value (-1)
+ description "
+ Which block of flash should hold the directory
+ information. Positive numbers are absolute block numbers.
+ Negative block numbers count backwards from the last block.
+ eg 2 means block 2, -2 means the last but one block."
+ }
+
+ cdl_option CYGNUM_REDBOOT_FIS_ADDITIONAL_DIRECTORY_BLOCK {
+ display "Flash block containing the backup Directory"
+ active_if CYGOPT_REDBOOT_ENHANCED_FIS
+ flavor data
+ default_value (-3)
description "
Which block of flash should hold the directory
information. Positive numbers are absolute block numbers.
Only in current/cdl: redboot.cdl~
diff -rbup current.orig/include/fis.h current/include/fis.h
--- current.orig/include/fis.h Sat Aug 24 13:20:55 2002
+++ current/include/fis.h Wed Oct 20 17:56:25 2004
@@ -73,7 +73,22 @@ struct fis_image_desc {
unsigned long file_cksum; // Checksum over image data
};
+#define EFIS_MAGIC_LENGTH 10
+#define EFIS_MAGIC ".FisValid" //exactly 10 bytes
+
+#define EFIS_VALID (0xa5a5)
+#define EFIS_IN_PROGRESS (0xfdfd)
+#define EFIS_EMPTY (0xffff)
+
+struct fis_valid_info
+{
+ unsigned char magic_name[EFIS_MAGIC_LENGTH];
+ unsigned short valid_flag;
+ unsigned long version_count;
+};
+
struct fis_image_desc *fis_lookup(char *name, int *num);
#endif // CYGOPT_REDBOOT_FIS
#endif // _FIS_H_
+
diff -rbup current.orig/src/flash.c current/src/flash.c
--- current.orig/src/flash.c Wed Sep 1 23:21:30 2004
+++ current/src/flash.c Wed Oct 20 18:03:45 2004
@@ -169,6 +169,8 @@ int flash_block_size, flash_num_blocks;
#ifdef CYGOPT_REDBOOT_FIS
void *fis_work_block;
void *fis_addr;
+void *fis_addr0;
+void *fis_addr1;
int fisdir_size; // Size of FIS directory.
#endif
#ifdef CYGSEM_REDBOOT_FLASH_CONFIG
@@ -278,6 +280,7 @@ fis_init(int argc, char *argv[])
{
int stat;
struct fis_image_desc *img;
+ struct fis_valid_info* fvi=NULL;
void *err_addr;
bool full_init = false;
struct option_info opts[1];
@@ -301,9 +304,21 @@ fis_init(int argc, char *argv[])
redboot_image_size = flash_block_size > MIN_REDBOOT_IMAGE_SIZE ?
flash_block_size : MIN_REDBOOT_IMAGE_SIZE;
- // Create a pseudo image for RedBoot
img = (struct fis_image_desc *)fis_work_block;
memset(img, 0xFF, fisdir_size); // Start with erased data
+
+#ifdef CYGOPT_REDBOOT_ENHANCED_FIS
+ //create the valid flag entry
+ fvi=(struct fis_valid_info*)img;
+ memset(img, 0, sizeof(struct fis_image_desc));
+ strcpy(fvi->magic_name, EFIS_MAGIC);
+
+ fvi->valid_flag=EFIS_VALID;
+ fvi->version_count=0;
+ img++;
+#endif
+
+ // Create a pseudo image for RedBoot
#ifdef CYGOPT_REDBOOT_FIS_RESERVED_BASE
memset(img, 0, sizeof(*img));
strcpy(img->name, "(reserved)");
@@ -357,10 +372,18 @@ fis_init(int argc, char *argv[])
// And a descriptor for the descriptor table itself
memset(img, 0, sizeof(*img));
strcpy(img->name, "FIS directory");
- img->flash_base = (CYG_ADDRESS)fis_addr;
- img->mem_base = (CYG_ADDRESS)fis_addr;
+ img->flash_base = (CYG_ADDRESS)fis_addr0;
+ img->mem_base = (CYG_ADDRESS)fis_addr0;
+ img->size = fisdir_size;
+ img++;
+#ifdef CYGOPT_REDBOOT_ENHANCED_FIS
+ memset(img, 0, sizeof(*img));
+ strcpy(img->name, "FIS directory~");
+ img->flash_base = (CYG_ADDRESS)fis_addr1;
+ img->mem_base = (CYG_ADDRESS)fis_addr1;
img->size = fisdir_size;
img++;
+#endif
#ifdef CYGOPT_REDBOOT_FIS_DIRECTORY_ARM_SIB_ID
// FIS gets the size of a full block - note, this should be changed
@@ -1351,10 +1374,36 @@ _flash_info(void)
flash_start, (CYG_ADDRWORD)flash_end + 1, flash_num_blocks, (void *)flash_block_size);
}
+#ifdef CYGOPT_REDBOOT_ENHANCED_FIS
+static int
+get_valid_buf(struct fis_valid_info* fvi0, struct fis_valid_info* fvi1)
+{
+ if (strncmp(fvi0->magic_name, EFIS_MAGIC, EFIS_MAGIC_LENGTH)!=0) //buf1 must be valid
+ return 1;
+ else if (strncmp(fvi1->magic_name, EFIS_MAGIC, EFIS_MAGIC_LENGTH)!=0) //buf0 must be valid
+ return 0;
+
+ //magic is ok for both, now check the valid flag
+ if (fvi0->valid_flag!=EFIS_VALID) //buf1 must be valid
+ return 1;
+ else if (fvi1->valid_flag!=EFIS_VALID) //buf0 must be valid
+ return 0;
+
+ //now check the version
+ if (fvi1->version_count == (fvi0->version_count+1)) //buf1 must be valid
+ return 1;
+
+ return 0;
+}
+#endif
+
bool
do_flash_init(void)
{
int stat;
+ void *err_addr=0;
+ struct fis_valid_info fvi0;
+ struct fis_valid_info fvi1;
if (!__flash_init) {
__flash_init = 1;
@@ -1379,17 +1428,64 @@ do_flash_init(void)
workspace_end = (unsigned char *)(workspace_end-fisdir_size);
fis_work_block = workspace_end;
# endif
+
+ fis_addr0 = NULL;
+ fis_addr1 = NULL;
+
if (CYGNUM_REDBOOT_FIS_DIRECTORY_BLOCK < 0) {
- fis_addr = (void *)((CYG_ADDRESS)flash_end + 1 +
+ fis_addr0 = (void *)((CYG_ADDRESS)flash_end + 1 +
(CYGNUM_REDBOOT_FIS_DIRECTORY_BLOCK*flash_block_size));
} else {
- fis_addr = (void *)((CYG_ADDRESS)flash_start +
+ fis_addr0 = (void *)((CYG_ADDRESS)flash_start +
(CYGNUM_REDBOOT_FIS_DIRECTORY_BLOCK*flash_block_size));
}
- if (((CYG_ADDRESS)fis_addr + fisdir_size - 1) > (CYG_ADDRESS)flash_end) {
+
+#ifdef CYGOPT_REDBOOT_ENHANCED_FIS
+ if (CYGNUM_REDBOOT_FIS_ADDITIONAL_DIRECTORY_BLOCK < 0) {
+ fis_addr1 = (void *)((CYG_ADDRESS)flash_end + 1 +
+ (CYGNUM_REDBOOT_FIS_ADDITIONAL_DIRECTORY_BLOCK*flash_block_size));
+ } else {
+ fis_addr1 = (void *)((CYG_ADDRESS)flash_start +
+ (CYGNUM_REDBOOT_FIS_ADDITIONAL_DIRECTORY_BLOCK*flash_block_size));
+ }
+
+ if ((((CYG_ADDRESS)fis_addr0 + fisdir_size - 1) > (CYG_ADDRESS)flash_end)
+ || (((CYG_ADDRESS)fis_addr1 + fisdir_size - 1) > (CYG_ADDRESS)flash_end)
+ || (fis_addr0==fis_addr1)) {
diag_printf("FIS directory doesn't fit\n");
return false;
}
+
+ FLASH_READ(fis_addr0, &fvi0, sizeof(struct fis_valid_info), (void **)&err_addr);
+ FLASH_READ(fis_addr1, &fvi1, sizeof(struct fis_valid_info), (void **)&err_addr);
+
+#ifdef REDBOOT_FLASH_REVERSE_BYTEORDER
+ fvi0.magic=CYG_SWAP32(fvi0.magic);
+ fvi0.valid_flag=CYG_SWAP32(fvi0.valid_flag);
+ fvi0.version_count=CYG_SWAP32(fvi0.version_count);
+ fvi1.magic=CYG_SWAP32(fvi1.magic);
+ fvi1.valid_flag=CYG_SWAP32(fvi1.valid_flag);
+ fvi1.version_count=CYG_SWAP32(fvi1.version_count);
+#endif
+
+ if ((strncmp(fvi0.magic_name, EFIS_MAGIC, EFIS_MAGIC_LENGTH)==0) || (memcmp(fvi1.magic_name, EFIS_MAGIC, EFIS_MAGIC_LENGTH)==0)) {
+ if (get_valid_buf(&fvi0, &fvi1)==0)
+ fis_addr=fis_addr0;
+ else
+ fis_addr=fis_addr1;
+ } else {
+ fis_addr1=NULL;
+ fis_addr=fis_addr0;
+ }
+#else //no enhanced fis
+ if (((CYG_ADDRESS)fis_addr0 + fisdir_size - 1) > (CYG_ADDRESS)flash_end) {
+ diag_printf("FIS directory doesn't fit\n");
+ return false;
+ }
+ fis_addr1=NULL;
+ fis_addr=fis_addr0;
+#endif
+
fis_read_directory();
#endif
}
Only in current/src: flash.c~
[-- Attachment #3: fisfs-3.tar.gz --]
[-- Type: application/x-gzip, Size: 8722 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: contributing a failsafe update meachanism for FIS from within ecos applications
2004-10-20 16:14 AW: contributing a failsafe update meachanism for FIS from within ecos applications Neundorf, Alexander
@ 2004-10-22 19:14 ` Andrew Lunn
2004-10-25 7:26 ` Andrew Lunn
2004-10-25 7:32 ` AW: " Slawek
2004-10-25 13:15 ` Redboot lockups Curtis Whitley
2 siblings, 1 reply; 6+ messages in thread
From: Andrew Lunn @ 2004-10-22 19:14 UTC (permalink / raw)
To: Neundorf, Alexander; +Cc: Andrew Lunn, ecos-devel
[-- Attachment #1: Type: text/plain, Size: 195 bytes --]
Hi Alex
I've been hacking you patch a bit. Here is my version. It compiles
cleanly, but i've not actually tried to run it. Please take a look and
let me know what you think.
Andrew
[-- Attachment #2: redundant.diff --]
[-- Type: text/plain, Size: 11446 bytes --]
Index: redboot/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/redboot/current/ChangeLog,v
retrieving revision 1.213
diff -u -r1.213 ChangeLog
--- redboot/current/ChangeLog 13 Oct 2004 21:22:53 -0000 1.213
+++ redboot/current/ChangeLog 22 Oct 2004 19:12:13 -0000
@@ -1,3 +1,13 @@
+2004-10-22 Alexander Neundorf <Alexander.Neundorf@jenoptik.com>
+ Andrew Lunn <andrew.lunn@ascom.ch>
+
+ * include/fis.h
+ * src/flash.c: Added basic support for a redundant FIS directory.
+ Currently there is no way to actually write a redundant directory,
+ but if such a directory where to exist, we can check if the
+ primary directory is valid and if not use the redundant one
+ instead.
+
2004-10-10 Iztok Zupet <iz@elsis.si>
* cdl/redboot.cdl: added CYGSEM_REDBOOT_DISK_IDE_VMWARE option.
Index: redboot/current/cdl/redboot.cdl
===================================================================
RCS file: /cvs/ecos/ecos/packages/redboot/current/cdl/redboot.cdl,v
retrieving revision 1.68
diff -u -r1.68 redboot.cdl
--- redboot/current/cdl/redboot.cdl 13 Oct 2004 21:22:53 -0000 1.68
+++ redboot/current/cdl/redboot.cdl 22 Oct 2004 19:12:15 -0000
@@ -638,7 +638,33 @@
Negative block numbers count backwards from the last block.
eg 2 means block 2, -2 means the last but one block."
}
-
+
+ cdl_component CYGOPT_REDBOOT_REDUNDANT_FIS {
+ display "Redundant Flash Image System Directory Support"
+ default_value 0
+ requires { 0 == CYGSEM_REDBOOT_FLASH_COMBINED_FIS_AND_CONFIG }
+ description "
+ This option enables the use of a redundant FIR
+ directory within RedBoot. If enabled a flash block
+ will be reserved for a second copy of the fis
+ directory. Doing this allow for power failure safe
+ updates of the directory by the application."
+
+ cdl_option CYGNUM_REDBOOT_FIS_REDUNDANT_DIRECTORY_BLOCK {
+ display "Flash block containing the backup Directory"
+ flavor data
+ default_value (-3)
+ requires { CYGNUM_REDBOOT_FIS_REDUNDANT_DIRECTORY_BLOCK !=
+ CYGNUM_REDBOOT_FIS_DIRECTORY_BLOCK }
+ description "
+ Which block of flash should hold the redundant
+ directory information. Positive numbers are
+ absolute block numbers. Negative block numbers
+ count backwards from the last block. eg 2 means
+ block 2, -2 means the last but one block."
+ }
+ }
+
cdl_option CYGOPT_REDBOOT_FIS_RESERVED_BASE {
display "Pseudo-file to describe reserved area"
active_if { 0 != CYGNUM_REDBOOT_FLASH_RESERVED_BASE }
Index: redboot/current/include/fis.h
===================================================================
RCS file: /cvs/ecos/ecos/packages/redboot/current/include/fis.h,v
retrieving revision 1.6
diff -u -r1.6 fis.h
--- redboot/current/include/fis.h 24 Aug 2002 11:20:55 -0000 1.6
+++ redboot/current/include/fis.h 22 Oct 2004 19:12:15 -0000
@@ -75,5 +75,22 @@
struct fis_image_desc *fis_lookup(char *name, int *num);
+// These will need to move somewhere else when the fisfs needs to use
+// the following definitions.
+#ifdef CYGOPT_REDBOOT_REDUNDANT_FIS
+#define CYG_REDBOOT_RFIS_VALID_MAGIC ".FisValid" //exactly 10 bytes
+
+#define CYG_REDBOOT_RFIS_VALID (0xa5a5)
+#define CYG_REDBOOT_RFIS_IN_PROGRESS (0xfdfd)
+#define CYG_REDBOOT_RFIS_EMPTY (0xffff)
+
+struct fis_valid_info
+{
+ unsigned long version_count;
+ unsigned short valid_flag;
+};
+#endif // CYGOPT_REDBOOT_REDUNDANT_FIS
+
#endif // CYGOPT_REDBOOT_FIS
#endif // _FIS_H_
+
Index: redboot/current/src/flash.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/redboot/current/src/flash.c,v
retrieving revision 1.69
diff -u -r1.69 flash.c
--- redboot/current/src/flash.c 1 Sep 2004 21:21:30 -0000 1.69
+++ redboot/current/src/flash.c 22 Oct 2004 19:12:17 -0000
@@ -169,6 +169,9 @@
#ifdef CYGOPT_REDBOOT_FIS
void *fis_work_block;
void *fis_addr;
+#ifdef CYGOPT_REDBOOT_REDUNDANT_FIS
+void *redundant_fis_addr;
+#endif
int fisdir_size; // Size of FIS directory.
#endif
#ifdef CYGSEM_REDBOOT_FLASH_CONFIG
@@ -273,6 +276,31 @@
fis_endian_fixup(fis_work_block);
}
+#ifdef CYGOPT_REDBOOT_REDUNDANT_FIS
+void
+fis_erase_redundant_directory(void)
+{
+ int stat;
+ void *err_addr;
+
+#ifdef CYGSEM_REDBOOT_FLASH_LOCK_SPECIAL
+ // Ensure [quietly] that the directory is unlocked before trying
+ // to update
+ flash_unlock((void *)redundant_fis_addr, flash_block_size,
+ (void **)&err_addr);
+#endif
+ if ((stat = flash_erase(redundant_fis_addr, flash_block_size,
+ (void **)&err_addr)) != 0) {
+ diag_printf("Error erasing FIS directory at %p: %s\n",
+ err_addr, flash_errmsg(stat));
+ }
+#ifdef CYGSEM_REDBOOT_FLASH_LOCK_SPECIAL
+ // Ensure [quietly] that the directory is locked after the update
+ flash_lock((void *)fis_addr, flash_block_size, (void **)&err_addr);
+#endif
+}
+#endif
+
static void
fis_init(int argc, char *argv[])
{
@@ -283,6 +311,9 @@
struct option_info opts[1];
CYG_ADDRESS redboot_flash_start;
unsigned long redboot_image_size;
+#ifdef CYGOPT_REDBOOT_REDUNDANT_FIS
+ struct fis_valid_info fvi;
+#endif
init_opts(&opts[0], 'f', false, OPTION_ARG_TYPE_FLG,
(void *)&full_init, (bool *)0, "full initialization, erases all of flash");
@@ -301,9 +332,23 @@
redboot_image_size = flash_block_size > MIN_REDBOOT_IMAGE_SIZE ?
flash_block_size : MIN_REDBOOT_IMAGE_SIZE;
- // Create a pseudo image for RedBoot
img = (struct fis_image_desc *)fis_work_block;
memset(img, 0xFF, fisdir_size); // Start with erased data
+
+#ifdef CYGOPT_REDBOOT_REDUNDANT_FIS
+ CYG_ASSERT(sizeof(fvi)+sizeof(EFIS_MAGIC) <= sizeof(img->name),
+ "Size mismatch");
+
+ //create the valid flag entry
+ memset(img, 0, sizeof(struct fis_image_desc));
+ strcpy(img->name, CYG_REDBOOT_RFIS_VALID_MAGIC);
+ fvi.valid_flag=CYG_REDBOOT_RFIS_VALID;
+ fvi.version_count=0;
+ memcpy(&img->name[sizeof(CYG_REDBOOT_RFIS_VALID_MAGIC)],&fvi,sizeof(fvi));
+ img++;
+#endif
+
+ // Create a pseudo image for RedBoot
#ifdef CYGOPT_REDBOOT_FIS_RESERVED_BASE
memset(img, 0, sizeof(*img));
strcpy(img->name, "(reserved)");
@@ -361,6 +406,14 @@
img->mem_base = (CYG_ADDRESS)fis_addr;
img->size = fisdir_size;
img++;
+#ifdef CYGOPT_REDBOOT_REDUNDANT_FIS
+ memset(img, 0, sizeof(*img));
+ strcpy(img->name, "Redundant FIS");
+ img->flash_base = (CYG_ADDRESS)redundant_fis_addr;
+ img->mem_base = (CYG_ADDRESS)redundant_fis_addr;
+ img->size = fisdir_size;
+ img++;
+#endif
#ifdef CYGOPT_REDBOOT_FIS_DIRECTORY_ARM_SIB_ID
// FIS gets the size of a full block - note, this should be changed
@@ -475,6 +528,9 @@
#endif
}
fis_update_directory();
+#ifdef CYGOPT_REDBOOT_REDUNDANT_FIS
+ fis_erase_redundant_directory();
+#endif
}
static void
@@ -1355,7 +1411,13 @@
do_flash_init(void)
{
int stat;
-
+#ifdef CYGOPT_REDBOOT_REDUNDANT_FIS
+ void *err_addr=0;
+ struct fis_valid_info fvi0;
+ struct fis_valid_info fvi1;
+ struct fis_image_desc img0;
+ struct fis_image_desc img1;
+#endif
if (!__flash_init) {
__flash_init = 1;
if ((stat = flash_init(diag_printf)) != 0) {
@@ -1379,17 +1441,79 @@
workspace_end = (unsigned char *)(workspace_end-fisdir_size);
fis_work_block = workspace_end;
# endif
+
if (CYGNUM_REDBOOT_FIS_DIRECTORY_BLOCK < 0) {
fis_addr = (void *)((CYG_ADDRESS)flash_end + 1 +
(CYGNUM_REDBOOT_FIS_DIRECTORY_BLOCK*flash_block_size));
} else {
- fis_addr = (void *)((CYG_ADDRESS)flash_start +
+ fis_addr = (void *)((CYG_ADDRESS)flash_start +
(CYGNUM_REDBOOT_FIS_DIRECTORY_BLOCK*flash_block_size));
}
+
if (((CYG_ADDRESS)fis_addr + fisdir_size - 1) > (CYG_ADDRESS)flash_end) {
diag_printf("FIS directory doesn't fit\n");
return false;
}
+
+#ifdef CYGOPT_REDBOOT_REDUNDANT_FIS
+ if (CYGNUM_REDBOOT_FIS_REDUNDANT_DIRECTORY_BLOCK < 0) {
+ redundant_fis_addr =
+ (void *)((CYG_ADDRESS)flash_end + 1 +
+ (CYGNUM_REDBOOT_FIS_REDUNDANT_DIRECTORY_BLOCK *
+ flash_block_size));
+ } else {
+ redundant_fis_addr =
+ (void *)((CYG_ADDRESS)flash_start +
+ (CYGNUM_REDBOOT_FIS_REDUNDANT_DIRECTORY_BLOCK *
+ flash_block_size));
+ }
+
+ if (((CYG_ADDRESS)redundant_fis_addr + fisdir_size - 1) >
+ (CYG_ADDRESS)flash_end) {
+ diag_printf("Redundant FIS directory doesn't fit\n");
+ return false;
+ }
+
+ // Read the first img from each directory and see if it
+ // contains the appropriate magic
+ FLASH_READ(fis_addr, &img0, sizeof(img0), (void **)&err_addr);
+ FLASH_READ(redundant_fis_addr, &img1, sizeof(img1), (void **)&err_addr);
+
+ if (!strncmp(img0.name, CYG_REDBOOT_RFIS_VALID_MAGIC,
+ sizeof(CYG_REDBOOT_RFIS_VALID_MAGIC))) {
+ memcpy(&fvi0,&img0.name[sizeof(CYG_REDBOOT_RFIS_VALID_MAGIC)],
+ sizeof(fvi0));
+ } else {
+ memset(&fvi0, 0, sizeof(fvi0));
+ }
+ if (!strncmp(img1.name, CYG_REDBOOT_RFIS_VALID_MAGIC,
+ sizeof(CYG_REDBOOT_RFIS_VALID_MAGIC))) {
+ memcpy(&fvi1,&img1.name[sizeof(CYG_REDBOOT_RFIS_VALID_MAGIC)],
+ sizeof(fvi1));
+ } else {
+ memset(&fvi1, 0, sizeof(fvi1));
+ }
+
+#ifdef REDBOOT_FLASH_REVERSE_BYTEORDER
+ fvi0.valid_flag = CYG_SWAP32(fvi0.valid_flag);
+ fvi0.version_count = CYG_SWAP32(fvi0.version_count);
+ fvi1.valid_flag = CYG_SWAP32(fvi1.valid_flag);
+ fvi1.version_count = CYG_SWAP32(fvi1.version_count);
+#endif
+ // Now check if the primary FIS directory is valid
+ if (fvi0.valid_flag != CYG_REDBOOT_RFIS_VALID) {
+ // Primary is not valid, try the secondary
+ if (fvi1.valid_flag == CYG_REDBOOT_RFIS_VALID) {
+ // Valid, so swap primary and secondary
+ void * tmp;
+ tmp = fis_addr;
+ fis_addr = redundant_fis_addr;
+ redundant_fis_addr = tmp;
+ } else {
+ // Both are invalid, stick with the invalid primary
+ }
+ }
+#endif
fis_read_directory();
#endif
}
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: contributing a failsafe update meachanism for FIS from within ecos applications
2004-10-22 19:14 ` Andrew Lunn
@ 2004-10-25 7:26 ` Andrew Lunn
0 siblings, 0 replies; 6+ messages in thread
From: Andrew Lunn @ 2004-10-25 7:26 UTC (permalink / raw)
To: Andrew Lunn; +Cc: Neundorf, Alexander, ecos-devel
On Fri, Oct 22, 2004 at 09:13:44PM +0200, Andrew Lunn wrote:
> Hi Alex
>
> I've been hacking you patch a bit. Here is my version. It compiles
> cleanly, but i've not actually tried to run it. Please take a look and
> let me know what you think.
After a little thought i notices a bug. I do not check the version
when both FIS directories are valid. Easy to fix, i just don't have
the time at the moment.
Andrew
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: AW: contributing a failsafe update meachanism for FIS from within ecos applications
2004-10-20 16:14 AW: contributing a failsafe update meachanism for FIS from within ecos applications Neundorf, Alexander
2004-10-22 19:14 ` Andrew Lunn
@ 2004-10-25 7:32 ` Slawek
2004-10-25 13:15 ` Redboot lockups Curtis Whitley
2 siblings, 0 replies; 6+ messages in thread
From: Slawek @ 2004-10-25 7:32 UTC (permalink / raw)
To: Neundorf, Alexander, Andrew Lunn; +Cc: ecos-devel
Hello!
In message to "Andrew Lunn" <andrew@lunn.ch> sent Wed, 20 Oct 2004 18:11:18
+0200 you wrote:
NA> #define EFIS_VALID (0xa5a5)
NA> #define EFIS_IN_PROGRESS (0xfdfd)
NA> #define EFIS_EMPTY (0xffff)
Some additional ideas from somebody who watches the conversation:
1) Why do we need EFIS_IN_PROGRESS? Isn't EFIS_EMPTY enough? Both can't be
used to load the application anyway.
2) ".FisValid" suggest this is valid FIS entry while it doesn't need to be.
Why don't use separate name for valid and for invalid (empty or in progress)
fis tables? This could also save additional space used to mark
"valid/invalid" as this could be decided be the name.
--
Slawomir Piotrowski
^ permalink raw reply [flat|nested] 6+ messages in thread
* Redboot lockups
2004-10-20 16:14 AW: contributing a failsafe update meachanism for FIS from within ecos applications Neundorf, Alexander
2004-10-22 19:14 ` Andrew Lunn
2004-10-25 7:32 ` AW: " Slawek
@ 2004-10-25 13:15 ` Curtis Whitley
2004-10-25 13:26 ` Andrew Lunn
2 siblings, 1 reply; 6+ messages in thread
From: Curtis Whitley @ 2004-10-25 13:15 UTC (permalink / raw)
To: ecos-devel
I am new to eCos and am trying to get setup so that I can write an eCos
application under Linux, to run on the ARM platform. For now, the platform
that I will be using does not exist, so I intend to test some parts of the
application on a PC (i386).
So, I built a Redboot image (i386) under Linux and made a floppy for the PC.
This image will boot fine and respond to either keyboard keys or to input
from the serial port, when running on an old machine (e.g. Gateway 200Mhz
Pentium).
When I run this image on my newer PC (3GHz Pentium 4), Redboot displays its
startup message and prompts, but then appears to lock up. It does not
respond to any keys or serial input.
Prior to this, I ran into problems trying to get a Redboot image running
under MS Virtual PC or VMWare on a single XP machine. At that time, I was
running eCos stuff under cygwin.
The bottom line is... I just want to write an application on my laptop (Dell
M60) under Linux and debug it. If I can do all that on the one laptop,
great. If not, I will attach a second PC via serial cable, but this seems to
be a problem.
I hear there is some kind of virtual machine for eCos under Linux. Is that
true?
I am running Redhat WS V3. Kernel is 2.4.21-15.EL on an i686.
Anyone with any ideas, please respond. Thanks!
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Redboot lockups
2004-10-25 13:15 ` Redboot lockups Curtis Whitley
@ 2004-10-25 13:26 ` Andrew Lunn
0 siblings, 0 replies; 6+ messages in thread
From: Andrew Lunn @ 2004-10-25 13:26 UTC (permalink / raw)
To: Curtis Whitley; +Cc: ecos-devel
> I hear there is some kind of virtual machine for eCos under Linux. Is that
> true?
Yes. Its the synthetic target.
http://ecos.sourceware.org/docs-latest/ref/hal-synth-arch.html
You will find this much easier to use than VMware, or a PC.
Andrew
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2004-10-25 13:26 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-20 16:14 AW: contributing a failsafe update meachanism for FIS from within ecos applications Neundorf, Alexander
2004-10-22 19:14 ` Andrew Lunn
2004-10-25 7:26 ` Andrew Lunn
2004-10-25 7:32 ` AW: " Slawek
2004-10-25 13:15 ` Redboot lockups Curtis Whitley
2004-10-25 13:26 ` Andrew Lunn
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).