Quick Guide to Using Code Warrior

Similar documents
CodeWarrior. Microcomputer Architecture and Interfacing Colorado School of Mines Professor William Hoff

ELECTRICAL AND COMPUTER ENGINEERING DEPARTMENT, OAKLAND UNIVERSITY ECE-470/570: Microprocessor-Based System Design Fall 2014.

How to use CodeWarrior ASM with Adapt9S12 and Serial Monitor.doc

It translates (converts) assembly language to machine code.

Using CodeWarrior V4.5 Assembler with Adapt9S12X and Serial Monitor

Lecture #4 Microcontroller Instruction Set Embedded System Engineering Philip Koopman Monday, 25-Jan-2016

ECE372 CodeWarrior Simulator Andreou/Michaelides

538 Lecture Notes Week 5

HC(S)12 Assembler Manual

538 Lecture Notes Week 5

; export symbols ; export 'Entry' symbol. ; include derivative specific macros PORTA EQU $0000 PORTB EQU $0001 DDRA EQU $0002 DDRB EQU $0003

; export symbols XDEF Entry ; export 'Entry' symbol ABSENTRY Entry ; for assembly entry point

ECE 367 -Experiment #1 Fall 2012

Coe538 Final Study Guide 2016 (Questions & Answers)

CodeWarrior Development Studio for Microcontrollers V10.x S12Z Assembler Reference Manual

ECE 3120 Lab 1 Code Entry, Assembly, and Execution

Lab 2 Part 1 Assembly Language Programming and 9S12 Ports

ECE 3120 Fall 2013 Lab 1 Code Entry, Assembly, and Execution

Sample Problem Set #1

Using the stack and the stack pointer

MC9S12 Assembler Directives A Summary of MC9S12 Instructions Disassembly of MC9S12 op codes. Summary of HCS12 addressing modes ADDRESSING MODES

Introduction to Programming the 9S12 in C Huang Sections 5.2 and 5.3. You will be able to use all of the Motorola data manuals on the exam.

Exam 1 Feb. 23, 25, 27?

Programming the Motorola MC68HC11 Microcontroller

Lecture 9 Subroutines

CMPEN 472 Sample EXAM II

Using RS08 Microcontrollers with Variable Interrupt Priorities Program Association of RS08 Microcontrollers

1. Memory Mapped Systems 2. Adding Unsigned Numbers

EE 5340/7340 Motorola 68HC11 Microcontroler Lecture 1. Carlos E. Davila, Electrical Engineering Dept. Southern Methodist University

ECE 3120: Computer Systems Chapter 8: ECE-3120-A Musical

ME4447/6405. Microprocessor Control of Manufacturing Systems and Introduction to Mechatronics. Instructor: Professor Charles Ume LECTURE 7

EE319 K Lecture 7. Address mode review Assembler, Debugging Psuedo ops 16 bit timer finite state machines. University of Texas ECE

Installing and using CW 10.6 for TPMS applications. Revision 4

Wed. Sept 6 Announcements

To add XGATE support to projects using Processor Expert for HCS12X

BRANCH IF REGISTER IS HIGHER/GREATHER/ THAN OPERAND e.g. CMPA #$D0

538 Lecture Notes Week 2

Chapter 4: Advanced Assembly Programming. EE383: Introduction to Embedded Systems University of Kentucky. Samir Rawashdeh

Lab 1 MC9S12 Assembler and Monitor

COSC 243. Instruction Sets And Addressing Modes. Lecture 7&8 Instruction Sets and Addressing Modes. COSC 243 (Computer Architecture)

538 Lecture Notes Week 3

ECE 331: PC Lab 3 Stack and Subroutines

CodeWarrior Development Studio for Freescale 68HC12/HCS12/HCS12X/XGATE Microcontrollers Quick Start SYSTEM REQUIREMENTS Hardware Operating System 200

Decimal, Hexadecimal and Binary Numbers Writing an assembly language program

Comparison of C and Assembly How to compile a C program using CodeWarrior

LECTURE #21: G-CPU & Assembly Code EEL 3701: Digital Logic and Computer Systems Based on lecture notes by Dr. Eric M. Schwartz

Introduction to Programming the 9S12 in C Huang Sections 5.2 and 5.3

Lecture #6 Embedded Language Use Embedded System Engineering Philip Koopman Monday, 1-Feb-2016

ME 4447/6405 Introduction to Mechatronics Instructor: Professor Charles Ume

ECE331 Handout 3- ASM Instructions, Address Modes and Directives

Chapter 2: HCS12 Assembly Programming. EE383: Introduction to Embedded Systems University of Kentucky. Samir Rawashdeh

Linking Assembly Subroutine with a C Program

EE319 K Lecture 3. Introduction to the 9S12 Lab 1 Discussion Using the TExaS simulator. University of Texas ECE

Module 1-D. Control Structure Applications. Tim Rogers 2017 [1.D]-1

EE319K Final Fall 2005 Solution C. (3) Question 1. (3) Question 2. short function(const short in){ return in+5; } const

Lecture 6 Assembly Programming: Branch & Iteration

TEMPERATURE SENSOR. Revision Class. Instructor / Professor LICENSE

0b) [2] Can you name 2 people form technical support services (stockroom)?

Changing the Embedded World TM. Module 3: Getting Started Debugging

EE 308 Spring The HCS12 has 6 addressing modes

Comparison of C and Assembly How to compile a C program using CodeWarrior

ME 4447/ME Microprocessor Control of Manufacturing Systems/ Introduction to Mechatronics. Instructor: Professor Charles Ume

Chapter 2 HCS12 Assembly Language

Microcontrollers. 2IN60: Real-time Architectures (for automotive systems) Mike Holenderski,

C SC 230 Computer Architecture and Assembly Language April 2000 Exam Sample Solutions

COE538 Microprocessor Systems Lab 1: Using the CodeWarrior IDE and Introduction to Assembly Programming 1

AN Kbyte Addressing with the M68HC11. Overview

ECE 3610 MICROPROCESSING SYSTEMS

m 1 se 7 m 23 Introduction to Embedded Microcomputer Systems Lecture 16.1 Recap Finite State Machines Pointer implementation

Introduction to the 9S12 Microcontroller

Serial Communication Through an Asynchronous FIFO Buffer

Installing and using CW 10.x for TPMS applications. Revision 5

Reading Assignment. 68HC12 Instruction Set. M68HC12 Instruction Set Categories. Some Tips. Endianness (Byte Order) Load and Store Instructions

indart -HC08 In-Circuit Debugger/Programmer for Freescale HC08 Family FLASH Devices User s Manual Rev. 2.0 Copyright 2006 SofTec Microsystems DC01027

Using and Installing: HCS12C128 Board, USB-to-Serial port driver, and HyperTerminal

COSC345 Software Engineering. Basic Computer Architecture and The Stack

Lab 1 MC9S12 Assembler and Monitor

History of the Microprocessor. ECE/CS 5780/6780: Embedded System Design. Microcontrollers. First Microprocessors. MC9S12C32 Block Diagram

Programming Book for 6809 Microprocessor Kit

EB301. Motorola Semiconductor Engineering Bulletin. Programming EEPROM on the MC68HC811E2 during Program Execution. Freescale Semiconductor, I

ECE/CE 3720: Embedded System Design

ME 6405 Introduction to Mechatronics

538 Lecture Notes Week 3

LAB #1: The CSM12C32 Module and PBMCUSLK Project Board

EE 308 Spring A software delay. To enter a software delay, put in a nested loop, just like in assembly.

Lecture 36 April 25, 2012 Review for Exam 3. Linking Assembly Subroutine with a C Program. A/D Converter

PUSH BUTTON. Revision Class. Instructor / Professor LICENSE

Eclipse Quick Reference Windows Hosted

UNIVERSITY OF HONG KONG DEPARTMENT OF ELECTRICAL AND ELECTRONIC ENGINEERING. Principles of Computer Operation

The Motorola 68HC11 Instruc5on Set

Getting Started with the HCS12 IDE

ECE L A B 1 Introduction ASSEMBLY PROGRAMMING WITH MINIIDE

Introduction to Embedded Systems and Chapter 1: Introduction to HCS12/MC9S12. EE383: Introduction to Embedded Systems University of Kentucky

POTENTIOMETER. Revision Class. Instructor / Professor LICENSE

P&E Microcomputer Systems, Inc. PKGPPCNEXUS

2. Arithmetic Instructions addition, subtraction, multiplication, divison (HCS12 Core Users Guide, Sections 4.3.4, and ).

EE 308 LAB 1 ASSEMBLER, SIMULATOR, AND MONITOR. Introduction and Objectives

The 6502 Instruction Set

Table 1: Mnemonics Operations Dictionary. Add Accumulators Add B to Y. Add with carry to B. Add Memory to B. Add 16-bit to D And B with Memory

ECE3120: Computer Systems Hardware & Software Development Tools

Transcription:

Quick Guide to Using Code Warrior So now that you have created a project, you are going to want to write an assembly program and assemble (compile) it. When you create a project a new panel appears on the left of the screen, this is the project panel. The project panel contains all the files and settings required to ensure your program compiles properly for the right hardware device (in our case the MC9S12XDP512 processor). Project Tool Bar Main Tool Bar Editor Panel Project Panel Main Tool Bar The main tool bar allows you to create new projects and files, it also allows you to open and save your files, as well as cut, copy and paste from one file to another. The main tool bar also allows you compile, build and debug your programs. The figure below explains the function of each button on the main tool bar, buttons are gray if they are unavailable. New Text file Open File Undo Cut Paste Find Next Compile Stop Build Errors and Warnings New Project Save Redo Copy Find Replace Make (Build)

Project Panel The project panel contains everything associated with your project. It contains a project tool bar and a file panel. Current Project Tool Bar File Panel Project Tool bar The project tool bar allows you to easily check, build and debug your programs. Make (Build) Project File Panel Synchronize Modification Dates The project file panel contains all the files associated with your project. These files are categorized into sub folders depending on their purpose. The sources directory contains all your source code, all your assembly files are contained within this directory. The prm directory contains????? and the Libraries directory contains any library files your project may be using to support the various devices (subsystems) built into the processor. The two remaining folders ( Project File, Cmd Files) contain configuration data for the debugger. Click here... Step 1: How to Modify the example assembly file If you click you click the plus sign next to the sources directory, it will expand showing you all your source files. Double click here... If you double click main.asm, then Code warrior will open the text file main.asm inside the editor panel, as shown in following figure.

The editor panel where the main.asm code appears is simply a text editor. This panel allows you to modify and save your code. You must first modify the example code in this panel so that you can use it for your own programs. Below is a listing of main.asm, the lines that are colored red should be removed, the lines colored blue should be added and the lines colored black should be left alone. *** ;* This stationery serves as the framework for a * ;* user application (single file, absolute assembly application) * ;* For a more comprehensive program that * ;* demonstrates the more advanced functionality of this * ;* processor, please see the demonstration applications * ;* located in the examples subdirectory of the * ;* Freescale CodeWarrior for the HC12 Program directory * *** ; export symbols XDEF Entry ; export 'Entry' symbol ABSENTRY Entry ; for absolute assembly: mark this as application entry point ; include derivative specific macros INCLUDE 'mc9s12xdp512.inc' ROMStart EQU $4000 ; absolute address to place my code/constant data ; variable/data section ORG RAMStart ; Insert here your data definition. Counter DS.W 1 FiboRes DS.W 1 ; code section ORG ROMStart Entry: LDS #RAMEnd+1 ; initialize the stack pointer CLI ; enable interrupts mainloop: LDX #1 ; X contains counter couterloop: STX Counter ; update global. BSR CalcFibo STD FiboRes ; store result LDX Counter INX CPX #24 ; larger values cause overflow. BNE couterloop BRA mainloop ; restart. CalcFibo: ; Function to calculate fibonacci numbers. Argument is in X. LDY #$00 ; second last LDD #$01 ; last DBEQ X,FiboDone ; loop once more (if X was 1, were done already) FiboLoop: LEAY D,Y ; overwrite second last with new value EXG D,Y ; exchange them -> order is correct again DBNE X,FiboLoop FiboDone: RTS ; result in D Spin: BRA Spin ;* Interrupt Vectors * ORG $FFFE DC.W Entry ; Reset Vector

When you have finished modifying main.asm it should look like this. *** ;* This stationery serves as the framework for a * ;* user application (single file, absolute assembly application) * ;* For a more comprehensive program that * ;* demonstrates the more advanced functionality of this * ;* processor, please see the demonstration applications * ;* located in the examples subdirectory of the * ;* Freescale CodeWarrior for the HC12 Program directory * *** ; export symbols XDEF Entry ABSENTRY Entry point ; export 'Entry' symbol ; for absolute assembly: mark this as application entry ; include derivative specific macros INCLUDE 'mc9s12xdp512.inc' ROMStart EQU $4000 ; absolute address to place my code/constant data ; variable/data section ORG RAMStart ; Insert here your data definition. ; code section Variables go here... ORG ROMStart Entry: LDS #RAMEnd+1 ; initialize the stack pointer CLI ; enable interrupts mainloop: Your assembly code Spin: BRA Spin goes here... ;* Interrupt Vectors * ORG $FFFE DC.W Entry ; Reset Vector Once you have made the changes to main.asm save it. Click here The assembler source file main.asm is now ready to be modified for a particular problem. Step 2: How to Make (Build) your modified Code To ensure that the assembly file main.asm is free of any errors you should click the make button on the project panel tool bar. Click here... If the assembly code is error free then nothing will appear on the screen. However if an error is detected the

following panel will appear above the main.asm code. Error Panel Arrow showing line in code were error appears. Now that you are sure that the code is error free, it is time to run it on the Adapt9S12X microcontroller. This process is outlined in the final document in this series Using the inside Code Warrior (CW-07-003.pdf).