SA8155 QNX 系统启动时序

About the system startup sequence

A system running the QNX Neutrino RTOS boots in several stages, as illustrated in the following diagram:


QNX系统启动经历过7个阶段:
PLL => IPL => Startup => BaseSystem(Kernel,Core OS) => Boot Script => SLM => Apps


PLL阶段:  (phase locked loop 锁相环)
硬件时钟稳定阶段,锁相环将外部晶振稳定到系统内部的所有频率(Sysclk,timer等),消耗时间大概在32ms左右;属于纯硬件动作;


IPL阶段:(initial program loader)
基本操作包括:CPU、内存、外部存储等控制器的初始化,将启动程序从映像文件系统IFS(包括启动程序、内核、启动脚本、驱动程序、应用程序等)拷贝到内存,并跳转到内存继续执行;IPL阶段执行的程序,类似于UBoot,UEFI (XBL,ABL)等启动引导程序。


Startup阶段: Startup program
可引导OS映像中的第一个程序是一个启动程序,其目的是完成所有硬件初始化配置,如定时器、时钟频率、中断控制器、缓存控制器等,但不包括配置串口波特率之类的东西。

它也不会初始化标准周边设备,例如以太网控制器或EIDE硬件disk控制器——这些都留给驱动稍后启动以后来完成,然后将控制加载并转移到内核(procnto或procnto-smp)。


Base system阶段:
内核初始化内存管理单元(MMU),创建结构来处理分页

When the power is first turned on your system, the PLL, IPL, and startup program run and bring up your base system. The base system is primarily the kernel or core operating system. From there, a boot script runs to load device drivers, run services, and start applications. Then finally the main system boots, which allows the main applications of your system to boot, such as the HMI (human machine interface). The previous diagram shows this generic boot sequence:

The boot stages are as follows as part of the Kernel:

PLL (phase locked loop)—PLL refers to how long it takes for the first instruction to begin executing after power is applied to the processor. Most CPUs have a PLL that divides the main crystal frequency into all the timers used by the chip. The time that the PLL takes to settle to the desired frequencies often represents the largest portion of the chip's startup time. The PLL stage is independent of any OS and varies from CPU to CPU; in some cases, it takes as long as 32 milliseconds. Consult the hardware platform's user manual for the exact timing.  PLL (锁相环) 是指处理器上电后第一条指令开始执行所需的时间。大多数 CPU 都有一个 PLL,它将主晶振频率分成芯片使用的所有定时器。 PLL 稳定到所需频率所需的时间通常代表芯片启动时间的最大部分。 PLL 阶段独立于任何操作系统,并且因 CPU 而异;在某些情况下,它需要长达 32 毫秒。请查阅硬件平台的用户手册了解确切的时间。

IPL (initial program loader)—QNX provides a standard, bare-bones IPL that performs the fewest steps necessary to configure the memory controller, initialize the chip selects and/or PCI controller, and configure other required CPU settings. Once these steps are complete, the IPL copies the startup program from the image filesystem (IFS) into RAM and jumps to it to continue execution.      QNX 提供了一个标准的基本 IPL,它执行配置内存控制器、初始化芯片选择和/或 PCI 控制器以及配置其他所需的 CPU 设置所需的最少步骤。完成这些步骤后,IPL 将启动程序从映像文件系统 (IFS) 复制到 RAM 并跳转到它以继续执行。

The IFS contains the OS image, which consists of the startup program, the kernel, the boot script, and any other drivers, applications, and binaries that the system requires. Because you can control what the IFS contains, the time for the copying stage varies, but it typically constitutes the longest part of the kernel boot process. In extreme cases where the system contains a very large image and has no filesystem other than the IFS, this stage can take a long time (10 seconds or more).     IFS 包含操作系统映像,它由启动程序、内核、引导脚本以及系统所需的任何其他驱动程序、应用程序和二进制文件组成。因为您可以控制 IFS 包含的内容,所以复制阶段的时间会有所不同,但它通常构成内核引导过程中最长的部分。在系统包含非常大的映像并且除 IFS 之外没有其他文件系统的极端情况下,此阶段可能需要很长时间(10 秒或更长时间)。

That said, you can exercise a great deal of control over the length of this phase, albeit indirectly, by reducing the size of the IFS. To add, remove, or configure files stored in the IFS, you can edit the script block in the buildfile or use the QNX System Builder in the IDE. You can also compress the image to make the IFS smaller (with the additional overhead of decompression, which you can speed up by enabling the cache in the IPL).   也就是说,您可以通过减小 IFS 的大小来对这个阶段的长度进行大量控制,尽管是间接的。要添加、删除或配置存储在 IFS 中的文件,您可以编辑构建文件中的脚本块或使用 IDE 中的 QNX System Builder。您还可以压缩图像以使 IFS 更小(具有额外的解压缩开销,您可以通过在 IPL 中启用缓存来加速)。

Typically, the bootloader executes for at least 6 milliseconds before it starts to load the OS image. The actual amount of time depends on the CPU architecture, on what the board requires for minimal configuration, and on what the chosen bootloader does before it passes control to the startup program.   通常,引导加载程序在开始加载 OS 映像之前至少执行 6 毫秒。实际时间量取决于 CPU 架构、电路板对最小配置的要求以及所选引导加载程序在将控制权传递给启动程序之前所做的工作。

Some boards come with another bootloader, such as U-boot. These bootloaders aren't as fast as the QNX IPL, since the IPL has been specifically tuned for QNX systems. We recommend that you replace your bootloader with the IPL.   有些板带有另一个引导加载程序,例如 U-boot。这些引导加载程序不如 QNX IPL 快,因为 IPL 专门针对 QNX 系统进行了调整。我们建议您将引导加载程序替换为 IPL。

For more information on the IPL and how to modify it for your purposes, see the Initial Program Loaders (IPLs) chapter in Building Embedded Systems.   有关 IPL 以及如何根据您的目的对其进行修改的更多信息,请参阅构建嵌入式系统中的初始程序加载器 (IPL) 章节。

Startup program—The first program in a bootable OS image is a startup program whose purpose is to initialize the hardware, initialize the system page, initialize callouts, and then load and transfer control to the kernel (procnto or procnto-smp). If the OS image isn't in its final destination in RAM, the startup program copies it there and decompresses it, if required.  可启动操作系统映像中的第一个程序是启动程序,其目的是初始化硬件、初始化系统页面、初始化标注,然后加载并将控制权转移到内核(procnto 或 procnto-smp)。 如果操作系统映像不在 RAM 中的最终目标位置,则启动程序会将其复制到那里并在需要时对其进行解压缩。

During bootup, the kernel initializes the memory management unit (MMU), creates structures to handle paging, processes, and exceptions, as well as enabling interrupts. Once this phase is complete, the kernel is fully operational and can begin to load and run user processes from the boot script.    在启动期间,内核初始化内存管理单元 (MMU),创建结构来处理分页、进程和异常,以及启用中断。 一旦这个阶段完成,内核就可以完全运行,并且可以开始从引导脚本加载和运行用户进程。

Boot script—Each board has a different set of scripts to support different configurations. The script blocks in the buildfile lets you specify which drivers and applications to start, and in what order.   引导脚本——每个板都有一组不同的脚本来支持不同的配置。 构建文件中的脚本块可让您指定要启动的驱动程序和应用程序以及启动顺序。

You can use the boot script to launch services and utilities that need to be running very early (for example, sound a chime, show a splash screen, or show a video feed from a camera) or that require extra time to load (for example, PPS or disk drivers). Wherever possible, these processes should be started in the background to optimize parallelism and maintain the highest possible utilization of the CPU until all components of your system are running and operational.    您可以使用引导脚本来启动需要很早运行的服务和实用程序(例如,发出提示音、显示启动屏幕或显示来自摄像机的视频源)或需要额外时间才能加载的服务和实用程序(例如 , PPS 或磁盘驱动程序)。 在可能的情况下,这些进程应该在后台启动,以优化并行性并保持 CPU 的最高利用率,直到系统的所有组件都运行和操作。

It's also important to limit what goes into the boot script because it's included in the IFS, and everything that's added to it increases the IFS size and the time it takes to load it. Here are some of the things you might load in the boot script:   限制进入引导脚本的内容也很重要,因为它包含在 IFS 中,添加到其中的所有内容都会增加 IFS 大小和加载它所需的时间。 以下是您可能会在引导脚本中加载的一些内容:

  • screen and camera services
  • audio service and the early chime utility
  • disk drivers (and then mount the disks)
  • PPS service
  • debugging utilities, such as slogger2 and dumper
  • BSP drivers, like the serial driver, realtime clock, and other hardware utilities
  • SLM and the system debug console

SLM (system launch and monitor) —SLM is a service that starts the processes required for your system.  SLM 是一项服务,可启动系统所需的进程。

Typically, there are processes and applications that aren't required immediately, such as network connectivity io-pkt) or processes that need to start before your main application, such as an human-machine interface (HMI). At this point, SLM waits for further instructions. SLM is controlled by a set of configuration files (slm-config-all.xml and slm-config-platform.xml) that tell it what modules to start and whether there are dependencies within or between those modules. For more information, see the System launch and monitor (SLM) section in the Utilities Reference.  通常,有些进程和应用程序不需要立即启动,例如网络连接(io-pkt)或需要在主应用程序之前启动的进程,例如人机界面 (HMI)。 此时,SLM 等待进一步的指令。 SLM 由一组配置文件(slm-config-all.xml 和 slm-config-platform.xml)控制,这些文件告诉它要启动哪些模块以及这些模块内部或之间是否存在依赖关系。 有关详细信息,请参阅实用程序参考中的系统启动和监控 (SLM) 部分。

  • 2
    点赞
  • 38
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值