CHAPTER 2 SYSTEM CONSTRUCTION
This chapter describes how to build a system (load module) that uses the functions provided by the RI850V4.
System building consists in the creation of a load module using the files (kernel library, etc.) installed on the user development environment (host machine) from the RI850V4's supply media.
Code the SYSTEM CONFIGURATION FILE required for creating information files (system information table file, system information header file, entry file) that contain data to be provided for the RI850V4.
Note For details about the system configuration file, refer to "CHAPTER 17 SYSTEM CONFIGURATION FILE".
In the RI850V4, the processing program is classified into the following seven types, in accordance with the types and purposes of the processing that should be implemented.
- Tasks
A task is processing program that is not executed unless it is explicitly manipulated via service calls provided by the RI850V4, unlike other processing programs (cyclic handler, interrupt handler, etc.).
A task is processing program that is not executed unless it is explicitly manipulated via service calls provided by the RI850V4, unlike other processing programs (cyclic handler, interrupt handler, etc.).
- Cyclic handlers
The cyclic handler is a routine dedicated to cycle processing that is activated periodically at a constant interval (activation cycle).
The RI850V4 handles the cyclic handler as a "non-task (module independent from tasks)".
Therefore, even if a task with the highest priority in the system is being executed, the processing is suspended when a specified activation cycle has come, and the control is passed to the cyclic handler.
The cyclic handler is a routine dedicated to cycle processing that is activated periodically at a constant interval (activation cycle).
The RI850V4 handles the cyclic handler as a "non-task (module independent from tasks)".
Therefore, even if a task with the highest priority in the system is being executed, the processing is suspended when a specified activation cycle has come, and the control is passed to the cyclic handler.
- Interrupt Handlers
The interrupt handler is a routine dedicated to interrupt servicing that is activated when an EI level maskable interrupt occurs.
The RI850V4 handles the interrupt handler as a "non-task (module independent from tasks)".
Therefore, even if a task with the highest priority in the system is being executed, its processing is suspended when an EI level maskable interrupt occurs, and control is passed to the interrupt handler.
The interrupt handler is a routine dedicated to interrupt servicing that is activated when an EI level maskable interrupt occurs.
The RI850V4 handles the interrupt handler as a "non-task (module independent from tasks)".
Therefore, even if a task with the highest priority in the system is being executed, its processing is suspended when an EI level maskable interrupt occurs, and control is passed to the interrupt handler.
- Extended Service Call Routines
This is a routine to which user-defined functions are registered in the RI850V4, and will never be executed unless it is called explicitly, using service calls provided by the RI850V4.
The RI850V4 positions extended service call routines as extensions of the processing program that called the extended service call routine.
This is a routine to which user-defined functions are registered in the RI850V4, and will never be executed unless it is called explicitly, using service calls provided by the RI850V4.
The RI850V4 positions extended service call routines as extensions of the processing program that called the extended service call routine.
Note For details about the processing programs, refer to "CHAPTER 3 TASK MANAGEMENT FUNCTIONS", "CHAPTER 9 TIME MANAGEMENT FUNCTIONS", "CHAPTER 10 INTERRUPT MANAGEMENT FUNCTIONS", "CHAPTER 11 SERVICE CALL MANAGEMENT FUNCTIONS".
To support various execution environments, the hardware-dependent processing and various information required for the RI850V4 to execute processing are extracted as user-own coding modules.
The user-own coding modules for the RI850V4 are classified into the following six types depending on the type of hardware-dependent processing to be executed and the usage of the module.
- Post-overflow processing
A routine dedicated to post-processing (function name: _kernel_stk_overflow) that is extracted as a user-own coding module to execute post-overflow processing and is called when a stack overflow occurs in the RI850V4 or a processing program.
Acceptance of interrupts is disabled (the ID flag in the program status word (PSW) is set to 1) in the initial state after activation.
A routine dedicated to post-processing (function name: _kernel_stk_overflow) that is extracted as a user-own coding module to execute post-overflow processing and is called when a stack overflow occurs in the RI850V4 or a processing program.
Acceptance of interrupts is disabled (the ID flag in the program status word (PSW) is set to 1) in the initial state after activation.
- Interrupt entry processing
A routine dedicated to entry processing that is extracted as a user-own coding module to assign processing for branching to the relevant processing (such as interrupt preprocessing), to the handler address to which the CPU forcibly passes control when an interrupt occurs.
The interrupt entry processing for the EI level maskable interrupts defined in the Interrupt handler information in the system configuration file is included in the entry file created by executing the configurator for the system configuration file.
Therefore, coding of interrupt entry processing is necessary for other interrupts (such as a reset) that are not EI level maskable interrupts.
A routine dedicated to entry processing that is extracted as a user-own coding module to assign processing for branching to the relevant processing (such as interrupt preprocessing), to the handler address to which the CPU forcibly passes control when an interrupt occurs.
The interrupt entry processing for the EI level maskable interrupts defined in the Interrupt handler information in the system configuration file is included in the entry file created by executing the configurator for the system configuration file.
Therefore, coding of interrupt entry processing is necessary for other interrupts (such as a reset) that are not EI level maskable interrupts.
- Initialization routine
A routine dedicated to initialization processing that is extracted as a user-own coding module to initialize the hardware dependent on the user execution environment (such as the peripheral controller), and is called from the Kernel Initialization Module.
A routine dedicated to initialization processing that is extracted as a user-own coding module to initialize the hardware dependent on the user execution environment (such as the peripheral controller), and is called from the Kernel Initialization Module.
- Idle Routine
A routine dedicated to idle processing that is extracted from the SCHEDULER as a user-own coding module to utilize the standby function provided by the CPU (to achieve the low-power consumption system), and is called from the scheduler when there no longer remains a task subject to scheduling by the RI850V4 (task in the RUNNING or READY state) in the system.
A routine dedicated to idle processing that is extracted from the SCHEDULER as a user-own coding module to utilize the standby function provided by the CPU (to achieve the low-power consumption system), and is called from the scheduler when there no longer remains a task subject to scheduling by the RI850V4 (task in the RUNNING or READY state) in the system.
- Boot processing
A routine dedicated to initialization processing that is extracted as a user-own coding module to initialize the minimum required hardware for the RI850V4 to perform processing, and is called from Interrupt entry processing.
A routine dedicated to initialization processing that is extracted as a user-own coding module to initialize the minimum required hardware for the RI850V4 to perform processing, and is called from Interrupt entry processing.
- System dependent information
The system-dependent information is a header file (file name: userown.h) including various information required for the RI850V4 to execute processing, which is extracted as a user-own coding module.
The system-dependent information is a header file (file name: userown.h) including various information required for the RI850V4 to execute processing, which is extracted as a user-own coding module.
Note For details about the user-own coding module, refer to "CHAPTER 7 MEMORY POOL MANAGEMENT FUNCTIONS", "CHAPTER 10 INTERRUPT MANAGEMENT FUNCTIONS", "CHAPTER 12 SYSTEM CONFIGURATION MANAGEMENT FUNCTIONS", "CHAPTER 13 SCHEDULER", "CHAPTER 14 SYSTEM INITIALIZATION ROUTINE".
The trace information file (file name: trcinf.c) includes descriptions of the processing necessary for the trace mode selected in the Property panel -> [Task Analyzer] tabbed page -> [Trace] category -> [Selection of trace mode].
Note that this file should be incorporated into the load module even when the trace facility is not used. Include this file as a target of build processing even when using the GHS-version development environment.
Run a build on CS+ for files created in sections from "2.2 Cording System Configuration File" to "2.4 Coding User-Own Coding Module", the trace information file, and the library files provided by the RI850V4 and C compiler package, to create a load module.
Note See RI Series Real-time OS User's Manual: Start or CS+ Integrated Development Environment User's Manual: Start for details about creating a new project or loading an existing one.
Note See CS+ Integrated Development Environment User's Manual: RH850 Build for details about setting the active project.
Note See CS+ Integrated Development Environment User's Manual: RH850 Build for details about adding or removing build target files for the project and updating the dependencies.
Note Specify "cfg" as the extension of the system configuration file name. If the extension is different, "cfg" is automatically added (for example, if you designate "aaa.c" as a file name, the file is named as "aaa.c.cfg").
- User-own coding module (post-overflow processing, interrupt entry processing, initialization routine, idle routine, boot processing, system dependent information)
Note 1 If the system configuration file is added to the Project Tree panel, the Real-Time OS generated files node is appeared.
The following information files are appeared under the Real-Time OS generated files node. However, these files are not generated at this point in time.
The following information files are appeared under the Real-Time OS generated files node. However, these files are not generated at this point in time.
Note 2 When replacing the system configuration file, first remove the added system configuration file from the project, then add another one again.
Note 3 Although it is possible to add more than one system configuration files to a project, only the first file added is enabled. Note that if you remove the enabled file from the project, the remaining additional files will not be enabled; you must therefore add them again.
On the [System Configuration File Related Information] tab, set the output of information files (system information table file, system information header file, and entry file).
Use the task analyzer tool (a utility tool provided by the RI850V4) on the [Task Analyzer] tabbed page in the Property panel to specify the information necessary to analyze the execution history (trace data) of the processing program.
When using the RI850V4, some options should always be specified. For details, see "15.4 Conditional Compile Macro".
Note See CS+ Integrated Development Environment User's Manual: RH850 Build for details about setting build options.
Note See CS+ Integrated Development Environment User's Manual: RH850 Build for details about running a build.
Note See CS+ Integrated Development Environment User's Manual: Project Operation for details about saving the project.
In addition, the options listed in "15.4 Conditional Compile Macro" should also be specified when using the header file provided by the RI850V4.