Re: barebox image for an spi flash (like m25p0) on an imx7 soc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

I could finally put a barebox image together that's able to boot from
the qspi on an imx7d soc !

It is still very much hacked up but it works.

The imx7 boots in internal boot mode (BOOT_MODE=0x2) and the eFuses selecting
the boot device are as follows (BOOT_CFG):

imx7d: / md 0x30350470+1
30350470: 10004000                                           .

The '4' means QSPI as the boot device.

Now the bootloader image on the QSPI flash needs to have the 'QSPI Parameters Table'
at offset 0x00 (512 bytes long): I cut the table from my working u-boot image;
the table depends only on the used flash, not on the bootloader SW.

The rest of the image is a 'normal' barebox image, at offset 0x400 starts the IVT
as usual.

The image composed this way still doesn't boot, because of how the barebox 'boot process'
is structured in the early boot stages (this description is fuzzy because I'm
not aware of all the details here).
What's missing is a jump asm instruction at offset 0x00: 0xea0003fe
it overwrites the first 4 bytes of the 'QSPI Parameters Table' but is seems not so
dangerous.

Here is a dump of the final result:

samx7: / md -s /dev/m25p0 0+2k
00000000: ea0003fe 00000000 00000000 00000000                ................
00000010: 00000000 00000000 00000000 02000000                ................
00000020: 00000003 00000003 02000000 00000000                ................
00000030: 00000000 00000000 00000000 00000000                ................
00000040: 00000002 00000000 00000000 00000000                ................
00000050: 00000000 00000000 00000000 00000000                ................
00000060: 00000000 00000000 0818043b 1d040d08                ........;.......
00000070: 00002400 00000000 00000000 00000000                .$..............
00000080: 00000000 00000000 00000000 00000000                ................
00000090: 00000000 00000000 00000000 00000000                ................
000000a0: 00000000 00000000 00000000 00000000                ................
000000b0: 00000000 00000000 00000000 00000000                ................
000000c0: 00000000 00000000 00000000 00000000                ................
000000d0: 00000000 00000000 00000000 00000000                ................
000000e0: 00000000 00000000 00000000 00000000                ................
000000f0: 00000000 00000000 00000000 00000000                ................
00000100: 00000000 00000000 00000000 00000000                ................
00000110: 00000000 00000000 00000000 00000000                ................
00000120: 00000000 00000000 00000000 00000000                ................
00000130: 00000000 00000000 00000000 00000000                ................
00000140: 00000000 00000000 00000000 00000000                ................
00000150: 00000000 00000000 00000000 00000000                ................
00000160: 00000000 00000000 01000001 00000000                ................
00000170: 00000000 00000000 00000000 00000000                ................
00000180: 00000000 00000000 00000000 00000000                ................
00000190: 00000000 00000000 00000000 00000000                ................
000001a0: 00000000 00000000 00000000 00000000                ................
000001b0: 00000000 00000000 00000000 00000000                ................
000001c0: 00000000 00000000 00000000 00000000                ................
000001d0: 00000000 00000000 00000000 00000000                ................
000001e0: 00000000 00000000 00000000 00000000                ................
000001f0: 00000000 00000000 00000000 c0ffee01                ................
00000200: ffffffff ffffffff ffffffff ffffffff                ................
00000210: ffffffff ffffffff ffffffff ffffffff                ................
00000220: ffffffff ffffffff ffffffff ffffffff                ................
00000230: ffffffff ffffffff ffffffff ffffffff                ................
00000240: ffffffff ffffffff ffffffff ffffffff                ................
00000250: ffffffff ffffffff ffffffff ffffffff                ................
00000260: ffffffff ffffffff ffffffff ffffffff                ................
00000270: ffffffff ffffffff ffffffff ffffffff                ................
00000280: ffffffff ffffffff ffffffff ffffffff                ................
00000290: ffffffff ffffffff ffffffff ffffffff                ................
000002a0: ffffffff ffffffff ffffffff ffffffff                ................
000002b0: ffffffff ffffffff ffffffff ffffffff                ................
000002c0: ffffffff ffffffff ffffffff ffffffff                ................
000002d0: ffffffff ffffffff ffffffff ffffffff                ................
000002e0: ffffffff ffffffff ffffffff ffffffff                ................
000002f0: ffffffff ffffffff ffffffff ffffffff                ................
00000300: ffffffff ffffffff ffffffff ffffffff                ................
00000310: ffffffff ffffffff ffffffff ffffffff                ................
00000320: ffffffff ffffffff ffffffff ffffffff                ................
00000330: ffffffff ffffffff ffffffff ffffffff                ................
00000340: ffffffff ffffffff ffffffff ffffffff                ................
00000350: ffffffff ffffffff ffffffff ffffffff                ................
00000360: ffffffff ffffffff ffffffff ffffffff                ................
00000370: ffffffff ffffffff ffffffff ffffffff                ................
00000380: ffffffff ffffffff ffffffff ffffffff                ................
00000390: ffffffff ffffffff ffffffff ffffffff                ................
000003a0: ffffffff ffffffff ffffffff ffffffff                ................
000003b0: ffffffff ffffffff ffffffff ffffffff                ................
000003c0: ffffffff ffffffff ffffffff ffffffff                ................
000003d0: ffffffff ffffffff ffffffff ffffffff                ................
000003e0: ffffffff ffffffff ffffffff ffffffff                ................
000003f0: ffffffff ffffffff ffffffff ffffffff                ................
00000400: 402000d1 80001000 00000000 8000042c                .. @........,...
00000410: 80000420 80000400 00000000 00000000                 ...............
00000420: 80000000 00070000 00000000 40bc01d2                ...............@
00000430: 046c01cc 04003430 0500404f 00103930                ..l.04..O@..09..
00000440: 02000000 00007a30 01000401 a0017a30                ....0z......0z..
00000450: 03004080 a4017a30 20001000 a8017a30                .@..0z..... 0z..
00000460: 04001080 64007a30 46004000 90047a30                ....0z.d.@.F0z..
00000470: 01000000 d0007a30 03010200 d4007a30                ....0z......0z..
00000480: 00006900 dc007a30 04003009 e0007a30                .i..0z...0..0z..
00000490: 00000804 e4007a30 00001000 f4007a30                ....0z......0z..
000004a0: 3f030000 00017a30 09080809 04017a30                ...?0z......0z..
000004b0: 0d020d00 08017a30 07030504 0c017a30                ....0z......0z..
000004c0: 06200000 10017a30 05020204 14017a30                .. .0z......0z..
000004d0: 02020303 20017a30 03080000 80017a30                ....0z. ....0z..
000004e0: 20008000 84017a30 00010002 90017a30                ... 0z......0z..
000004f0: 04820902 94017a30 03030300 00027a30                ....0z......0z..
00000500: 1f000000 04027a30 08080800 10027a30                ....0z......0z..
00000510: 0f0f0000 14027a30 07070707 18027a30                ....0z......0z..
00000520: 07070707 40027a30 04060006 44027a30                ....0z.@....0z.D
00000530: 01000000 00103930 00000000 00007930                ....09......0y..
00000540: 400f4217 04007930 00012110 10007930                .B.@0y...!..0y..
00000550: 07080600 b0007930 7e001010 9c007930                ....0y.....~0y..
00000560: 6e0d0000 20007930 08080808 30007930                ...n0y. ....0y.0
00000570: 08080808 50007930 10000001 50007930                ....0y.P....0y.P
00000580: 10000000 c0007930 0473400e c0007930                ....0y...@s.0y..
00000590: 0473440e c0007930 0673440e 1c0c00cf                .Ds.0y...Ds.....
000005a0: c4007930 01000000 043400cc c0007930                0y........4.0y..
000005b0: 0473440e c0007930 0473400e 30413830                .Ds.0y...@s.08A0
000005c0: 00000000 20003430 78010000 30413830                ....04. ...x08A0
000005d0: 02000000 18007930 0f000000 1c0c00cf                ....0y..........
000005e0: 04007a30 01000000 00000000 00000000                0z..............
000005f0: 00000000 00000000 00000000 00000000                ................
00000600: 00000000 00000000 00000000 00000000                ................
00000610: 00000000 00000000 00000000 00000000                ................
00000620: 00000000 00000000 00000000 00000000                ................
...

thank you again for your help,
giorgio

> On March 6, 2020 at 2:01 PM Sascha Hauer <s.hauer@xxxxxxxxxxxxxx> wrote:
> 
> 
> On Fri, Mar 06, 2020 at 09:41:42AM +0100, Giorgio Dal Molin wrote:
> > Hi all,
> > 
> > I've just double checked the reg=val entries I have in my DTD for the imx7d
> > but could not find anything wrong with it, it is very similar to the
> > 'arch/arm/mach-imx/include/mach/flash-header/imx7d-ddr-sabresd.imxcfg'.
> > 
> > What I don't understand is the absolute address of the DTD present at offset 0x40c:
> > in my barebox image it is 0x8000042c: when the rom code in the imx7 reads the image
> > from the qspi flash it must transfer it to the OCRAM (0x00910000) because it is
> > the only memory that works at this early stage of the boot process; but then, when it
> > searches for the DCD it finds its absolute address, at offset 040c, to be 0x8000042c;
> > but this address is on the DDR space that is still not configured and so cannot be accessed.
> > 
> > Here is a hex dump of the barebox image I'm using:
> > 
> > ...
> > 0400: 0xd1 0x00 0x20 0x40 0x00 0x10 0x00 0x80 0x00 0x00 0x00 0x00 0x2c 0x04 0x00 0x80 
> > 0410: 0x20 0x04 0x00 0x80 0x00 0x04 0x00 0x80 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 
> > 0420: 0x00 0x00 0x00 0x80 0x00 0x00 0x07 0x00 0x00 0x00 0x00 0x00 0xd2 0x01 0xbc 0x40 
> > 0430: 0xcc 0x01 0x6c 0x04 0x30 0x34 0x00 0x04 0x4f 0x40 0x00 0x05 0x30 0x39 0x10 0x00 
> > 0440: 0x00 0x00 0x00 0x02 0x30 0x7a 0x00 0x00 0x01 0x04 0x00 0x01 0x30 0x7a 0x01 0xa0 
> 
> This is quite unreadable. Could you post the output of 'md -s /dev/m25p0 1k+1k' ?
> 
> Sascha
> 
> -- 
> Pengutronix e.K.                           |                             |
> Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
> 31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
> 
> _______________________________________________
> barebox mailing list
> barebox@xxxxxxxxxxxxxxxxxxx
> http://lists.infradead.org/mailman/listinfo/barebox

_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux