The instructor presents the 1st 9 slides

Slides:



Advertisements
Similar presentations
Introduction to Eclipse. Start Eclipse Click and then click Eclipse from the menu: Or open a shell and type eclipse after the prompt.
Advertisements

Getting started with MPLAB Launch MPLAB Set Toolbar as in the next slide by clicking the leftmost icon Open a new Source file by choosing [FILE][NEW] Type.
Renesas Technology America Inc. 1 SKP8CMINI-15,17 Tutorial 2 Creating A New Project Using HEW4.
Introduction to HT-IDE3000 Micro-C development System Department.
X-Call Version V3.0 User Guide
Lab7: Introduction to Arduino
 Use the Left and Right arrow keys or the Page Up and Page Down keys to move between the pages. You can also click on the pages to move forward.  To.
Slides created by: Professor Ian G. Harris PIC Development Environment MPLAB IDE integrates all of the tools that we will use 1.Project Manager -Groups.
Lab6 – Debug Assembly Language Lab
© by Pearson Education, Inc. All Rights Reserved.
LAUNCHXL2-RM57L – Project 0
Using PDG with e2studio: Example
Chapter 2: The Visual Studio.NET Development Environment Visual Basic.NET Programming: From Problem Analysis to Program Design.
ECE Department: University of Massachusetts, Amherst Lab 1: Introduction to NIOS II Hardware Development.
1 Introduction to Programming Environment Using MetroWerks CodeWarrior and Palm Emulator.
SKP8CMINI-15,17 Tutorial 1 Software Development Process using HEW4
Renesas Technology America Inc. 1 SKP8CMINI Tutorial 1 Introduction.
M16C/Tiny SKP Tutorial 1 Software Development Process using HEW4
Bit-DSP-MicrocontrollerTMS320F2812 Module 2 : Program Development Tools.
Introduction Purpose Objectives Content Learning Time
Creating a Web Page HTML, FrontPage, Word, Composer.
2. Introduction to the Visual Studio.NET IDE 2. Introduction to the Visual Studio.NET IDE Ch2 – Deitel’s Book.
Part 1 Using the ARM board And start working with C Tutorial 5 and 6
Silicon Labs ToolStick Development Platform
The 6713 DSP Starter Kit (DSK) is a low-cost platform which lets customers evaluate and develop applications for the Texas Instruments C67X DSP family.
Renesas Technology America Inc. 1 M16C/Tiny SKP Tutorial 2 Creating A New Project Using HEW4.
Introduction Purpose This training course covers debugging an application on an SH target in the Renesas HEW (High-performance Embedded Workshop) development.
© 2008, Renesas Technology America, Inc., All Rights Reserved 1 Introduction Purpose  This training course provides an overview of the installation and.
© 2008, Renesas Technology America, Inc., All Rights Reserved 1 Purpose  This training course describes how to configure the the C/C++ compiler options.
CCS APPS CODE COVERAGE. CCS APPS Code Coverage Definition: –The amount of code within a program that is exercised Uses: –Important for discovering code.
High Speed Data Converter University
Introduction to Visual Basic. Quick Links Windows Application Programming Event-Driven Application Becoming familiar with VB Control Objects Saving and.
IE 411/511: Visual Programming for Industrial Applications
MagicInfo Pro Scheduler Now that a template has been created from content imported into the Library, the user is ready to begin scheduling content to.
© 2008, Renesas Technology America, Inc., All Rights Reserved 1 Purpose  This training module provides an overview of optimization techniques used in.
Alice 2.0 Introductory Concepts and Techniques Project 1 Exploring Alice and Object-Oriented Programming.
ADAM2 Single Remocon MCU IDE User’s Manual S/W Integrated Development Environment - Assembler - Simulator - Code Wizard V1.0 Technical Sales Team, ETA.
Renesas Technology America Inc. 1 SKP8CMINI Tutorial 2 Creating A New Project Using HEW.
Windows Tutorial Common Objects ACOS: 1, 4. Using the Taskbar 1. Using the taskbar, you can switch between open programs and between open documents within.
Introduction Purpose This training course covers debugging an application on an SH target in the Renesas HEW (High-performance Embedded Workshop) development.
© 2008, Renesas Technology America, Inc., All Rights Reserved 1 Introduction Purpose  This training module provides an overview of debugging features.
Bit-DSP-MicrocontrollerTMS320F2812 Texas Instruments Incorporated European Customer Training Center University of Applied Sciences Zwickau (FH)
Renesas Technology America Inc. 1 M16C Seminars Lab 3 Creating Projects Using HEW4 14 March 2005 M16C Seminars Lab 3 Creating Projects Using HEW4 Last.
JDS5 Training Guide. On Start Up you will see this screen click the OK button Click OK.
Renesas Technology America Inc. 1 SKP8CMINI Tutorial 2 Creating A New Project Using HEW.
© 2008, Renesas Technology America, Inc., All Rights Reserved 1 Introduction Purpose  This training course explains how to use section setting and memory.
ChibiOS/RT Demo A free embedded RTOS
Debugging tools in Flash CIS 126. Debugging Flash provides several tools for testing ActionScript in your SWF files. –The Debugger, lets you find errors.
© 2008, Renesas Technology America, Inc., All Rights Reserved 1 Introduction Purpose  This training course describes Coverage, a utility that is used.
Embedded Systems Design with Qsys and Altera Monitor Program
© 2008, Renesas Technology America, Inc., All Rights Reserved 1 Introduction Purpose  This training course demonstrates the Project Generator function.
IE 411/511: Visual Programming for Industrial Applications Lecture Notes #2 Introduction to the Visual Basic Express 2010 Integrated Development Environment.
SNG via Webinar. Where’s Webinar??  Double click Aflac 2000 folder  Highlight “SNGWebCommunicator”  Right Click and “Send To - Desktop”
What Is Firefox? __________ is a Web ___________ that you use to search for and view Web pages, save pages for use in the future, and maintain a list.
Some of the utilities associated with the development of programs. These program development tools allow users to write and construct programs that the.
Chapter 2: The Visual Studio.NET Development Environment Visual Basic.NET Programming: From Problem Analysis to Program Design.
Programming and Debugging with the Dragon and JTAG Many thanks to Dr. James Hawthorne for evaluating the Dragon system and providing the core content for.
© 2008, Renesas Technology America, Inc., All Rights Reserved 1 Introduction Purpose  This training course demonstrates the use of the High-performance.
Workshop Setup The software/hardware used in this workshop are:
Programming and Debugging with the Dragon and JTAG
VAB™ for INFINITY Tutorial
Lab 1: Using NIOS II processor for code execution on FPGA
The first change to your project files that is needed is to change the device to the correct FPGA. This is done by going to the Assignments tab on the.
Microcontroller Applications
PRU-ICSS Programming with CCS
RX111 Promotion Board (RPB) hands on
ECE 3567 Microcontroller Lab
Software Setup & Validation
ECE 3567 Microcontrollers Lab
ECE 3567 Microcontrollers Lab
Presentation transcript:

M16C HEW4 Lab 2: M16C Tools Introduction (Version 5) Last Updated: 27 July 2005 The instructor presents the 1st 9 slides. Remainder of the lab (slide 10: Start HEW) is hands on

Overview The following is a brief introduction on how to develop and debug M16C programs using HEW4 (High- performance Embedded Workshop) and other Renesas software and hardware tools. The Lab is based on the M16C/Tiny family of Starter Kits. These kits include SKP16C26A, SKP16C28 and SKP16C29-CL.

The HEW / ICD Development Process NC30 Compiler Absolute file “.x30” Workspace and Source windows AS30 Assembler HEW Editor window LN30 Linker Project files Options and Settings HEW Build command Debug Symbols Machine Code HEW Debugger Builder: Error reporting .r30 files .c .h .a30 .inc Correct Errors UART1 RAM Flash Monitor Flash User Monitor RAM User RAM M16C/Tiny MCU 3. HEW sends the machine code to the M16C/Tiny SKP during downloads and uses the symbols for source level debugging 1. Write programs using text editor 5. Correct errors & repeat process Host PC 2. HEW automates compile & link I/O Connector ICD USB 4. Debugging info sent back & forth SIO SKP16C/Tiny Board

M16C/Tiny SKP Connectivity

M16C/Tiny SKP Board Features M16C/Tiny MCU’s 20MHz Operating Frequency at 3.0V – 5V, 10MHz Operating Frequency at 2.7V – 5V 32~96kB Flash ROM, 2kB x 2 Virtual EEPROM, and 2~8kB RAM Up to 71 GPIO with 4 Key-on Wakeup Inputs Up to 8 Timers plus a Watchdog Timer Up to 24-channel 10-bit ADC 2 DMAC Up to 5 Serial IO’s (SIO’s) (supports I2C and SPI) Voltage and Oscillation Failure Detection Clock sources: Main (Xin), Sub (XCin), Internal R/C (ring) Onboard Features LED’s (3 User, 1 Power) Removable 2-line x 8-character LCD Pushbutton Switches (3 User, 1 Reset) Thermistor and potentiometer on two A/D inputs I/O available on Expansion Ports

ICD (RTA-FoUSB-MON) The ICD (In-Circuit Debugger) provides power and a USB interface to the Host PC and communicates commands and data to and from the M16C/Tiny SKP board via a synchronous serial interface. As a debugging tool (during program debug), the ICD + HEW downloads a small kernel (or ROM Monitor) program with the user program to the M16C/Tiny SKP Board . This kernel provides a communication interface between the M16C/Tiny MCU and the ICD + HEW Debugger application on MCU status. While the kernel uses some resources of the M16C/Tiny, the operation of the ICD is transparent to the user’s program. As a programming tool, the ICD + Flash-over-USBTM(FoUSB) Programmer can be used to download user programs to the M16C/Tiny MCU on the SKP Board and many other Renesas’ flash MCU’s (the ICD will support other Renesas flash MCU’s by downloading an MCU Monitor Image (MMI) file for a particular MCU thru HEW or FoUSB Programmer). The ICD can be used with user’s target hardware providing the proper interface (details in RTA-FoUSB-MON manual, see www.renesas.com/skp ) NOTE: The kernel is only downloaded with the user program when Debugging but NOT when using the FoUSB Programmer. Note that the ICD can be used on any target (not just SKP) and info on how to contect to user’s target comes with SKP or on website (ICD manual found under any SKP)

Development Tools HEW4 NC30, NC30WA AS30 Flash-over-USB Programmer An Integrated Development Environment (IDE) that invokes all necessary software for building your project. Also communicates with the ROM Monitor Program (in flash on the MCU) for program debug NC30, NC30WA C-compiler. Conforms to ANSI C standards. If not registered within 60days, limits code size to 64k bytes and no support. AS30 Relocatable Assembler Supports structured assembly language and a wide variety of macro instructions. Included with NC30WA Flash-over-USB Programmer Flash programming software for Renesas Flash MCU’s.

HEW IDE Overview HEW is an acronym for High-performance Embedded Workshop. When writing a microcontroller (or any computer) program, the program is usually split into multiple files to make it easier to read and understand. While exactly how the files are organized is up to the programmer, typically, the code is split up in a logical manner into various files (e.g. math functions in one file, serial port code in another, etc). After all the files in a project are compiled and assembled, a linker resolves the final address of the code within a single file. These steps can be tedious and repetitive. To make the process simple, we use an Integrated Development Environment (IDE) called HEW.

Lab 2 Hands on Section In this lab you will: Open and build a project in HEW Launch a Debug session and: download your program into the SKP hardware, set breakpoints, Step through your code, and open various debug windows. Edit a project file, re-build, download, and run the program

Start HEW From the Windows Start menu, click on Programs > Renesas > High-performance Embedded Workshop > High-performance Embedded Workshop The instructor presents the 1st 9 slides. Remainder of the lab (slide 10: Start HEW) is hands on

Open a HEW Workspace Select ‘Browse to another project workspace’ when the “Welcome!” dialog box appears. 2 1 Click <OK>

Open a HEW Workspace (cont.) In the “Open Workspace” dialog box, Look in the ‘C:\Renesas\SKP16C26A\ Sample_Code\Tutor1’ folder. Click on the Tutor1.hws file to select it. (The .hws file extension stands for HEW workspace file.) Click <Open>

Auto-Recovery Is this cool or what? PS. Do not expect to see this screen. I only saw it because I did not shut-down my machine correctly.

A file may, or may not, be open in the Editor Window! The HEW Workspace HEW should look like the figure below. Menu bar (Pull down menus) Output window Editor window Workspace window Toolbars A file may, or may not, be open in the Editor Window!

Workspace Window The Workspace Window has three tab windows: Projects, Templates, and Navigation. The Projects tab gives you the easiest way to open a file. Simply double click on the file and it will open in the Editor Window. Files are grouped by type (C, Assembly). Additionally, you can keep the dependent files together, or place them under the file that depends upon them. (We will look at this on the next page.)

Workspace Window Lets change how dependent files are displayed. Right-click within the Projects window Select “Configure View…”. Enable “Show dependencies under each file”. Click <OK> Notice the .h files under main_tutor1.c?

M16C Linkage Order The 1st code that the linker needs to see is the section information! If you configure the Project Window to show the files in time order, you will see the files in the order that they will be sent to the linker. If you go through the Tutor1 code in the order it will be linked, the first code that is linked defines the section information. (You will find it in the include file, sect30_26askp_tutor1.inc, starting on line 118.)

Link Order (M16C Toolchain Version 5.30.02 and later) By default, HEW links the Project files in alphabetical order. BUT, when using M16C toolchain version 5.30.02 and HEW 4.0 (or latter), you have the ability to manually control the link order! We are going to cover how to manually control the linkage order in Lab 3. So lets go on to other issues…..

HEW Tip When you first start using HEW, right click in every window and see what options are available to that window. Play with every option. See what they do. This method is usually faster than going to the Top Menu’s (Pull Down Menu’s).

Editor (Source) Window Lets look at the Right Click options in the Editor Window. Double click on the file main_tutor1.c in the project window. (This will bring the file up for editing in the Editor Window.) Right-click within the Editor Window Select 4. Right-click within the Editor Window. Notice some of the options are not available.

HEW Toolbars HEW is a powerful development environment with a lot of features and functionality. For this lab, the focus will be on features (i.e. Standard Toolbar) that will help you understand the M16C development process using HEW. Editor Toolbar2 Debug Toolbar1 Bookmarks Toolbar2 Standard Toolbar Templates Toolbar2 Debug Run Toolbar1 Search Toolbar2 Version Control Toolbar2 Notes: M16C is supported by the Debug toolbars only on HEW 4.x and above. See HEW user’s manual about these toolbars.

Current Configuration2 Launch external Debugger Standard Toolbar Build File Current Debugger Session2 Launch Slave HEW2 View Output2 Build All Current Configuration2 View Workspace2 Build Stop Build File – builds1 a specific file Build – builds files that were modified since last build Build All – builds the whole project regardless of whether there were modifications or not Stop – stops a running build process Current Configuration – build configuration (e.g. for debug, optimized, etc) Current Debugger Session – debug session configuration Launch Debugger – calls defined external debugger Notes: A ‘build’ means running certain files (e.g. source files) under some tools (e.g. compiler, linker) to produce an output file (i.e. X30 or MOT executable files for M16C) See HEW Users Manual for details Launch external Debugger

Build (re-build) Tutor1 Build All (re-build) Build Let’s re-build the Tutor1 project into an executable module. This will re-compile and link all the source files. Click the ‘Build All’ icon. If any of the source files are modified, clicking the ‘Build’ icon will result in compiling only the modified files. (This makes generating the executable module faster.) Status, errors, messages, etc during a build process are displayed in the Output window... (Always perform a ‘Build All’ when the configuration has changed.)

Output Window The major use of the Output window is to determine if any errors or warnings occurred during the build process. or The “0 Errors, 1 Warnings” OR “0 Errors, 0 Warnings” message will show up in this window when the build is finished. Remember, we are using the Evaluation Version of the Toolchain so after 60 days, the output from the linker will be limited to 64K and you will get a Warning Message informing you of the same. If errors had shown up during your build, you could have scrolled up to find the error message then double clicked on the message to bring up that line of code within the project.

HEW Debugging: Overview HEW 4 integrates in-circuit Debugging. These features can be used to verify that the program we developed works exactly as we intended and when it does not, we can also use HEW to find out why. Breakpoints can be set in HEW to stop the program at certain points and verify registers, variables in memory, etc. The number of breakpoints will vary from MCU to MCU. For M16C/26A, /28 and /29 the maximum number of breakpoints is 6. HEW allows “step” execution in our program, which means the program executes on a per line basis (whether in source level or machine code level). Various windows in HEW allow us to see register values and memory locations As the debugging features of HEW are fully integrated with the IDE, edit, compiling and debugging can be done in the same window.

HEW Debugger Exercise In this part of the lab you will: Download and run a program on the M16C/Tiny SKP board General use of the Debugger including: a) Stepping b) Setting Breakpoints Modify the program, rebuild, and run the updated program on the M16C/Tiny SKP board

Connect Hardware Since you’ve just completed Lab 1, the SKP should be correctly connected to the Seminar Laptop. Just to verify that the hardware interface is ok, take a look at the blink rate of the yellow Status LED of the FoUSB. (Remember this from lab 1?) If the Status (Yellow) LED is blinking once a second the USB driver for the FoUSB is loaded and working correctly, proceed to the next page. BUT, if the Status LED is blinking three times a second, the FoUSB is not communicating with the Laptop. Disconnect the mini USB cable, wait a few seconds, and then plug it back in. If this does not work, please check Appendix. A Troubleshooting in the M16C/Tiny SKP user’s manual.

HEW debugging example Launch a debugging session by pulling down the menu in the “sessions” box and select M16C_R8C_FoUSB. 2 When the Init Window comes up, Click the “Run Mode” tab

RUN Mode (Just Some Notes) Set the mode in which you want the user program to run when executing Go or Come. With this debugger, the monitor program Periodically monitors the User Programs execution status to check whether the user program is halted by a break etc… This means the monitor program interrupts the CPU when executing the user program, and hence, the user program’s real-time capability is lost. To solve this problem, this debugger has two execution modes: Sampling Mode: The user program’s execution status is periodically monitored when executing Go or Come. (You will see updates to the variables in the HEW debugger while the user program is executing.) Free Run Mode: The user program’s execution status is NOT monitored while executing Go or Come. Use this mode for Real-Time capability!

Debug Init Window (cont.) Verify “SamplingMode” is selected. Verify Sampling Period is set to 1000 m sec (Sample once a second) Click on <OK> 1 2 3

HEW Debug Session Edit window has not changed, but more buttons are available in the toolbar. Open ‘Init’ window Reset CPU Go (run) Reset go Go to cursor Step in: (execute 1 line of code) Step over Step out Stop run Display PC Go free Open Windows: Registers C Watch Asm Watch Breakpoints Memory I/O Status RamMonitor

Download the executable file (with debugging information into the M16C/Tiny SKP Board) In the project window, right click on Tutor.x30 file Select ‘Download Module’… Note: When you download code, the program counter is automatically reset to the address the reset vector points to.

Download the executable file (Cont.) View options: Source Mix Disassembly After the download, three columns are added to the Editor Window. Put a breakpoint on line 68. (Double click here. Where the Red Dot is.) Add a few breakpoints at other points in the code. NOTE: You can only put a breakpoint where code exists. (Code exists when you see information in the Address Column.) Also, if you double click on a breakpoint (red dot), it will disable the breakpoint. Address Column Double clicking here changes pass count (# of times the program will go through this breakpoint before stopping)

HEW Advanced Breakpoint Options Click on the S/W Breakpoints icon. Notice Breakpoint information can be saved and loaded between sessions! Click <Delete All> Click <OK> (to delete all breakpoints) Click <Close>

Running Downloaded Program 4 5 Click on the ‘Reset Go’ icon to run the program. Note: The ‘STOP’ icon turns red. On the board, the LED’s D1, D2, and D3 blink sequentially. Turn the analog potentiometer clockwise to increase the LED blink rate. Turn the potentiometer counter-clockwise to decrease the LED blink rate. Click on the ‘Stop’ icon to halt program execution. Click on the ‘Register’ icon to open the register view. (You may have to adjust the size of this window by dragging it.)

Program ‘Stepping’ Click on the ‘Step in’ icon several times. Look in the ‘Register Window’. Register values that are changed turn red.

RAM Monitor Window Click on the ‘RAM Monitor’ icon. (Icon with color in it!) Inside the RAM Monitor Window, click on the ‘Base’ icon. Verify that the Start address is set to 400. Click <OK>.

RAM Monitor Window The RAM Monitor displays the current value of the memory area shown in the window. Since we set the Run Mode to “Sampling Mode”, the monitor periodically samples the data viewed in the RAM monitor window and HEW updates the window with the sampled data. 2. Click on the ‘Go’ icon and watch as RAM data is updated. Notice that when data is updated, the color is changed to Red. Had we set the Run Mode to “Free Run”, the data inside the RAM Monitor Window would not be updated while the program is running. (Only after you pressed the STOP icon would HEW update the contents.) 3. Click the ‘STOP’ icon.

Memory Window Click on the ‘Memory’ icon. If the “Display Address” Dialog box appears, enter: Display Address = 400 Scroll Start Address: Leave at 0 Scroll end Address: Leave at 0FFFFF Click <OK> The ‘Memory Window’ displays the location and contents of memory. The main difference between the ‘Memory Window’ and the ‘RAM Monitor Window’ is the Memory Window DOES NOT update the data during program execution. You MUST stop the program, then HEW will update the contents. (Notice the different icons at the top of each Window.)

C Watch Window Go back to the ‘Editor Window’ and find line 91 in the file main_tutor1.c. Left click on the variable ‘disp_cont’ (this makes sure your cursor is on the right spot for step 3). Right click on the variable ‘disp_cont’ and in the pop up menu select ‘Add C Watch’. The Watch Window will appear. (You may have to adjust the size to see useful information in this Window.) There are a lot of great options in this window. Take the time to look around! (Local, File, Global variables are also displayed here.)

I/O Window when the micro is not defined! Click on the ‘I/O’ icon. If, when the I/O Window is opened it contains useful information, skip to the next page, otherwise you will need to define the micro that you are dealing with. A) Right click in the I/O Window. B) Select “Load I/O File…” C) Select “Browse” D) Select “M16C26a.io” E) Click on <Open> F) Click on <OK> I/O Window when the micro is not defined!

I/O Window The I/O Window allows you to easily view peripheral register contents and monitor the status of your I/O port pins without setting up complicated watch variables or learning where the address is for each peripheral register. Also, the I/O structures are grouped together like A/D converter, or Timer A1.

Modifying the Program Return to the file main_tutor1.c in the Editor Window. Scroll down until and find the function ‘ta1_irq’ (line 83). Note: You can also find a function by clicking the ‘Navigation’ tab in the project window and double click on the function name. (HEW shortens the names in the tabs if the window is too small. You may only see ‘Navi’.) Change line 87 to read: “ta1 = (0x3FF – ad0);” Save the revised file. Build the project.

Load (re-load) Modified Program The HEW debugger will automatically detect that the program has been recompiled and ask if you wish to download again. Click <Yes> Click on the ‘Reset Go’ icon to run the new program. Turn the analog potentiometer clockwise to decrease the LED blink rate. (This is the opposite of before.) Turn the potentiometer counter-clockwise to increase the LED blink rate. Click on the ‘Stop’ icon to halt program execution.

Save the Session To stop a debug session but leave HEW open (i.e. edit only), re-open the default session. Click on the Session pull down menu and change it to “DefaultSession”.

End of Lab 2 This is the end of lab 2. If you finished early and time permits, try using the ‘GO to Cursor’ and ‘Display PC’ buttons…