- •Preface
- •Document Conventions
- •Contents
- •Chapter 1. Introduction
- •Manual Topics
- •Changes to the Documentation
- •Evaluation Kits and Production Kits
- •Types of Users
- •Requesting Assistance
- •Software Development Cycle
- •Product Overview
- •Chapter 2. Installation
- •System Requirements
- •Installation Details
- •Folder Structure
- •Chapter 3. Development Tools
- •C51 Optimizing C Cross Compiler
- •A51 Macro Assembler
- •BL51 Code Banking Linker/Locator
- •LIB51 Library Manager
- •OC51 Banked Object File Converter
- •Chapter 4. Creating Applications
- •Creating Projects
- •Project Targets and File Groups
- •Overview of Configuration Dialogs
- •Code Banking
- •µVision2 Utilities
- •Writing Optimum Code
- •Tips and Tricks
- •Chapter 5. Testing Programs
- •µVision2 Debugger
- •Debug Commands
- •Expressions
- •Tips and Tricks
- •Chapter 6. µVision2 Debug Functions
- •Creating Functions
- •Invoking Functions
- •Function Classes
- •Chapter 7. Sample Programs
- •HELLO: Your First 8051 C Program
- •Introduction
- •RTX51 Technical Data
- •Overview of RTX51 Routines
- •TRAFFIC: RTX-51 Tiny Example Program
- •RTX Kernel Aware Debugging
- •Chapter 9. Using On-chip Peripherals
- •Special Function Registers
- •Register Banks
- •Interrupt Service Routines
- •Interrupt Enable Registers
- •Parallel Port I/O
- •Timers/Counters
- •Serial Interface
- •Watchdog Timer
- •D/A Converter
- •A/D Converter
- •Power Reduction Modes
- •Chapter 10. CPU and C Startup Code
- •Caveats
- •Hardware and Software Requirements
- •Serial Transmission Line
- •µVision2 Monitor Driver
- •µVision2 Restrictions when using Monitor-51
- •Monitor-51 Configuration
- •Troubleshooting
- •Debugging with Monitor-51
- •Chapter 12. Command Reference
- •µVision 2 Command Line Invocation
- •A51 / A251 Macro Assembler Directives
- •C51/C251 Compiler
- •LIB51 / L251 Library Manager Commands
- •OC51 Banked Object File Converter
- •Index
180 |
Chapter 8. RTX-51 Real-Time Operating System |
|
|
RTX Kernel Aware Debugging
A RTX application can be tested with the same methods and commands as standard 8051 applications. When you select an Operating System under Options for Target – Target, µVision2 enables additional debugging features: a dialog lists the operating system status and with the _TaskRunning_ debug function you may stop program execution when a specific task is active.
The following section exemplifies RTX debugging with the TRAFFIC example.
Stop program execution, reset the CPU and kill all breakpoints.
An RTX-51 application can be tested in the same way as standard applications. You may open source files, set break points and single step through the code. The TRAFFIC application starts with task 0 init.
µVision2 is completely kernel aware. You may display the task status with the menu command Peripherals – RTX Tiny Tasklist.
8
Getting Started and Creating Applications |
181 |
|
|
The dialog RTX51 Tiny Tasklist gives you the following information:
Heading Description
TID
Task Name State
Wait for Event
Sig
Timer
Stack
task_id used in the definition of the task function.
name of the task function.
task state of the function; explained in detail in the next table.
event the task is waiting for; the following events are possible (also in combination):
Timeout: the task Timer is set to the duration is specified with the os_wait function call. After the Timer decrements to zero, the task goes into Ready state.
Interval: the time interval specified with os_wait is added to the task Timer value. After the Timer decrements to zero, the task goes into Ready state.
Signal: the os_wait function was called with K_SIG and the task waits for Sig = 1. status of the Signal bit that is assigned to this task.
value of the Timer that is assigned to this task. The Timer value decrements with every RTX system timer tick. If the Timer becomes zero and the task is waiting for Timeout or Interval the task goes into Ready state.
value of the stack pointer (SP) that is used when this task is Running.
RTX-51 Tiny contains an efficient stack management that is explained in the "RTX51 Tiny" User’s Guide, Chapter 5: RTX51 Tiny, Stack Management.
This manual provides detailed information about the Stack value.
State |
Task State of a RTX51 Task Function |
|
|
Deleted Tasks that are not started are in the Deleted state.
Ready Tasks that are waiting for execution are in the Ready state. After the currently Running task has finished processing, RTX starts the next task that is in the Ready state.
Running The task currently being executed is in the Running state. Only one task is in the Running state at a time.
Timeout Tasks that were interrupted by a round-robin timeout are in the Timeout state. This state is equivalent to Ready; however, a round-robin task switch is marked due to internal operating procedures.
Waiting Tasks that are waiting for an event are in the Waiting state. If the event occurs which the task is waiting for, this task then enters the Ready state.
8
182 |
Chapter 8. RTX-51 Real-Time Operating System |
|
|
The Debug – Breakpoints… dialog allows you to define breakpoints that stop the program execution only when the task specified in the _TaskRunning_ debug function argument is Running. Refer to “Predefined Functions” on page 134 for a detailed description of the _TaskRunning_ debug function.
The breakpoint at the function signalon stops execution only if lights is the current Running task.
8