FADS and ICU862 Environment problems
The current FADS code does not seem to restore the environment properly, and i can't figure out what it SHOULD do.
Right now, relocate_code only relocates up to the end of text (_init_end), and since CFG_MONITOR_BASE + CONFIG_MONITOR_LEN is after CFG_ENV_ADDR, ENV_IS_EMBEDDED is set.
Since ENV_IS_EMBEDDED is set, env_reloca_spec in flash.c does NOT memcpy(env_addr,CFG_ENV_ADDR,CFG_ENV_SIZE).
There are several refereces to environment[] in start.S that are ifdefed out if CONFIG_FADS or CONFIG_ICU862, which don't look right.
My fix is to remove those ifdefs, and make sure that ENV_IS_EMBEDDED is NOT set by reducing CFG_MONITOR_LEN to not include the environment.
What is the correct behavior?
TIA
Signature · 6 lines
Nye Liu nliu at mrv.com (818) 772-6235x248 "Who would be stupid enough to quote a fictitious character?" -- Don Quixote
Quoted 2 lines · In message <[email protected]> you wrote:
The current FADS code does not seem to restore the environment properly, and i can't figure out what it SHOULD do.
It _should_ work, of course :-)
Quoted 3 lines
Right now,
relocate_codeonly relocates up to the end of text (_init_end), and sinceCFG_MONITOR_BASE+CONFIG_MONITOR_LENis afterCFG_ENV_ADDR,ENV_IS_EMBEDDEDis set.
This is probably a result of our attempt to get rid ofCONFIG_MONITOR_LEN as far as possible. Now it is ONLY used to determine if the environment is embedded, or not.
Quoted 2 lines
Since
ENV_IS_EMBEDDEDis set,env_reloca_specinflash.cdoes NOTmemcpy(env_addr,CFG_ENV_ADDR,CFG_ENV_SIZE).
Correcnt.
Quoted 2 lines
There are several refereces to environment[] in
start.Sthat are ifdefed out ifCONFIG_FADSorCONFIG_ICU862, which don't look right.
Why not? I cannot speak for the FADS, of course. Won't touch no F*** ADS...
Quoted 4 lines
My fix is to remove those ifdefs, and make sure that
ENV_IS_EMBEDDEDis NOT set by reducingCFG_MONITOR_LENto not include the environment.What is the correct behavior?
Setting CFG_MONITOR_LEN correctly is correct. But why removing which #ifdefs ?
Best regards,
Wolfgang Denk
Signature · 7 lines
Software Engineering: Embedded and Realtime Systems, Embedded Linux Phone: (+49)-8142-4596-87 Fax: (+49)-8142-4596-88 Email: wd at denx.de In the beginning, I was made. I didn't ask to be made. No one consul- ted with me or considered my feelings in this matter. But if it brought some passing fancy to some lowly humans as they haphazardly pranced their way through life's mournful jungle, then so be it. - Marvin the Paranoid Android
Quoted 2 lines · Wolfgang Denk
Setting
CFG_MONITOR_LENcorrectly is correct. But why removing which #ifdefs ?
if ENV_IS_EMBEDDED is set, nothing in environment.c gets compiled, and cpu/mpc8xx/start.S has a few
#if defined(CONFIG_FADS) || defined(CONFIG_ICU862)
directives which surround GOT_ENTRY(environment) and GOT(environment) references...
safe to remove these?
btw. wolfgang, this patch is growing larger and larger every week, I'm not sure how easy it is going to be for me to split it up into digestible chunks for you...
Signature · 6 lines
Nye Liu nliu at mrv.com (818) 772-6235x248 "Who would be stupid enough to quote a fictitious character?" -- Don Quixote
Quoted 8 lines · In message <[email protected]> you wrote:
Quoted 2 lines · Wolfgang Denk
Setting
CFG_MONITOR_LENcorrectly is correct. But why removing which #ifdefs ?if
ENV_IS_EMBEDDEDis set, nothing inenvironment.cgets compiled, andcpu/mpc8xx/start.Shas a few
Quoted 6 lines
#if
defined(CONFIG_FADS)||defined(CONFIG_ICU862)directives which surround
GOT_ENTRY(environment)and GOT(environment) references...safe to remove these?
No.
If you look at the u-boot.map file when building for the ICU862 board you can see this:
...
0x40f22b3c __init_end = .
0x40f22b3c __bss_start = ..bss 0x40f22c00 0x417c
...
0x40f26c30 flash_info
0x40f40000 . = ALIGN (0x40000).ppcenv 0x40f40000 0x4000
common/environment.o(.ppcenv)
.ppcenv 0x40f40000 0x4000 common/environment.o
0x40f40000 environment
0x40f44000 _end = .
0x40f44000 PROVIDE (end, .)The #ifdef in "cpu/mpc8xx/start.S" makes sure that clear_bss() does not attempt to clear any memory that belongs to the environment.
Quoted 3 lines
btw. wolfgang, this patch is growing larger and larger every week, I'm not sure how easy it is going to be for me to split it up into digestible chunks for you...
Split it now, and submit any stable parts of it.
Best regards,
Wolfgang Denk
Signature · 4 lines
Software Engineering: Embedded and Realtime Systems, Embedded Linux Phone: (+49)-8142-4596-87 Fax: (+49)-8142-4596-88 Email: wd at denx.de When the ax entered the forest, the trees said, "The handle is one of us!" -- Turkish proverb
Quoted 30 lines · Wolfgang Denk
Quoted 8 lines · In message <[email protected]> you wrote:
Quoted 2 lines · Wolfgang Denk
Setting
CFG_MONITOR_LENcorrectly is correct. But why removing which #ifdefs ?if
ENV_IS_EMBEDDEDis set, nothing inenvironment.cgets compiled, andcpu/mpc8xx/start.Shas a fewQuoted 6 lines
#if
defined(CONFIG_FADS)||defined(CONFIG_ICU862)directives which surround
GOT_ENTRY(environment)and GOT(environment) references...safe to remove these?
No.
If you look at the u-boot.map file when building for the ICU862 board you can see this:
...
0x40f22b3c __init_end = . 0x40f22b3c __bss_start = ..bss
0x40f22c000x417c
...0x40f26c30 flash_info 0x40f40000 . = ALIGN (0x40000)
Quoted 7 lines
.ppcenv
0x40f400000x4000
common/environment.o(.ppcenv)
.ppcenv0x40f400000x4000common/environment.o0x40f40000 environment 0x40f44000 _end = . 0x40f44000 PROVIDE (end, .)
shouldn't the ifdef depend on ENV_IS_EMBEDDED? If that is set, even in the ICU862 case, nothing in environment.c gets compiled (ALL of the code is ifdef'ed out), and "environment" will be unresolved..
Quoted 2 lines
The #ifdef in "
cpu/mpc8xx/start.S" makes sure thatclear_bss()does not attempt to clear any memory that belongs to the environment.
but only if ENV_IS_EMBEDDED is NOT set... unless i'm missing something obvious?
Quoted 5 lines
Quoted 3 lines
btw. wolfgang, this patch is growing larger and larger every week, I'm not sure how easy it is going to be for me to split it up into digestible chunks for you...
Split it now, and submit any stable parts of it.
Too much is tangled together, i will try, but it doesn't look good.
TIA
Signature · 6 lines
Nye Liu nliu at mrv.com (818) 772-6235x248 "Who would be stupid enough to quote a fictitious character?" -- Don Quixote
Quoted 4 lines · In message <[email protected]> you wrote:
shouldn't the ifdef depend on
ENV_IS_EMBEDDED? If that is set, even in the ICU862 case, nothing inenvironment.cgets compiled (ALL of the code is ifdef'ed out), and "environment" will be unresolved..
ENV_IS_EMBEDDED? is not set on the ICU862 board, since the
environment is located after the end of the U-Boot image, but not embedded within it.
Quoted 5 lines
Quoted 2 lines
The #ifdef in "
cpu/mpc8xx/start.S" makes sure thatclear_bss()does not attempt to clear any memory that belongs to the environment.but only if
ENV_IS_EMBEDDEDis NOT set... unless i'm missing something obvious?
I see no discrepancy - ENV_IS_EMBEDDED is NOT set for ICU862
Quoted 3 lines
Quoted 1 line
Split it now, and submit any stable parts of it.
Too much is tangled together, i will try, but it doesn't look good.
I know how that feels. Split splittable parts, then.
Best regards,
Wolfgang Denk
Signature · 3 lines
Software Engineering: Embedded and Realtime Systems, Embedded Linux Phone: (+49)-8142-4596-87 Fax: (+49)-8142-4596-88 Email: wd at denx.de Calm down, it's *__only* ones and zeroes.
Quoted 10 lines · Wolfgang Denk
Quoted 4 lines · In message <[email protected]> you wrote:
shouldn't the ifdef depend on
ENV_IS_EMBEDDED? If that is set, even in the ICU862 case, nothing inenvironment.cgets compiled (ALL of the code is ifdef'ed out), and "environment" will be unresolved..
ENV_IS_EMBEDDED? is not set on the ICU862 board, since the
environment is located after the end of the U-Boot image, but not embedded within it.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
The #ifdef in "
cpu/mpc8xx/start.S" makes sure thatclear_bss()does not attempt to clear any memory that belongs to the environment.but only if
ENV_IS_EMBEDDEDis NOT set... unless i'm missing something obvious?I see no discrepancy -
ENV_IS_EMBEDDEDis NOT set for ICU862
I'm sorry, i must be dense, i'm still not getting this (i do not know anything about the ICU board) ...
So, leave in the ifdef ICU862 case, but what about FADS (and other boards) which may or may not have ENV_IS_EMBEDDED set?
shouldn't they also NOT initialize past the bss into environment.o if ENV_IS_EMBEDDED is not set, but not refer to the "environment" symbol if ENV_IS_EMBEDDED IS set?
i.e.
#if !defined(ENV_IS_EMBEDDED) || defined(CONFIG_ICU862)
Sorry that this is taking so long to explain, but now i'm hopelessly confused ;/
Signature · 6 lines
Nye Liu nliu at mrv.com (818) 772-6235x248 "Who would be stupid enough to quote a fictitious character?" -- Don Quixote
Quoted 8 lines · In message <[email protected]> you wrote:
Quoted 2 lines
I see no discrepancy -
ENV_IS_EMBEDDEDis NOT set for ICU862I'm sorry, i must be dense, i'm still not getting this (i do not know anything about the ICU board) ...
So, leave in the ifdef ICU862 case, but what about FADS (and other boards) which may or may not have
ENV_IS_EMBEDDEDset?
I don't know anything about the FADS board. I tried to use one once. Probably I will never touch one again.
Quoted 3 lines
shouldn't they also NOT initialize past the bss into environment.o if
ENV_IS_EMBEDDEDis not set, but not refer to the "environment" symbol ifENV_IS_EMBEDDEDIS set?
It depends on the flash layout, i. e. where your environment is located.
Quoted 1 line
#if !defined(ENV_IS_EMBEDDED) ||
defined(CONFIG_ICU862)
No. "!defined(ENV_IS_EMBEDDED)" might include situations where the environment is in EEPROM or so.
Quoted 2 lines
Sorry that this is taking so long to explain, but now i'm hopelessly confused ;/
Me too. What's wrong with the existing code? Where does it cause problems?
Best regards,
Wolfgang Denk
Signature · 4 lines
Software Engineering: Embedded and Realtime Systems, Embedded Linux
Phone: (+49)-8142-4596-87 Fax: (+49)-8142-4596-88 Email: wd at denx.de
Cleverness and Style have no place in getting a project completed.
-- Tom ChristiansenQuoted 2 lines · Wolfgang Denk
Me too. What's wrong with the existing code? Where does it cause problems?
in FADS, where ENV_IS_EMBEDDED may or may not be set, depending on how big MONITOR_LENGTH is... (i.e. past FLASH_ENV_BASE or not)
Signature · 6 lines
Nye Liu nliu at mrv.com (818) 772-6235x248 "Who would be stupid enough to quote a fictitious character?" -- Don Quixote
Quoted 6 lines · In message <[email protected]> you wrote:
Quoted 2 lines · Wolfgang Denk
Me too. What's wrong with the existing code? Where does it cause problems?
in FADS, where
ENV_IS_EMBEDDEDmay or may not be set, depending on how bigMONITOR_LENGTHis... (i.e. pastFLASH_ENV_BASEor not)
But this is exactly the point of defining MONITOR_LENGTH: _if_ the environment shall be embedded in the U-Boot image (ENV_IS_EMBEDDED will be set), then MONITOR_LENGTH must be big enough to include the environment; and if the environment shall be in a separate flash sector, then MONITOR_LENGTH must be small enough NOT to include the environment.
I don't know who designed it that way (because I don't care about the FADS board), but according to "board/fads/u-boot.lds" the environment on this board is aligned on a 256kB boundary _after_ the U-Boot image. So MONITOR_LENGTH must not include the environment, and ENV_IS_EMBEDDED shall not be set.
Best regards,
Wolfgang Denk
Signature · 3 lines
Software Engineering: Embedded and Realtime Systems, Embedded Linux Phone: (+49)-8142-4596-87 Fax: (+49)-8142-4596-88 Email: wd at denx.de This is now. Later is later.
Quoted 15 lines · Wolfgang Denk
Quoted 6 lines · In message <[email protected]> you wrote:
Quoted 2 lines · Wolfgang Denk
Me too. What's wrong with the existing code? Where does it cause problems?
in FADS, where
ENV_IS_EMBEDDEDmay or may not be set, depending on how bigMONITOR_LENGTHis... (i.e. pastFLASH_ENV_BASEor not)But this is exactly the point of defining
MONITOR_LENGTH: _if_ the environment shall be embedded in the U-Boot image (ENV_IS_EMBEDDEDwill be set), thenMONITOR_LENGTHmust be big enough to include the environment; and if the environment shall be in a separate flash sector, thenMONITOR_LENGTHmust be small enough NOT to include the environment.
Quoted 5 lines
I don't know who designed it that way (because I don't care about the FADS board), but according to "
board/fads/u-boot.lds" the environment on this board is aligned on a 256kB boundary _after_ the U-Boot image. SoMONITOR_LENGTHmust not include the environment, andENV_IS_EMBEDDEDshall not be set.
In which case NOTHING in environment.c is compiled, and "environment" goes unresolved....
should it JUST be #ifdef CONFIG_ICU862?
Signature · 6 lines
Nye Liu nliu at mrv.com (818) 772-6235x248 "Who would be stupid enough to quote a fictitious character?" -- Don Quixote
Quoted 17 lines · Wolfgang Denk
No.
If you look at the u-boot.map file when building for the ICU862 board you can see this:
...
0x40f22b3c __init_end = . 0x40f22b3c __bss_start = ..bss
0x40f22c000x417c
...0x40f26c30 flash_info 0x40f40000 . = ALIGN (0x40000).ppcenv
0x40f400000x4000
common/environment.o(.ppcenv)
.ppcenv0x40f400000x4000common/environment.o
Quoted 6 lines
0x40f40000 environment 0x40f44000 _end = . 0x40f44000 PROVIDE (end, .)The #ifdef in "
cpu/mpc8xx/start.S" makes sure thatclear_bss()does not attempt to clear any memory that belongs to the environment.
but later, you write:
Quoted 1 line
I see no discrepancy -
ENV_IS_EMBEDDEDis NOT set for ICU862
how does environment.o have any data; it is totally ifdef'ed out if ENV_IS_EMBEDDED is not set...?
I am totally confused now ;/
Signature · 6 lines
Nye Liu nliu at mrv.com (818) 772-6235x248 "Who would be stupid enough to quote a fictitious character?" -- Don Quixote
Quoted 9 lines · In message <[email protected]> you wrote:
Quoted 6 lines
I don't know who designed it that way (because I don't care about the FADS board), but according to "
board/fads/u-boot.lds" the environment on this board is aligned on a 256kB boundary _after_ the U-Boot image. SoMONITOR_LENGTHmust not include the environment, andENV_IS_EMBEDDEDshall not be set.In which case NOTHING in
environment.cis compiled, and "environment" goes unresolved....
But this is normal for a non-embedded environment. If you don;t embed it with the U-Boot image it will not be initialized after installing the image anyway (because it is not included), so there is little sense initializing it at compile time.
There are several other options: in cases where the environment is directly adjecent to the U-Boot image (it looks as if the FADS is such a configuration) you can "include" the environment, producing a bigger image which then contains an initialized environment.
It is up for the board maintainer to decide what he wants.
Best regards,
Wolfgang Denk
Signature · 3 lines
Software Engineering: Embedded and Realtime Systems, Embedded Linux Phone: (+49)-8142-4596-87 Fax: (+49)-8142-4596-88 Email: wd at denx.de All I ask is a chance to prove that money can't make me happy.
Quoted 5 lines · In message <[email protected]> you wrote:
Quoted 2 lines
I see no discrepancy -
ENV_IS_EMBEDDEDis NOT set for ICU862how does environment.o have any data; it is totally ifdef'ed out if
ENV_IS_EMBEDDEDis not set...?
It does not. On the ICU862 the U-Boot image is at the lower end of the enfironment, while the environment is at the upper end (IIRC this board uses top boot sector flash memory). The environment does NOT get installed when installing the U-Boot image. So there is no need to put any initialized data in it.
It will be initialized as soon as the user types "saveenv" for the first time. Until then, the default environment is used.
Quoted 1 line
I am totally confused now ;/
I'm sorry.
Best regards,
Wolfgang Denk
Signature · 4 lines
Software Engineering: Embedded and Realtime Systems, Embedded Linux Phone: (+49)-8142-4596-87 Fax: (+49)-8142-4596-88 Email: wd at denx.de "Whoever undertakes to set himself up as a judge of Truth and Know- ledge is shipwrecked by the laughter of the gods." - Albert Einstein
Quoted 10 lines · Wolfgang Denk
Quoted 9 lines · In message <[email protected]> you wrote:
Quoted 6 lines
I don't know who designed it that way (because I don't care about the FADS board), but according to "
board/fads/u-boot.lds" the environment on this board is aligned on a 256kB boundary _after_ the U-Boot image. SoMONITOR_LENGTHmust not include the environment, andENV_IS_EMBEDDEDshall not be set.In which case NOTHING in
environment.cis compiled, and "environment" goes unresolved....
unresolved, meaning:
ld -Bstatic -T /home/nyet/src/local/u-boot/board/fads/u-boot.lds -Ttext 0x02800000 -n cpu/mpc8xx/start.o \
--start-group board/fads/libfads.a cpu/mpc8xx/libmpc8xx.a lib_ppc/libppc.a fs/jffs2/libjffs2.a fs/fdos/libfdos.a net/libnet.a disk/libdisk.a rtc/librtc.a dtt/libdtt.a drivers/libdrivers.a post/libpost.a post/cpu/libcpu.a common/libcommon.a lib_generic/libgeneric.a --end-group \
-Map u-boot.map -o u-boot
cpu/mpc8xx/start.o(.got2+0x24):/local/nyet-build/u-boot-mrv/cpu/mpc8xx/start.S:99: undefined reference to `environment'
make: *** [u-boot] Error 1
Quoted 21 lines
But this is normal for a non-embedded environment. If you don;t embed it with the U-Boot image it will not be initialized after installing the image anyway (because it is not included), so there is little sense initializing it at compile time.
There are several other options: in cases where the environment is directly adjecent to the U-Boot image (it looks as if the FADS is such a configuration) you can "include" the environment, producing a bigger image which then contains an initialized environment.
It is up for the board maintainer to decide what he wants.
Best regards,
Wolfgang Denk
Signature · 3 lines
Software Engineering: Embedded and Realtime Systems, Embedded Linux Phone: (+49)-8142-4596-87 Fax: (+49)-8142-4596-88 Email: wd at denx.de All I ask is a chance to prove that money can't make me happy.
Signature · 6 lines
Nye Liu nliu at mrv.com (818) 772-6235x248 "Who would be stupid enough to quote a fictitious character?" -- Don Quixote
Quoted 9 lines · In message <[email protected]> you wrote:
unresolved, meaning:
ld -Bstatic -T
/home/nyet/src/local/u-boot/board/fads/u-boot.lds-Ttext0x02800000-ncpu/mpc8xx/start.o\
--start-group board/fads/libfads.a cpu/mpc8xx/libmpc8xx.a lib_ppc/libppc.afs/jffs2/libjffs2.afs/fdos/libfdos.anet/libnet.adisk/libdisk.a rtc/librtc.a dtt/libdtt.adrivers/libdrivers.apost/libpost.a post/cpu/libcpu.a common/libcommon
.a lib_generic/libgeneric.a --end-group \
-Map u-boot.map -o u-boot
cpu/mpc8xx/start.o(.got2+0x24):/local/nyet-build/u-boot-mrv/cpu/mpc8xx/start.S:99: undefined reference to `environment'
make: *** [u-boot] Error 1
Strange. I see no such problems:
-> MAKEALL FADS823 FADS850SAR FADS860T ICU862
rm -f include/config.h include/config.mk
Configuring for FADS823 board...
text data bss dec hex filename
95364 323632 16372 435368 6a4a8 u-boot
rm -f include/config.h include/config.mk
Configuring for FADS850SAR board...
text data bss dec hex filename
87028 284488 16296 387812 5eae4 u-boot
rm -f include/config.h include/config.mk
Configuring for FADS860T board...
text data bss dec hex filename
87352 38776 16336 142464 22c80 u-boot
rm -f include/config.h include/config.mk
Configuring for ICU862 board...
text data bss dec hex filename
106712 47928 16764 171404 29d8c u-boot
No errors, no warnings.
I think I lost you. Please let's restart from zero.
What exactly is your problem with the current code?
Best regards,
Wolfgang Denk
Signature · 4 lines
Software Engineering: Embedded and Realtime Systems, Embedded Linux Phone: (+49)-8142-4596-87 Fax: (+49)-8142-4596-88 Email: wd at denx.de "We Americans, we're a simple people... but piss us off, and we'll bomb your cities." - Robin Williams, _Good Morning Vietnam_
Quoted 31 lines · Wolfgang Denk
Quoted 9 lines · In message <[email protected]> you wrote:
unresolved, meaning:
ld -Bstatic -T
/home/nyet/src/local/u-boot/board/fads/u-boot.lds-Ttext0x02800000-ncpu/mpc8xx/start.o\
--start-group board/fads/libfads.a cpu/mpc8xx/libmpc8xx.a lib_ppc/libppc.afs/jffs2/libjffs2.afs/fdos/libfdos.anet/libnet.adisk/libdisk.a rtc/librtc.a dtt/libdtt.adrivers/libdrivers.apost/libpost.a post/cpu/libcpu.a common/libcommon
.a lib_generic/libgeneric.a --end-group \
-Map u-boot.map -o u-boot
cpu/mpc8xx/start.o(.got2+0x24):/local/nyet-build/u-boot-mrv/cpu/mpc8xx/start.S:99: undefined reference to `environment'
make: *** [u-boot] Error 1Strange. I see no such problems:
-> MAKEALL FADS823 FADS850SAR FADS860T ICU862 rm -f
include/config.hinclude/config.mkConfiguring for FADS823 board...
text data bss dec hex filename
95364 323632 16372 435368 6a4a8 u-boot
rm -finclude/config.hinclude/config.mkConfiguring for FADS850SAR board...
text data bss dec hex filename
87028 284488 16296 387812 5eae4 u-boot
rm -finclude/config.hinclude/config.mkConfiguring for FADS860T board...
text data bss dec hex filename
87352 38776 16336 142464 22c80 u-boot
rm -finclude/config.hinclude/config.mkConfiguring for ICU862 board...
text data bss dec hex filename
106712 47928 16764 171404 29d8c u-boot
Quoted 5 lines
No errors, no warnings.
I think I lost you. Please let's restart from zero.
What exactly is your problem with the current code?
Ok. To summarize:
If ENV_IS_EMBEDDED is set in FADS, it does not get copied during relocation due to common/env_flash.c
If ENV_IS_EMBEDDED is NOT set (by reducing MONITOR_LEN to not include ENV), i get this error.
Signature · 6 lines
Nye Liu nliu at mrv.com (818) 772-6235x248 "Who would be stupid enough to quote a fictitious character?" -- Don Quixote
Quoted 8 lines · In message <[email protected]> you wrote:
Ok. To summarize:
If
ENV_IS_EMBEDDEDis set in FADS, it does not get copied during relocation due tocommon/env_flash.cIf
ENV_IS_EMBEDDEDis NOT set (by reducingMONITOR_LENto not include ENV), i get this error.
Sorry, I don't know much about the FADS (and actually I really don;t want to care about broken hardware like this; but anyway).
Which specific board configuration are you using?
Checking "include/configs/FADS860T.h" I see:
#define CFG_MONITOR_LEN (272 << 10) /* Reserve 272 kB for Monitor */
...
#define CFG_ENV_IS_IN_FLASH 1 #define CFG_ENV_OFFSET 0x00040000 #define CFG_ENV_SIZE 0x4000 /* Total Size of Environment Sector */ #define CFG_ENV_SECT_SIZE 0x40000 /* see README - env sector total size */
After building the board "u-boot.map" says:
...
.text 0x02800000 0x15538
cpu/mpc8xx/start.o(.text)
.text 0x02800000 0x2468 cpu/mpc8xx/start.o
0x028001c8 _start_of_vectors
...
0x0281b77c __init_end = .
0x0281b77c __bss_start = ....
.ppcenv 0x02840000 0x4000
common/environment.o(.ppcenv)
.ppcenv 0x02840000 0x4000 common/environment.o
0x02840000 environment
0x02844000 _end = .
0x02844000 PROVIDE (end, .)Address of section .text set to 0x2800000
...
So the text segment starts at 0x02800000, and one sector (or 256 kB) later @ 0x02840000 the environment follows. CFG_MONITOR_LEN is bigger than __bss_start, so ENV_IS_EMBEDDED should be set.
You are right, the environment will NOT be copied in function env_relocate_spec() in "common/env_flash.c", but it _will_ be copied
in function env_relocate() in "common/env_common.c" (assuminggd->env_valid is zero).
I think this is correct. What am I missing?
Best regards,
Wolfgang Denk
Signature · 3 lines
Software Engineering: Embedded and Realtime Systems, Embedded Linux Phone: (+49)-8142-4596-87 Fax: (+49)-8142-4596-88 Email: wd at denx.de grep me no patterns and I'll tell you no lines.
Quoted 10 lines · Wolfgang Denk
Quoted 8 lines · In message <[email protected]> you wrote:
Ok. To summarize:
If
ENV_IS_EMBEDDEDis set in FADS, it does not get copied during relocation due tocommon/env_flash.cIf
ENV_IS_EMBEDDEDis NOT set (by reducingMONITOR_LENto not include ENV), i get this error.
.... snip
Quoted 7 lines
You are right, the environment will NOT be copied in function
env_relocate_spec()in "common/env_flash.c", but it _will_ be copied
in functionenv_relocate()in "common/env_common.c" (assuminggd->env_validis zero).I think this is correct. What am I missing?
but that is the default environment that is copied, not the saved copy stored via saveenv? When is the saved environment restored? relocate_code() never copies it since it is AFTER __init_end due to the way u-boot.lds locates environment.o after .bss
Signature · 6 lines
Nye Liu nliu at mrv.com (818) 772-6235x248 "Who would be stupid enough to quote a fictitious character?" -- Don Quixote
Quoted 7 lines · In message <[email protected]> you wrote:
Quoted 2 lines
I think this is correct. What am I missing?
but that is the default environment that is copied, not the saved copy stored via saveenv? When is the saved environment restored?
relocate_code()never copies it since it is AFTER__init_enddue to the wayu-boot.ldslocates environment.o after .bss
Argh... now I see. Well, I think you are right.
Best regards,
Wolfgang Denk
Signature · 4 lines
Software Engineering: Embedded and Realtime Systems, Embedded Linux Phone: (+49)-8142-4596-87 Fax: (+49)-8142-4596-88 Email: wd at denx.de Generally speaking, there are other ways to accomplish whatever it is that you think you need ... - Doug Gwyn
[U-Boot-Users] a small problem
In reply to Wolfgang DenkIn post/memory.c file
int memory_post_test (int flags)
{
int ret = 0;
DECLARE_GLOBAL_DATA_PTR;
bd_t *bd = gd->bd;
unsigned long memsize = (bd->bi_memsize >= 256 << 20 ?
256 << 20 : bd->bi_memsize) - (1 << 20);
if (flags & POST_POWERFAIL) {
ret = memory_post_tests (CFG_SDRAM_BASE, memsize);
} else { /* POST_POWERNORMAL */
unsigned long i;
for (i = 0; i < (memsize >> 20) && ret == 0; i++) {
if (ret == 0)
ret = memory_post_tests (i << 20, 0x800);
if (ret == 0)
ret = memory_post_tests ((i << 20) + 0xff800, 0x800);
}
}
return ret;
}I think the line should be:
unsigned long memsize = (bd->bi_memsize >= 257 << 20 ? 256 << 20 : bd->bi_memsize) - (1 << 20);
Yabo Ding
[email protected]
[U-Boot-Users] Re: a small problem
Quoted 2 lines · In message <[email protected]> you wrote:
In
post/memory.cfile
...
Quoted 2 lines
unsigned long memsize = (bd->bi_memsize >= 256 << 20 ? 256 << 20 : bd->bi_memsize) - (1 << 20);
...
Quoted 4 lines
I think the line should be:
unsigned long memsize = (bd->bi_memsize >= 257 << 20 ? 256 << 20 : bd->bi_memsize) - (1 << 20);
Will you please explain what makes you think so?
Best regards,
Wolfgang Denk
Signature · 4 lines
Software Engineering: Embedded and Realtime Systems, Embedded Linux Phone: (+49)-8142-4596-87 Fax: (+49)-8142-4596-88 Email: [email protected] ...though his invention worked superbly -- his theory was a crock of sewage from beginning to end. - Vernor Vinge, "The Peace War"
[U-Boot-Users] Re: a small problem
Sorry, I have a mistake about the parenthesis' position.
Yabo Ding
Quoted 24 lines · Wolfgang Denk
Quoted 1 line · In message <[email protected]> you wrote:
In
post/memory.cfile...
Quoted 2 lines
unsigned long memsize = (bd->bi_memsize >= 256 << 20 ? 256 << 20 : bd->bi_memsize) - (1 << 20);...
Quoted 4 lines
I think the line should be:
unsigned long memsize = (bd->bi_memsize >= 257 << 20 ? 256 << 20 : bd->bi_memsize) - (1 << 20);Will you please explain what makes you think so?
Best regards,
Wolfgang Denk
Quoted 10 lines · Wolfgang Denk
Quoted 7 lines · In message <[email protected]> you wrote:
Quoted 2 lines
I think this is correct. What am I missing?
but that is the default environment that is copied, not the saved copy stored via saveenv? When is the saved environment restored?
relocate_code()never copies it since it is AFTER__init_enddue to the wayu-boot.ldslocates environment.o after .bssArgh... now I see. Well, I think you are right.
let me know when you come up with a recommended solution; for now I have removed those ifdef's in start.S and reduced MONITOR_LEN such that ENV_IS_EMBEDDED is not set.
Suggestions for the ENV_IS_EMBEDDED case?
Signature · 6 lines
Nye Liu nliu at mrv.com (818) 772-6235x248 "Who would be stupid enough to quote a fictitious character?" -- Don Quixote