(5)platform.c 调用fw_platform_init,读取设备树,初始化platform结构体。 { const char *model; void *fdt = (void *)arg1; u32 hartid, hart_count = 0; int rc, root_offset, cpus_offset, cpu_offset, len; root_offset = fdt_path_offset(fdt, "/"); if (root_offset < 0) goto fail; f...
l 所有的hart都进入_start_warm; l在_start_warm函数中,设置自己的trap_handler,设置sp寄存器的值,接着调用sbi_init函数; 1.1.1 fw_platform_init函数 l 解析设备上,获取model信息; l 获取当前的hart数目; l 返回设备上地址; 1.1.2 _scratch_init函数 对于每一个hart,设置自己的scratch space,对应的结构如下...
就是调用fw_platform_init函数即可,如果函数是没有定义的,那么就直接执行下方弱定义的空函数即可.这个platform init需要我们在编译open-sbi的时候指定何种paltform,指定了platform的种类才能找到指定的init函数,注意此时传入参数a0——hart id,a1——fdt地址,a2,a3,a4均为上级loader程序的传入参数....
执行call fw_platform_init函数,前面分析过该函数的原型在opensbi/platform/generic/platform.c。 带四个参数。 代码语言:javascript 代码运行次数:0 运行 AI代码解释 unsigned longfw_platform_init(unsigned long arg0,unsigned long arg1,unsigned long arg2,unsigned long arg3,unsigned long arg4){constchar*model...
fw_boot_hart--从a2寄存器指向的struct fw_dynamic_info中获取boot_hart。 fw_save_info--将next_addr、next_mode、options、boot_hart分别保存到_dynamic_next_addr、_dynamic_next_mode、_dynamic_options、_dynamic_boot_hard中。 fw_platform_init--共5个参数:a0-boot HART, a1-FDT地址。
Platform Specific Library:某些平台特有的功能。 固件:提供三种不同类型的Runtime固件,包括Payload、Dynamic、Jump。 1.5 OpenSBI三种形态 固件的三种形态: FW_PAYLOAD:OpenSBI和下一级启动固件绑定在一起。 缺点: 任何OpenSBI或者Bootloader改变,都需要重新编译。
接下来就是调用fw_platform_init函数,注意此时传入参数a0——hart id,a1——fdt地址,a2,a3,a4均为上级loader程序的传入参数,这个函数由platform来实现如果不使用则该函数由弱定义空函数来代替,platform函数具体内容我们后面实现时再来看,此处暂时跳过。接下来就是_scratch_init函数,scratch你可以认为就是另一个sp指针...
make all PLATFORM=hpmicro CROSS_COMPILE=riscv32-unknown-elf- HPMSOC=HPM6800 O={build_dir} 编译完成后可以在{build_dir}中找到platform/hpmicro/firmware/fw_jump.bin,需要loader将其拷贝到地址0然后再跳转到地址0来运行。 5.2 Loader参考: · Github仓库地址 https://github.com/hpmicro/hpm_opensbi_lo...
为了简化模型,目前只通过FW_JUMP方式进行跳转。 下载opensbi的代码 gitclonehttps://github.com/riscv/opensbi.git 进行编译 exportCROSS_COMPILE=riscv64-unknown-elf- makePLATFORM=genericclean makePLATFORM=genericFW_JUMP_ADDR=0x80200000 注意FW_JUMP_ADDR=0x80200000是指定的跳转地址。当然可以指定固件跳转到其...
编译完成后可以在{build_dir}中找到platform/hpmicro/firmware/fw_jump.bin,需要loader将其拷贝到地址0然后再跳转到地址0来运行。 5.2 Loader参考: · Github仓库地址 https://github.com/hpmicro/hpm_opensbi_loader.git · 编译命令 HPM_SDK_BASE={SDKBASE} GNURISCV_TOOLCHAIN_PATH={RISCV TOOLCHAIN PATH} ...