User`s manual

4 digi.com Table of Contents
5.6 Patterns of Cooperative Multitasking .......68
5.7 Timing Considerations ..............................69
5.7.1 waitfor Accuracy Limits...............69
5.8 Overview of Preemptive Multitasking ......70
5.9 Slice Statements ........................................70
5.9.1 Slice Syntax..................................70
5.9.2 Usage ............................................70
5.9.3 Restrictions ...................................71
5.9.4 Slice Data Structure ......................71
5.9.5 Slice Internals ...............................71
5.10 µC/OS-II...................................................74
5.10.1 Changes to µC/OS-II ..................74
5.10.2 Tasking Aware Interrupt Service
Routines (TA-ISR) .............................76
5.10.3 Library Reentrancy.....................82
5.10.4 How to Get a µC/OS-II Application
Running..............................................83
5.10.5 Compatibility with TCP/IP.........88
5.10.6 Debugging Tips ..........................89
5.11 Summary ..................................................89
6. Debugging with Dynamic C............................91
6.1 Debugging Features Prior to Dynamic C 991
6.2 Debugging Features Introduced in Dynamic
C 9 .............................................................92
6.3 Debugging Tools .......................................93
6.3.1 printf()...........................................93
6.3.2 Software Breakpoints ...................94
6.3.3 Single Stepping............................ 96
6.3.4 Watch Expressions........................97
6.3.5 Evaluate Expressions....................98
6.3.6 Memory Dump .............................99
6.3.7 MAP File ....................................100
6.3.8 Execution Trace..........................102
6.3.9 Symbolic Stack Trace.................103
6.3.10 Assert Macro ........................... 104
6.3.11 Miscellaneous Debugging Tools.....
104
6.4 Where to Look for Debugger Features ...107
6.4.1 Run and Inspect Menus ..............108
6.4.2 Options Menu .............................108
6.4.3 Window Menu ............................108
6.5 Debug Strategies .....................................109
6.5.1 Good Programming Practices.....109
6.5.2 Finding the Bug ..........................110
6.6 Reference to Other Debugging Information .
112
7. The Virtual Driver...........................................113
7.1 Default Operation....................................113
7.2 Calling _GLOBAL_INIT() .....................113
7.3 Global Timer Variables ...........................114
7.3.1 Example: Timing Loop...............114
7.3.2 Example: Delay Loop.................115
7.4 Watchdog Timers ....................................116
7.4.1 Hardware Watchdog ...................116
7.4.2 Virtual Watchdogs ...................... 116
7.5 Preemptive Multitasking Drivers............ 117
8. Run-Time Errors ............................................. 119
8.1 Run-Time Error Handling....................... 119
8.1.1 Error Code Ranges ..................... 119
8.1.2 Fatal Error Codes .......................120
8.2 User-Defined Error Handler ...................121
8.2.1 Replacing the Default Handler...121
8.3 Run-Time Error Logging ........................122
8.3.1 Error Log Buffer.........................122
8.3.2 Initialization and Defaults.......... 123
8.3.3 Configuration Macros ................ 123
8.3.4 Error Logging Functions ............124
8.3.5 Examples of Error Log Use........124
9. Memory Management....................................125
9.1 Memory Map ..........................................125
9.1.1 Memory Mapping Control .........126
9.1.2 Macro to Use Second Flash for Code
126
9.2 Extended Memory Functions..................126
9.3 Code Placement in Memory ...................126
9.4 Dynamic Memory Allocation .................127
10. File Systems.....................................................129
10.1 FS2 .........................................................129
10.1.1 General Usage ..........................129
10.1.2 Application Requirements........131
10.1.3 File System API Functions.......134
10.1.4 Setting up and Partitioning the File
System .............................................135
10.1.5 File Identifiers .......................... 137
10.1.6 Skeleton Program Using FS2 ... 139
10.2 FAT File System.....................................140
10.2.1 Overview of FAT Documentation ..
141
10.2.2 Running Your First FAT Sample
Program ...........................................141
10.2.3 More Sample Programs............148
10.2.4 FAT Operations ........................154
10.2.5 More FAT Information .............164
11. Using Assembly Language............................171
11.1 Mixing Assembly and C.........................171
11.1.1 Embedded Assembly Syntax.... 171
11.1.2 Embedded C Syntax .................172
11.1.3 Setting Breakpoints in Assembly ...
172
11.2 Assembler and Preprocessor ..................173
11.2.1 Comments.................................173
11.2.2 Defining Constants ...................173
11.2.3 Multiline Macros ...................... 175
11.2.4 Labels .......................................175
11.2.5 Special Symbols .......................175
11.2.6 C Variables ...............................176