From: Wolter Kamphuis Date: Mon, 01 Dec 2003 18:10:24 +0100 Subject: [U-Boot-Users] reading environment from flash fails In-Reply-To: <20031128184207.E0B39C5F5F@atlas.denx.de> References: <20031128184207.E0B39C5F5F@atlas.denx.de> Message-ID: <3FCB7600.6040402@wkamphuis.student.utwente.nl> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Wolfgang Denk wrote: > In message <3FC7802B.7010506@wkamphuis.student.utwente.nl> you wrote: > >>We define: >>#define CFG_MONITOR_BASE 0xFFF00000 >>#define CFG_ENV_SECT_SIZE (128*1024) >>#define CFG_ENV_SIZE (2*1024) >>#define CFG_ENV_ADDR (CFG_MONITOR_BASE + CFG_ENV_SECT_SIZE - CFG_ENV_SIZE) > > > The CFG_ENV_ADDR definition makes no sense to me. If it results in > the intended value than by pure chance, not by any deeper logic. > > U-boot is located at 0xfff00000 up to 0xfff20000. I would like to save my environment in the same sector as u-boot, but in the last two Kb's, thus at 0xfff1f800-0xfff20000 (0xfff00000 + 0x20000 - 0x800 = 0xfff1f800 = starting address for env) >>Shouldn't gd->env_addr be equal to CFG_ENV_ADDR? Now my saved >>environment settings aren't read and after a reset all settings are >>restored to the defaults. > > > I don't know which board you're talking about, and I don't understand > how your patch and your question are related to each other. From this > message it sounds as if you want to put the environment in flash, but > your code #defines CFG_ENV_IS_IN_NVRAM (at least in some cases). > > Sorry, forgot to tell. This patch is for 3 boards, the QS823, QS850 and the QS860T. We only got the QS850 boards so I'm only talking about the QS850. The QS850 only has flash ram, no nvram. The board I'm testing on has 8Mb flash but we also got boards with 4Mb flash. Full spec's can be found at http://www.snmc.com/prod_qs850.html >>Could someone give me a tip pointer where to look for a solution? I have >>a feeling it has something to do with the u-boot.lds file but I don't >>know what. > > > Of course the linker script must match your flash layout. > > Ok, now the problem is I don't know how to tell the linker where to store the environment. If I add . = env_offset; common/environment.o (.text) to the u-boot.lds I get "cannot move location counter backwards (from fff07b10 to 0061f800)". Where does the 0061f800 comes from? If I force the offset to 0xfff1f800 and add . = 0xfff10000; common/environment.o (.text) to the u-boot.lds I get "cannot move location counter backwards (from fff07b10 to ffe1f800)". Anyone here knows why 0xfff10000 becomes ffe1f800? Letting u-boot store its environment outside the u-boot sector (<0xfff0000) works perfectly but will cost me a flash sector dedicated for the environment. I rather do without since I realy need that space. thanks in advance, Wolter Kamphuis