Hi All, I've been thinking about where U-Boot runs in memory on my sc520 based board and it appears that it is always executing from ROM and I started pondering if I should attempt to relocate U-Boot into RAM.
Note: Please correct me if I am mistaken and U-Boot does indeed run from RAM on i386 / sc520 This, of course, would give me the benefit of having unfettered access to the flash that U-Boot is located on for things like environment storage, upgrade in place etc. My thought is to not actually 'Relocate' U-Boot but to use a very handy feature of the sc520 - The ability to map the BOOTCS (Boot ROM Chip Select) to anywhere in memory using a PAR (Programmable Address Region). Currently, BOOTCS is mapped from 0x38000000. My board has 512k Boot Flash, so the BOOTCS PAR is 0x38000000 - 0x3807ffff. With U-Boot in the upper 256k (puts the reset vector at fff0 for cpu startup), this puts u-boot code at 0x38040000 (TEXT_BASE in config.mk). The SDRAM for my board is 128MB starting at 0x00000000 (ending at 0x08000000) My thought is to change TEXT_BASE to 0x08040000, keep BOOTCS at 0x38000000, copy 0x38040000 - 0x3807ffff to 0x08040000 - 0x0807ffff as soon as I enter protected mode (and have access to all memory) and have set up the SDRAM controller etc, then jump directly to the copy in RAM. I would then have two copies of u-boot in memory - One in RAM at 0x08040000 and one in ROM at 0x38040000. One problem I can think of is that the linker will point all the jump labels into RAM - not an issue for the 16-bit code which uses relative jumps, but I think I may run into issues during the real to protected mode transition (far jump) which, by definition, has to happen before I get access to the full memory space. How do I tell the linker that these jumps should target 0x38040000+ and not 0x08040000+ ? Does all this sound logical? viable? sensible? practical? Regards, Graeme _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot