This Introduction to the Metrowerks Codewarrior Software Development Tools
Total Page:16
File Type:pdf, Size:1020Kb
Tutorial Introduction PURPOSE: - Provides an overview of the Metrowerks CodeWarrior toolset and explains how the toolset is organized and operates OBJECTIVES - Describe the CodeWarrior integrated development environment (IDE) - Identify the components of the CodeWarrior build system. - Identify the hosts on which the IDE executes. - Define a target. CONTENT: - 14 pages - 3 questions LEARNING TIME: - 20 minutes Welcome to this introduction to the Metrowerks CodeWarrior software development tools. This tutorial explains how CodeWarrior combines the programs required to write software into one seamless, integrated work environment. CodeWarrior tools run on several different platforms and can generate machine code for a variety of desktop and embedded systems. Upon completion of this tutorial, you’ll be able to describe the components of the CodeWarrior build system and the general organization of the software package. You’ll also be able to define a target and describe the operating systems that will host the software. 1 What is an IDE? • The IDE consists of tools that are used throughout the software development process. Project Manager Compiler Editor Assembler Search engine Linker Source code browser Debugger GUI designer • The tools are integrated fully and seamlessly. • A single environment is provided for software development. -- consistent operation -- move among all the tools freely -- a non-modal design In the CodeWarrior toolset, the Editor, Compiler, Linker, Debugger, and other software modules operate within an Integrated Development Environment, or IDE. The IDE oversees the control and execution of the tools. It provides an interface to the tools that is consistent and predictable. The operation of the development tools is seamless. There are no separate programs to run. You can readily switch between the Editor, Compiler, and Debugger by simply pointing and clicking or using a menu command. 2 IDE Architecture This figure describes a conceptual model of the CodeWarrior IDE architecture. The IDE components are interdependent on each other and work in concert to move the user rapidly through the edit, build, and debug phases of the development cycle. CodeWarrior’s strength and ease of use is centered around the Project Manager, which orchestrates the operation of the tools. The Project Manager also handles vital housekeeping functions, such as tracking modified files. The tetrahedron is a good representation of the IDE architecture. Each point represents a tool or combination of tools. Each point communicates with every other point. For example, the compiler conveys information about the syntax errors it detects back to the Editor. The Program Manager can then have the Editor open the appropriate source file with the insertion point positioned at the first offending line of source code. 3 IDE Components • Project Manager - scalable and unbounded • Source code editor - any supported language • Search engine - any text file or group of files • Source browser - any supported language • Build system - plug-in compilers, assemblers, linkers • Debugger - any supported language and target -- Displays source, machine code disassembly, or both • Designer - graphical interface layout Next, let’s discuss the IDE components. The Project Manager can handle projects as small as "Hello World!" and as large and complex as CodeWarrior itself. You can use CodeWarrior to manage any kind of project, not just source code. The Editor is a complete editing environment that can handle any text file. Customizable syntax coloring clearly identifies keywords for all supported languages. The Search Engine searches any text file or group of files. The Source Browser is a powerful navigation and editing tool for all supported languages. The Build System includes all compilers, linkers, and assemblers for a given target platform. Its plug-in architecture allows third parties to write their own tools that integrate with the CodeWarrior IDE. This mechanism is similar to how third-party plug-ins add capabilities to a Web browser. The Debugger enables you to view your source code, either as is or in assembly. Using the Debugger, you can set breakpoints, watch specific variables change, and move line-by-line through your program. Finally, the Designer is a visual development tool that helps you create a complete user interface. It even generates code for that UI. 4 CodeWarrior Host Environments • CodeWarrior runs on the following operating systems: Windows 95/98, NT Solaris Mac OS Linux • The user interface operates identically on all hosts. • Project files and source files operate on all hosts. • Some project data is not transferable. -- precompiled headers -- compiled data such as object code, debug information, browser information CodeWarrior runs on many different operating systems including Windows, Mac OS, Solaris, and Linux, with others to be added in the near future. The interface looks and operates the same on all environments. There are, of course, minor differences in screen appearance among host operating systems, but the functional capabilities are effectively the same. One of the greatest benefits of CodeWarrior’s multi-platform approach is that your project files are completely transferable from one host operating system to another. For example, if you were writing a project for Motorola’s StarCore architecture using the Windows hosted tools, you could transfer your project and files to a Solaris system for final testing without needing to convert your project in any way. 5 CodeWarrior Build System Responding to commands from the Project Manager, front-end language compilers parse source code into a memory-resident, syntactically-complete, Intermediate Representation (IR). The IR is a hardware-independent expression of the program’s logic. The IR can be improved by an IR optimizer. Back-end code generators read the IR and produce hardware-specific machine code. Linkers use the machine code to create executables and libraries designed to run on the target hardware. Pre- and post-linker plug-ins can be added. Support is provided for using traditional command-line tools. The compiler and linker components are modular plug-ins. Metrowerks publishes this API, allowing developers to create custom or proprietary tools. Customers derive significant benefits from this architecture. For example, an advance in the C/C++ front-end compiler translates to an immediate advance in all code generation. Optimizations in the IR mean that any new back-end code generator starts its translation using highly optimized code. Because every compiler uses the identical front-end module, targeting a new processor does not require compiler-related changes in the source code. This makes porting code much simpler. 6 CodeWarrior Targets Desktop Chip Families RTOS* Device Java VM DSP** PowerPC Nucleus GTD-5 Switch*** Linux M-Core SHx Palm OS Nintendo64 Mac OS MIPS V8xx Precise/MQX Novell Netware SPARC MIPS 16 68K QNX/Neutrino PlayStation Win32 NEC VR TriMedia VxWorks PlayStation II StarCore Sega Dreamcast * Real-Time Operating System ** Members of the Motorola DSP56800 family *** The GTD-5 Switch is a complex telecommunication switching device. This chart shows a wide range of Metrowerks products. Not all targets are available from all hosts or products. For example, the Nucleus RTOS is supported only for PowerPC and MIPS processors. 7 What Is a Target? • A platform target is the chip or operating system selected for development. -- processor examples are PowerPC, MIPS, x86, and 68K -- operating system examples are Windows, Mac OS, Neutrino • A build target is a file, library, or build option for a program. -- build target examples are debug, release, optimize • A build target is analogous to a makefile. Next, let’s take a detailed look at targets. In CodeWarrior, the word “target” can refer to two different things. First, the platform target is the specific operating system or chip architecture you want your code to run on. Second, the build target refers to the specific libraries and source files you use and what options you set. Each build target can be set up completely differently. For example, you can have separate debug and release builds. The debug build would have all compiler optimizations turned off and debug code generation turned on, such as symbol table generation, and would use Debugger-friendly libraries to construct the executable code. The release build would have all compiler optimizations turned on and debug code generation switched off, and would use optimized libraries to generate the executable code. A build target functions like a Makefile in that it specifies the files, the compiler and linker settings, and the libraries necessary to generate a program. 8 Target Settings • Target settings are the options used to control a build. • Each build target has its own settings. • Example settings are -- -- platform targets -- compiler options -- language options Target settings are options that are specific to a build target. Target settings include options for file access paths, which linker to use and thus what platform you are targeting, debug information, language options, compiler options, and more. The settings are changed visually through a settings panel available from the Edit menu. 9 IDE Preferences • IDE preferences are global settings. • They affect all projects/builds. • They are primarily Editor and Debugger preferences. • Example preferences are -- -- syntax coloring in editor -- debugger display options IDE preferences are settings