ULINKPRO Keil, ULINKPRO Datasheet
![KIT DEBUG/TRACE UNIT HIGH SPEED](/photos/28/41/284194/ulinkpro_sml.jpg)
ULINKPRO
Specifications of ULINKPRO
Related parts for ULINKPRO
ULINKPRO Summary of contents
Page 1
... Creating Applications with µVision For 8-bit, 16-bit, and 32-bit Microcontrollers www.keil.com Getting Started 4 ® ...
Page 2
...
Page 3
... Copyright © 1997-2009 Keil, Tools by ARM, and ARM Ltd. All rights reserved. Keil Software and Design C51™, C166™, MDK™, RL-ARM™, ULINK ARTX™ are trademarks or registered trademarks of Keil, Tools by ARM, and ARM Ltd. ® Microsoft and Windows™ are trademarks or registered trademarks of Microsoft Corporation. ® ...
Page 4
... Getting Started: Creating Applications with µVision Preface This manual is an introduction to the Keil development tools designed for Cortex-Mx, ARM7, ARM9, C166, XE166, XC2000, and 8051 microcontrollers. It introduces the µVision Integrated Development Environment, Simulator, and Debugger and presents a step-by-step guided tour of the numerous features and capabilities the Keil embedded development tools offer ...
Page 5
... Chapter Overview “Chapter 1. Introduction”, provides an overview of product installation and licensing and shows how to get support for the Keil development tools. “Chapter 2. Microcontroller Architectures”, discusses various microcontroller architectures supported by the Keil development tools and assists you in choosing the microcontroller best suited for your application. ...
Page 6
Getting Started: Creating Applications with µVision Document Conventions Examples Description 1 README.TXT Bold capital text is used to highlight the names of executable programs, data files, source files, environment variables, and commands that you can enter at the command prompt. ...
Page 7
Contents Preface ................................................................................................................... 3 Document Conventions ........................................................................................ 5 Contents ................................................................................................................ 6 Chapter 1. Introduction...................................................................................... 9 Last-Minute Changes ....................................................................................... 11 Licensing .......................................................................................................... 11 Installation ....................................................................................................... 11 Requesting Assistance ..................................................................................... 13 Chapter 2. Microcontroller Architectures ...................................................... 14 Selecting an Architecture ................................................................................. ...
Page 8
Getting Started: Creating Applications with µVision Editor Windows ............................................................................................... 71 Output Windows .............................................................................................. 73 Other Windows and Dialogs ............................................................................ 74 On-line Help .................................................................................................... 74 Chapter 6. Creating Embedded Programs ..................................................... 75 Creating a Project File ..................................................................................... 75 Using the Project ...
Page 9
Chapter 8. Using Target Hardware............................................................... 112 Configuring the Debugger ............................................................................. 113 Programming Flash Devices .......................................................................... 114 Configuring External Tools ........................................................................... 115 Using ULINK Adapters ................................................................................. 116 Using an Init File ........................................................................................... 121 Chapter 9. Example Programs ...................................................................... 122 “Hello” ...
Page 10
... DK251: Keil 251 Development Tools, for 251 devices PK51: Keil 8051 Development Tools, for Classic & Extended 8051 devices In addition to the software packages, Keil offers a variety of evaluation boards, USB-JTAG adapters, emulators, and third-party tools, which completes the range of products. The following illustrations show the generic component blocks of µVision in conjunction with tools provided by Keil, or tools from other vendors, and the way the components relate ...
Page 11
... Software Development Tools Like all software based on Keil’s µVision IDE, the toolsets provide a powerful, easy to use and easy to learn environment for developing embedded applications. They include the components you need to create, debug, and assemble your C/C++ source files, and incorporate simulation for microcontrollers and related peripherals ...
Page 12
... Installation Please check the minimum hardware and software requirements that must be satisfied to ensure that your Keil development tools are installed and will function properly. Before attempting installation, verify that you have: A standard PC running Microsoft Windows XP, or Windows Vista 1GB RAM and 500 MB of available hard-disk space is recommended 1024x768 or higher screen resolution ...
Page 13
... Installation using the web download 1. Download the product from www.keil.com/demo 2. Run the downloaded executable 3. Follow the instructions displayed by the Installation from CD-ROM 1. Insert the CD-ROM into your CD-ROM drive. The CD-ROM browser should start automatically does not, you can run CD-ROM. ...
Page 14
... Read the section in this manual that pertains to the task you are attempting 2. Check the update section of the Keil web site to make sure you have the latest software and utility version 3 ...
Page 15
... Chapter 2. Microcontroller Architectures The Keil µVision Integrated Development Environment (µVision IDE) supports three major microcontroller architectures and sustains the development of a wide range of applications. 8-bit (classic and extended 8051) devices include an efficient interrupt system designed for real-time performance and are found in more than 65% of all 8-bit applications ...
Page 16
... Selecting an Architecture Choosing the optimal device for an embedded application is a complex task. The Keil Device Database (www.keil.com/dd) supports you in selecting the appropriate architecture and provides three different methods for searching. You can find your device by architecture, by specifying certain characteristics of the microcontroller vendor ...
Page 17
C166, XE166 and XC2000 Architecture Advantages Extremely fast I/O operations via the Peripheral Event Controller High-speed interrupt system with very well-tuned peripherals Efficient arithmetic and fast memory access These devices are used in medium to large sized applications that ...
Page 18
... Some devices provide an extended data (EDATA) space with up to 64KB. CODE memory consists of 64KB ROM space used for program code and constants. The Keil linker supports code banking that allows you to expand the physical memory space. In extended variants 16MB ROM space is available ...
Page 19
... Low-power, high-speed devices up to 100 MIPS are available 8051 Development Tool Support The Keil C51 Compiler and the Keil Linker/Locator provide optimum 8051 architecture support with the following features and C language extensions. Interrupt functions with register bank support are written directly in C ...
Page 20
Getting Started: Creating Applications with µVision 8051 Memory Types A memory type prefix is used to assign a memory type to an expression with a constant. This is necessary, for example, when an expression is used as an address for ...
Page 21
Infineon C166, XE166, XC2000 The 16-bit architecture of these devices is designed for high-speed real-time applications. It provides up to 16MB memory space with fast memory areas mapped into parts of the address space. High-performance applications benefit from locating ...
Page 22
... Getting Started: Creating Applications with µVision C166, XE166, XC2000 Development Tool Support The Keil C166 Compiler supports all C166, XE166, XC2000 specific features and provides additional extensions such as: Memory type support and flexible digital pattern processing for extremely fast variable access ...
Page 23
R10 R10 R11 R11 R12 R12 R13 = SP R13 = SP R14 = LR R14 = LR R15 = PC CPSR SPSR FIQ User ARM7 and ARM9 ...
Page 24
Getting Started: Creating Applications with µVision ARM7 and ARM9 Development Tool Support The ARM compilation tools support all ARM-specific features and provide: Function Inlining eliminates call/return overhead and optimizes parameter passing Inline assembly supports special ARM/Thumb instructions in C/C++ programs ...
Page 25
Cortex Core Register Set R10 R11 R12 R13 = PSP R13 = MSP R14 = LR R15 = PC xPSR PRIMASK FAULTMASK BASEPRI CONTROL Cortex-Mx Highlights Nested Vectored Interrupt ...
Page 26
... Getting Started: Creating Applications with µVision Cortex-Mx Development Tool Support In addition to the ARM specific characteristics, the Keil MDK-ARM supports the Cortex-Mx Microcontroller Software Interface Standard (CMSIS) and provides the following features: Core registers and core peripherals are accessible through C/C++ functions ...
Page 27
Code Comparison The following short but representative code examples show the impressive individual strengths of the different microcontroller architectures. I/O Port Access Comparison Source Code if (IO_PIN == 1) { i++; } 8051 devices provide bit-addressable I/O Ports and ...
Page 28
Getting Started: Creating Applications with µVision Pointer Access Comparison Source Code typedef struct { int x; int arr[10]; } sx; int f (sx xdata *sp, int i) { return sp->arr[i]; } 8051 devices provide byte arithmetic requiring several microcontroller instructions ...
Page 29
... Generating Optimum Code The C/C++ compilers provided by Keil are leaders in code generation and produce highly efficient code. However, code generation and translation is influenced by the way the application software is written. The following hints will help you optimize your application performance. Coding Hints for All Architectures Hint Keep interrupt functions short ...
Page 30
... You can locate large objects, as arrays or structures, into xdata or pdata memory using explicit memory types. Note, the Keil C51 run-time library uses generic pointers and can work with any memory type. Variables in the data address space are directly accessed by an 8-bit address that is encoded into the 8051 instruction set ...
Page 31
... These CPUs have efficient bit instructions that are fully supported by the Keil C166 Compiler with the bit data type. In these memory models, the default location of a variable is in near memory, accessible through16-bit direct addresses encoded in the CPU instructions ...
Page 32
Getting Started: Creating Applications with µVision Coding Hints for the ARM7 and ARM9 Architecture Hint When possible, use 32-bit data types for automatic and parameter variables. Use the Thumb instruction set. Use __swi software interrupt functions for atomic sequences. Enhance ...
Page 33
Coding Hints for the Cortex-Mx Architecture Hint When possible, use 32-bit data types for automatic and parameter variables. Optimize for Size MicroLIB Optimize for Speed Sleep mode features Enhance struct pointer access, by placing scalars at the beginning and ...
Page 34
... Software Development Cycle When using the Keil tools, the project development cycle is similar to any other software development project. 1. Create a project, select the target device from the Device Data base, and configure the tool settings 2 ...
Page 35
... Interface to configure Software Version Control Systems and third-party utilities Flash Programming Utilities, such as the family of Keil ULINK USB- JTAG Adapters Dialogs for all development tool settings On-line Help and links to microcontroller data sheets and user guides ...
Page 36
Getting Started: Creating Applications with µVision µVision Device Database The µVision Device Database offers a convenient way to select and configure your device and project parameters. It includes preconfigured settings, so that you can fully concentrate on your application requirements. ...
Page 37
... Emulator that connects to the microcontroller pins of the target hardware In-System Debugger that is part of the user application program and provides basic test functions ULINKPro Adapter a high-speed debug and trace unit connecting to on-chip debugging systems via JTAG/SWD/SWV, and offering Cortex-M3 ETM Instruction Trace capabilities 1 Some target drivers have hardware restrictions that limit or eliminate features of the µ ...
Page 38
... This information enables the debugger to display the program variables exactly. Line numbers are used for source-level debugging with the µVision Debugger or other third-party debugging tools. Keil assemblers support several different types of macro processors (depending on architecture): The Standard Macro Processor is the easier macro processor to use. It allows you to define and use macros in your assembly programs using syntax that is compatible with that used in many other assemblers ...
Page 39
... C/C++ Compiler The ARM C/C++ compiler is designed to generate fast and compact code for the ARM7, ARM9 and Cortex-Mx processor architectures; while the Keil ANSI C compilers target the 8051, C166, XE166, and XC2000 architectures. They can generate object code that matches the efficiency and speed of assembly programming ...
Page 40
Getting Started: Creating Applications with µVision Linker/Locator The linker/locator combines object modules into a single, executable program. It resolves external and public references and assigns absolute addresses to re- locatable program segments. The linker includes the appropriate run-time library modules ...
Page 41
... Keil RTX Kernels. Note that the Keil development tools are compatible with many third-party RTOS solutions. You are not bound to use Keil RTX; however, the RTX Kernels are well integrated into the development tools and are feature-rich, and well tailored towards the requirements of deeply embedded systems ...
Page 42
Getting Started: Creating Applications with µVision 8051, C166/XE166/XC2000, and ARM Cortex-Mx microcontrollers provide several interrupt levels. Higher-level interrupts may halt lower-level interrupts, or the main function impossible to suspend the execution of an ISR except through higher priority ...
Page 43
... The RTOS also solves many other challenges specific to embedded applications. It helps you to maintain memory resources and data communication facilities, and allows you to split a complex application into simpler jobs. Keil provides several different RTOS systems for the various microcontroller architectures: RTX51 Tiny and RTX166 Tiny (for 8051 and C166/XE166/XC2000 ...
Page 44
Getting Started: Creating Applications with µVision RTX Introduction Many microcontroller applications require simultaneous execution of multiple jobs or tasks. For such applications, an RTOS allows flexible scheduling of system resources (CPU, memory, etc.) to several tasks. With RTX, you write ...
Page 45
Simple RTX Program using Round-Robin Task Switching int counter0; int counter1; 1 __task void job0 (void) os_tsk_create (job1, 1); while (1) { counter0++; } } __task void job1 (void) while (1) { counter1++; } } main (void) { os_sys_init ...
Page 46
Getting Started: Creating Applications with µVision Program with Wait for Time Delay int counter0; int counter1; __task void job0 (void) os_tsk_create (job1, 1); while (1) { counter0++; os_dly_wait (3 __task void job1 (void) while (1) { counter1++; os_dly_wait ...
Page 47
Preemptive Task Switching Tasks with the same priority explicit call to a RTX wait function to execute other tasks. Therefore, in the example above, the value of save_i0 is not zero, as you might have expected. If job1 has ...
Page 48
Getting Started: Creating Applications with µVision Mailbox Communication A mailbox is a FIFO (first in – first out) buffer for transferring messages between task functions. Mailbox functions accept pointer values, typically referencing memory buffers. However, by using appropriate type casts, ...
Page 49
Semaphores Semaphores are utilized to synchronize tasks within an application. Although they have a simple set of calls to the operating system, they are the classic solution in preventing race conditions. However, they do not resolve resource deadlocks. RTX ...
Page 50
Getting Started: Creating Applications with µVision Counting Semaphores (Multiplex) Use a multiplex to limit the number of tasks that can access a critical section of code. For example, a routine to access memory resources and that supports a limited number ...
Page 51
RTX ensures that interrupts execute correctly and leaves the machine in a well- defined state. Interrupt service routines, also known as interrupt handlers, are used to service hardware devices and transitions between operation modes, such as system calls, system ...
Page 52
... F1 to the on-line help. Memory and Memory Pools The compilers delivered with the Keil development tools provide access to all memory areas, regardless of the microcontroller architecture. Variables can be explicitly assigned to a specific memory space by including a memory type in the declaration, or implicitly assigned based on the memory model. Function arguments and atomic variables that cannot be located in registers are also stored in the default memory area ...
Page 53
Built-in memory allocation routines enable you to dynamically use the system memory by creating memory pools and use fixed sized blocks from the memory pool. The memory pool needs to be properly initialized to ...
Page 54
Getting Started: Creating Applications with µVision RTX and ARTX166 Function Overview Function Group Task Management Event/Signal Functions Semaphore Functions Mailbox Functions Memory Management Mutex Management System Clock (Timer- Ticks) Generic WAIT Function RTX and ARTX166 Technical Data Technical Data max ...
Page 55
RTX51 Tiny and RTX166 Tiny Function Overview Function Group Task Management Signal Functions System Clock (Timer-Ticks) reset-interval Generic WAIT Function RTX51 Tiny and RTX166 Tiny Technical Data Technical Data max Tasks Signals RAM max Code Space Hardware Needs Context ...
Page 56
Getting Started: Creating Applications with µVision Chapter 5. Using µVision The µVision IDE is, for most developers, the easiest way to create embedded system programs. This chapter describes commonly used µVision features and explains how to use them. General Remarks ...
Page 57
To launch µVision click the µVision icon on your desktop or select µVision from the Start Menu. Window Layout Concepts You can set up your working environment Nevertheless, let us define three major screen areas. The definition will help ...
Page 58
Getting Started: Creating Applications with µVision The Project Windows area is that part of the screen in which, by default, the Project Window, Functions Window, Books Window, and Registers Window are displayed. Within the Editor Windows area, you are able ...
Page 59
Positioning Windows The µVision windows may be placed onto any area of the screen, even outside of the µVision frame another physical screen. Click and hold the Title Bar Drag the window to the preferred area, or ...
Page 60
Getting Started: Creating Applications with µVision µVision Modes µVision operates in two modes: Build Mode and Debug Mode. Screen settings, Toolbar settings, and project options are stored in the context of the mode. The File Toolbar is enabled in all ...
Page 61
View Menu The View Menu includes commands to display/hide a variety of windows. You can also enable/disable the Status Bar. The Periodic Window Update option is useful in Debug Mode to force the screens to periodically refresh. If this ...
Page 62
Getting Started: Creating Applications with µVision Debug Menu The Debug Menu includes commands that start and stop a debug session, reset the CPU, run and halt the program, and single-step in high-level and assembly code. In addition, commands are available ...
Page 63
Peripherals Menu The Peripherals Menu includes dialogs to display and change on-chip peripheral settings. The content of this menu is tailored to show the specific microcontroller options selected for your application. Dialogs are typically available for System Configuration, Interrupts, ...
Page 64
Getting Started: Creating Applications with µVision Toolbars and Toolbar Icons The µVision IDE incorporates several Toolbars with buttons for the most commonly used commands. The File Toolbar contains buttons for commands used to edit source files, to configure µVision, and ...
Page 65
Navigate Forwards – moves cursor to its former forward position Bookmark – sets or removes a bookmark at cursor position Previous Bookmark – moves the cursor to the bookmark previous to the current cursor position Next Bookmark – moves ...
Page 66
Getting Started: Creating Applications with µVision Build Toolbar Translate/Compile – compiles or assembles the file in the current edit window Build – builds and links those files of the project that have changed or whose dependencies have changed Rebuild – ...
Page 67
Debug Toolbar Reset – Resets the microcontroller CPU or simulator while debugging Run – continues target program execution to next breakpoint Stop – halts target program execution Step One Line – steps to the next instruction or into procedure ...
Page 68
Getting Started: Creating Applications with µVision Performance Analyzer – displays, in graphical form, the time consumed by modules and functions as well as the number of function calls Code Coverage – dialog to view code execution statistics in a different ...
Page 69
Folder or Group – expanded – icon identifying an expanded folder or group; options correspond to the default settings Folder or group – expanded – icon identifying an expanded folder or group; with changed options that are different from ...
Page 70
Getting Started: Creating Applications with µVision Project Windows Project Windows display information about the current project. The tabs at the bottom of this area provide access to: Project structure and management. Group your files to enhance the project overview. Functions ...
Page 71
The Functions Window displays all functions of your project or of open editor files. Double-click a function to jump to its definition. Invoke its Context Menu to toggle the displaying mode of this window or scan the files. The ...
Page 72
Getting Started: Creating Applications with µVision Editor Windows The Editor Windows are used to: Write, edit, and debug source files. Press on language elements for help. F1 Set breakpoints and bookmarks Set project options and initialize target systems by using ...
Page 73
Using the Editor You can view text files in the Editor side by side. Invoke the Context Menu of the file tab and choose a horizontal or vertical arrangement. Files can be dragged and dropped from one Tab Group ...
Page 74
Getting Started: Creating Applications with µVision Output Windows By default, the Output Windows screen and include: The Build Output Window includes errors and warnings from the compiler, assembler, and linker. Double-click a message to jump to the location of the ...
Page 75
Other Windows and Dialogs Peripheral Dialogs and Windows Peripheral Dialogs and Windows allow you to review and modify the status of on-chip peripherals. These dialogs are dependent on the target system you selected at the beginning of your project ...
Page 76
... Getting Started: Creating Applications with µVision Chapter 6. Creating Embedded Programs µVision is a Windows application that encapsulates the Keil microcontroller development tools as well as several third-party utilities. µVision provides everything you need to start creating embedded programs quickly. µVision includes an advanced editor, project manager, and make utility, which work together to ease your development efforts, decreases the learning curve, and helps you to get started with creating embedded applications quickly ...
Page 77
Selecting the Folder and Project Name To create a new project file, select the Project – New Project… Menu. This opens a standard dialog that prompts you for the new project file name good practice to use ...
Page 78
... Any file, the startup file included, may be moved to any other group you may define in future. The Books Window, also part of the Project Windows, provides the Keil product manuals, data sheets, and programmer’s guides for the selected microcontroller. Double-click a book to open it. ...
Page 79
... To use this feature immediately, save the empty file with the desired extension prior to starting coding. Save the new source file using the button on the File Toolbar or use the File – Save Menu 1 Most microcontroller manuals are part of the toolset, or are available on the Keil Development Tools CD-ROM. Chapter 6. Creating Embedded Programs ...
Page 80
Getting Started: Creating Applications with µVision Adding Source Files to the Project After you have created and saved your source file, add it to the project. Files existing in the project folder, but not included in the current project structure, ...
Page 81
To change the name of a Target, Group, or File you may either: Double-click the desired item, or Highlight the item and press F2 Change the name and click the OK button. Changes will be visible in the other ...
Page 82
Getting Started: Creating Applications with µVision Setting Target Options Open the Options for Target dialog from the Build Toolbar or from the Project Menu Through this dialog, you can change the target device set target options and configure the development ...
Page 83
The following table lists the project options that are configurable on each page of the Target Options dialog. Dialog Page Description Device Selects the target device from the Device Database Target Specifies the hardware settings of your target system ...
Page 84
... Getting Started: Creating Applications with µVision Configuring the Startup Code Keil tools include files with chip-specific startup code for most of the supported devices. Keil startup files contain assembler code with options you can adjust to your particular target system. Most startup files have embedded commands for the µ ...
Page 85
Building the Project Several commands are available from the Build Toolbar or Project Menu to assemble, compile, and link the files of your project. Before any of these actions are executed, files are saved. Translate File – compiles or ...
Page 86
Getting Started: Creating Applications with µVision Creating a HEX File Check the Create HEX File box under Options for Target — Output, and µVision will automatically create a HEX file during the build process. Select the desired HEX format through ...
Page 87
Working with Multiple Projects Sometimes, application development requires working with more than one project at the same time. With single projects, that requires closing the current project and opening the new project. The µVision Multi-Project feature allows you to ...
Page 88
Getting Started: Creating Applications with µVision Add existing stand-alone 1,2 projects to your Multi- Project. Use the controls to change the file order, to add or remove project files define the active project. Removing or deleting a project ...
Page 89
Batch-Building Multiple Projects While you can compile the individual projects one-by-one, the Multi-Project environment provides a more convenient way to compile all the projects in one working step. 1 Use the Batch Build command from the Build Toolbar or ...
Page 90
... Emulators that connect to the MCU pins of the target hardware In-System Debuggers that are part of the user application program and provide basic test functions Third-party tool developers may use the Keil Advanced GDI to interface µVision to their own hardware debuggers. No matter whether you choose to debug with the Simulator or with a target debugger, the µ ...
Page 91
To debug programs using the Simulator, check Use Simulator on the left side of the Debug dialog. To debug programs running on target hardware, check Use <Hardware Debugger> on the right side of the Debug dialog. In addition to ...
Page 92
Getting Started: Creating Applications with µVision Simulation µVision simulates memory from which specific areas can be mapped for reading, writing, executing combination of these. In most cases, µVision can deduce the correct memory ...
Page 93
This screenshot below shows some of the key windows available in Debug Mode. Chapter 7. Debugging ...
Page 94
Getting Started: Creating Applications with µVision Debug Mode Most editor features are also available while debugging. The Find command can be used to locate source text and source code can be modified. Much of the Debugger interface is identical to ...
Page 95
Using the Command Window Generic compile and debug information are displayed here while stepping through the code. Additional notifications are provided if, for example, memory areas cannot be accessed. Enter debugger commands on the Command Line of the Command ...
Page 96
Getting Started: Creating Applications with µVision Executing Code µVision provides several ways to run your programs. You can Instruct the program to run directly to the main C function. Set this option in the Debug tab of the Options for ...
Page 97
Single-Stepping To step through the program and into function calls use the Step command from the Debug Toolbar or Debug Menu. Alternatively, you enter TSTEP in the Command Window, or press To step through the program and over function ...
Page 98
Getting Started: Creating Applications with µVision Memory Window Monitor memory areas through four distinct Memory Windows. Open the Memory Window from the Debug Toolbar or the View – Memory – Memory[x] Menu The Context Menu allows you to select the ...
Page 99
Breakpoints and Bookmarks In µVision, you can set breakpoints and bookmarks while: Creating or editing your program source code Debugging, using the Breakpoints dialog, invoked from the Debug Menu Debugging, using commands you enter in the Command Window Setting ...
Page 100
Getting Started: Creating Applications with µVision Breakpoints Window Invoke the Breakpoints Window from the Debug Menu. You have to stop the program running, to get access to this dialog. Modify existing breakpoints and add new breakpoints via this dialog. Enable/disable ...
Page 101
When a Command has been specified for a breakpoint, µVision executes the command and continues to execute your target program. The command specified can be a µVision debug function or signal function. To halt program execution in a µVision ...
Page 102
Getting Started: Creating Applications with µVision Watchpoints Define watchpoints to observe variables, objects, and memory areas affected by your target program. Watchpoints can be defined in two Watch pages. The Locals Window contains items of the currently executed function. Items ...
Page 103
Serial I/O and UARTs µVision provides three Serial Windows, named «UART #{1|2|3}», for each simulated on-chip UART. Serial data output from the simulated microcontroller are shown in these windows. Characters you type into the Serial Window are considered input ...
Page 104
Getting Started: Creating Applications with µVision Execution Profiler The Execution Profiler in µVision records the amount of time and the number of times each assembler instruction and high-level statement in your program executes. The amount of time and the number ...
Page 105
Code Coverage The Code Coverage Window marks the code that has been executed, and groups the information based on modules and functions. Use this feature to test safety-critical applications where certification and validation is required. You can detect instructions ...
Page 106
Getting Started: Creating Applications with µVision Performance Analyzer The µVision Performance Analyzer displays the execution time recorded for functions in your application program. Results show up as bar graphs along with the number of calls, the time spent in the ...
Page 107
Logic Analyzer The Logic Analyzer displays values of variables or virtual registers and shows the changes on a time axis. Add values through the Setup … button or drag and drop objects from other windows into the Logic Analyzer. ...
Page 108
Getting Started: Creating Applications with µVision System Viewer Peripheral Registers are memory mapped registers that a processor can write to and read from to control a peripheral device. µVision provides an advanced method for viewing and debugging these peripheral registers. ...
Page 109
Symbols Window The Symbols Window displays information from the Debugger in an ordered and grouped manner and can be called via the Debug Toolbar or from the View—Symbol Window Menu. This functionality includes objects: Of simulated resources as the ...
Page 110
Getting Started: Creating Applications with µVision Browse Window The Browse Window enables you to search for objects in the code. This feature can be used in Debug and Build Mode. Nevertheless, the browse information is only available after compilation. You ...
Page 111
Toolbox The Toolbox contains user-configurable buttons that execute debugger commands or user-defined functions. Click on a Toolbox button to execute the associated command. Toolbox buttons may be clicked at any time, even while the program executes. Define a Toolbox ...
Page 112
Getting Started: Creating Applications with µVision Instruction Trace Window To follow the instruction sequence history, invoke the Instruction Trace Window from the Debug Toolbar or via the View – Trace Menu. Use this window in conjunction with the Disassembly Window. ...
Page 113
... ULINK for Infineon XC8xx, ST µPSD3xxx, and NXP LPC95x 166 ULINK for Infineon C166, XE166, and XC2000 ARM ULINK, ULINKPro for ARM7, ARM9, and Cortex-Mx devices The µVision Debugger interfaces to the target hardware through the following drivers, which are provided by Keil: ...
Page 114
Getting Started: Creating Applications with µVision Configuring the Debugger Choose Target Options – from the Build Toolbar and select the Debug tab Alternatively, you can use the Project – Options for Target Menu, to open this dialog. Check the Use ...
Page 115
... Select Use Target Driver for Flash Programming to use a target adapter, like the Keil ULINK USB-JTAG Adapter, SEGGER J-Link, EPM900 Emulator, or Silabs adapter to program your system’s Flash memory. Select Use External Tool for Flash Programming to use a third-party command-line utility, like FlashMagic, to program your system’ ...
Page 116
Getting Started: Creating Applications with µVision Configuring External Tools To configure µVision for Flash Use External Tool for Flash Programming and specify the Command and the Arguments to be used. Choose Target Options – from the Build Toolbar and select ...
Page 117
... Using ULINK Adapters The Keil ULINK USB-JTAG family of adapters, further referred to as ULINK, connects your PC’s USB port to your target system. The connection between the microcontroller and the ULINK unit can be established via the JTAG of the embedded system. The ULINK adapters enables you to: ...
Page 118
... Click Target Options from the Build Toolbar and select the Debug tab, or open the dialog from the Project – Options for Target – Debug Menu Click the Settings button to open the Target Driver Setup dialog. ULINK2 ULINKPro Yes Yes Yes - Yes ...
Page 119
Configuring Debug Settings The Target Driver Setup dialog depends on the target device selected in your project. Please use the on-line Help for additional information. Configuring Trace Settings The Trace dialog tab controls the real-time trace operations. Please use ...
Page 120
... Getting Started: Creating Applications with µVision Configuring Flash Download The Keil ULINK drivers support a wide variety of Flash-based microcontrollers. Click Target Options from the Build Toolbar and select the Utilities tab, or open the dialog from the Project – Options for Target Menu To configure µ ...
Page 121
... Highlight your preferred programming algorithm to Add it for your target hardware. If the Flash device you use is not listed, you may define new algorithms. Do this for a new Flash device, which is currently not directly supported by Keil. You may use the algorithms found in any \ algorithms. ...
Page 122
Getting Started: Creating Applications with µVision Using an Init File Some applications or target systems require the execution of specific debug commands or functions ahead of Flash programming. This feature is typically used to define BUS configuration for your device ...
Page 123
... Chapter 9. Example Programs Each Keil toolset includes example programs, which are ready to run and which help you to get started. Browse the examples to learn how the development tools work and get familiar with the look and feel, as well as with the behavior of µ ...
Page 124
... Alternatively, you may drag and drop the application, or simply double-click the file. 1 Since µVision simulates the target hardware required for this program, you actually do not need target hardware or an evaluation board. Example Folder \KEIL\ARM\EXAMPLES\HELLO\ \KEIL\C166\EXAMPLES\HELLO\ \KEIL\C51\EXAMPLES\HELLO\ HELLO.UVPROJ HELLO.UVPROJ HELLO.UVPROJ 123 ” Hello World project file from the file into the µ ...
Page 125
Once the project has been opened, µVision shows the source files that comprise the project. The files are shown in the Project Window. Double-click on HELLO.C edit the source file. µVision loads and displays the file contents in the ...
Page 126
Getting Started: Creating Applications with µVision Testing the “Hello” Project Once the “Hello” program has been compiled and linked successfully, test it with the µVision Debugger. Select Debug – Start/Stop Debug Session from the menu or from the File Toolbar. ...
Page 127
While debugging, µVision displays the following default screen layout. If you re-arrange the layout, µVision saves the layout automatically and provides this layout next time you invoke the debugger. However, you cannot explicitly recall the changed layout, unless you ...
Page 128
... Calls, whereas the startup file resides under the Startup Code group. 1 Since µVision simulates the hardware required for this program, you do not actually need target hardware or an evaluation board. GETLINE records data received from digital ports and A/D inputs. Example Folder \KEIL\ARM\EXAMPLES\MEASURE\ \KEIL\C166\EXAMPLES\MEASURE\ \KEIL\C51\EXAMPLES\MEASURE\ from . , and MCOMMAND.C 127 ...
Page 129
A project may contain one or more targets, a feature that allows you to build different versions of your program. The “Measure” project contains several targets for different test environments including the simulator and evaluation boards. Select the model ...
Page 130
Getting Started: Creating Applications with µVision Source Browser The “Measure” project is configured to generate complete browser and debug information. Use the Source Browse command from the File Toolbar or View Menu to view information about program variables and other ...
Page 131
Using the Serial Interface Open the serial UART Window from the View Menu or the Debug Toolbar to view the output Before you start running the “Measure” program, open the Serial Window so that you can enter commands and ...
Page 132
Getting Started: Creating Applications with µVision Viewing Program Code Use the Disassembly Window command from the Debug Toolbar or View Menu to view mixed source and assembly code Test the various stepping commands, first while in the Disassembly Window, and ...
Page 133
Using the Trace Buffer In any programming process often required to investigate circumstances that led to a certain state. You can guide the µVision Debugger to record instructions into a trace memory buffer. In Debug Mode, you ...
Page 134
Getting Started: Creating Applications with µVision Using Breakpoints µVision supports execution, access, and complex breakpoints. The following example shows how to create a breakpoint that is triggered when the value 3 is written to current.time.sec Open the Breakpoints dialog from ...
Page 135
Watching Variables The µVision Debugger provides two Watch Windows to which you can add variables, structures, and arrays for easy reference. The Watch Window updates at the end of each execution command. Enable the View – Periodic Window Update ...
Page 136
Getting Started: Creating Applications with µVision Viewing and Changing On-Chip Peripherals The “Measure” program accepts input from several I/O and A/D ports. Use the µVision Debugger to view data and interact with peripherals. Changes made to the inputs are reflected ...
Page 137
Using VTREG Symbols In addition to the peripheral dialogs, you may use Virtual Target Registers (VTREG) to change input signals. On the Command Window, you can assign values to VTREG symbols. For example: PORT0=0xAA55 /* Set digital input PORT ...
Page 138
Getting Started: Creating Applications with µVision Using the Logic Analyzer The µVision Debugger includes a configurable Logic Analyzer you can use to trace simulated signals and variables during program execution. Open the Logic Analyzer Window from the Debug Toolbar or ...
Page 139
... Opening the “Traffic” Project To start working with the “Traffic” project, open the project file from the TRAFFIC.UVPROJ appropriate example folder. Most Keil example projects include a text file named that explains the aspects ABSTRACT.TXT and the intention of the program and is included in the Project Window. ...
Page 140
Getting Started: Creating Applications with µVision Using the Configuration Wizard µVision incorporates a Configuration Wizard that assists you in choosing the settings for the startup file and other configuration files. Traditionally, these files are assembler or other source files, which ...
Page 141
Using the Watch Window Use the Watch Window command on the Debug Toolbar or View Menu. Open the Call Stack Window as well. The status of the traffic pedestrian lights displays in the Watch 1 page of the Output ...
Page 142
Getting Started: Creating Applications with µVision Displaying Kernel-Aware Debug Information The µVision Simulator allows you to run and test applications created with a real-time operating system. Real-time applications load exactly like other programs. No special commands or options are required ...
Page 143
... ABSTRACT.TXT explains how to use the “Blinky” program for that specific board. You will also find a detailed description of the “Blinky” program in the User’s Guide manual of the board. Chapter 9. Example Programs Example Folder \KEIL\ARM\BOARDS\vendor\board name\BLINKY\ \KEIL\C166\BOARDS\board name\BLINKY\ \KEIL\C51\EXAMPLES\BLINKY\ ...
Page 144
Getting Started: Creating Applications with µVision Building the “Blinky” Project The project may contain several targets, for example: Simulator configuration to debug code without real target hardware Board specific target configuration to download and test the ...
Page 145
Downloading the “Blinky” Program Before using the Download command for the first time, verify the Flash options in the Project – Options for Target – Utilities dialog. Alternatively, you can use the Flash – Configure Flash Tools… Menu to ...
Page 146
Getting Started: Creating Applications with µVision Click Start/Stop Debug Session from the Debug Toolbar, or open the Debug – Start/Stop Debug Session Menu, to start debugging your application Step One Line – use the step commands to debug the application ...
Page 147
Glossary ASCII American Standard Code for Information Interchange This is a set of codes used by computers to represent digits, characters, punctuation, and other special symbols. The first 128 characters are standardized. The remaining 128 are defined by the ...
Page 148
Getting Started: Creating Applications with µVision CRC Cyclic Redundancy Check Is a type of function to detect accidental alteration of data during transmission or storage. Debugger A computer program to test software. Debuggers offer sophisticated functions such as running a ...
Page 149
JTAG Joint Test Action Group The common name used for the IEEE 1149.1 standard called Standard Test Access Port and Boundary-Scan Architecture. JTAG is often used as a microcontroller debug or probing port and allows data transfer out of ...
Page 150
Getting Started: Creating Applications with µVision MISRA Motor Industry Software Reliability Association A forum that provides software development standards for the C/C++ programming language, focusing on code safety, portability , and reliability in the context of embedded systems. Monitor Is ...
Page 151
Token Is a fundamental symbol that represents a name or entity in a programming language. Thumb, Thumb2 An instruction set for ARM and Cortex devices. See instruction set. UART Universal Asynchronous Receiver/Transmitter Is an individual IC, or part of ...
Page 152
Getting Started: Creating Applications with µVision Index µ µVision Concepts................................... 55 Debugger .................................. 35 Debugger Modes ...................... 36 Device Database ...................... 35 features ..................................... 34 IDE ........................................... 34 Operating Modes ...................... 59 8 8051 Advantages............................... 15 Classic ...................................... 17 Coding ...
Page 153
ARM7/ARM9 .......................... 31 C166, XE166, XC2000 ............ 30 Cortex-Mx ................................ 32 Compare memory areas ............... 97 Compiler ...................................... 38 Copying the startup code ............. 77 Cortex-Mx .................................... 23 Advantages ............................... 16 Coding Hints ............................ 32 ...
Page 154
... Getting Started: Creating Applications with µVision I I/O access comparison ................. 26 Infineon C166, XE166, XC2000 . 20 Installation ................................... 11 K Keil Tools ...................................... 9 Kernel information ..................... 141 L Last Minute Changes ................... 11 Library manager ........................... 39 Licensing ...................................... 11 Linker ........................................... 39 Locator ......................................... 39 Loogic Analyzer ........................ 106 M Memory commands ..................... 97 Menu ............................................ 59 Debug ....................................... 61 Edit ........................................... 59 File ........................................... 59 Flash ......................................... 60 Help .......................................... 61 Peripherals ............................... 62 Project ...................................... 60 SVCS ...
Page 155
Mailbox communication .......... 47 Memory & Memory Pools ....... 51 Preemptive Task Switching ..... 46 Round-Robin ............................ 43 Semaphores .............................. 48 Binary ................................... 48 Counting ............................... 49 Single Task .............................. 43 Technical Data ......................... 53 Technical Data, Tiny ................ ...
Page 156
Getting Started: Creating Applications with µVision Code Coverage ....................... 104 Command ................................. 94 Debug Layouts ....................... 111 Disassembly ............................. 94 Editor ....................................... 71 Help .......................................... 74 Instruction Trace .................... 111 Logic Analyzer ...................... 106 Memory .................................... 97 moving and positioning ...
Page 157
156 ...