environment not being used
Hi,
I am using U-boot on our FPGA based board. Currently, its not possible to execute instructions directly from flash on our board since our flash device is configured as an 8-bit device and it is connected to a 32-bit processor bus.
To get around this, we have a small program which is stored in FPGA bitstream and runs in FPGA on-chip memory (called BRAM). This program copies u-boot binary image from flash to sdram and jumps to it. This allows U-boot to run. However the problem is that the environment variables saved in flash are not being used even though U-boot has been configured with the CFG_ENV_IS_IN_FLASH option turned on. CFG_FLASH_BASE has been set to the flash base address of u-boot and when I use saveenv the environment is saved at the proper offset CFG_ENV_OFFSET. The only thing thats a bit different for my U-boot configuration is that CFG_MONITOR_BASE is set to the sdram base address where U-boot starts executing from instead of being set to CFG_FLASH_BASE.
Any ideas why the environment variables in flash do not get used?
Thanks,
Shamile
Quoted 13 lines · In message <[email protected]> you wrote:
To get around this, we have a small program which is stored in FPGA bitstream and runs in FPGA on-chip memory (called BRAM). This program copies u-boot binary image from flash to sdram and jumps to it. This allows U-boot to run. However the problem is that the environment variables saved in flash are not being used even though U-boot has been configured with the
CFG_ENV_IS_IN_FLASHoption turned on.CFG_FLASH_BASEhas been set to the flash base address of u-boot and when I use saveenv the environment is saved at the proper offsetCFG_ENV_OFFSET. The only thing thats a bit different for my U-boot configuration is thatCFG_MONITOR_BASEis set to the sdram base address where U-boot starts executing from instead of being set toCFG_FLASH_BASE.
Normally U-Boot attempts to read the environment when starting from the same position in memory where it will save it to when you issue a "saveenv" command. You will have to modify U-Boot such that the initialization reads from the "fixed" copy in RAM, while "saveenv" saves to the address in flash, performing the 16-bit-expansion needed for your setup. It seems obvious that a plain copy as usuall cannot work on your system.
Best regards,
Wolfgang Denk
Signature · 4 lines
See us @ Embedded World, Nuremberg, Feb 17 - 19, Hall 12.0 Booth 440
Phone: (+49)-8142-4596-87 Fax: (+49)-8142-4596-88 Email: wd at denx.de
Drun'? 'm not drun'! You woudn' dare call m' drun' if I was sober!
- Terry Pratchett, _Men at Arms_Hi,
Just as a follow up, I conclude that U-boot treats flash reads exactly as sdram reads i.e. 32-bit accesses. So its not just about the environment variables. Most of the flash-based U-boot functionality wouldn't work for us unless we modify all the commands that have access to flash e.g md, imiinfo, bootm etc. A hardware fix (an 8-bit bus to our byte-mode flash chip) seems like the right way to go.
Shamile
Quoted 33 lines · Wolfgang Denk
Quoted 13 lines · In message <[email protected]> you wrote:
To get around this, we have a small program which is stored in FPGA bitstream and runs in FPGA on-chip memory (called BRAM). This program copies u-boot binary image from flash to sdram and jumps to it. This allows U-boot to run. However the problem is that the environment variables saved in flash are not being used even though U-boot has been configured with the
CFG_ENV_IS_IN_FLASHoption turned on.CFG_FLASH_BASEhas been set to the flash base address of u-boot and when I use saveenv the environment is saved at the proper offsetCFG_ENV_OFFSET. The only thing thats a bit different for my U-boot configuration is thatCFG_MONITOR_BASEis set to the sdram base address where U-boot starts executing from instead of being set toCFG_FLASH_BASE.Normally U-Boot attempts to read the environment when starting from the same position in memory where it will save it to when you issue a "saveenv" command. You will have to modify U-Boot such that the initialization reads from the "fixed" copy in RAM, while "saveenv" saves to the address in flash, performing the 16-bit-expansion needed for your setup. It seems obvious that a plain copy as usuall cannot work on your system.
Best regards,
Wolfgang Denk
Signature · 4 lines
See us @ Embedded World, Nuremberg, Feb 17 - 19, Hall 12.0 Booth 440 Phone: (+49)-8142-4596-87 Fax: (+49)-8142-4596-88 Email: wd at denx.de Drun'? 'm not drun'! You woudn' dare call m' drun' if I was sober! - Terry Pratchett, _Men at Arms_
Quoted 3 lines · In message <[email protected]> you wrote:
Just as a follow up, I conclude that U-boot treats flash reads exactly as sdram reads i.e. 32-bit accesses. So its not just about the
This is not correct.
U-Boot accesses the flash just the way how you configure your memory controller for flash accesses.
Quoted 2 lines
to flash e.g md, imiinfo, bootm etc. A hardware fix (an 8-bit bus to our byte-mode flash chip) seems like the right way to go.
Either you or me must be missing something. Why don't you just configure U-Boot for a 8 bit flash device then?
Best regards,
Wolfgang Denk
Signature · 4 lines
See us @ Embedded World, Nuremberg, Feb 17 - 19, Hall 12.0 Booth 440 Phone: (+49)-8142-4596-87 Fax: (+49)-8142-4596-88 Email: wd at denx.de Real Programmers always confuse Christmas and Halloween because OCT 31 == DEC 25 ! - Andrew Rutherford (andrewr at ucs.adelaide.edu.au)
Quoted 9 lines · Wolfgang Denk
Quoted 3 lines · In message <[email protected]> you wrote:
Just as a follow up, I conclude that U-boot treats flash reads exactly as sdram reads i.e. 32-bit accesses. So its not just about the
This is not correct.
U-Boot accesses the flash just the way how you configure your memory controller for flash accesses.
Exactly. The memory controller is in FPGA. Its been configured to have a data bus width of 8 bits to the flash memory device. Consequently if a 32 bit access is requested, the first 8 bits are fine and the rest are garbage.
Quoted 6 lines
Quoted 3 lines
to flash e.g md, imiinfo, bootm etc. A hardware fix (an 8-bit bus to our byte-mode flash chip) seems like the right way to go.
Either you or me must be missing something. Why don't you just configure U-Boot for a 8 bit flash device then?
I do have the flash device configured as an 8-bit device and flash memory writes are for byte mode in the flash driver. So writes to flash are fine as long as I use cp.b instead of just cp.
As far as reads are concerned, since the flash device is in byte mode I can only access 8 bits in one flash memory read cycle. However U-boot commands like md, bootm, iminfo, crc32 etc access 32 bits in one flash memory read cycle (md.b is an exception).
So those commands would work if I have for example 4 byte-mode flash devices and the memory controller concatenates the data thats read from those devices. But I only have one byte-mode flash device.
Quoted 10 lines
Best regards,
Wolfgang Denk
Signature · 4 lines
See us @ Embedded World, Nuremberg, Feb 17 - 19, Hall 12.0 Booth 440 Phone: (+49)-8142-4596-87 Fax: (+49)-8142-4596-88 Email: wd at denx.de Real Programmers always confuse Christmas and Halloween because OCT 31 == DEC 25 ! - Andrew Rutherford (andrewr at ucs.adelaide.edu.au)
Quoted 8 lines · In message <[email protected]> you wrote:
Quoted 3 lines
U-Boot accesses the flash just the way how you configure your memory controller for flash accesses.
Exactly. The memory controller is in FPGA. Its been configured to have a data bus width of 8 bits to the flash memory device. Consequently if a 32 bit access is requested, the first 8 bits are fine and the rest are garbage.
Then your memory controller is broken.
Best regards,
Wolfgang Denk
Signature · 4 lines
See us @ Embedded World, Nuremberg, Feb 17 - 19, Hall 12.0 Booth 440 Phone: (+49)-8142-4596-87 Fax: (+49)-8142-4596-88 Email: wd at denx.de To the systems programmer, users and applications serve only to provide a test load.