初始化组件是核心组件。它不同于标准版MQX的初始化组件。 标准版的_mqx 函数在精简版中分成两个函数: _mqxlite_init()-这个函数是在处理器专家内部初始化期间调用的。基于在MQX精简版初始化传递给函数_mqxlite()的值,MQX会做以下工作: 设置和初始化MQX精简版内部使用的数据包括MQX精简版的内核数据结构,准备好的队列,中断堆栈; 创建内部同步需要的轻量级信号量; 开启定时器滴答; _mqxlite()-这个函数启动MQX精简版系统,应该由用户程序调用,一般来说是在处理器专家内部初始化代码(PE_low_level_init()函数)调用之后在main函数中调用。 _mqxlite函数会: 创建在没有就绪任务时激活的idle(空闲函数); 创建任务模板列表里面定义的自动开启的任务; 启动任务调度器 1.2.1 Initialization
Initialization is a core component. It differs from the initialization component of the
standard MQX. The _mqx() function of the standard MQX is split into two functions in
MQXLite:
• _mqxlite_init() - This function is called during the Processor Expert internal
initialization. Based on the values in MQX Lite initialization structure that is passed
as _mqxlite() function argument, MQX Lite does the following:
• It sets up and initializes the data that MQX Lite uses internally, including MQX
Lite kernel data structure, ready queues, and the interrupt stack.
• It creates lightweight semaphore for internal synchronization needs.
• It starts the tick timer.
• _mqxlite() - This function starts MQX Lite and should be called from the user
application, typically in main(), after the Processor Expert internal initialization code
(PE_low_level_init() function). The _mqxlite() function:
• Creates the idle task, which is active if no other task is ready.
• Creates tasks that the task template list defines as autostart tasks.
• Starts the task scheduler.
|