简体   繁体   English

U-boot可在单独的核心上加载两个映像

[英]U-boot to load two images on separate cores

I have NXP/Free-scale Imx6 sabre lite development board. 我有恩智浦/自由规模的Imx6 saber lite开发板。 My task is to flash two OS kernels (Linux and RTOS)in such a way that linux runs on core0 and RTOS on core1. 我的任务是以这样的方式刷新两个OS内核(Linux和RTOS),以便linux在core0上运行,而在core1上运行RTOS。 I have 1GB DDR3 in which i have to allocate first 128MB for RTOS and rest for LINUX image. 我有1GB DDR3,我必须先为RTOS分配128MB,然后为LINUX映像分配。

  1. How to configure U-boot in this case? 在这种情况下如何配置U-boot?
  2. core-0 should load Linux kernel in >128MB DDR3 area meanwhile core1 is in idle state at that time. core-0应该在> 128MB DDR3区域加载Linux内核,同时core1处于空闲状态。
  3. core-0 should load RTOS and transfer control to core-1. core-0应该加载RTOS并将控制转移到core-1。

How can i achieve this scenario using u-boot ? 如何使用u-boot实现这种情况?

Please let me know if anyone have solved this! 如果有人解决了这个问题,请告诉我!

Thanks in advance! 提前致谢!

Well this is possible but I don't think uboot allow's this with some exceptions. 嗯,这是可能的,但我不认为uboot允许这有一些例外。 Some vendors provide modified uboot binaries with their boards that support such functionality. 一些供应商提供修改后的uboot二进制文件及其支持此类功能的主板。 For example Xilinx provided u-boot for ZCU102 allows loading and bringing up of cortex-R cores from cortex-a53 cores present in the same SOC. 例如,Xilinx为ZCU102提供了u-boot,允许从同一SOC中存在的cortex-a53核心加载和提取皮质-R核心。

One of the famous Open source framework OpenAMP does this work. 其中一个着名的开源框架OpenAMP可以完成这项工作。 It allows remote's life cycle management and also establishes communication between multiple OS running on different cores. 它允许远程的生命周期管理,并在不同核心上运行的多个OS之间建立通信。 But as far as I remember saber-lite is not supported currently. 但据我记得,目前不支持saber-lite。

Important in your case: In your case, you can simply follow these steps to get your work done. 在您的情况下很重要:在您的情况下,您只需按照以下步骤完成工作即可。

Step1: Make sure the memory given to RTOS is not accesible to Linux. 步骤1:确保提供给RTOS的内存不可访问Linux。 For this you will need to modify the dts file, the memory node to be exact. 为此,您需要修改dts文件,确切地说是内存节点。

Step2: Remove the devices from the dts that you want to access from RTOS. 步骤2:从要从RTOS访问的dts中删除设备。 Don't remove the important ones like GIC. 不要删除重要的像GIC。 RTOS will share it with linux without even it knowing. 即使知道,RTOS也会与linux共享它。 This is the only way I know of using GIC in an unsupervised environment. 这是我知道在无人监督的环境中使用GIC的唯一方法。 This also answers @AndrejsCainikovs question asked in the comments. 这也回答了@AndrejsCainikovs在评论中提出的问题。

Step3: Modify bootargs from dts. 第3步:修改dts的bootargs。 Add nosmp flag in the bootargs in the dts. 在dts的bootargs中添加nosmp标志。

Step4: Build the dts and replace the already placed dts in the boot partition of the SD-card. 步骤4:构建dts并将已放置的dts替换为SD卡的启动分区。

Step5: In your GIC code comment our the reset and init code. Step5:在你的GIC代码中注释我们的reset和init代码。 Let the GIC be in what ever state it is in. Enable the cpu interface and those peripheral interrupts that you will be using and set their CPU affinity to RTOS core only. 让GIC处于它所处的状态。启用cpu接口和将要使用的外围中断,并仅将它们的CPU亲和性设置为RTOS内核。 Now modify the linker file and build and link the RTOS code for the memory region that you just removed from linux memory region. 现在修改链接器文件,构建并链接刚从linux内存区域中删除的内存区域的RTOS代码。

Step6: Copy the RTOS binary to boot partition of the SD-card. 步骤6:将RTOS二进制文件复制到SD卡的启动分区。

Step7: Run the board and stop the u-boot at auto-boot. 步骤7:运行电路板并在自动启动时停止u-boot。 run the following command to load the RTOS image in memory. 运行以下命令以在内存中加载RTOS映像。

    fatload mmc 0:1 0x10000000 rtos.bin;

Obviously you will need to change load address as per your RTOS addresses and may be the mmc partition number. 显然,您需要根据RTOS地址更改加载地址,并且可能是mmc分区号。

Step8: Run the linux kernel using boot command and in the linux kernel you will need to play with some registers. Step8:使用boot命令运行linux内核,在linux内核中你需要使用一些寄存器。 I would choose to do it by writing a kernel driver and using ioremap to map those registers and access them. 我会选择通过编写内核驱动程序并使用ioremap映射这些寄存器并访问它们来实现。 But its upto you how you do it, I am explaining here what needs to be done. 但是你如何做到这一点,我在这里解释需要做些什么。

Write the RTOS start address in SRC_GPR3 register for core1 or in SRC_GPR5 for core2 or SRC_GPR7 for core3. 将核心1的SRC_GPR3寄存器中的RTOS起始地址写入核心2的SRC_GPR5或核心3的SRC_GPR7中写入RTOS起始地址。

Now enable the core using SRC_SCR register's 22nd 23rd and 24th bit for core1 core2 and core3 respectively, which ever you intend to run your RTOS on. 现在使用SRC_SCR寄存器分别为core1 core2和core3的第22和第23位启用内核,这是您打算运行RTOS的。 Note that core0 can not be disabled or enabled. 请注意,无法禁用或启用core0。

Now bring the core out of reset using SRC_SCR register's 13th 14th 15th and 16th bits for core0 core1 core2 and core3 respectively. 现在,使用SRC_SCR寄存器的core1 core1 core2和core3的第13个第14位和第16位将内核从复位中移出。 Your RTOS will start running. 您的RTOS将开始运行。

This overall configuration is formally called unsupervised systems as opposed to supervised systems that run hypervisor to do the strict resource partitioning. 这种整体配置正式称为无监督系统,与运行管理程序进行严格资源分区的监督系统相反。 Here each OS runs with caution to not to touch any of the resources assigned to other OS. 这里每个操作系统都谨慎运行,以免触及分配给其他操作系统的任何资源。

You can find these registers memory addresses in i.MX 6Dual/6Quad Applications processor reference manual. 您可以在i.MX 6Dual / 6Quad Applications处理器参考手册中找到这些寄存器的存储器地址。 Document Number: IMX6DQRM 文件编号:IMX6DQRM

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM