Nucleus Plus System architecture and components

Source: Internet
Author: User

(a) methodology and software components1. Software components (software Component) Definitions

In the general sense. Components (Component) are part of the system that can understand the identification, an opaque function implementation body. In software development, a component is a simple encapsulation of data and methods, and it has an interface of the agreed-upon specification. Components have object-oriented features, feature independence, high reusability, and language and platform-independent characteristics.

Software component is a certain and relatively independent component of software system, it is a running unit which provides a set of service code through the specified interface, which is characterized by high cohesion and low coupling.

The interface of a component is separated from the implementation of the component, and the caller simply needs to know the interface and access the interface to be able to use the component.

Interfaces are relatively fixed, and changes in the functionality and implementation of the components should not cause changes in the interface. Software component is the key technology of software reuse.

2, Software component methodology:

Component technology is a software development technology that appeared in the early 90, it is developed on the basis of structural design and object-oriented technology, and it is the standard method of software development after object-oriented technology. is an extension of object-oriented development technology. Software component development is primarily a component used in the development and maintenance of the system construction process.

The software component is used as a separate process in order to use the component as the "component" of the construction software.

With the concept of components and component technology. Software development can learn from the success of architecture and modern manufacturing, the first structure of the overall software architecture. Then, based on the component reuse technology, the architecture is based on the components that need to assemble the required functions, and finally the application is formed.

Version number updates can only be implemented by replacing the old component with the new component. Without having to modify the entire program, you do not need to compile the whole program again.

(ii) Nucleus Plus System Architecture

The Nucleus Plus system is composed of software components to add code clarity, reliability, and reusability to the system, making the system modular and easy to maintain. Nucleus Plus is comprised of multiple software components, each with a unique purpose and a specific external interface. The use of each component is implemented through calls to these interfaces. In most cases, the data structures inside the component are not directly available to other components. Such a component architecture makes every software component of nucleus plus easy to replace and reuse.

Each software component consists of two header files and several source files, in which the source files are mostly written in C and a few are written in assembly language.

One for the data type definition and a constant declaration, and the other for declaring the component's external interface.

The following table is an overview of each component file, and the component does not necessarily include all of the files in the table, where XX identifies the component name abbreviation.

On the processor architecture that supports user mode and management mode. The Nucleus PLUS kernel and all application tasks are performed in admin mode.

This approach is simple and the task system invocation overhead is small, but every task has access to whatever resources.

The header file "NUCLEUS.h" should be included in all user code source files that need to call the NUCLEUS Plus system service or use the NUCLEUS data type. The file includes data types, constant definitions, and all function declarations for the nucleus plus service. In fact. All functions in "NUCLEUS.h" that begin with "nu_" are virtually nonexistent in the source code of the NUCLEUS components. The vast majority of nucleus functions have a function that actually runs the operation (as defined in each component) and a "shell" function that incorrectly checks the user's call before invoking a really running function. The error checking function is disabled and does not define a macro labeled "nu_no_error_checking". The definition of nu_no_error_checking determines the component function that the "nu_" function really maps.

(iii) components of the Nucleus plus

The Nucleus Plus system consists of 16 components, each of which discusses, for example, the following (mainly describing the functions of the narrative components):

1, General Service component common service Component (CS)

All nucleus plus component control data structures are linked list, CS is responsible for providing link structure and list operation function, including join, delete node.

2. Initializing component Initialization Component (in)

Responsible for initializing and starting the nucleus Plus system. The initialization and startup process consists of two parts: the detailed Hardware target Board dependency section (processor-related and board-level initialization) is initialized first, followed by the nucleus plus each component and user program initialization.

The Int_initialize subroutine is first executed in the nucleus PLUS system. Responsible for all initialization related to the target hardware board. Transfer of control to the advanced Nucleus PLUS initialization subroutine Inc_initialize is no longer returned when the int_initialize is finished. Inc_initialize invokes all nucleus plus component initialization functions, invokes application_initialize to create user tasks, and finally gives control to the dispatch function Tct_schedule, and the system starts. The initialization process is described in the "Nucleus Plus startup, execution thread, and interrupt handling" blog post.

3. Thread scheduling component Tread Control Component (TC)

Responsible for nucleus Plus's preemptive real-time tasks and HISR scheduling management.

Each user application consists of multiple tasks, a task is a semi-independent program fragment with a specific purpose, and the task is one of five states-execution, ready, suspended, terminated, complete. tasks have different priorities. High-priority tasks can preempt low-priority tasks, with priority tasks scheduled in the order that they enter "ready state", with priority descending from 0-255.

Nucleus Plus each task has a control structure called Thread control block (TCB)-TC_TCB, task support dynamic creation and deletion, TC through a doubly linked list Tcd_created_tasks_ The list manages all tasks, and the global variable tcd_total_tasks represents the number of total task that have been created.

Tcd_priority_list is a TCB pointer array of size 256 (the array size is the same as the Nucleus plus precedence series), each array pointer is the head of a table (an element that is empty indicates a task without that priority). The element of the table is a TCB pointer to a task that has the same priority into the ready state. That is, nucleus plus maintains an array of pointers to dispatch task lists of different priority levels.

The task scheduling process is described in the post "Nucleus Plus Task Scheduler".

HISR is the lower half of the interrupt handling routine, and you can access most of the nucleus plus tasks (you cannot suspend yourself voluntarily). HISR is also a preemptive type. Its priority 0-2 is decremented. HISR is activated by LISR. Therefore, it must be created and registered beforehand.

The management of HISR and the management of tasks are similar. Each HISR has a control structure TC_HCB and an exclusive stack. Tcd_created_hisrs_list is a table header that stores a doubly linked list of created HISR routines, Tcd_total_hisrs represents the total number of HISR that have been created. In addition, the TC maintains two activated HISR tables, each of which is the head and tail of the HISR doubly linked list with three priority activations. The TC also maintains the LISR routine through a linked list, including interrupt vector and LISR entry functions.

The TC component provides functions such as HISR creation, deletion, activation, and so on.

4, Clock component timer Component (TM)

Responsible for the management of all nucleus Plus timer devices.

The basic timing unit for Nucleus Plus is a tick. It is equivalent to a hardware timer interrupt. At the system level, timers are used for task management-timed sleep and wake-up, and at the user application level, timers are used in places where a timeout processing mechanism is required.

The timer supports dynamic creation/deletion, each timer has a control structure TM_TCB, TMD_HISR, or TM_APP_TCB, respectively, for System task timers, HISR timers, and application-specific timers. The TM maintains a list of activated timers that have been created via the linked list.

TM provides a system timer Tmd_system_clock.

Timer functions include Create, start, stop, reset, delete, timeout processing, and so on.

5, Mailbox component Mailbox Component (MB) The following nucleus plus interprocess communication mechanism mailboxes, queues, pipelines, semaphores, and event groups are described in the blog post "nucleus interprocess communication (IPC) mode ."

Responsible for managing nucleus Plus all mailbox services. Provides a low-overhead inter-process communication mechanism. Each mailbox includes a message with a length of 4 32-bit words.

Mailboxes can be created/deleted dynamically by the user. Support for task suspend and resume.

Each mailbox has a control block. Mailbox control block (MCB) MB_MCB,MB maintains the created mailbox through a doubly linked list.

The task suspend/wake for the mailbox supports FIFO order and task priority order. is also done by maintaining a doubly linked list. Every task hangs on a mailbox creates a control block mb_suspend struct.

MB provides functions such as creating, deleting, sending/retrieving, resetting, emptying, broadcasting, etc. of a mailbox.

6 Queuing Components Queue Component (QM) and 7 piping Components pipe Component (PI)

Responsible for managing all nucleus Plus queue services, respectively. Manage all nucleus Plus piping services. The management of two parts is similar to MB, except that the message of the queue is one or more 32-bit words, and the message of the pipeline is one or more 8-bit bytes.

8. Semaphore component Semaphore Component (SM)

Responsible for managing all nucleus Plus semaphore services for synchronization between multiple tasks.

Semaphores support dynamic creation/deletion, and SM can provide a semaphore count range of 0-4, 294,967,294. Its management is similar to MB.

9, Event component Events Flag Component (EV)

Responsible for managing all Nucleus Plus Event Group services, each of which includes 32 event flags. That is, the 32-bit unsigned integer number is an event flag (1 indicates that events occur.) 0 indicates that it has not occurred).

Its management is similar to MB.

10, storage allocation component partition Memory Component (PM)

Responsible for managing all nucleus Plus partition memory, the memory pool for partitioned memory refers to memory that is fixed by the total number of user-specified memory, and the number of bytes per partition (partition). Partition memory supports dynamic creation and task-pending/Wakeup (FIFO or task-priority order).

Each partition memory requires a control block partition memory control blocks (PCB)-PM_PCB (extra RAM is occupied. Not included in the partition memory). PM maintains all created partition memory through a doubly linked list.

The available partitions for each partition memory are controlled by a null-terminated single-linked list, and each available partition starts with the pm_header of the struct body.

11, Dynamic memory Component (Component) (DM)

Responsible for managing all nucleus Plus dynamic memory services. The starting position and length of the dynamic memory pool are specified by the user, which supports dynamic creation/deletion and task suspend/wake. The allocation of dynamic memory is allocated according to the first fit algorithm, and there are no partitions with a fixed number of bytes. The management of DM is similar to PM.

12. I/O driver components iinput/output Driver Component (I/O)

Responsible for the management of all nucleus Plus input/output device driver services. Provides a common, similar S-driven service interface that includes services such as initialization, allocation, release, input/output, device State acquisition, and termination of service requests.

13. Error handling Component Component (ER)

Responsible for managing all nucleus Plus system errors.

14. Historical component History Component (HI)

Responsible for nucleus Plus's historical equipment management.

15, License component License Component (LI)

Responsible for license management of nucleus plus.

16, Version number control component release Component (RL)

Responsible for nucleus Plus version number management.

Copyright notice: This article blog original articles, blogs, without consent, may not be reproduced.

Nucleus Plus System architecture and components

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: 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.