reset
[TOC] reset-uclass.creset_get_by_index123456789101112int reset_get_by_index(struct udevice *dev, int index, struct reset_ctl *reset_ctl){ struct ofnode_phandle_args args; int ret; //寻找当前节点的`resets`的phandle索引,内容为`#reset-cells`的设备节点 ret = dev_read_phandle_with_args(dev, "resets", "#reset-cells", 0, index, &args); return reset_get_by_index_tail(ret, dev_ofnode(dev), &args, "resets", index > 0, reset_ctl);} reset_get_by...
test
[TOC] testtest.hUNIT_TEST12345678//在段中定义一个测试用例函数#define UNIT_TEST(_name, _flags, _suite) \ ll_entry_declare(struct unit_test, _name, ut_ ## _suite) = { \ .file = __FILE__, \ .name = #_name, \ .flags = _flags, \ .func = _name, \ } ut.c 单元测试相关函数 参考Unity测试框架,不在分析
serial
[TOC] serial-uclass.cserial_init 初始化串口 注意DM已初始化完成 serial_init 在relocation前调用 serial_initialize 在relocation后调用 1234567891011121314/* Called after relocation */int serial_initialize(void){ /* Scanning uclass to probe devices */ if (IS_ENABLED(CONFIG_SERIAL_PROBE_ALL)) { int ret; //探测所有的串口设备 ret = uclass_probe_all(UCLASS_SERIAL); if (ret) return ret; } return serial_init();} 123456789101112131415161718192021222324252627282930/* Called prior to relocation */i...
bootretry
[TOC] BOOT_RETRY 允许 U-Boot 命令提示符超时并尝试以再次启动。 如果找到环境变量 “bootretry”,则使用其值,否则重试超时为CONFIG_BOOT_RETRY_TIME。 CONFIG_BOOT_RETRY_MIN 是可选的,并且默认为 CONFIG_BOOT_RETRY_TIME。所有时间均以秒为单位。 如果重试超时为负数,则 U-Boot 命令提示符永不超时。否则,它将被强制为至少CONFIG_BOOT_RETRY_MIN 秒。如果没有有效的 U-Boot 命令在指定时间之前输入,则引导延迟序列为重新启动。U-Boot 执行的每个命令都会重新启动超时。 如果CONFIG_BOOT_RETRY_TIME < 0,则该功能存在,但除非环境变量 “bootretry” >= 0,否则不会执行任何操作。 bootretry_init_cmd_timeout 从env中获取bootretry的值,如果没有配置,则使用CONFIG_BOOT_RETRY_TIME的值 如果0 < CONFIG_BOOT_RETRY_TIME &...
bootm
cmd/bootm.c 从内存中的映像引导应用程序映像do_bootm1234567891011121314151617181920212223242526//bootm 90080000//cmdtp:命令表,flag:标志位,argc:参数个数,argv:参数列表int do_bootm(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]){ struct bootm_info bmi; int ret; //执行子命令 //默认命令执行默认参数初始化 bootm_init(&bmi); if (argc) bmi.addr_img = argv[0]; //设置镜像地址 字符串"90080000" if (argc > 1) bmi.conf_ramdisk = argv[1]; if (argc > 2) bmi.conf_fdt = argv[2]; /* set up argc and argv[] since some OSes ...
env
envU_BOOT_ENV_LOCATION 通过该宏定义环境变量的位置 1234567891011121314151617181920/* * Define a callback that can be associated with variables. * when associated through the ".callbacks" environment variable, the callback * will be executed any time the variable is inserted, overwritten, or deleted. * * For SPL these are silently dropped to reduce code size, since environment * callbacks are not supported with SPL. */#ifdef CONFIG_XPL_BUILD#define U_BOOT_ENV_CALLBACK(name, callback) \ static ...
image
image-board.cgenimg_get_kernel_addr_fit1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253/** * genimg_get_kernel_addr_fit() - 解析 FIT 说明符 * * 从通常为第一个的字符串中获取真正的内核起始地址 bootm/bootz 的 argv * 这些情况根据 @img_addr 的值进行处理: * NULL:返回 image_load_addr,不设置最后两个参数 * “<addr>”:返回地址 * 对于 FIT: * “[<addr>]#<conf>”:返回地址(或image_load_addr)、 * 将 fit_uname_config 设置为 Config Name * “[<addr>]:<subimage>”:返回地址(或 image_load_addr)并设置 * fit_uname_ker...
bootz
[TOC] bootz12345678910111213141516171819U_BOOT_LONGHELP(bootz, "[addr [initrd[:size]] [fdt]]\n" " - boot Linux zImage stored in memory\n" "\tThe argument 'initrd' is optional and specifies the address\n" "\tof the initrd in memory. The optional argument ':size' allows\n" "\tspecifying the size of RAW initrd.\n"#if defined(CONFIG_OF_LIBFDT) "\tWhen booting a Linux kernel which requires a flat device-tree\n" &quo...
arm
[TOC] Kconfig中断控制器GIC (Generic Interrupt Controller) 通用中断控制器 GIC 是 ARM 处理器的一种通用中断控制器,用于管理和分发中断信号。GIC 支持多种中断类型,包括外部中断、定时器中断、软件中断等。GIC 通过中断控制器和中断分配器组件实现中断的管理和分发。 GICv2 GICV2是 ARM 提供的第二版通用中断控制器,广泛应用于 ARMv7 和部分 ARMv8 架构的处理器中。 中断管理:支持多达 1020 个中断源,包括外部中断和内部中断。提供中断优先级管理和中断屏蔽功能。 分布式架构:包括一个分配器(Distributor)和多个 CPU 接口(CPU Interface),分配器负责中断的分发,CPU 接口负责中断的处理。 中断路由:支持将中断路由到特定的 CPU 或多个 CPU,提供灵活的中断处理机制。 软件生成中断:支持软件生成中断(SGI),允许处理器之间通过中断进行通信。 GICv3 GICV3 是 ARM 提供的第三版通用中断控制器,广泛应用于 ARMv8 架构的处理器中。 扩展的中断管理:支持多达...
assembly
[TOC] 声明.globl 声明全局符号 使其在链接过程中可以被其他文件引用 .long 用于定义一个32位的整数.type 声明符号类型 .type reset, %function指令指定reset是一个函数类型的符号 段定义与操作.section 用于定义代码段 通过使用 .section 指令,开发者可以明确地指定代码和数据在内存中的布局,从而更好地控制程序的结构和行为。 pushsection 用于定义代码段并且设置段属性 pushsection 指令用于定义一个新的代码段,并且可以设置段属性。它的语法如下: 1pushsection section_name, flags section_name 是新的代码段的名称。 flags 是段属性,可以是以下值之一: awx:表示代码段,可读、可写、可执行。 a:表示代码段,可读。 w:表示代码段,可写。 x:表示代码段,可执行。 .text 指定了代码段为 .text.macro 定义宏.macro 指令用于在汇编代码中定义一个宏。宏是一段可以重复使用的代码块,可以带有参数。定义宏后,可以在代码中多...