Monday 1 December 2014

Allwinner device boot process

Similar to all arm cores, the reset vector is at 0xffff0000. This is where the BROM resides within the SoC, and executes the boot rom code, which initialises NOR / NAND (if present), USB (felmode) and SD.

.. from the A20 manual :

"After power on, the system will try to boot from SDC0, NAND Flash, SDC2, SPI0, and USB successively, but if the Boot Select Pin, or BSP, an external pin that is used to select system boot method, is checked to be in low level state, the system will direclty boot from USB. In normal state, this pin is pulled up by an internal 50K resistor."


The debug uart (uart0) seems to left uninitialised by the BROM code. If SD card is present, BROM then loads the Secondary Program Loader (SPL) from the 8th 1KiB sector. In the early days, there used to be a closed source binary from Allwinner reside in this location, which then loads u-boot, which in turn load the kernel uImage.

The current versions of u-boot integrates the SPL. and the current git build generates a uboot with SPL which can be dd to the sd card :

 dd=u-boot-sunxi-with-spl.bin of=/dev/sdb bs=1024 seek=8  

When Allwinner developed the A10, almost four years ago, Linux device tree was not properly in place as we have today. Hence Allwinner cooked their own devicetree like method called fex.

The boot loader loads a binary version of this fex file (generated by fex2bin).  Very similar to the way the device tree blob is loaded when uImage is loaded.  The sunxi kernel code has a parser similar to the standard device tree parser, and picks out configuration data from the loaded fex binary (script.bin). Its all very straightforward and easy to configure the soc io to suit your custom system peripherals.

Its worth taking a look at the Fex_Guide if you are playing with the ioports. The BananaPi specific kernel is at https://github.com/LeMaker/linux-sunxi.git .



No comments:

Post a Comment