* [U-Boot-Users] Patch: Changes to support GCC 3.3.x
@ 2004-03-04 14:00 Yuli Barcohen
2004-03-04 15:14 ` Stephan Linz
2004-03-14 1:05 ` Wolfgang Denk
0 siblings, 2 replies; 5+ messages in thread
From: Yuli Barcohen @ 2004-03-04 14:00 UTC (permalink / raw)
To: u-boot
GCC 3.3.x changed handling of global variables explicitly initialised to
zero. It puts them to .bss section and not .data as it was in older GCC
versions. This change breaks environment redundancy feature. Attached
patch fixes the problem.
--
========================================================================
Yuli Barcohen | Phone +972-9-765-1788 | Software Project Leader
yuli at arabellasw.com | Fax +972-9-765-7494 | Arabella Software, Israel
========================================================================
-------------- next part --------------
Index: common/env_flash.c
===================================================================
RCS file: /home/CVS/u-boot/u-boot/common/env_flash.c,v
retrieving revision 1.1.1.3
diff -p -u -r1.1.1.3 env_flash.c
--- common/env_flash.c 16 Jul 2003 11:23:42 -0000 1.1.1.3
+++ common/env_flash.c 4 Mar 2004 13:50:24 -0000
@@ -79,9 +79,9 @@ static env_t *flash_addr_new = (env_t *)
static ulong end_addr = CFG_ENV_ADDR + CFG_ENV_SECT_SIZE - 1;
static ulong end_addr_new = CFG_ENV_ADDR_REDUND + CFG_ENV_SECT_SIZE - 1;
-static uchar active_flag = 1;
-static uchar obsolete_flag = 0;
-#endif
+#define ACTIVE_FLAG 1
+#define OBSOLETE_FLAG 0
+#endif /* CFG_ENV_ADDR_REDUND */
extern uchar default_environment[];
extern int default_environment_size;
@@ -127,12 +127,12 @@ int env_init(void)
gd->env_addr = addr_default;
gd->env_valid = 0;
}
- else if (flag1 == active_flag && flag2 == obsolete_flag)
+ else if (flag1 == ACTIVE_FLAG && flag2 == OBSOLETE_FLAG)
{
gd->env_addr = addr1;
gd->env_valid = 1;
}
- else if (flag1 == obsolete_flag && flag2 == active_flag)
+ else if (flag1 == OBSOLETE_FLAG && flag2 == ACTIVE_FLAG)
{
gd->env_addr = addr2;
gd->env_valid = 1;
@@ -161,6 +161,7 @@ int saveenv(void)
{
char *saved_data = NULL;
int rc = 1;
+ char flag = OBSOLETE_FLAG, new_flag = ACTIVE_FLAG;
#if CFG_ENV_SECT_SIZE > CFG_ENV_SIZE
ulong up_data = 0;
#endif
@@ -215,11 +216,11 @@ int saveenv(void)
(ulong)&(flash_addr_new->crc),
sizeof(env_ptr->crc)) ||
- flash_write((char *)&obsolete_flag,
+ flash_write(&flag,
(ulong)&(flash_addr->flags),
sizeof(flash_addr->flags)) ||
- flash_write((char *)&active_flag,
+ flash_write(&new_flag,
(ulong)&(flash_addr_new->flags),
sizeof(flash_addr_new->flags)))
{
@@ -373,24 +374,28 @@ void env_relocate_spec (void)
end_addr_new = ltmp;
}
- if (flash_addr_new->flags != obsolete_flag &&
+ if (flash_addr_new->flags != OBSOLETE_FLAG &&
crc32(0, flash_addr_new->data, ENV_SIZE) ==
flash_addr_new->crc)
{
+ char flag = OBSOLETE_FLAG;
+
gd->env_valid = 2;
flash_sect_protect (0, (ulong)flash_addr_new, end_addr_new);
- flash_write((char *)&obsolete_flag,
+ flash_write(&flag,
(ulong)&(flash_addr_new->flags),
sizeof(flash_addr_new->flags));
flash_sect_protect (1, (ulong)flash_addr_new, end_addr_new);
}
- if (flash_addr->flags != active_flag &&
- (flash_addr->flags & active_flag) == active_flag)
+ if (flash_addr->flags != ACTIVE_FLAG &&
+ (flash_addr->flags & ACTIVE_FLAG) == ACTIVE_FLAG)
{
+ char flag = ACTIVE_FLAG;
+
gd->env_valid = 2;
flash_sect_protect (0, (ulong)flash_addr, end_addr);
- flash_write((char *)&active_flag,
+ flash_write(&flag,
(ulong)&(flash_addr->flags),
sizeof(flash_addr->flags));
flash_sect_protect (1, (ulong)flash_addr, end_addr);
^ permalink raw reply [flat|nested] 5+ messages in thread* [U-Boot-Users] Patch: Changes to support GCC 3.3.x
2004-03-04 14:00 [U-Boot-Users] Patch: Changes to support GCC 3.3.x Yuli Barcohen
@ 2004-03-04 15:14 ` Stephan Linz
2004-03-04 16:08 ` Wolfgang Denk
2004-03-04 17:01 ` Yuli Barcohen
2004-03-14 1:05 ` Wolfgang Denk
1 sibling, 2 replies; 5+ messages in thread
From: Stephan Linz @ 2004-03-04 15:14 UTC (permalink / raw)
To: u-boot
Am Donnerstag, 4. M?rz 2004 15:00 schrieb Yuli Barcohen:
> GCC 3.3.x changed handling of global variables explicitly initialised to
> zero. It puts them to .bss section and not .data as it was in older GCC
> versions. This change breaks environment redundancy feature. Attached
> patch fixes the problem.
short comment/question: Is the result backward compatible to older pre 3.x
gcc ? There are some targets (ex. Nios) with gcc 2.95 support only.
Best Regards,
Stephan Linz
^ permalink raw reply [flat|nested] 5+ messages in thread
* [U-Boot-Users] Patch: Changes to support GCC 3.3.x
2004-03-04 15:14 ` Stephan Linz
@ 2004-03-04 16:08 ` Wolfgang Denk
2004-03-04 17:01 ` Yuli Barcohen
1 sibling, 0 replies; 5+ messages in thread
From: Wolfgang Denk @ 2004-03-04 16:08 UTC (permalink / raw)
To: u-boot
In message <04030416143003.12732@pcj86> you wrote:
> Am Donnerstag, 4. M?rz 2004 15:00 schrieb Yuli Barcohen:
> > GCC 3.3.x changed handling of global variables explicitly initialised to
> > zero. It puts them to .bss section and not .data as it was in older GCC
> > versions. This change breaks environment redundancy feature. Attached
> > patch fixes the problem.
>
> short comment/question: Is the result backward compatible to older pre 3.x
> gcc ? There are some targets (ex. Nios) with gcc 2.95 support only.
AFAICT it is.
Best regards,
Wolfgang Denk
--
Software Engineering: Embedded and Realtime Systems, Embedded Linux
Phone: (+49)-8142-4596-87 Fax: (+49)-8142-4596-88 Email: wd at denx.de
You can love it, change it, or leave it. There is NO other option.
But do not complain - it is your own choice... -- wd
^ permalink raw reply [flat|nested] 5+ messages in thread
* [U-Boot-Users] Patch: Changes to support GCC 3.3.x
2004-03-04 15:14 ` Stephan Linz
2004-03-04 16:08 ` Wolfgang Denk
@ 2004-03-04 17:01 ` Yuli Barcohen
1 sibling, 0 replies; 5+ messages in thread
From: Yuli Barcohen @ 2004-03-04 17:01 UTC (permalink / raw)
To: u-boot
>>>>> Stephan Linz writes:
Stephan> Am Donnerstag, 4. M?rz 2004 15:00 schrieb Yuli Barcohen:
Yuli> GCC 3.3.x changed handling of global variables explicitly
Yuli> initialised to zero. It puts them to .bss section and not
Yuli> .data as it was in older GCC versions. This change breaks
Yuli> environment redundancy feature. Attached patch fixes the
Yuli> problem.
Stephan> short comment/question: Is the result backward compatible
Stephan> to older pre 3.x gcc ? There are some targets (ex. Nios)
Stephan> with gcc 2.95 support only.
Yes, the patch just makes the code to behave the same way with any
version of the compiler.
--
========================================================================
Yuli Barcohen | Phone +972-9-765-1788 | Software Project Leader
yuli at arabellasw.com | Fax +972-9-765-7494 | Arabella Software, Israel
========================================================================
^ permalink raw reply [flat|nested] 5+ messages in thread
* [U-Boot-Users] Patch: Changes to support GCC 3.3.x
2004-03-04 14:00 [U-Boot-Users] Patch: Changes to support GCC 3.3.x Yuli Barcohen
2004-03-04 15:14 ` Stephan Linz
@ 2004-03-14 1:05 ` Wolfgang Denk
1 sibling, 0 replies; 5+ messages in thread
From: Wolfgang Denk @ 2004-03-14 1:05 UTC (permalink / raw)
To: u-boot
In message <16455.13925.369050.724478@gargle.gargle.HOWL> you wrote:
>
> GCC 3.3.x changed handling of global variables explicitly initialised to
> zero. It puts them to .bss section and not .data as it was in older GCC
> versions. This change breaks environment redundancy feature. Attached
> patch fixes the problem.
Added.
CHANGELOG entry missing!!!!
Best regards,
Wolfgang Denk
--
Software Engineering: Embedded and Realtime Systems, Embedded Linux
Phone: (+49)-8142-4596-87 Fax: (+49)-8142-4596-88 Email: wd at denx.de
Why is an average signature file longer than an average Perl script??
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2004-03-14 1:05 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-03-04 14:00 [U-Boot-Users] Patch: Changes to support GCC 3.3.x Yuli Barcohen
2004-03-04 15:14 ` Stephan Linz
2004-03-04 16:08 ` Wolfgang Denk
2004-03-04 17:01 ` Yuli Barcohen
2004-03-14 1:05 ` Wolfgang Denk
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.