Mmc startup is supported under pcDuino3. The official Uboot is implemented using the SPL framework because the internal SRAM space reaches 32 KB, we can write a complete and small bootloader in this 32 K space to guide Linux kernel.
First, let's introduce the SPL framework. First, let's take a look at gnu arm assembly -- (18th) u-boot-how to start with nand_spl and gnu arm assembly -- (19th) u-boot-nand-spl Startup Process Analysis, NAND_SPL is also a Mode Under the SPL framework.
When using Nand flash or MMC as the boot mode, we need to use the ROM or other mechanisms in the chip to load the firmware to the SRAM.
In this case, SPL is required because SPL is short and suitable for 4 K or even smaller SRAM environments. At this time, the boot process becomes, SPL guides Uboot, and Uboot guides the system kernel.
In fact, as the SPL of pcDuino3, it can directly guide the kernel function, if you do not need to use the additional powerful features provided by uboot.
Here we will introduce the idea of writing bootloader:
Use the read driver function of mmc to read the kernel image at the specified location to the memory, and then complete the parameter list transmission and MMU and cache configuration according to Linux requirements, you can complete the jump action.
The code for the last step is as follows:
void boot_linux(void){uart_printf("boot linux\n");void (*kernel_entry)(int zero, int arch, uint params);unsigned long r2;unsigned long machid;setup_linux_param(0x40000000 + 0x100);cleanup_before_linux();kernel_entry = (void (*)(int, int, uint))0x48000000;machid = 4283;r2= 0x40000100;kernel_entry(0, machid, r2);}
This function completes the description of booting arm Linux in the kernel Documentation/ARM/booting.
In this way, a bootloader with only 18 K size can guide the kernel.