Nucleus PLUS system architecture and components

Source: Internet
Author: User
Tags constant definition
(1) Methodology of components and software components1. Definition of software components

In general, components are components that can be clearly identified in the system, and an opaque function implementation body. In software development, components are simple encapsulation of data and methods, and they have standardized and agreed interfaces. Components are object-oriented, feature-independent, highly reusable, and independent from languages and platforms. A software component is a relatively independent component of a software system. It is an execution unit that provides a set of service code through a specified interface, this execution unit features high cohesion and low coupling. The interface of the component is separated from the implementation of the component. The caller only needs to know the interface and access the interface to use the component. The interface is relatively fixed. Changes in component functions and implementations should not cause changes to the interface. Software components are key technologies for software reuse.

2. Software Component methodology:

Component Technology is a software development technology that emerged in the early 1990s S. It was developed on the basis of structured design and object-oriented technology, it is a standard system for software development after object-oriented technology and an extension of object-oriented development technology. Software Component development is mainly used in the process of developing and maintaining the system structure. The purpose of using software components as a separate process is to use components as the "parts" of the construction software ". With the concept and technology of components, software development can draw on successful instances in architecture and modern manufacturing, first construct the overall architecture of software, and then based on the Component Reuse Technology, assemble the required functional components on the architecture as needed, and finally form an application. Version updates can only be implemented by replacing the old component with the new component, without modifying the entire program or re-compiling the entire program.

(2) system architecture of Nucleus PLUS

The Nucleus PLUS system is composed of software components to enhance the code clarity, reliability, and reusability of the system, making the system modular and easy to maintain. Nucleus PLUS consists of multiple software components, each of which has a unique purpose and a specific external interface. Each component is implemented by calling these interfaces. In most cases, the data structure inside the component cannot be directly accessed by other components. This component architecture allows each software component of Nucleus PLUS to be easily replaced and reused.

Each software component consists of two header files and several source files. The source files are mostly written in C language, and a few are written in assembly language. One header file is used for data type definition and constant declaration, and the other is used to declare the external interface of the component. The following table provides an overview of each component file. components do not necessarily contain all the files in the Table. XX indicates the abbreviation of the component.

In a processor architecture that supports user mode and management mode, the Nucleus PLUS kernel and all application tasks run in management mode. This method is simple and has low overhead for task system calls, but each task can access any resource.

All user code source files that need to call the Nucleus PLUS system service or use the Nucleus data type must contain the header file "nucleus. h ". The file contains the data type, constant definition, and all function declarations of the Nucleus PLUS Service. In fact, all functions starting with "Nu _" in "nucleus. H" do not actually exist in the source code of each component of nucleus. Most nucleus functions have a function (defined in each component) that actually executes operations and a "shell" function that checks errors before calling a function. The error check function can be disabled. The macro may not mark "nu_no_error_checking. The definition of nu_no_error_checking determines whether the "Nu _" function is actually mapped to the component function.

(3) components of Nucleus PLUS

A total of 16 components of the Nucleus PLUS system are discussed as follows (mainly describes the functions of the components ):

1. Common Service component (CS)

All the control data structures controlled by the Nucleus PLUS component are linked lists. CS is responsible for providing the link structure and linked list operation functions, including adding and deleting nodes.

2. initialize the component initialization component (in)

Initializes and starts the Nucleus PLUS system. The initialization and startup process consists of two parts: the hardware target board dependency (processor-related and board-Level Initialization) is first initialized, and then the initialization of each of the core plus components and user programs.

Int_initialize subprogram is the first to run in the Nucleus PLUS system and is responsible for initialization of all hardware boards related to the target. After int_initialize is completed, the control is transferred to the advanced Nucleus PLUS initialization subroutine inc_initialize and no return is returned. Inc_initialize calls all the objects such as the initialization function of the Nucleus PLUS component, the application_initialize is called to create a user task, and the control is handed over to the scheduling function tct_schedule. The system starts up. For details about the initialization process, see "startup, running thread, and interrupt handling of Nucleus PLUS".

3. Thread Scheduling component tread control component (TC)

Responsible for preemptible real-time tasks and hisr scheduling and management of Nucleus PLUS. Each user application consists of multiple tasks. A task is a semi-independent program segment with a specific purpose. A task is in one of five states: running, ready, suspended, terminated, and completed. Tasks have different priorities. High-priority tasks can seize low-priority tasks. tasks with the same priority are scheduled in the "ready" order, with the priority decreasing from 0 to 25.

Each task of Nucleus PLUS has a control struct called thread control block (TCB)-tc_tcb. Tasks support dynamic creation and deletion. TC manages all tasks through a two-way linked table tcd_created_tasks_list, the global variable tcd_total_tasks indicates the total number of tasks that have been created.

Tcd_priority_list is a 256-sized TCB pointer array (the array size is the same as the priority level of the Nucleus PLUS ), each array pointer is the header of a table (a blank element indicates a task without this priority). The element of this table is a TCB pointer of a ready task with the same priority. That is, Nucleus PLUS maintains a pointer array to schedule the linked list of tasks with different priorities.

For details about the task scheduling process, see the blog "Nucleus PLUS task scheduling".

Hisr is the lower half of the interrupt processing routine and can access most of the Nucleus PLUS tasks (which cannot be automatically suspended ). Hisr is also preemptible, and its priority is 0-2. Hisr is activated by lisr, so it must be created and registered in advance.

The management of hisr is similar to the management of tasks. Each hisr has a control structure tc_hcb and an exclusive stack. tcd_created_hisrs_list is the header that stores the two-way linked list of created hisr routines, tcd_total_hisrs indicates the total number of hisr instances that have been created. In addition, TC maintains two activated hisr tables. The table items are the headers and tails of three hisr two-way linked lists with priority activated. TC also maintains lisr routines through the linked list, including interrupt vector registration and lisr entry functions. The TC component provides functions such as creating, deleting, and activating hisr.

4. Clock component timer component (TM)

Manages all the Nucleus PLUS timer devices. The basic timing unit of Nucleus PLUS is a tick, which is equivalent to a hardware timer interruption. At the system level, the timer is used for Task Management-timed sleep and wake-up. At the user application level, the timer is used in places where a timeout processing mechanism is required.

The timer supports dynamic creation/deletion. Each timer has a control structure such as tm_tcb, tmd_hisr, or tm_app_tcb, which are used for system task timer, hisr timer, and application dedicated timer respectively. TM maintains the list of created and activated timers through the linked list. TM provides a system timer tmd_system_clock.

Timer functions include creation, start, stop, reset, deletion, and timeout processing.

5. For the mail component mailbox component (MB), the following shows the communication mechanism between processes (such as mailbox, queue, pipeline, semaphores, and event groups) of the Nucleus PLUS. For details, refer to the blog post "Interprocess Communication (IPC) mode".

Manages all the mailbox services of Nucleus PLUS and provides a low-cost inter-process communication mechanism. Each mailbox contains a message with a length of 4 32-bit characters. Mailboxes can be dynamically created/deleted by users, and can be suspended or restored.

Each mailbox has a control block mailbox control block (MCB) mb_mcb, and MB maintains the created mailbox through a two-way linked list. Task suspension/wakeup in the mailbox supports FIFO order and task priority order. It is also implemented by maintaining a two-way linked list. Each task is suspended in the mailbox and a control block mb_suspend structure is created.

MB provides functions such as mailbox creation, deletion, message sending/retrieval, resetting, clearing, and broadcasting.

6 Queue Component Queue component (QM) and 7 Pipeline component pipe component (PI)

Manage all the core plus queue services and all the core plus queue services respectively. The management of the two parts is similar to that of the MB, the difference is that the queue message is one or more 32-bit characters, and the pipeline message is one or more 8-bit bytes.

8. semaphore component (SM)

Manages all the Nucleus PLUS semaphores for synchronization between multiple tasks. Semaphores support dynamic creation/deletion. sm provides a semaphore count range of 0-4,294,967,294, which is similar to MB management.

9. Event flag component (EV)

Manages all the services of the Nucleus PLUS event group. Each event group contains 32 event flags ), that is, each bit of a 32-bit unsigned integer is an event flag (1 indicates that the event occurred, and 0 indicates that the event has not occurred ). Its management is similar to that of MB.

10. Storage allocation component partition memory component (pm)

Manages all the core plus partition memory. The memory pool of the partition memory refers to the memory that is determined by the total number of memory specified by the user and the number of bytes of each partition. The partition memory supports dynamic creation and task suspension/Wakeup (FIFO or task priority order ).

Each partition memory requires a control block partition memory control block (PCB)-pm_pcb (memory occupied, not included in the partition memory ), PM maintains the memory of all created partitions through a two-way linked list. The available partitions in each partition memory are controlled by a single-chain table ending with a null value. Each available partition starts with the header structure pm_header.

11. dynamic memory component (DM)

Responsible for managing all the core plus dynamic memory services. The starting position and length of the dynamic memory pool are specified by the user. It supports dynamic creation/deletion and task suspension/wakeup. The dynamic memory is allocated according to the first fit algorithm, and there is no fixed number of shards. The management of DM is similar to that of PM.

12, I/O Driver component iinput/output driver component (I/O)

Responsible for managing the driver services of all the Nucleus PLUS input/output devices and providing a common and similar s driver service interface, services include initialization, allocation, release, input/output, device status retrieval, and service application termination.

13. Error component (ER)

Manages all the errors in the Nucleus PLUS system.

14. Historical component history component (HI)

Responsible for managing the historical devices of Nucleus PLUS.

15. License component license component (Li)

Responsible for License Management of Nucleus PLUS.

16. Version Control Component release component (RL)

Responsible for Version Management of Nucleus PLUS.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.