Received: from eggs.gnu.org ([2001:4830:134:3::10]:55969) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VYa9z-0004OU-HC for qemu-devel@nongnu.org; Tue, 22 Oct 2013 07:30:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VYa9u-0003Hn-Eq for qemu-devel@nongnu.org; Tue, 22 Oct 2013 07:30:03 -0400 Received: from mail-lb0-x22a.google.com ([2a00:1450:4010:c04::22a]:58224) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VYa9t-0003HY-VD for qemu-devel@nongnu.org; Tue, 22 Oct 2013 07:29:58 -0400 Received: by mail-lb0-f170.google.com with SMTP id u14so3519502lbd.15 for ; Tue, 22 Oct 2013 04:29:56 -0700 (PDT) Date: Tue, 22 Oct 2013 15:26:55 +0400 From: Antony Pavlov Message-Id: <20131022152655.d749a1064f5c34972be6c822@gmail.com> In-Reply-To: References: <1378537467-13471-1-git-send-email-antonynpavlov@gmail.com> <1378537467-13471-3-git-send-email-antonynpavlov@gmail.com> <526031BD.9030204@g3gg0.de> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [RFC v5 2/5] hw/arm/digic: prepare DIGIC-based boards support List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Alex Dumitrache , Peter Crosthwaite , Giovanni Condello , g3gg0 , QEMU Developers , Georg Hofstetter , Paul Brook , Paolo Bonzini , Andreas =?ISO-8859-1?Q?F=E4rber?= On Thu, 17 Oct 2013 20:17:15 +0100 Peter Maydell wrote: > On 17 October 2013 19:51, Georg Hofstetter wrote: > > flash (ROM1) on these cameras starts at 0xF8000000 and is either > > 0x00800000, 0x01000000 ox 0x02000000 large. just like with every > > chip-selected memory, where the CS/EN line is selected by address masks, > > addressing beyond the size memory repeats the content over and over. > > > > ROM0 (0xF0000000) is rarely used. > > > > The ARM in DIGIC has the high vectors selected by hardware and so the > > reset vector is 0xFFFF0000. There you will find a bootloader. > > Due to the memories repeating over and over starting from 0xF8000000, > > the CPU will read from 0xF87F0000, 0xF8FF0000 or 0xF9FF0000, depending > > on flash size (see above). > > > > This kind of addressing beyond real flash end and wrapping over is > > intentionally used by canon in multiple places - even in the main > > firmware and when reflashing. > > Some blocks are reflashed on a regular basis. They are used for > > properties, which are the configuration area. >=20 > Thanks for this explanation of the hardware. >=20 > > If you want to make the emulator behave like the real hardware, then you > > have to: > > > > - reset to 0xFFFF0000 >=20 > Yep. This implies having a cpu property corresponding to "enable > hivecs from bootup" (matching the h/w config signal), and making > sure cpu reset honours it; that's fairly easy. >=20 > > - place ROM0 at 0xF0000000 > > - place ROM1 at 0xF8000000 > > - make the memory subsystem address correctly: (pseudocode) > > if((virt_addr & 0xF8000000) =3D=3D 0xF0000000) > > { > > real_addr =3D 0xF0000000 | (virt_addr & (rom0_size - 1)); > > } > > if((virt_addr & 0xF8000000) =3D=3D 0xF8000000) > > { > > real_addr =3D 0xF8000000 | (virt_addr & (rom1_size - 1)); > > } >=20 > The easy way to do this is just to use memory region aliases > to repeat the ROM through the whole area; you can do that > in the board model without having to mess with the memory > subsystem itself. Hmm. The current DIGIC patchseries already has the functionality like this! Here is my console log: $ xxd -g 1 -l 0x40 ./canon-a1100-rom1.bin=20 0000000: 12 00 00 ea fe ff ff ea fe ff ff ea fe ff ff ea ................ 0000010: fe ff ff ea fe ff ff ea fe ff ff ea fe ff ff ea ................ 0000020: 62 61 72 65 62 6f 78 00 00 00 10 00 84 5e 01 00 barebox......^.. 0000030: 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 UUUUUUUUUUUUUUUU $ ./arm-softmmu/qemu-system-arm -M canon-a1100 -bios ./canon-a1100-rom1.bin= -serial stdio Switch to console [cs0] barebox 2013.08.0-00267-g85b83fb #125 Thu Aug 29 07:58:57 MSK 2013 Board: Canon PowerShot A1100 IS digic-gpio c0220000.gpio: probed gpiochip-1 with base 0 cfi_flash f8000000.flash: found cfi flash at f8000000, size 4194304 malloc space: 0x00100000 -> 0x002fffff (size 2 MiB) Open /dev/env0 No such file or directory no valid environment found on /dev/env0. Using default environment running /env/bin/init... canon> / canon> / md -b 0xf8000000+0x40 f8000000: 12 00 00 ea fe ff ff ea fe ff ff ea fe ff ff ea ..............= .. f8000010: fe ff ff ea fe ff ff ea fe ff ff ea fe ff ff ea ..............= .. f8000020: 62 61 72 65 62 6f 78 00 00 00 10 00 84 5e 01 00 barebox......^= .. f8000030: 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 UUUUUUUUUUUUUU= UU canon> / md -b 0xf8400000+0x40 f8400000: 12 00 00 ea fe ff ff ea fe ff ff ea fe ff ff ea ..............= .. f8400010: fe ff ff ea fe ff ff ea fe ff ff ea fe ff ff ea ..............= .. f8400020: 62 61 72 65 62 6f 78 00 00 00 10 00 84 5e 01 00 barebox......^= .. f8400030: 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 UUUUUUUUUUUUUU= UU canon> / md -b 0xf9000000+0x40 f9000000: 12 00 00 ea fe ff ff ea fe ff ff ea fe ff ff ea ..............= .. f9000010: fe ff ff ea fe ff ff ea fe ff ff ea fe ff ff ea ..............= .. f9000020: 62 61 72 65 62 6f 78 00 00 00 10 00 84 5e 01 00 barebox......^= .. f9000030: 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 UUUUUUUUUUUUUU= UU canon> /=20 --=A0 Best regards, =A0 Antony Pavlov