BALATON Zoltan <bala...@eik.bme.hu> writes: > On Mon, 18 Feb 2019, Markus Armbruster wrote: >> Machine "ref405ep" maps its flash memory at address 2^32 - image size. >> Image size is rounded up to the next multiple of 64KiB. Useless, >> because pflash_cfi02_realize() fails with "failed to read the initial >> flash content" unless the rounding is a no-op. >> >> If the image size exceeds 0x80000 Bytes, we overlap first SRAM, then >> other stuff. No idea how that would play out, but a useful outcomes >> seem unlikely. >> >> Map the flash memory at fixed address 0xFFF80000 with size 512KiB, >> regardless of image size, to match the physical hardware. > > If PPC405 behaves the same as PPC440 and starts at 0xfffffffc then > this won't boot. It's maybe better to keep 2^32 - image_size but > assert image is not bigger than 512kB. But I don't know anything about > these boards so just sharing this comment for your consideration. I'm > fine with any decision you take.
If the image is smaller than 512KiB, pflash_cfi02_realize() fails with "failed to read the initial flash content". Alex Bennée has a patch that'll make it fail for any size mismatch, with a much nicer error message. I like it; silently truncating firmware images is unlikely to be useful. For what it's worth, my patch brings this board into line with most other boards: create flash memory of fixed size at a fixed address, matching the physical machine we emulate.