allwinner boot0启动

news2024/11/22 6:23:29

目录

路径:u-boot-2018/arch/arm/cpu/armv7/sunxi/u-boot-spl.lds

路径:u-boot-2018/arch/arm/cpu/armv7/start.S

路径:u-boot-2018/arch/arm/lib/crt0.S

路径:u-boot-2014.07\common\board_f.c

 路径:u-boot-2014.07\common\board_r.c

U_BOOT_CMD(烧写函数)

 Uboot用户自定义程序(未找到被调用的位置)

SUNXI_USB 

结构体申明

结构体定义

dram_data_recv_finish

Uboot中添加环境变量


 

路径:u-boot-2018/arch/arm/cpu/armv7/sunxi/u-boot-spl.lds

/* SPDX-License-Identifier: GPL-2.0+ */
/*
 * (C) Copyright 2012
 * Allwinner Technology Co., Ltd. <www.allwinnertech.com>
 * Tom Cubie <tangliang@allwinnertech.com>
 *
 * Based on omap-common/u-boot-spl.lds:
 *
 * (C) Copyright 2002
 * Gary Jennejohn, DENX Software Engineering, <garyj@denx.de>
 *
 * (C) Copyright 2010
 * Texas Instruments, <www.ti.com>
 *	Aneesh V <aneesh@ti.com>
 */
MEMORY { .sram : ORIGIN = CONFIG_SPL_TEXT_BASE,\
		LENGTH = CONFIG_SPL_MAX_SIZE }
MEMORY { .sdram : ORIGIN = CONFIG_SPL_BSS_START_ADDR, \
		LENGTH = CONFIG_SPL_BSS_MAX_SIZE }

OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
OUTPUT_ARCH(arm)
ENTRY(_start)
SECTIONS
{
	.text      :
	{
		__start = .;
		*(.vectors)
		arch/arm/cpu/armv7/start.o	(.text)
		*(.text*)
	} > .sram

	. = ALIGN(4);
	.rodata : { *(SORT_BY_ALIGNMENT(.rodata*)) } >.sram

	. = ALIGN(4);
	.data : { *(SORT_BY_ALIGNMENT(.data*)) } >.sram

	. = ALIGN(4);
	.u_boot_list : {
		KEEP(*(SORT(.u_boot_list*)));
	} > .sram

	. = ALIGN(4);
	__image_copy_end = .;
	_end = .;

	.bss :
	{
		. = ALIGN(4);
		__bss_start = .;
		*(.bss*)
		. = ALIGN(4);
		__bss_end = .;
	} > .sdram
}

ENTRY(_start)表示入口函数,即uboot上电启动的位置。

arch/arm/cpu/armv7/start.o    (.text):表示文本段被调用的文件

路径:u-boot-2018/arch/arm/cpu/armv7/start.S

/* SPDX-License-Identifier: GPL-2.0+ */
/*
 * armboot - Startup Code for OMAP3530/ARM Cortex CPU-core
 *
 * Copyright (c) 2004	Texas Instruments <r-woodruff2@ti.com>
 *
 * Copyright (c) 2001	Marius Gr枚ger <mag@sysgo.de>
 * Copyright (c) 2002	Alex Z眉pke <azu@sysgo.de>
 * Copyright (c) 2002	Gary Jennejohn <garyj@denx.de>
 * Copyright (c) 2003	Richard Woodruff <r-woodruff2@ti.com>
 * Copyright (c) 2003	Kshitij <kshitij@ti.com>
 * Copyright (c) 2006-2008 Syed Mohammed Khasim <x0khasim@ti.com>
 */

#include <asm-offsets.h>
#include <config.h>
#include <asm/system.h>
#include <linux/linkage.h>
#include <asm/armv7.h>

/*************************************************************************
 *
 * Startup Code (reset vector)
 *
 * Do important init only if we don't start from memory!
 * Setup memory and board specific bits prior to relocation.
 * Relocate armboot to ram. Setup stack.
 *
 *************************************************************************/

	.globl	reset
	.globl	save_boot_params_ret
	.type   save_boot_params_ret,%function
#ifdef CONFIG_ARMV7_LPAE
	.global	switch_to_hypervisor_ret
#endif

reset:
	/* Allow the board to save important registers */
	b	save_boot_params
save_boot_params_ret:
#ifdef CONFIG_ARMV7_LPAE
/*
 * check for Hypervisor support
 */
	mrc	p15, 0, r0, c0, c1, 1		@ read ID_PFR1
	and	r0, r0, #CPUID_ARM_VIRT_MASK	@ mask virtualization bits
	cmp	r0, #(1 << CPUID_ARM_VIRT_SHIFT)
	beq	switch_to_hypervisor
switch_to_hypervisor_ret:
#endif
	/*
	 * disable interrupts (FIQ and IRQ), also set the cpu to SVC32 mode,
	 * except if in HYP mode already
	 */
	mrs	r0, cpsr
	and	r1, r0, #0x1f		@ mask mode bits
	teq	r1, #0x1a		@ test for HYP mode
	bicne	r0, r0, #0x1f		@ clear all mode bits
	orrne	r0, r0, #0x13		@ set SVC mode
	orr	r0, r0, #0xc0		@ disable FIQ and IRQ
	msr	cpsr,r0

/*
 * Setup vector:
 * (OMAP4 spl TEXT_BASE is not 32 byte aligned.
 * Continue to use ROM code vector only in OMAP4 spl)
 */
#if !(defined(CONFIG_OMAP44XX) && defined(CONFIG_SPL_BUILD))
	/* Set V=0 in CP15 SCTLR register - for VBAR to point to vector */
	mrc	p15, 0, r0, c1, c0, 0	@ Read CP15 SCTLR Register
	bic	r0, #CR_V		@ V = 0
	mcr	p15, 0, r0, c1, c0, 0	@ Write CP15 SCTLR Register

#ifdef CONFIG_HAS_VBAR
	/* Set vector address in CP15 VBAR register */
	ldr	r0, =_start
	mcr	p15, 0, r0, c12, c0, 0	@Set VBAR
#endif
#endif

	/* the mask ROM code should have PLL and others stable */
#ifndef CONFIG_SKIP_LOWLEVEL_INIT
#ifdef CONFIG_CPU_V7A
	bl	cpu_init_cp15
#endif
#ifndef CONFIG_SKIP_LOWLEVEL_INIT_ONLY
	bl	cpu_init_crit
#endif
#endif

	bl	_main

/*------------------------------------------------------------------------------*/

ENTRY(c_runtime_cpu_setup)
/*
 * If I-cache is enabled invalidate it
 */
#if !CONFIG_IS_ENABLED(SYS_ICACHE_OFF)
	mcr	p15, 0, r0, c7, c5, 0	@ invalidate icache
	mcr     p15, 0, r0, c7, c10, 4	@ DSB
	mcr     p15, 0, r0, c7, c5, 4	@ ISB
#endif

	bx	lr

ENDPROC(c_runtime_cpu_setup)

/*************************************************************************
 *
 * void save_boot_params(u32 r0, u32 r1, u32 r2, u32 r3)
 *	__attribute__((weak));
 *
 * Stack pointer is not yet initialized at this moment
 * Don't save anything to stack even if compiled with -O0
 *
 *************************************************************************/
ENTRY(save_boot_params)
	b	save_boot_params_ret		@ back to my caller
ENDPROC(save_boot_params)
	.weak	save_boot_params

#ifdef CONFIG_ARMV7_LPAE
ENTRY(switch_to_hypervisor)
	b	switch_to_hypervisor_ret
ENDPROC(switch_to_hypervisor)
	.weak	switch_to_hypervisor
#endif

/*************************************************************************
 *
 * cpu_init_cp15
 *
 * Setup CP15 registers (cache, MMU, TLBs). The I-cache is turned on unless
 * CONFIG_SYS_ICACHE_OFF is defined.
 *
 *************************************************************************/
ENTRY(cpu_init_cp15)
	/*
	 * Invalidate L1 I/D
	 */
	mov	r0, #0			@ set up for MCR
	mcr	p15, 0, r0, c8, c7, 0	@ invalidate TLBs
	mcr	p15, 0, r0, c7, c5, 0	@ invalidate icache
	mcr	p15, 0, r0, c7, c5, 6	@ invalidate BP array
	mcr     p15, 0, r0, c7, c10, 4	@ DSB
	mcr     p15, 0, r0, c7, c5, 4	@ ISB

	/*
	 * disable MMU stuff and caches
	 */
	mrc	p15, 0, r0, c1, c0, 0
	bic	r0, r0, #0x00002000	@ clear bits 13 (--V-)
	bic	r0, r0, #0x00000007	@ clear bits 2:0 (-CAM)
	orr	r0, r0, #0x00000002	@ set bit 1 (--A-) Align
	orr	r0, r0, #0x00000800	@ set bit 11 (Z---) BTB
#if CONFIG_IS_ENABLED(SYS_ICACHE_OFF)
	bic	r0, r0, #0x00001000	@ clear bit 12 (I) I-cache
#else
	orr	r0, r0, #0x00001000	@ set bit 12 (I) I-cache
#endif
	mcr	p15, 0, r0, c1, c0, 0

#ifdef SUNXI_ARM_A53
	/*
	 *clear AFE,TRE bit in sctrl
	 *non-secure: reset value is unknow
	 *secure    : default value is 0
	 *notice    : we must set the TRE bit to enable the memory
	 *            arttribute configuration from the section table.
	 */
	MRC     p15, 0, r0, c1, c0, 0   @Read SCTLR
	BIC     r0, r0, #(1<<28)        @clr TRE bit
	BIC     r0, r0, #(1<<29)        @clr AEF bit
	MCR     p15, 0, r0, c1, c0, 0   @Write SCTLR
#endif


#ifdef CONFIG_ARM_ERRATA_716044
	mrc	p15, 0, r0, c1, c0, 0	@ read system control register
	orr	r0, r0, #1 << 11	@ set bit #11
	mcr	p15, 0, r0, c1, c0, 0	@ write system control register
#endif

#if (defined(CONFIG_ARM_ERRATA_742230) || defined(CONFIG_ARM_ERRATA_794072))
	mrc	p15, 0, r0, c15, c0, 1	@ read diagnostic register
	orr	r0, r0, #1 << 4		@ set bit #4
	mcr	p15, 0, r0, c15, c0, 1	@ write diagnostic register
#endif

#ifdef CONFIG_ARM_ERRATA_743622
	mrc	p15, 0, r0, c15, c0, 1	@ read diagnostic register
	orr	r0, r0, #1 << 6		@ set bit #6
	mcr	p15, 0, r0, c15, c0, 1	@ write diagnostic register
#endif

#ifdef CONFIG_ARM_ERRATA_751472
	mrc	p15, 0, r0, c15, c0, 1	@ read diagnostic register
	orr	r0, r0, #1 << 11	@ set bit #11
	mcr	p15, 0, r0, c15, c0, 1	@ write diagnostic register
#endif
#ifdef CONFIG_ARM_ERRATA_761320
	mrc	p15, 0, r0, c15, c0, 1	@ read diagnostic register
	orr	r0, r0, #1 << 21	@ set bit #21
	mcr	p15, 0, r0, c15, c0, 1	@ write diagnostic register
#endif

#ifdef CONFIG_ARM_ERRATA_845369
	mrc     p15, 0, r0, c15, c0, 1	@ read diagnostic register
	orr     r0, r0, #1 << 22	@ set bit #22
	mcr     p15, 0, r0, c15, c0, 1	@ write diagnostic register
#endif

	mov	r5, lr			@ Store my Caller
	mrc	p15, 0, r1, c0, c0, 0	@ r1 has Read Main ID Register (MIDR)
	mov	r3, r1, lsr #20		@ get variant field
	and	r3, r3, #0xf		@ r3 has CPU variant
	and	r4, r1, #0xf		@ r4 has CPU revision
	mov	r2, r3, lsl #4		@ shift variant field for combined value
	orr	r2, r4, r2		@ r2 has combined CPU variant + revision

#ifdef CONFIG_ARM_ERRATA_798870
	cmp	r2, #0x30		@ Applies to lower than R3p0
	bge	skip_errata_798870      @ skip if not affected rev
	cmp	r2, #0x20		@ Applies to including and above R2p0
	blt	skip_errata_798870      @ skip if not affected rev

	mrc	p15, 1, r0, c15, c0, 0  @ read l2 aux ctrl reg
	orr	r0, r0, #1 << 7         @ Enable hazard-detect timeout
	push	{r1-r5}			@ Save the cpu info registers
	bl	v7_arch_cp15_set_l2aux_ctrl
	isb				@ Recommended ISB after l2actlr update
	pop	{r1-r5}			@ Restore the cpu info - fall through
skip_errata_798870:
#endif

#ifdef CONFIG_ARM_ERRATA_801819
	cmp	r2, #0x24		@ Applies to lt including R2p4
	bgt	skip_errata_801819      @ skip if not affected rev
	cmp	r2, #0x20		@ Applies to including and above R2p0
	blt	skip_errata_801819      @ skip if not affected rev
	mrc	p15, 0, r0, c0, c0, 6	@ pick up REVIDR reg
	and	r0, r0, #1 << 3		@ check REVIDR[3]
	cmp	r0, #1 << 3
	beq	skip_errata_801819	@ skip erratum if REVIDR[3] is set

	mrc	p15, 0, r0, c1, c0, 1	@ read auxilary control register
	orr	r0, r0, #3 << 27	@ Disables streaming. All write-allocate
					@ lines allocate in the L1 or L2 cache.
	orr	r0, r0, #3 << 25	@ Disables streaming. All write-allocate
					@ lines allocate in the L1 cache.
	push	{r1-r5}			@ Save the cpu info registers
	bl	v7_arch_cp15_set_acr
	pop	{r1-r5}			@ Restore the cpu info - fall through
skip_errata_801819:
#endif

#ifdef CONFIG_ARM_CORTEX_A15_CVE_2017_5715
	mrc	p15, 0, r0, c1, c0, 1	@ read auxilary control register
	orr	r0, r0, #1 << 0		@ Enable invalidates of BTB
	push	{r1-r5}			@ Save the cpu info registers
	bl	v7_arch_cp15_set_acr
	pop	{r1-r5}			@ Restore the cpu info - fall through
#endif

#ifdef CONFIG_ARM_ERRATA_454179
	mrc	p15, 0, r0, c1, c0, 1	@ Read ACR

	cmp	r2, #0x21		@ Only on < r2p1
	orrlt	r0, r0, #(0x3 << 6)	@ Set DBSM(BIT7) and IBE(BIT6) bits

	push	{r1-r5}			@ Save the cpu info registers
	bl	v7_arch_cp15_set_acr
	pop	{r1-r5}			@ Restore the cpu info - fall through
#endif

#if defined(CONFIG_ARM_ERRATA_430973) || defined (CONFIG_ARM_CORTEX_A8_CVE_2017_5715)
	mrc	p15, 0, r0, c1, c0, 1	@ Read ACR

#ifdef CONFIG_ARM_CORTEX_A8_CVE_2017_5715
	orr	r0, r0, #(0x1 << 6)	@ Set IBE bit always to enable OS WA
#else
	cmp	r2, #0x21		@ Only on < r2p1
	orrlt	r0, r0, #(0x1 << 6)	@ Set IBE bit
#endif
	push	{r1-r5}			@ Save the cpu info registers
	bl	v7_arch_cp15_set_acr
	pop	{r1-r5}			@ Restore the cpu info - fall through
#endif

#ifdef CONFIG_ARM_ERRATA_621766
	mrc	p15, 0, r0, c1, c0, 1	@ Read ACR

	cmp	r2, #0x21		@ Only on < r2p1
	orrlt	r0, r0, #(0x1 << 5)	@ Set L1NEON bit

	push	{r1-r5}			@ Save the cpu info registers
	bl	v7_arch_cp15_set_acr
	pop	{r1-r5}			@ Restore the cpu info - fall through
#endif

#ifdef CONFIG_ARM_ERRATA_725233
	mrc	p15, 1, r0, c9, c0, 2	@ Read L2ACR

	cmp	r2, #0x21		@ Only on < r2p1 (Cortex A8)
	orrlt	r0, r0, #(0x1 << 27)	@ L2 PLD data forwarding disable

	push	{r1-r5}			@ Save the cpu info registers
	bl	v7_arch_cp15_set_l2aux_ctrl
	pop	{r1-r5}			@ Restore the cpu info - fall through
#endif

#ifdef CONFIG_ARM_ERRATA_852421
	mrc	p15, 0, r0, c15, c0, 1	@ read diagnostic register
	orr	r0, r0, #1 << 24	@ set bit #24
	mcr	p15, 0, r0, c15, c0, 1	@ write diagnostic register
#endif

#ifdef CONFIG_ARM_ERRATA_852423
	mrc	p15, 0, r0, c15, c0, 1	@ read diagnostic register
	orr	r0, r0, #1 << 12	@ set bit #12
	mcr	p15, 0, r0, c15, c0, 1	@ write diagnostic register
#endif

	mov	pc, r5			@ back to my caller
ENDPROC(cpu_init_cp15)

#if !defined(CONFIG_SKIP_LOWLEVEL_INIT) && \
	!defined(CONFIG_SKIP_LOWLEVEL_INIT_ONLY)
/*************************************************************************
 *
 * CPU_init_critical registers
 *
 * setup important registers
 * setup memory timing
 *
 *************************************************************************/
ENTRY(cpu_init_crit)
	/*
	 * Jump to board specific initialization...
	 * The Mask ROM will have already initialized
	 * basic memory. Go here to bump up clock rate and handle
	 * wake up conditions.
	 */
	b	lowlevel_init		@ go setup pll,mux,memory
ENDPROC(cpu_init_crit)
#endif

reset:是第一个被执行的汇编位置。

bl    _main:跳转到main函数,文件位置:u-boot-2018/arch/arm/lib/crt0.S

路径:u-boot-2018/arch/arm/lib/crt0.S

/* SPDX-License-Identifier: GPL-2.0+ */
/*
 *  crt0 - C-runtime startup Code for ARM U-Boot
 *
 *  Copyright (c) 2012  Albert ARIBAUD <albert.u.boot@aribaud.net>
 */

#include <config.h>
#include <asm-offsets.h>
#include <linux/linkage.h>
#ifdef CONFIG_CPU_V7M
#include <asm/armv7m.h>
#endif

/*
 * This file handles the target-independent stages of the U-Boot
 * start-up where a C runtime environment is needed. Its entry point
 * is _main and is branched into from the target's start.S file.
 *
 * _main execution sequence is:
 *
 * 1. Set up initial environment for calling board_init_f().
 *    This environment only provides a stack and a place to store
 *    the GD ('global data') structure, both located in some readily
 *    available RAM (SRAM, locked cache...). In this context, VARIABLE
 *    global data, initialized or not (BSS), are UNAVAILABLE; only
 *    CONSTANT initialized data are available. GD should be zeroed
 *    before board_init_f() is called.
 *
 * 2. Call board_init_f(). This function prepares the hardware for
 *    execution from system RAM (DRAM, DDR...) As system RAM may not
 *    be available yet, , board_init_f() must use the current GD to
 *    store any data which must be passed on to later stages. These
 *    data include the relocation destination, the future stack, and
 *    the future GD location.
 *
 * 3. Set up intermediate environment where the stack and GD are the
 *    ones allocated by board_init_f() in system RAM, but BSS and
 *    initialized non-const data are still not available.
 *
 * 4a.For U-Boot proper (not SPL), call relocate_code(). This function
 *    relocates U-Boot from its current location into the relocation
 *    destination computed by board_init_f().
 *
 * 4b.For SPL, board_init_f() just returns (to crt0). There is no
 *    code relocation in SPL.
 *
 * 5. Set up final environment for calling board_init_r(). This
 *    environment has BSS (initialized to 0), initialized non-const
 *    data (initialized to their intended value), and stack in system
 *    RAM (for SPL moving the stack and GD into RAM is optional - see
 *    CONFIG_SPL_STACK_R). GD has retained values set by board_init_f().
 *
 * 6. For U-Boot proper (not SPL), some CPUs have some work left to do
 *    at this point regarding memory, so call c_runtime_cpu_setup.
 *
 * 7. Branch to board_init_r().
 *
 * For more information see 'Board Initialisation Flow in README.
 */

/*
 * entry point of crt0 sequence
 */

ENTRY(_main)

/*
 * Set up initial C runtime environment and call board_init_f(0).
 */

#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_STACK)
	ldr	r0, =(CONFIG_SPL_STACK)
#else
	ldr	r0, =(CONFIG_SYS_INIT_SP_ADDR)
#endif
	bic	r0, r0, #7	/* 8-byte alignment for ABI compliance */
	mov	sp, r0
	bl	board_init_f_alloc_reserve
	mov	sp, r0
	/* set up gd here, outside any C code */
	mov	r9, r0
	bl	board_init_f_init_reserve

	mov	r0, #0
	bl	board_init_f

#if ! defined(CONFIG_SPL_BUILD)

/*
 * Set up intermediate environment (new sp and gd) and call
 * relocate_code(addr_moni). Trick here is that we'll return
 * 'here' but relocated.
 */

	ldr	r0, [r9, #GD_START_ADDR_SP]	/* sp = gd->start_addr_sp */
	bic	r0, r0, #7	/* 8-byte alignment for ABI compliance */
	mov	sp, r0
	ldr	r9, [r9, #GD_BD]		/* r9 = gd->bd */
	sub	r9, r9, #GD_SIZE		/* new GD is below bd */

	adr	lr, here
	ldr	r0, [r9, #GD_RELOC_OFF]		/* r0 = gd->reloc_off */
	add	lr, lr, r0
#if defined(CONFIG_CPU_V7M)
	orr	lr, #1				/* As required by Thumb-only */
#endif
	ldr	r0, [r9, #GD_RELOCADDR]		/* r0 = gd->relocaddr */
	b	relocate_code
here:
/*
 * now relocate vectors
 */

	bl	relocate_vectors

/* Set up final (full) environment */

	bl	c_runtime_cpu_setup	/* we still call old routine here */
#endif
#if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_FRAMEWORK)
# ifdef CONFIG_SPL_BUILD
	/* Use a DRAM stack for the rest of SPL, if requested */
	bl	spl_relocate_stack_gd
	cmp	r0, #0
	movne	sp, r0
	movne	r9, r0
# endif
	ldr	r0, =__bss_start	/* this is auto-relocated! */

#ifdef CONFIG_USE_ARCH_MEMSET
	ldr	r3, =__bss_end		/* this is auto-relocated! */
	mov	r1, #0x00000000		/* prepare zero to clear BSS */

	subs	r2, r3, r0		/* r2 = memset len */
	bl	memset
#else
	ldr	r1, =__bss_end		/* this is auto-relocated! */
	mov	r2, #0x00000000		/* prepare zero to clear BSS */

clbss_l:cmp	r0, r1			/* while not at end of BSS */
#if defined(CONFIG_CPU_V7M)
	itt	lo
#endif
	strlo	r2, [r0]		/* clear 32-bit BSS word */
	addlo	r0, r0, #4		/* move to next */
	blo	clbss_l
#endif

#if ! defined(CONFIG_SPL_BUILD)
	bl coloured_LED_init
	bl red_led_on
#endif
	/* call board_init_r(gd_t *id, ulong dest_addr) */
	mov     r0, r9                  /* gd_t */
	ldr	r1, [r9, #GD_RELOCADDR]	/* dest_addr */
	/* call board_init_r */
#if CONFIG_IS_ENABLED(SYS_THUMB_BUILD)
	ldr	lr, =board_init_r	/* this is auto-relocated! */
	bx	lr
#else
	ldr	pc, =board_init_r	/* this is auto-relocated! */
#endif
	/* we should not return here. */
#endif

ENDPROC(_main)

ENTRY(_main):入口函数

board_init_f:与平台相关的函数,路径:u-boot-2014.07\common\board_f.c

board_init_r:

路径:u-boot-2014.07\common\board_f.c

 

workmode = 16,storage type = 0     //u-boot-2014.07\drivers\sunxi_flash\sunxi_flash.c  sunxi_flash_handle_init 函数
[     12.759]NAND_UbootProbe start
[     12.762]NB1 : enter phy init
[     12.765]nand_physic_init
[     12.773]Reset NDFC start 0  0
[     12.773]Reset NDFC end 0  0

 路径:u-boot-2014.07\common\board_r.c

 

 

 

 

U_BOOT_CMD(烧写函数)

 

位置:include/configs/sun8iw10p1.h:283:

函数:SUNXI_SPRITE_ENV环境变量

CONFIG_SUNXI_SPRITE_ENV_SETTINGS="bootdelay=0\0bootcmd=run sunxi_sprite_test\0console=ttyS0,115200\0sunxi_sprite_test=sprite_test read\0"

U_BOOT_CMD(
	sprite_test, 2, 0, do_sprite_test,
	"do a sprite test",
	"NULL"
);

 

以上的sprite_test函数被调用流程

步骤1:boot启动延时函数

位置:u-boot-2014.07\common\autoboot.c 

函数:bootdelay_process(void)

s = getenv("bootcmd"); //其中的bootcmd是上面CONFIG_SUNXI_SPRITE_ENV_SETTINGS配置

步骤2:自动启动传递的命令参数

位置:u-boot-2014.07\common\main.c

函数:autoboot_command(s); //上面的参数s传给当前函数

步骤2:运行命令

位置:u-boot-2014.07\common\autoboot.c

函数:run_command_list(s, -1, 0); //上面的参数s传给当前函数,即sprite_test

特别注意,上面的“bootdelay=0”,所以以下函数不会执行内核验签,即在烧写镜像环境不会执行的

 

 

 Uboot用户自定义程序(未找到被调用的位置)

U_BOOT_CMD(
	go, CONFIG_SYS_MAXARGS, 1,	do_go,
	"start application at address 'addr'",
	"addr [arg ...]\n    - start application at address 'addr'\n"
	"      passing 'arg' as arguments"
);

SUNXI_USB 

结构体申明

typedef struct sunxi_usb_setup_req_s
{
	int  (* state_init		  )(void);
	int  (* state_exit		  )(void);
	void (* state_reset       )(void);
	int  (* standard_req_op   )(uint cmd, struct usb_device_request *req, uchar *buffer);
	int  (* nonstandard_req_op)(uint cmd, struct usb_device_request *req, uchar *buffer, uint data_status);
	int  (* state_loop		  )(void *sunxi_udc);
	void (* dma_rx_isr		  )(void *p_arg);
	void (* dma_tx_isr		  )(void *p_arg);
}
sunxi_usb_setup_req_t;

结构体定义

路径:u-boot-2014.07\usb_sunxi\usb_efex.c

定义一个usb模块,初始化相关的函数指针
sunxi_usb_module_init(SUNXI_USB_DEVICE_EFEX,					\
					  sunxi_efex_init,							\
					  sunxi_efex_exit,							\
					  sunxi_efex_reset,							\
					  sunxi_efex_standard_req_op,				\
					  sunxi_efex_nonstandard_req_op,			\
					  sunxi_efex_state_loop,					\
					  sunxi_efex_usb_rx_dma_isr,				\
					  sunxi_efex_usb_tx_dma_isr					\
					  );
sunxi_usb_module_init
#define  sunxi_usb_module_init(name, state_init, state_exit, state_reset, standard_req_op, nonstandard_req_op, state_loop, dma_rx_isr, dma_tx_isr)			\
			__sunxi_usb_module_init(name, state_init, state_exit, state_reset, standard_req_op, nonstandard_req_op, state_loop, dma_rx_isr, dma_tx_isr)

__sunxi_usb_module_init
#define  __sunxi_usb_module_init(name, state_init, state_exit, state_reset, standard_req_op, nonstandard_req_op, state_loop, dma_rx_isr, dma_tx_isr)					\
			sunxi_usb_setup_req_t setup_req_##name = {state_init, state_exit, state_reset, standard_req_op, nonstandard_req_op, state_loop, dma_rx_isr, dma_tx_isr };

说明:setup_req_##name:即为定义的结构体名称

__sunxi_usb_module_reg
#define  __sunxi_usb_module_reg(name)						\
			sunxi_udev_active = &setup_req_##name

说明:
1.模块注册,即绑定__sunxi_usb_module_init内初始化的结构体
2.sunxi_udev_active即为全局的USB操作结构体对象
sunxi_usb_module_reg(name)
#define  sunxi_usb_module_reg(name)							\
			__sunxi_usb_module_reg(name)

dram_data_recv_finish

要剖析这个函数以及unxi_usb_module_init(SUNXI_USB_DEVICE_EFEX的结构体中函数的使用,在烧写的时候抓USB包分析。

Uboot中添加环境变量

 setenv("partitions", partition_sets);

 

 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/425815.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

领英如何不让对方查看自己的好友,防止他人添加自己客户

那如何防止好友加自己的好友呢&#xff1f;其实领英是可以设置谁能查看到自己好友的&#xff0c;甚至不让所有人查看。 领英是一个关系性的职业社交平台&#xff0c;最大的特点就是关系性。彼此有某种关系的人或在3度内的人都可以查看对方的详细资料&#xff0c;甚至可添加对方…

Redis 如何配置读写分离架构(主从复制)?

文章目录Redis 如何配置读写分离架构&#xff08;主从复制&#xff09;&#xff1f;什么是 Redis 主从复制&#xff1f;如何配置主从复制架构&#xff1f;配置环境安装 Redis 步骤通过命令行配置从节点通过配置文件配置从节点Redis 主从复制优点Redis 主从复制缺点Redis 如何配…

第十四届蓝桥杯单片机省赛真题(巨简代码+超级详解)

文章目录前言一、陷阱分析二、代码相关定义、声明1.变量声明2.函数声明三、主要函数1.函数初始化 &#xff1a;关闭蜂鸣器、定时器初始化、设置时间、消除85℃影响、开启总中断2.按键扫描&#xff1a;长按松开清除数据&#xff0c;短按切换界面&#xff0c;加减参数3.数据采集与…

视频提取gif如何操作?教你用gif制作工具快速截取gif

从视频中提取gif动画就是将电影、电视剧中的某一段视频提取出来做成gif格式的动态图片。那么&#xff0c;如何使用电脑或是手机来将视频转换成gif动图呢&#xff1f; 一、使用什么工具能够完成视频转gif制作呢&#xff1f; 通过使用GIF中文网的视频转gif&#xff08;https://…

S型加减速速度给定功能块(SCL+梯形图)

S型加减速详细算法公式请参看下面博客文章,这里不再赘述: 博途PLC1200/1500PLC S型速度曲线变频器控制应用(SCL完整源代码)_RXXW_Dor的博客-CSDN博客PLC运动控制基础系列之梯形速度曲线,可以参看下面这篇博客:PLC运动控制基础系列之梯形速度曲线_RXXW_Dor的博客-CSDN博客运…

前段开发:配置VSCode像IDEA一样调试VUE项目

如果不配置VSCode调试&#xff0c;那么我们的前段项目一般都是在浏览器中的开发者工具中调试&#xff0c;这样对于使用习惯了IDEA开发调试的人特别不习惯&#xff0c;这几天个人研究了下VSCode中的代码调试功能&#xff0c;做以下记录&#xff1a; 1、使用插件调试&#xff1a…

应用DAP-seq技术鉴定百脉根中一个NAC转录因子在全基因上的靶基因,揭示硝酸盐诱导根瘤衰老的新机制

豆科植物通过与根瘤菌共生&#xff0c;形成能够固氮的根瘤。硝酸盐能够影响根瘤共生的过程&#xff0c;适宜浓度的硝酸盐促进结瘤固氮&#xff0c;而高浓度的硝酸盐抑制菌根共生&#xff0c;并且会促进根瘤衰老。NLP (NIN-Like Protein)转录因子调控硝酸盐信号转导&#xff0c;…

CSS实现三角形的四种方法

方法一&#xff1a;使用 border (常见) 【解释】不设置宽高&#xff0c;用边框大小控制三角型大小 【分解步骤】 设置一个div不设宽高 【示例】 <style>#triangle{width: 0;height: 0;border: 100px solid;border-color: orangered skyblue gold yellowgreen;} </s…

3.8——友元

类的主要特点之一是信息隐藏和封装&#xff0c;即类的私有成员和保护成员只能在定义的范围内使用&#xff0c;也就是说私有成员和保护成员只能通过类的成员函数来访问。但是&#xff0c;有时候我们在类外也需要访问私有成员数据或保护成员数据怎么办。这时我们就要通过友元函数…

gru 串联LLm

单纯是为了降低大LLM 设计的结构 当前如果transformers 可以 输出一个状态也是可以的 这样串联的好处是每次运行知识一个小模型的计算量 时间换空间的概念 可以训练100个模型而后根据需要进行微调 从100 个中选择一个预测比较接近的进行微调预测 预测后继续进行从100中选择 而后…

Linux内核之网络协议栈以及套接字sk_buff分析

网络协议栈以及套接字sk_buff分析一、Linux 内核网络协议栈构架二、网络协议栈常见的数据结构2.1、TCP/IP 参考模型及 ISO/OSI 参考模型2.2、套接字 sk_buff 分析2.3、套接字缓冲区管理数据2.4、Linux 内核提供套接字缓冲区标准 API 函数2.5、使用一个表头来实现套接字缓冲区的…

java StringBuffer和StringBuilder

目录一、概述二、StringBuffer和StringBuilder区别三、StringBuffer使用一、概述 String类是字符串常量&#xff0c;是不可更改的常量。而StringBuffer是字符串变量&#xff0c;它的对象是可以扩充和修改的。 StringBuffer是使用缓冲区的&#xff0c;本身也是操作字符串的&…

工作2年,连接口自动化测试用例怎么设计都不知道?你好意思吗

目录 前言 接口信息来源 单接口测试 场景逻辑验证 异常测试 尽量自动化 独立性 可重复性 合理的断言 公共参数 数据集合 数据模板 前言 说到自动化测试&#xff0c;或者说接口自动化测试&#xff0c;多数人的第一反应是该用什么工具&#xff0c;比如&#xff1a;Py…

FTP-----局域网内部传输文件(1)

在日常工作中&#xff0c;如果需要跨设备的传输文件&#xff0c;您需要借助USB数据线或者借助应用实现无线互联&#xff0c;将所需文件传输到对应设备&#xff0c;这一来一去&#xff0c;花费的时间与精力变多了&#xff0c;那么&#xff0c;怎么实现不使用第三方软件来实现跨设…

【MySQL】表的操作和数据类型

前言 大家好呀~&#xff0c;今天继续我们的mysql学习&#xff01; 本篇博客主要记录Mysql创建完数据库后&#xff0c;要在数据库中创建表&#xff0c;那么首先需要定义表的结构约束&#xff08;SQL-DDL&#xff09;等&#xff0c;这篇主要介绍基础定义表的结构&#xff08;创建…

学习React与Next.js过程中的疑惑

学习React与Next.js过程中的疑惑1、为什么React中函数作为props的时候&#xff0c;会出现无限调用的情况&#xff0c;而把函数放在箭头函数中就可以解决呢&#xff1f;2、next.js与node.js有什么区别&#xff1f;3、什么是快速刷新&#xff1f;4、Hooks出现的原因是什么&#x…

2020年11月信息系统项目管理师真题(综合+案例)

请点击↑关注、收藏&#xff0c;本博客免费为你获取精彩知识分享&#xff01;有惊喜哟&#xff01;&#xff01; 1、&#xff08; &#xff09;使系统的描述及信息模型的表示与客观实体相对应&#xff0c;符合人们的思维习惯&#xff0c;有利于系统开发过程中用户与开发人员的…

【从零开始学Skynet】实战篇《球球大作战》(十二):场景代码设计(上)

场景服务会处理绝大部分的游戏逻辑。新建service/scene/init.lua&#xff0c;开始编写相关代码。1、Ball类 场景中包含小球和食物这两种对象&#xff0c;先看看小球的实现。代码如下所示&#xff1a;--球 local balls {} --[playerid] ballfunction ball()local m {playerid…

项目打包记录提交id

某天上午正在摸鱼的小邓&#xff0c;突然被领导拉倒一个2年前项目的现场问题沟通群&#xff0c;说是现场数据无法入库&#xff0c;需要排查&#xff0c;奈何不知道版本&#xff0c;无奈的小邓值得用时间记录一个点一个点的从gitlab中查找&#xff0c;为了防止后续提供到现场的版…

【蓝桥杯嵌入式】蓝桥杯嵌入式2023年第十四届省赛真题解答

目录 0 题目介绍 1 题目分析 2 Cubemx配置 4 代码 5 效果显示 0 题目介绍 具体要求如下图 1 题目分析 拿到题目咋一看&#xff0c;就是基本操作&#xff0c;实际做起来一堆定时器操作&#xff0c;很容易把人绕晕。 首先看看需要用到的外设 1. GPIO(key/led) 2.LCD 3…