Renesas 70 User Manual
Renesas 70 User Manual

Renesas 70 User Manual

Real-time os for m16c/70,80,m32c/80 series
Table of Contents

Advertisement

Quick Links

REJ10J1025-0200Z
M3T-MR308/4 V.4.00
User's Manual
Real-time OS for M16C/70,80,M32C/80 Series
Rev.2.00
Nov 1, 2005

Advertisement

Table of Contents
loading

Summary of Contents for Renesas 70

  • Page 1 REJ10J1025-0200Z M3T-MR308/4 V.4.00 User’s Manual Real-time OS for M16C/70,80,M32C/80 Series Rev.2.00 Nov 1, 2005...
  • Page 2 These materials are intended as a reference to assist our customers in the selection of the Renesas Technology product best suited to the customer's application; they do not convey any license under any intellectual property rights, or any other rights, belonging to Renesas Technology Corporation, Renesas Solutions Corporation or a third party.
  • Page 3 For the detailed information on individual service call procedures, refer to the MR308 Reference Manual. Requirements for MR308 Use When creating programs based on the MR308, it is necessary to purchase the following product of Renesas. • C-compiler package M3T-NC308WA(abbreviated as NC308) for M16C/70,80 M32C/80 series micro-...
  • Page 5: Table Of Contents

    Contents User’s Manual Organization ... - 1 - Chapter 1 General Information ... - 3 - Chapter 2 Objective of MR308 Development... - 4 - Relationship between TRON Specification and MR308... - 6 - MR308 Features ... - 7 - Introduction to MR308...
  • Page 6 Program Coding Procedure in C Language... - 68 - 5.1.1 Task Description Procedure ... - 68 - 5.1.2 Writing a Kernel (OS Dependent) Interrupt Handler ... - 70 - 5.1.3 Writing Non-kernel (OS-independent ) Interrupt Handler ... - 71 - 5.1.4 Writing Cyclic Handler/Alarm Handler ...
  • Page 7 Warning messages ... - 131 - Other messages... - 131 - Editing makefile ... - 132 - About an error when you execute make... - 133 - Application Creation Guide ... - 135 - Chapter 7 Processing Procedures for System Calls from Handlers... - 136 - 7.1.1 System Calls from a Handler That Caused an Interrupt during Task Execution ...
  • Page 8 List of Figures Figure 3.1 Relationship between Program Size and Development Period...- 10 - Figure 3.2 Microcomputer-based System Example(Audio Equipment) ... - 11 - Figure 3.3 Example System Configuration with Real-time OS(Audio Equipment) ...- 12 - Figure 3.4 Time-division Task Operation ...- 13 - Figure 3.5 Task Execution Interruption and Resumption ...- 13 - Figure 3.6 Task Switching ...- 14 - Figure 3.7 Task Register Area...- 15 -...
  • Page 9 Figure 5.2 Example Task Terminating with ext_tsk() Described in C Language...- 68 - Figure 5.3 Example of Kernel(OS-dependent) Interrupt Handler...- 70 - Figure 5.4 Example of Non-kernel(OS-independent) Interrupt Handler...- 71 - Figure 5.5 Example Cyclic Handler Written in C Language ...- 72 - Figure 5.6 Example Infinite Loop Task Described in Assembly Language...- 73 -...
  • Page 10 List of Tables Table 3-1 Task Context and Non-task Context ...- 27 - Table 3-2 Invocable Service Calls in a CPU Locked State ...- 29 - Table 3-3 CPU Locked and Dispatch Disabled State Transitions Relating to dis_dsp and loc_cpu - 29 - Table 3.4 List of the service call can be issued from the task and handler...- 55 - Table 5.1...
  • Page 11: Chapter 1 User's Manual Organization

    Chapter 1 User’s Manual Organization...
  • Page 12 The MR308 User’s Manual consists of nine chapters and thee appendix. • Chapter 2 General Information Outlines the objective of MR308 development and the function and position of the MR308. • Chapter 3 Introduction to MR308 Explains about the ideas involved in MR308 operations and defines some relevant terms. •...
  • Page 13: Chapter 2 General Information

    Chapter 2 General Information...
  • Page 14: Objective Of Mr308 Development

    OS To answer the above-mentioned demand, Renesas has developed a real-time operating system, tradenamed MR308, for use with the M16C/70, 80 and M32C/80 series of 16/32-bit microcomputers . When the MR308 is introduced, the following advantages are offered.
  • Page 15 7. Timer control is made easier. To perform processing at 10 ms intervals, the microcomputer timer function was formerly used to pe- riodically initiate an interrupt. However, as the number of usable microcomputer timers was limited, timer insufficiency was compensated for by, for instance, using one timer for a number of different processing operations.
  • Page 16: Relationship Between Tron Specification And Mr308

    Furthermore, in 1999, µITRON 4.0 Specification with enhanced compatibility was established. MR308 is the real-time operating system developed for use with the M16C/70, 80 and M32C/80 series of 16/32-bit microcomputers compliant with µITRON 4.0 Specification. µITRON 4.0 Specification stipulates stan- dard profiles as an attempt to ensure software portability.
  • Page 17: Mr308 Features

    3. Only necessary modules are automatically selected to constantly build up a system of the minimum size. MR308 is supplied in the object library format of the M16C/70, 80 and M32C/80 series. Therefore, the Linkage Editor LN308 functions are activated so that only necessary modules are automatically selected from numerous MR308 functional modules to generate a system.
  • Page 19: Chapter 3 Introduction To Mr308

    Chapter 3 Introduction to MR308...
  • Page 20: Concept Of Real-Time Os

    Chapter 3 Introduction to MR308 3.1 Concept of Real-time OS This section explains the basic concept of real-time OS. 3.1.1 Why Real-time OS is Necessary In line with the recent advances in semiconductor technologies, the single-chip microcomputer ROM capacity has increased. ROM capacity of 32K bytes. As such large ROM capacity microcomputers are introduced, their program development is not easily carried out by conventional methods.
  • Page 21: Figure 3.2 Microcomputer-Based System Example(Audio Equipment)

    Key input microcomputer Volume control microcomputer Figure 3.2 Microcomputer-based System Example(Audio Equipment) Using independent microcomputers for various functions as indicated in the above example offers the following advantages. 1. Individual programs are small so that program development is easy. 2. It is very easy to use previously developed software. 3.
  • Page 22: Figure 3.3 Example System Configuration With Real-Time Os(Audio Equipment)

    Key input Task Volume control Task Figure 3.3 Example System Configuration with Real-time OS(Audio Equipment) In other words, the real-time OS is the software that makes a one-microcomputer system look like operating a number of microcomputers. In the real-time OS, the individual programs, which correspond to a number of microcomputers used in a con- ventional system, are called tasks.
  • Page 23: Operating Principles Of Real-Time Os

    3.1.2 Operating Principles of Real-time OS The real-time OS is the software that makes a one-microcomputer system look like operating a number of mi- crocomputers. You should be wondering how the real-time OS makes a one-microcomputer system function like a number of microcomputers. As shown in Figure 3.4 the real-time OS runs a number of tasks according to the time-division system.
  • Page 24: Figure 3.6 Task Switching

    In the state shown in Figure 3.5, it appears to the programmer that the key input task or its microcomputer is halted while another task assumes execution control. Task execution restarts at the point of last interruption as the register contents prevailing at the time of the last interruption are recovered.
  • Page 25: Figure 3.7 Task Register Area

    Remote control Task Key input Task LED illumination Task Real-time Figure 3.8 shows the register and stack area of one task in detail. In the MR308, the register of each task is stored in a stack area as shown in Figure 3.8. This figure shows the state prevailing after register storage. Register not stored Key input Task...
  • Page 26 3.2 Service Call How does the programmer use the real-time OS in a program? First, it is necessary to call up a real-time OS function from the program in some way or other. Calling a real-time OS function is referred to as a service call. Task activation and other processing operations can be initiated by such a service call (See Figure 3.9).
  • Page 27: Service Call Processing

    3.2.1 Service Call Processing When a service call is issued, processing takes place in the following sequence. 1. The current register contents are saved. 2. The stack pointer is changed from the task type to the real-time OS (system) type. 3.
  • Page 28: Task Designation In Service Call

    3.2.2 Task Designation in Service call Each task is identified by the ID number internally in MR308. For example, the system says, "Start the task having the task ID number 1." However, if a task number is directly written in a program, the resultant program would be very low in readability. If, for instance, the following is entered in a program, the programmer is constantly required to know what the No.
  • Page 29: Task

    3.3 Task This section describes how tasks are managed by MR308. 3.3.1 Task Status The real-time OS monitors the task status to determine whether or not to execute the tasks. Figure 3.12 shows the relationship between key input task execution control and task status. When there is a key input, the key input task must be executed.
  • Page 30: Figure 3.13 Mr308 Task Status Transition

    READY state WAITING SUSPENDED state clear request from other task SUSPEND request from other task SUSPENDED state clear request Forced termination request from other task Task activation 1. RUNNING state In this state, the task is being executed. Since only one microcomputer is used, it is natural that only one task is being executed.
  • Page 31 to the ready queue is placed in the RUNNING state. ♦ A currently executed task has normally terminated itself. ♦ A currently executed task has placed itself in the WAITING state. ♦ A currently executed task has changed its own priority so that the priority of a different READY task is rendered higher.
  • Page 32 4. SUSPENDED state When the sus_tsk system call is issued from a task in the RUNNING state or the isus_tsk system call is issued from a handler, the READY task designated by the system call or the currently executed task enters the SUSPENDED state.
  • Page 33: Task Priority And Ready Queue

    3.3.2 Task Priority and Ready Queue In the real-time OS, several tasks may simultaneously request to be executed. In such a case, it is necessary to determine which task the system should execute first. To properly handle this kind of situation, the system or- ganizes the tasks into proper execution priority and starts execution with a task having the highest priority.
  • Page 34: Task Priority And Waiting Queue

    3.3.3 Task Priority and Waiting Queue In The standard profiles in µITRON 4.0 Specification support two waiting methods for each object. In one method, tasks are placed in a waiting queue in order of priority (TA_TPRI attribute); in another, tasks are placed in a waiting queue in order of FIFO (TA_TFIFO).
  • Page 35: Task Control Block(Tcb)

    3.3.4 Task Control Block(TCB) The task control block (TCB) refers to the data block that the real-time OS uses for individual task status, priority, and other control purposes. The MR308 manages the following task information as the task control block •...
  • Page 36: Figure 3.17 Task Control Block

    Task Connection pointer Status Priority Wake-up counter Flag wait mode Time-out counter Flag wait pattern Timer queue This area is allocated only when Connection pointer the timeout function is used. Flag wait pattern Figure 3.17 Task control block - 26 -...
  • Page 37: System States

    3.4 System States 3.4.1 Task Context and Non-task Context The system runs in either context state, "task context" or "non-task context." The differences between the task content and non-task context are shown in Table 3-1. Task Context and Non-task Context. Table 3-1 Invocable service call Task scheduling...
  • Page 38: Dispatch Enabled/Disabled States

    Timer interrupt Figure 3.18 Cyclic Handler/Alarm Handler Activation 3.4.2 Dispatch Enabled/Disabled States The system assumes either a dispatch enabled state or a dispatch disabled state. In a dispatch disabled state, no task scheduling is performed. Nor can service calls be invoked that may cause the service call issuing task to enter a wait state.
  • Page 39: Cpu Locked/Unlocked States

    3.4.3 CPU Locked/Unlocked States The system assumes either a CPU locked state or a CPU unlocked state. In a CPU locked state, all external interrupts are disabled against acceptance, and task scheduling is not performed either. The system can be placed into a CPU locked state or a CPU unlocked state by the loc_cpu(iloc_cpu) or unl_cpu(iunl_cpu) service call, respectively.
  • Page 40: Mr308 Kernel Structure

    3.5 MR308 Kernel Structure 3.5.1 Module Structure The MR308 kernel consists of the modules shown in Figure 3.19. Each of these modules is composed of func- tions that exercise individual module features. The MR308 kernel is supplied in the form of a library, and only necessary features are linked at the time of sys- tem generation.
  • Page 41: Module Overview

    3.5.2 Module Overview The MR308 kernel modules are outlined below. • Scheduler Forms a task processing queue based on task priority and controls operation so that the high-priority task at the beginning in that queue (task with small priority value) is executed. •...
  • Page 42: Task Management Function

    3.5.3 Task Management Function The task management function is used to perform task operations such as task start/stop and task priority up- dating. The MR308 kernel offers the following task management function service calls. • Activate Task (act_tsk, iact_tsk) Activates the task, changing its status from DORMANT to either READY or RUNNING. In this service call, unlike in sta_tsk(ista_tsk), startup requests are accumulated, but startup code cannot be speci- fied.
  • Page 43: Figure 3.21 Alteration Of Task Priority

    Priority Figure 3.21 Alteration of task priority ID Number 1 2 taskA 3 Priority 1 n When the priority of Task B is changed into 4 Figure 3.22 Task rearrangement in a waiting queue • Reference task priority (get_pri, iget_pri) Gets the priority of a task.
  • Page 44: Synchronization Functions Attached To Task

    3.5.4 Synchronization functions attached to task The task-dependent synchronization functions attached to task is used to accomplish synchronization between tasks by placing a task in the WAIT, SUSPENDED, or WAIT-SUSPENDED state or waking up a WAIT state task. The MR308 offers the following task incorporated synchronization service calls. •...
  • Page 45: Figure 3.25 Forcible Wait Of A Task And Resume

    only one forcible wait request to be nested, if sus_tsk is issued to a task in a forcible wait state, the error E_QOVR is returned. (See Figure 3.25). sus_tsk Task RUNNING state WAITING state Number of suspension request Figure 3.25 Forcible wait of a task and resume •...
  • Page 46: Figure 3.27 Dly_Tsk Service Call

    ♦ Timeout wait state ♦ Wait state entered by slp_tsk service call (+ timeout included) ♦ Event flag (+ timeout included) wait state ♦ Semaphore (+ timeout included) wait state ♦ Message (+ timeout included) wait state ♦ Data transmission (+ timeout included) wait state ♦...
  • Page 47: Synchronization And Communication Function (Semaphore)

    3.5.5 Synchronization and Communication Function (Semaphore) The semaphore is a function executed to coordinate the use of devices and other resources to be shared by several tasks in cases where the tasks simultaneously require the use of them. When, for instance, four tasks simultaneously try to acquire a total of only three communication lines as shown in Figure 3.28, communication line-to-task connections can be made without incurring contention.
  • Page 48: Figure 3.29 Semaphore Counter

    • Reference Semaphore Status (ref_sem, iref_sem) Refers the status of the target semaphore. Checks the count value and existence of the wait task for the target semaphore. Figure 3.30 shows example task execution control provided by the wai_sem and sig_sem service calls.
  • Page 49: Synchronization And Communication Function (Eventflag)

    3.5.6 Synchronization and Communication Function (Eventflag) The eventflag is an internal facility of MR308 that is used to synchronize the execution of multiple tasks. The eventflag uses a flag wait pattern and a 16-bit pattern to control task execution. A task is kept waiting until the flag wait conditions set are met.
  • Page 50: Figure 3.31 Task Execution Control By The Eventflag

    TaskA Flag queue Flag pattern Wait pattern 0x0F Wait mode set_flg Flag pattern 0x0F Figure 3.31 Task Execution Control by the Eventflag TaskD TaskB TaskC 0xFF 0x0F 0xFF TaskB TaskD - 40 - TaskE TaskF 0xFF 0x10 TaskF...
  • Page 51: Synchronization And Communication Function (Data Queue)

    3.5.7 Synchronization and Communication Function (Data Queue) The data queue is a mechanism to perform data communication between tasks. In Figure 3.32, for example, task A can transmit data to the data queue and task B can receive the transmitted data from the data queue. Data Task A Data in width of 32 bits can be transmitted to this data queue.
  • Page 52: Synchronization And Communication Function (Mailbox)

    3.5.8 Synchronization and Communication Function (Mailbox) The mailbox is a mechanism to perform data communication between tasks. In Figure 3.33, for example, task A can drop a message into the mailbox and task B can retrieve the message from the mailbox. Since mail- box-based communication is achieved by transferring the beginning address of a message from a task to an- other, this mode of communication is performed at high speed independently of the message size.
  • Page 53: Figure 3.34 Message Queue

    Message queue There are following data queue service calls that are provided by the MR308 kernel. • Send to Mailbox (snd_mbx, isnd_mbx) Transmits a message. Namely, a message is dropped into the mailbox. • Receive from Mailbox (rcv_mbx, trcv_mbx) Receives a message. Namely, a message is retrieved from the mailbox. At this time, if the mailbox has no messages in it, the task is kept waiting until a message is sent to the mailbox.
  • Page 54: Fixed-Size Memory Pool Management Function

    3.5.9 Memory pool Management Function The memorypool management function provides system memory space (RAM space) dynamic control. This function is used to manage a specific memory area (memorypool), dynamically obtain memory blocks from the memorypool as needed for tasks or handlers, and release unnecessary memory blocks to the memorypool. The MR308 supports two types of memorypool management functions, one for fixed-size and the other for variable-size.
  • Page 55: Variable-Size Memory Pool Management Function

    Variable-size Memory Pool Management Function The technique that allows you to arbitrary define the size of memory block acquirable from the memory pool is termed Variable-size scheme. The MR308 manages memory in terms of four fixed-size memory block sizes. The MR308 calculates the size of individual blocks based on the maximum memory block size to be acquired. You specify the maximum memory block size using the configuration file.
  • Page 56: Figure 3.36 Pget_Mpl Processing

    200 bytes Rounding 224 bytes • Release Acquire Variable-size Memory Block (rel_mpl) Releases a acquired memory block by pget_mpl service call. Memorypool • Reference Acquire Variable-size Memory Pool Status (ref_mpl, iref_mpl) Checks the total free area of the memory pool, and the size of the maximum free area that can imme- diately be acquired.
  • Page 57: Time Management Function

    3.5.10 Time Management Function The time management function provides system time management, time reading tions of the alarm handler, which actuates at preselected times, and the cyclic handler, which actuates at prese- lected time intervals. The MR308 kernel requires one timer for use as the system clock. There are following time management ser- vice calls that are provided by the MR308 kernel.
  • Page 58 at the fifth occurrence of the time tick. • Set System Time (set_tim) • Reference System Time (get_tim) The system time indicates an elapsed time from when the system was reset by using 48-bit data. The time is expressed in ms units. - 48 -...
  • Page 59: Cyclic Handler Function

    3.5.11 Cyclic Handler Function The cyclic handler is a time event handler that is started every startup cycle after a specified startup phase has elapsed. The cyclic handler may be started with or without saving the startup phase. In the former case, the cyclic han- dler is started relative to the point in time at which it was generated.
  • Page 60: Alarm Handler Function

    3.5.12 Alarm Handler Function The alarm handler is a time event handler that is started only once at a specified time. Use of the alarm handler makes it possible to perform time-dependent processing. The time of day is specified by a relative time. Figure 3.41 shows a typical operation of the alarm handler. Alarm handler operating created...
  • Page 61: System Status Management Function

    3.5.13 System Status Management Function • Rotate Task Precedence (rot_rdq, irot_rdq) This service call establishes the TSS (time-sharing system). That is, if the ready queue is rotated at regular intervals, round robin scheduling required for the TSS is accomplished (See Figure 3.42) Priority 1...
  • Page 62: Interrupt Management Function

    3.5.14 Interrupt Management Function The interrupt management function provides a function to process requested external interrupts in real time. The interrupt management service calls provided by the MR308 kernel include the following: • Returns from interrupt handler (ret_int) The ret_int service call activates the scheduler to switch over tasks as necessary when returning from the interrupt handler.
  • Page 63: System Configuration Management Function

    3.5.15 System Configuration Management Function This function inspects the version information of MR308. • References Version Information(ref_ver, iref_ver) The ref_ver service call permits the user to get the version information of MR308. This version infor- mation can be obtained in the standardized format of µITRON specification. 3.5.16 Extended Function (Short Data Queue) The short data queue is a function outside the scope of µITRON 4.0 Specification.
  • Page 64: Extended Function (Reset Function)

    3.5.17 Extended Function (Reset Function) The reset function is a function outside the scope of µITRON 4.0 Specification. It initializes the mailbox, data queue, and memory pool, etc. • Clear Data Queue Area (vrst_dtq) Initializes the data queue. If there are any tasks waiting for transmission, they are freed from WAIT- ING state and the error code EV_RST is returned.
  • Page 65: Service Calls That Can Be Issued From Task And Handler

    3.5.18 Service calls That Can Be Issued from Task and Handler Some service calls can be issued from a task, others can be issued from non-task context, and still others can be issued from both. These service calls are listed in Table 3.4. Table 3.4 List of the service call can be issued from the task and handler Service Call act_tsk...
  • Page 66 Service Call Task Context sig_sem isig_sem wai_sem twai_sem pol_sem ipol_sem ref_sem iref_sem set_flg iset_flg clr_flg iclr_flg wai_flg twai_flg pol_flg ipol_flg ref_flg iref_flg snd_dtq tsnd_dtq psnd_dtq ipsnd_dtq fsnd_dtq ifsnd_dtq rcv_dtq trcv_dtq prcv_dtq iprcv_dtq ref_dtq iref_dtq snd_mbx isnd_mbx rcv_mbx trcv_mbx prcv_mbx iprcv_mbx ref_mbx iref_mbx - 56 -...
  • Page 67 Service Call Task Context get_mpf tget_mpf pget_mpf rel_mpf irel_mpf ref_mpf iref_mpf ipget_mpf pget_mpl rel_mpl ref_mpl iref_mpl set_tim iset_tim get_tim iget_tim sta_cyc ista_cyc stp_cyc istp_cyc ref_cyc iref_cyc sta_alm ista_alm stp_alm istp_alm ref_alm iref_alm rot_rdq irot_rdq get_tid iget_tid loc_cpu iloc_cpu unl_cpu iunl_cpu dis_dsp ena_dsp sns_ctx...
  • Page 68 Service Call Task Context ref_ver iref_ver vsnd_dtq vtsnd_dtq vpsnd_dtq vipsnd_dtq vfsnd_dtq vifsnd_dtq vrcv_dtq vtrcv_dtq vprcv_dtq viprcv_dtq vref_dtq viref_dtq vrst_mpf vrst_mpl vrst_mbx vrst_dtq vrst_vdtq - 58 - Non-task Context...
  • Page 69: Chapter 4 Applications Development Procedure Overview

    Chapter 4 Applications Development Procedure Overview...
  • Page 70: Overview

    4.1 Overview Application programs for MR308 should generally be developed following the procedure described below. 1. Generating a project When using HEW , create a new project using MR308 on HEW. 2. Coding the application program Write the application program in code form using C or assembly language. If necessary, correct the sample startup program (crt0mr.a30) and section definition file (c_sec.inc or asm_sec.inc).
  • Page 71: Figure 4.1 Mr308 System Generation Detail Flowchart

    C standard MR308 include file header file Application include file Application C source C compiler nc308 Relocatable Assembler as308 Application C standard object Library Linkage Editor ln308 Absolute module Load module converter lmc308 ROM write format Figure 4.1 MR308 System Generation Detail Flowchart Configuration file Configurator kernel.h...
  • Page 72: Development Procedure Example

    4.2 Development Procedure Example This chapter outlines the development procedures on the basis of a typical MR308 application example. 4.2.1 Applications Program Coding Figure 4.2 shows a program that simulates laser beam printer operations. Let us assume that the file describing the laser beam printer simulation program is named lbp.c.
  • Page 73: Figure 4.2 Program Example

    #include <itron.h> #include <kernel.h> #include "kernel_id.h" void main() /* main task */ printf("LBP start simulation \n"); sta_tsk(ID_idle,1); sta_tsk(ID_image,1); sta_tsk(ID_printer,1); /* activate printer engine task */ void image() /* activate image expansion task */ while(1){ wai_flg(ID_pagein,waiptn,TWF_ANDW, &flgptn);/* wait for 1-page input */ printf("...
  • Page 74: Configuration File Preparation

    4.2.2 Configuration File Preparation Create a configuration file which has defined in it the task entry address, stack size, etc. Use of the GUI con- figurator available for MR308 helps to create a configuration file easily without having to learn how to write it. Figure 4.3 Configuration File Example shows an example configuration file for a laser beam printer simulation program (filename "lbp.cfg").
  • Page 75: Writing Rom

    UNIX compatible make command (e.g., the make command included with the C compiler from Microsoft Corporation). For details about the usefulness of UNIX compatible make commands, refer to the release notes from Renesas. The description in this chapter is made for the case where a UNIX compatible make command is executed, as an example.
  • Page 77: Chapter 5 Detailed Applications

    Chapter 5 Detailed Applications...
  • Page 78: Program Coding Procedure In C Language

    5.1 Program Coding Procedure in C Language 5.1.1 Task Description Procedure 1. Describe the task as a function. To register the task for the MR308, enter its function name in the configuration file. When, for instance, the function name "task()" is to be registered as the task ID number 3, proceed as follows. task[3]{ name entry_address...
  • Page 79: Table 5.1 C Language Variable Treatment

    7. To specify a task, use the string written in the task definition item “name” of the configura- tion file. wup_tsk(ID_main); 8. To specify an event flag, semaphore, or mailbox, use the respective strings defined in the configuration file. For example, if an event flag is defined in the configuration file as shown below, flag[1]{ To designate this eventflag, proceed as follows.
  • Page 80: Writing A Kernel (Os Dependent) Interrupt Handler

    A configuration file is used to define the relationship between handlers and functions. When an kernel(OS-dependent) interrupt handler is declared with #pragma INTHANDLER ,code for the ret_int service call is automati- cally generated. /* process */ iwup_tsk(ID_main); - 70 -...
  • Page 81: Writing Non-Kernel (Os-Independent ) Interrupt Handler

    5.1.3 Writing Non-kernel (OS-independent ) Interrupt Handler When describing the non-kernel(OS-independent) interrupt handler in C language, observe the following pre- cautions. 1. Be sure to declare the return value and argument of the interrupt handler start function as a void type. 2.
  • Page 82: Writing Cyclic Handler/Alarm Handler

    5.1.4 Writing Cyclic Handler/Alarm Handler When describing the cyclic or alarm handler in C language, observe the following precautions. 1. Describe the cyclic or alarm handler as a function. 2. Be sure to declare the return value and argument of the interrupt handler start function as a void type.
  • Page 83: Program Coding Procedure In Assembly Language

    5.2 Program Coding Procedure in Assembly Language This section describes how to write an application using the assembly language. 5.2.1 Writing Task This section describes how to write an application using the assembly language. 1. Be sure to include "mr308.inc" at the beginning of file. 2.
  • Page 84 Chapter 5 Detailed Applications 8. Set a task that is activated at MR308 system startup in the configuration file The relationship between task ID numbers and tasks(program) is defined in the configuration file. - 74 -...
  • Page 85: Writing Kernel(Os-Dependent) Interrupt Handler

    5.2.2 Writing Kernel(OS-dependent) Interrupt Handler When describing the kernel(OS-dependent) interrupt handler in assembly language, observe the following pre- cautions 1. At the beginning of file, be sure to include "mr308.inc" which is in the system directory. 2. For the symbol indicating the interrupt handler start address, make the external declara- tion(Global declaration).
  • Page 86: Writing Non-Kernel(Os-Independent) Interrupt Handler

    5.2.3 Writing Non-kernel(OS-independent) Interrupt Handler 1. For the symbol indicating the interrupt handler start address, make the external declaration (public declaration). 2. Make sure that the registers used in a handler are saved at the entry and are restored after use.
  • Page 87: Figure 5.10 Example Handler Written In Assembly Language

    5.2.4 Writing Cyclic Handler/Alarm Handler When describing the cyclic or alarm handler in Assembly Language, observe the following precautions. 1. At the beginning of file, be sure to include "mr308.inc" which is in the system directory. 2. For the symbol indicating the handler start address, make the external declaration. 3.
  • Page 88: The Use Of Int Instruction

    5.3 The Use of INT Instruction MR308 has INT instruction interrupt numbers reserved for issuing service calls as listed in Table 5.2. For this reason, when using software interrupts in a user application, do not use interrupt numbers 63 through 55 and be sure to use some other numbers.
  • Page 89: Regarding Interrupts

    5.5 Regarding Interrupts 5.5.1 Types of Interrupt Handlers MR308's interrupt handlers (OS-independent) interrupt handlers. The following shows the definition of each type of interrupt handler. • Kernel(OS-dependent) interrupt handler The kernel(OS-dependent) interrupt handler is defined as one that satisfies one of the following two conditions: ♦...
  • Page 90: Controlling Interrupts

    5.5.3 Controlling Interrupts Interrupt enable/disable control in a service call is accomplished by IPL manipulation. The IPL value in a service call is set to the kernel mask level(OS interrupt disable level = system.IPL) in order to disable interrupts for the kernel(OS-dependent) interrupt handler.
  • Page 91: Figure 3.9 Service Call

    , the interrupt enable flag and IPL change in a service call. For this reason, if you want to disable interrupts in a user application, Renesas does not recommend using the method for manipulating the interrupt disable flag and IPL to disable the interrupts.
  • Page 92: Regarding Delay Dispatching

    5.6 Regarding Delay Dispatching MR308 has four service calls related to delay dispatching. • dis_dsp • ena_dsp • loc_cpu • unl_cpu The following describes task handling when dispatch is temporarily delayed by using these service calls. 1. When the execution task in delay dispatching is preempted While dispatch is disabled, even under conditions where the task under execution should be pre- empted, no time is dispatched to new tasks that are in an executable state.
  • Page 93: Regarding Initially Activated Task

    Chapter 5 Detailed Applications 5.7 Regarding Initially Activated Task MR308 permits the user to specify a task that starts from a READY state at system startup time. To do this, add TA_STA as task attribute. This specification should be set in a configuration file. For details on how to set, refer to page - 105 -.
  • Page 94: Modifying Mr308 Startup Program

    5.8 Modifying MR308 Startup Program MR308 comes with two types of startup programs as described below. • start.a30 This startup program is used when you created a program using the assembly language. • crt0mr.a30 This startup program is used when you created a program using the C language. This program is derived from "start.a30"...
  • Page 95: Figure 5.14 C Language Startup Program (Crt0Mr.a30)

    C language startup program(crt0mr.a30). 1 ;**************************************************************** MR308 start up program for C language COPYRIGHT(C) 2003 RENESAS TECHNOLOGY CORPORATION AND RENESAS SOLUTIONS CORPORATION ALL RIGHTS RESERVED MR308 V.1.10 Release 1 8 ; **************************************************************** "$Id: crt0mr.a30,v 1.1 2005/05/20 06:28:47 inui Exp $"...
  • Page 96 MOV.L #FROM_,A0 MOV.L #TO_,A1 MOV.L #(sizeof SECT_ & 0FFFFFFH), R3R1 XCHG.W R1,R3 78 _loop: SMOVF.B CMP.W #0,R1 _end MOV.B [A0],[A1] ADD.L #1,A1 ADD.L #1,A0 MOV.W #0FFFFH,R3 SUB.W #1,R1 _loop 88 _end: .ENDM 91 ;================================================================= 92 ; Interrupt section start 93 ;----------------------------------------------------------------- .SECTION MR_KERNEL,CODE,ALIGN 96 ;-----------------------------------------------------------------...
  • Page 97 153 ;-------------------------------------------------------- BCOPY data_FEI_top,data_FE_top,data_FE BCOPY data_FOI_top,data_FO_top,data_FO #__Sys_Sp,SP #__Sys_Sp,FB 161 ;----------------------------------------------------------------- 162 ; Set System IPL and Set Interrupt Vector 163 ;----------------------------------------------------------------- MOV.B #0,R0L MOV.B #__SYS_IPL,R0H R0,FLG #__INT_VECTOR,INTB 169 ; +-----------------------------------------------------+ 170 ; | System timer interrupt setting 171 ; +-----------------------------------------------------+ .IF USE_TIMER MOV.B #stmr_mod_val,stmr_mod_reg+regoffset...
  • Page 98 JSR.W __init_alh .ENDIF .IF CYCLIC_HANDLER .GLB __init_cyh JSR.W __init_cyh .ENDIF __NUM_MPF 242 ; Fixed Memory Pool 243 .GLB __init_mpf 244 JSR.W __init_mpf .ENDIF __NUM_MPL 248 ; Variable Memory Pool 249 .GLB __init_mpl 250 JSR.W __init_mpl .ENDIF ; For PD308 __LAST_INITIAL 256 __END_INIT: 258 ;...
  • Page 99 The following explains the content of the C language startup program (crt0mr.a30). 1. Incorporate a section definition file [13 in Figure 5.14] 2. Incorporate an include file for MR308 [14 in Figure 5.14] 3. Incorporate a system ROM area definition file [15 in Figure 5.14] 4.
  • Page 100: Memory Allocation

    5.9 Memory Allocation This section describes how memory is allocated for the application program data. Use the section file provided by MR308 to set memory allocation. MR308 comes with the following two types of section files: • asm_sec.inc This file is used when you developed your applications with the assembly language. Refer to page - 91 - for details about each section.
  • Page 101: Section Allocation Of Start.a30

    5.9.1 Section Allocation of start.a30 The section allocation of the sample startup program for the assembly language "start.a30" is defined in "asm_sec.inc". Edit "asm_sec.inc" if section reallocation is required. The following explains each section that is defined in the sample section definition file "asm_sec.inc". •...
  • Page 102: Section Allocation Of Crt0Mr.a30

    5.9.2 Section Allocation of crt0mr.a30 The section allocation of the sample startup program for the C language "crt0mr.a30" is defined in "c_sec.inc". Edit "c_sec.inc" if section reallocation is required. The sections defined in the sample section definition file "c_sec.inc" include the following sections that are de- fined in the section definition file "asm_sec.inc"...
  • Page 103: Figure 5.15 Selection Allocation In C Language Startup Program

    000000H 000400H MR_RAM_DBG Section generated by NC308 MR_RAM_NE MR_RAM_NO MR_RAM Section generated by NC308 stack MR_HEAP Section generated by NC308 Section generated by NC308 0FF0000H Section generated by NC308 MR_KERNEL MR_CIF MR_ROM program, program_S 0FFFD00H INTERRUPT_VECTOR 0FFFE00H fvector 0FFFFDCH FIX_INTERRUPT_VECTOR Figure 5.15 Selection Allocation in C Language Startup Program data_SE bss_SE...
  • Page 104: Using In M16C/70 Series

    5.10 Using in M16C/70 Series When you use M16C/70 series, please be sure to set up the following options. Refer to the manual of each tool for detailed explanation of these options. 《NC308 Compile option》 -D M16C70=1 《AS308 Assemble option》...
  • Page 105: Chapter 6 Using Configurator

    Chapter 6 Using Configurator...
  • Page 106: Configuration File Creation Procedure

    6.1 Configuration File Creation Procedure When applications program coding and startup program modification are completed, it is then necessary to reg- ister the applications program in the MR308 system. This registration is accomplished by the configuration file. 6.1.1 Configuration File Data Entry Format This chapter describes how the definition data are entered in the configuration file.
  • Page 107: Operator

    Operator (Unary_minus) ∗ (Binary_minus) Numerical value examples are presented below. • • 123 + 0x23 • (23/4 + 3) ∗ 2 • 100B + 0aH Symbol The symbols are indicated by a character string that consists of numerals, upper- and lower-case al- phabetical letters, _(underscore), and ?, and begins with a non-numeric character.
  • Page 108 • 10ms • 10.5ms It is also well to remember that the time must not begin with . (period). - 98 -...
  • Page 109: Configuration File Definition Items

    6.1.2 Configuration File Definition Items The following definitions are to be formulated in the configuration file • System definition • System clock definition • Respective maximum number of items • Task definition • Eventflag definition • Semaphore definition • Mailbox definition •...
  • Page 110 2. Maximum value of priority (value of lowest priority) [( Definition format )] [( Definition range )] [( Default value )] Define the maximum value of priority used in MR308's application programs. This must be the value of the highest priority used. 3.
  • Page 111: System Clock Definition Procedure )]

    Define the MPU operating clock frequency of the microcomputer in MHz units. For the M16C/70 series, set the same value as the one that is set for the peripheral function operating clock, f1. The M16C/70 series requires that compile options be set. For details, refer to Page - 94 -.
  • Page 112: Definition Respective Maximum Numbers Of Items )]

    [( Definition respective maximum numbers of items )] This definition is to be given only in forming the separate ROMs. Here, define respective maximum numbers of items to be used in two or more applications. << Format >> // Max Definition maxdefine{ the maximum number of tasks defined max_task...
  • Page 113 5. The maximum number of semaphores defined [( Definition format )] [( Definition range )] [( Default value )] Define the maximum number of semaphores defined. 6. The maximum number of fixed-size memory pools defined [( Definition format )] [( Definition range )] [( Default value )] 7.
  • Page 114: Task Definition )]

    [( Task definition )] << Format >> // Tasks Definition ID No. task[ name entry_address stack_size priority context stack_section initial_start exinf The ID number must be in the range of 1 to 255. The ID number can be omitted. If omitted, numbers are automatically assigned sequentially beginning with the smallest. <<...
  • Page 115 3. User stack size of task [( Definition format )] [( Definition range )] [( Default value )] Define the user stack size for each task. The user stack means a stack area used by each individual task. MR308 requires that a user stack area be allocated for each task, which amount to at least 12 bytes.
  • Page 116: Eventflag Definition )]

    The task startup code of the initial startup task is 0. 8. Extended information [( Definition format )] [( Definition range )] [( Default value )] Define the extended information of a task. This information is passed to the task as argument when it is restarted by a queued startup request, for example.
  • Page 117: Semaphore Definition )]

    3. Initial value of the event flag [( Definition format )] [( Definition range )] [( Default value )] Specify the initial bit pattern of the event flag. 4. Multi-wait attribute [( Definition format )] [( Definition range )] [( Default value )] Specify whether multiple tasks can be enqueued in the eventflag waiting queue.
  • Page 118: Data Queue Definition )]

    2. Selecting a semaphore waiting queue [( Definition format )] [( Definition range )] [( Default value )] Select a method in which tasks wait for the semaphore. If TA_TFIFO is selected, tasks are enqueued in order of FIFO. If TA_TPRI is selected, tasks are enqueued in order of priority beginning with the one that has the highest priority.
  • Page 119: Short Data Queue Definition )]

    2. Number of data [( Definition format )] [( Definition range )] [( Default value )] Specify the number of data that can be transmitted. What should be specified here is the number of data, and not a data size. 3.
  • Page 120: Mailbox Definition )]

    3. Selecting a data queue waiting queue [( Definition format )] [( Definition range )] [( Default value )] Select a method in which tasks wait for short data queue transmission. If TA_TFIFO is selected, tasks are enqueued in order of FIFO. If TA_TPRI is selected, tasks are enqueued in order of priority begin- ning with the one that has the highest priority.
  • Page 121: Fixed-Size Memory Pool Definition )]

    4. Maximum message priority [( Definition format )] [( Definition range )] [( Default value )] Specify the maximum priority of message in the mailbox. [( Fixed-size memory pool definition )] This definition must always be set when the fixed-size memory pool function is to be used. <<...
  • Page 122: Variable-Size Memory Pool Definition )]

    4. Size (in bytes) [( Definition format )] [( Definition range )] [( Default value )] Define the size of the memory pool per block. The RAM size to be used as a memory pool is deter- mined by this definition: (number of blocks) x (size) in bytes. 5.
  • Page 123: Cyclic Handler Definition )]

    3. Section name [( Definition format )] [( Definition range )] [( Default value )] Define the name of the section in which the memory pool is located. The section defined here must always have an area allocated for it in the section file (asm_sec.inc or c_sec.inc). If no section names are defined, the memory pool is located in the MR_HEAP section.
  • Page 124 << Content >> Define the following for each cyclic handler ID number. 1. ID name [( Definition format )] [( Definition range )] [( Default value )] Define the name by which the memory pool is specified in a program. 2.
  • Page 125: Alarm Handler Definition )]

    7. Extended information [( Definition format )] [( Definition range )] [( Default value )] Define the extended information of the cyclic handler. This information is passed as argument to the cyclic handler when it starts. [( Alarm handler definition )] This definition is necessary to use Alarm handler function.
  • Page 126: Interrupt Vector Definition )]

    [( Interrupt vector definition )] This definition is necessary to use Interrupt function. << Format >> // Interrupt Vector Definition Vector No. interrupt_vector[ os_int entry_address pragma_switch The vector number can be written in the range of 0 to 63 and 247 to 255. However, whether or not the defined vector number is valid depends on the microcomputer used The relationship between interrupt causes and interrupt vector numbers for the M16C/80 series is shown in Table 6.3.
  • Page 127 specified at the same time. [Precautions] 1. Regarding the method for specifying a register bank A kernel (OS dependent) interrupt handler that uses register bank 1 cannot be written in C language. Such an interrupt handler can only be written in assembly language. When writing in assembly language, make sure the statements at the entry and exit of the interrupt handler are written as shown below.
  • Page 128: Table 6.3 Interrupt Causes And Vector Numbers

    Table 6.3 Interrupt Causes and Vector Numbers Interrupt cause DMA0 DMA1 DMA2 DMA3 Timer A0 Timer A1 Timer A2 Timer A3 Timer A4 UART0 transmit UART0 receive UART1 transmit UART1 receive Timer B0 Timer B1 Timer B2 Timer B3 Timer B4 INT5 external interrupt INT4 external interrupt INT3 external interrupt...
  • Page 129: Configuration File Example

    6.1.3 Configuration File Example The following is the configuration file example. 1 //////////////////////////////////////////////////////////////////////////////// 2 // 3 // kernel.cfg : building file for MR308 Ver.4.00 4 // 5 // Generated by M3T-MR308 GUI Configurator at 2005/02/28 19:01:20 6 // 7 //////////////////////////////////////////////////////////////////////////////// 9 // system definition 10 system{ stack_size...
  • Page 130 wait_queue = TA_TFIFO; clear_attribute = NO; wait_multi = TA_WMUL; 78 }; 79 flag[2]{ name = ID_flg3; initial_pattern = 0x0000ffff; wait_queue = TA_TPRI; clear_attribute = YES; wait_multi = TA_WMUL; 85 }; 86 flag[]{ name = ID_flg4; initial_pattern = 0x00000008; wait_queue = TA_TPRI; clear_attribute = YES;...
  • Page 131 name = ID_mpf1; wait_queue = TA_TFIFO; section = MR_RAM; siz_block = 16; num_block = 5; 160 }; 161 memorypool[2]{ name = ID_mpf2; wait_queue = TA_TPRI; section = MR_RAM; siz_block = 32; num_block = 4; 167 }; 168 memorypool[3]{ name = ID_mpf3; wait_queue = TA_TFIFO;...
  • Page 132 entry_address = alm2; name = ID_alm2; exinf = 0x12345678; 238 }; 241 // 242 // End of Configuration 243 // - 122 -...
  • Page 133: Configurator Execution Procedures

    6.2 Configurator Execution Procedures 6.2.1 Configurator Overview The configurator is a tool that converts the contents defined in the configuration file into the assembly language include file, etc.Figure 6.1 outlines the operation of the configurator. When used on HEW, the configurator is automatically started, and an application program is built. 1.
  • Page 134: Figure 6.1 The Operation Of The Configurator

    Configuration File xxx.cfg Default Configuration File default.cfg makefile Template File makefile.dos makefile,Makefile Template File sys_ram.inc, mr308.inc MR308 Version File version Figure 6.1 The operation of the Configurator System Data Difinition File sys_ram.inc, sys_rom.inc cfg308 System generation File makefile Include File mr308.inc,kernel_id.h - 124 -...
  • Page 135: Setting Configurator Environment

    6.2.2 Setting Configurator Environment Before executing the configurator, check to see if the environment variable "LIB308" is set correctly. The configurator cannot be executed normally unless the following files are present in the directory indicated by the environment variable "LIB308": •...
  • Page 136: Configurator Start Procedure

    6.2.3 Configurator Start Procedure Start the configurator as indicated below. A> cfg308 [-vmV] Configuration file name Normally, use the extension .cfg for the configuration file name. Command Options -v Option Displays the command option descriptions and detailed information on the version. -V Option Displays the information on the files generated by the command.
  • Page 137: Makefile Generate Function

    6.2.4 makefile generate Function The configurator follows the procedure below to generate makefile. 1. Examine the source file's dependency relationship. Assuming that the files bearing extensions .c and .a30 in the current directory respectively to be the C language and the assembly language files, the configurator examines the dependency relationship of the files to be included by those.
  • Page 138: Precautions On Executing Configurator

    6.2.5 Precautions on Executing Configurator The following lists the precautions to be observed when executing the configurator: • If you have re-run the configurator, always be sure to execute make clean or delete all object files (ex- tension .r30) and execute the make command. In this case, an error may occur during linking. •...
  • Page 139: Configurator Error Indications And Remedies

    6.2.6 Configurator Error Indications and Remedies If any of the following messages is displayed, the configurator is not normally functioning. Therefore, correct the configuration file as appropriate and the execute the configurator again. Error messages cfg308 Error : syntax error near line xxx (xxxx.cfg) There is an syntax error in the configuration file.
  • Page 140 service call of system definition item. cfg308 Error : system timer's vector <x>conflict near line xxx A different vector is defined for the system clock timer interrupt vector. Confirm the vector No.x for in- terrupt vector definition. cfg308 Error : XXXX is not defined (xxxx.cfg) "XXXX"...
  • Page 141: Warning Messages

    Warning messages The following message are a warning. A warning can be ignored providing that its content is understood. cfg308 Warning : system is not defined (xxxx.cfg) cfg308 Warning : system.XXXX is not defined (xxxx.cfg) System definition or system definition item XXXX is omitted in the configuration file. cfg308 Warning : system.message_size is not defined (xxxx.cfg) The message size definition is omitted in the system definition.
  • Page 142: Editing Makefile

    6.3 Editing makefile Here you edit makefile the configurator generated, and set compilation options, libraries, and so on. The proce- dure for setting them is given below. 1. NC308WA command options You define command options of the C compiler in "CFLAGS". Be sure to define the "-c" option. 2.
  • Page 143: About An Error When You Execute Make

    Chapter 6 Using Configurator 6.4 About an error when you execute make The following warning message of mr308tbl is displayed when you execute make. mr308tbl Warning : You need not specify systime.timeout YES in configuration file Unless the following service calls are used, there is no need to set "Timeout=YES" in the system defi- nition of a configuration file.
  • Page 145: Chapter 7 Application Creation Guide

    Chapter 7 Application Creation Guide...
  • Page 146: Processing Procedures For System Calls From Handlers

    7.1 Processing Procedures for System Calls from Handlers When a service call is issued from a handler, task switching does not occur unlike in the case of a service call from a task. However, task switching occurs when a return from a handler The processing procedures for service calls from handlers are roughly classified into the following three types.
  • Page 147: System Calls From A Handler That Caused An Interrupt During Task Execution

    Chapter 7 Application Creation Guide 7.1.1 System Calls from a Handler That Caused an Interrupt during Task Execution (See Figure 7.1). Scheduling (task switching) is initiated by the ret_int service call TaskA Interrupt handler Interrupt Save Registers system call processing iset_flg Restore Registers ret_int...
  • Page 148: System Calls From A Handler That Caused An Interrupt During System Call Processing

    Chapter 7 Application Creation Guide 7.1.2 System Calls from a Handler That Caused an Interrupt during System Call Processing Scheduling (task switching) is initiated after the system returns to the interrupted service call processing (See Figure 7.2). TaskA Interrupt handler wup_tsk Save Registers SP <= System...
  • Page 149: System Calls From A Handler That Caused An Interrupt During Handler Execution

    Chapter 7 Application Creation Guide 7.1.3 System Calls from a Handler That Caused an Interrupt during Handler Execution Let us think of a situation in which an interrupt occurs during handler execution (this handler is hereinafter re- ferred to as handler A for explanation purposes). When task switching is called for as a handler (hereinafter re- ferred to as handler B) that caused an interrupt during handler A execution issued a service call, task switching does not take place during the execution of the service call (ret_int service call) returned from handler B, but is effected by the ret_int service call from handler A (See Figure 7.3).
  • Page 150: Stacks

    7.2 Stacks 7.2.1 System Stack and User Stack The MR308 provides two types of stacks: system stack and user stack. • User Stack One user stack is provided for each task. Therefore, when writing applications with the MR308, it is necessary to furnish the stack area for each task.
  • Page 151: Chapter 8 Sample Program Description

    Chapter 8 Sample Program Description...
  • Page 152: Overview Of Sample Program

    8.1 Overview of Sample Program As an example application of MR308, the following shows a program that outputs a string to the standard output device from one task and another alternately. Table 8.1 Function Type Name main() Task task1() Task task2() Task cyh1()
  • Page 153: Program Source Listing

    8.2 Program Source Listing 1 /************************************************************************* MR308 smaple program 4 * COPYRIGHT(C) 2003(2005) RENESAS TECHNOLOGY CORPORATION 5 * AND RENESAS SOLUTIONS CORPORATION ALL RIGHTS RESERVED $Id: demo.c,v 1.2 2005/06/15 05:29:02 inui Exp $ 9 *************************************************************************/ 11 #include <itron.h> 12 #include <kernel.h>...
  • Page 154: Configuration File

    8.3 Configuration File 1 //************************************************************************* 2 // 3 // COPYRIGHT(C) 2003,2005 RENESAS TECHNOLOGY CORPORATION 4 // AND RENESAS SOLUTIONS CORPORATION ALL RIGHTS RESERVED 5 // 6 // MR308 System Configuration File. 7 // "$Id: smp.cfg,v 1.5 2005/06/15 05:41:54 inui Exp $"...
  • Page 155: Chapter 9 Separate Roms

    Chapter 9 Separate ROMs...
  • Page 156: How To Form Separate Roms

    9.1 How to Form Separate ROMs This chapter describes how to form the MR308's kernel and application programs into separate ROMs. Figure 9.1 shows an instance in which the sections common to two different applications together with the ker- nel are allocated in the kernel ROM and the applications are allocated in separate ROMs. Here is how to divide a ROM based on this example.
  • Page 157: Figure 9.1 Rom Separate

    kernel ROM (Internal ROM) Startup MR_KERNEL Program MR308 kernel Task of ID=1 program Fix Interrupt Vector area Application ROM2 MR308’s ROM MR_ROM MR_CIF C language I/F routine App_prog Interrupt vector area • Programs to be located in the application ROM ♦...
  • Page 158: Figure 9.2 Memory Map

    Here you change the section files (c_sec.inc, asm_sec.inc), and set addresses of programs you locate in the application ROM. In this instance, the respective first addresses of the sections given below must agree with each other between two applications. Also, you need to invariably locate the MR_ROM section at the beginning of the application ROM.
  • Page 159 e.g. mr308tbl \product\app1 \product\app2 8. Generating a system You execute the make command to generate a system. 9. Carrying out steps 4 through 8 with respect to application 2 allows you to generate the system for application 2. The steps given above allows you to form the separate ROMs. If the file mrtable.a30 is not held in the current directory, execute make command to generate a system.
  • Page 161 Real-time OS for M16C/70,80,M32C/80 Series M3T-MR308/4 User's Manual Publication Date: Nov. 1, 2005 Sales Strategic Planning Div. Published by: Renesas Technology Corp. Application Engineering Department 1 Edited by: Renesas Solutions Corp. © 2005. Renesas Technology Corp. and Renesas Solutions Corp., Rev.2.00...
  • Page 162 M3T-MR308/4 User's Manual...

This manual is also suitable for:

M3t-mr308/4 v.4.00

Table of Contents