Sei sulla pagina 1di 169

1415 IDE

Introduction to MPLAB® X IDE

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 1
MPLAB® X
Agenda

Introduction
Rationale
Key features
A Tour of MPLAB X
Lab 1: Create a new project
How to build applications
MPLAB 8 vs X
Project Properties Side-by-Side
How to work with the editor
© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 2
MPLAB® X
Agenda

How to work with the main toolbar


Lab 2 – How to convert an MPLAB 8
project
How to work with a debugger
How to navigate a project
Search, Editor Features, Navigate Menu
Navigator Window
Favorites
Call Graph
How to work with the local history
© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 3
Introduction

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 4
Introduction
Why change everything?

MPLAB 6-8.x has run its course


IDE feature set showing its age
Difficult to add many requested features
Not easily extensible by 3rd parties
Lacking some infrastructure for advanced
high level language development

"A little revolution now and then is a


healthy thing, don't you think?"
Captain Marko Ramius
The Hunt for Red October

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 5
Introduction
Rationale

A mature IDE proven through years of use


by thousands of developers worldwide
A modern IDE with all the latest features
Cross platform compatibility
A documented, extensible architecture
It's open source!
Many requested features are already there
Architected from the ground up with
support for advanced high level language
development
© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 6
Introduction
Rationale

A feature-rich IDE that isn't bloated


A large ecosystem of plug-ins
An IDE that can be used for embedded and
PC development
A project file structure that doesn't require
the IDE (great for external tools)
An IDE that keeps track of changes
A powerful project navigation system

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 7
Introduction
Why didn't we use Eclipse like everyone else?

Because everyone else gets in the way of


a good, targeted product ☺
NetBeans is acknowledged by many as
being:
More advanced
Less bloated
Faster
More intuitive (easier to use GUI)
We are NetBeans sole embedded partner

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 8
Introduction
Why didn't we use Eclipse like everyone else?

For testimonials, check out:


http://netbeans.org/switch/realstories.html

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 9
MPLAB® X
Key Features

Color coded syntax highlighting


Live parsing flags errors as you type
Smart code completion makes suggestions and
provides hints as you type
File history to view recent changes and revert,
even without a version control system
Powerful navigation tools: Go to file, Go to type,
Go to symbol, Go to header, Go to declaration…
Refactoring tools to intelligently restructure
code
© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 10
MPLAB® X
Key Features

Automatic code formatting based on user


defined rules
Built-in Diff (can use external too)
Tasks navigator finds code marked with special
comments (user defined) – e.g. //TODO, //FIXME
Fully customizable editor: toolbars, toolbar
buttons, windows, window placement…

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 11
MPLAB® X
Key Features

Built-in support for version


control systems:
Subversion, CVS, Mercurial –
others via plug-ins
Built-in support for Bugzilla
issue tracker
Integrated with editor for ease
of navigating issues

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 12
MPLAB® X
Projects and Workspaces

Workspaces are gone


Projects contain all relevant information
When you open MPLAB X, the last open
project is loaded
When you open a project, most windows /
tabs are restored to their previous layout
Multiple projects are handled with Project
Groups

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 13
MPLAB® X
Debug vs Release

The dreaded Debug/Release combo box is


gone! (Will say "Default" on release)

Different toolbar buttons used to build and


program for debug versus release
Build and Program (Debug) Build and Program (Release)

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 14
MPLAB® X
Upgrading from MPLAB 8

A project conversion utility is built-in


MPLAB 8 projects cannot be opened directly
Project files/structure completely different
Manual conversion easy but time consuming
MPLAB X uses WinUSB/LibUSB drivers rather
than custom drivers in MPLAB 8
8 and X can be installed side by side
Hardware tool drivers must be switched
Switching utility available
Compilers / assemblers are unaffected
Exceptions MPASM™ Assembler

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 15
A Tour of MPLAB® X IDE
Parts of the IDE

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 16
A Tour of MPLAB® X IDE
Parts of the IDE

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 17
A Tour of MPLAB® X IDE
Parts of the IDE

Project Window

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 18
A Tour of MPLAB® X IDE
Parts of the IDE

Navigator Window

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 19
A Tour of MPLAB® X IDE
Parts of the IDE

Output Window

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 20
A Tour of MPLAB® X IDE
Parts of the IDE

Editor Window

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 21
A Tour of MPLAB® X IDE
Parts of the IDE

Main Toolbar

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 22
A Tour of MPLAB® X IDE
Parts of the IDE

Editor Toolbar

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 23
A Tour of MPLAB® X IDE
Parts of the IDE

Glyph Margin

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 24
A Tour of MPLAB® X IDE
Parts of the IDE

Error Stripe

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 25
Lab 1
How to create a new project
Instructor led hands-on exercise

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 26
Lab 1
Create a new project

Objective

Create new project with the project wizard


Create new C source file
Add existing files to project to control Explorer 16 LCD
Configure the C compiler tool chain
Build code and debug on the target board

Requirements: Explorer 16 Demo Board with PIC24FJ128GA010

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 27
Lab 1
Create a new project

Launch the New Project Wizard

Click on the New Project icon on the


toolbar, or select File ` New Project from
the menu

Unlike MPLAB 8, you must use the wizard in MPLAB X because it creates
both the project directory itself as well as an entire hierarchy of
subdirectories that it needs to work properly. Manually creating a project is
not possible.

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 28
Lab 1
Create a new project

Choose Project

Select
Microchip
Embedded
under Categories

Select C/ASM
Standalone Project
under Projects

Click
Next >

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 29
Lab 1
Create a new project

Select Device

Select
PIC24FJ128GA010

The Family combo box


will filter the device list in
the Device combo box to
make specific devices
easier to find.

Click Next >

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 30
Lab 1
Create a new project

Select Tool

Select Real ICE


Select the serial number
that corresponds to the
MPLAB® REAL ICE™ in-
circuit emulator you wish
to use. If multiple REAL
ICE units are connected to
your PC, you will see
multiple serial numbers.

Click Next >

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 31
Lab 1
Create a new project

Select Compiler

Select C30
Compiler Toolchain

Click Next >

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 32
Lab 1
Create a new project

Select Project Name and Folder

Name the project


and choose where
you want the project
directory to be
created
This is the directory of where the
project directory will be created or
already exists. (i.e. this will be the
parent directory of the project
directory)

Click Finish

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 33
Lab 1
Create a new project

MPLAB® X Automatically Generated Project Directory Structure

Local Disk (C:)
RTC
TLS0101X Project Location (User's choice)
Lab1 Project Folder - Source Files (*.c, *.h)
build
Created by MPLAB

Embedded
debug
Intermediate Files (*.o, *.o.d)
production
dist
Embedded
debug
Output Files (*.elf, *.hex)
production
nbproject
Project Settings / Configuration
private

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 34
Lab 1
Create a new project

Create a new logical folder under Source Files

Right click on Source Files


and select New Logical
Folder from the pop-up menu

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 35
Lab 1
Create a new project

Rename new logical folder

Expand Source Files to make its


contents visible. Right click on
New Folder 1 and select
Rename… from the pop-up menu

Name the folder LCD and click OK

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 36
Lab 1
Create a new project

Add existing files to logical folder

Right click on the LCD folder and


select Add Existing Item… from
the pop-up menu

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 37
Lab 1
Create a new project

Select all lcd*.c files (use ctrl+click and/or shift+click)

Select all files of the


form lcd*.c
and
SwitchPressed.c
Store path as:
Relative

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 38
Lab 1
Create a new project

Add existing header file

Right click on Header Files and


select Add Existing Item… from
the pop-up menu

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 39
Lab 1
Create a new project

Select TLS2130.h

Select TLS2130.h

Store path as:


Relative

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 40
Lab 1
Create a new project

Create a new C source file

Right click on the Source Files folder under the Projects tab
and select from the pop-up menu: New ` C Source File…

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 41
Lab 1
Create a new project

Specify name and location of new C source file

Name the file.


Leave the Folder
box blank to create
the source file in the
project directory.

Click Finish

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 42
Lab 1
Create a new project

Add code to new source file

Add the following code to Lab1.c


You can copy it from C:\RTC\TLS0101X\source.txt
1 #include <p24FJ128GA010.h>
2 #include "TLS2130.h"
3
4 _CONFIG1(FWDTEN_OFF & JTAGEN_OFF)
5
6 int main(void)
7 {
8 lcdInit();
9 lcdPutStr("Hello, world!");
10 TRISA = 0;
11 LATA = 0x55;
12 while(1);
13 }

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 43
Lab 1
Create a new project

Build project and run program on demo board

Click on the Debug Project toolbar button


This will:
a. Build your code for debugging
b. Program the target
c. Run the program
When done, click on Pause then End Debug Session

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 44
Lab 1
Create a new project

D9, D7, D5 and D3 should turn on, "Hello, world!" on LCD

J1 Ostapiuk 2006

5V 9V

5V 9V
3.3V

3.3V
GND

GND
OPTREX
Graphics LCD
F-51320GNB-LW-AB
JP1
MCLR R6 Explorer 16
J9
<- PIC - PIM -> Development Board
J5 J6
S1 1 1
10 k 2 2

F4550 PIC24 9 10 9 10

PICKIT2
19 20 19 20
J8
Y1 29 30 29 30
Y2
1

39 40 39 40
P1

49 50 49 50

59 60 59 60

Y3
69 70 69 70

RB7

RB6
79 80 79 80

89 90 89 90

99 100 99 100

D1
JP2

109
D10 110
D9
109
D8
110
D7 D6 D5 D4 D3
119 120 119 120

D10 D9 D8 D7 D6 D5 D4 D3
J12 PICtail+
+ +3

JTAG
9-15V DC +5 GND RD6 S3 RD7 S6 RA7 S5 RD13 S4

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 45
How to build applications
Compiling or assembling code

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 46
How to Build Applications

MPLAB® 8 MPLAB X

Make Build Project


(Menu: Project ` Make) Build only files that have
Build only files that have changed since the last build
changed since the last build

Build All Clean and Build Project


(Menu: Project ` Build All) Builds all files regardless of
Builds all files regardless of whether or not they have
whether or not they have changed since the last build
changed since the last build

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 47
How to Build Applications
Working with a Debugger

MPLAB® 8 MPLAB X

Debug Mode Debug Project


• Debug Mode
Make • Make
• Program Target Device
Program Target Device • Reset
• Run
Reset
Run

In most situations, it is not


necessary to hit the "Build"
or "Clean and Build" button
before hitting this button.

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 48
How to Build Applications
Working with a Programmer

MPLAB® 8 MPLAB X

Release Mode Program Target Project


• Release Mode
Make • Make
• Program Target Device
Program Target Device

In most situations, it is not


necessary to hit the "Build"
or "Clean and Build" button
before hitting this button.

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 49
How to Build Applications
Working with a Debugger/Programmer

MPLAB® 8 MPLAB X

Release Mode Run Project


• Release Mode
Make • Make
• Program Target Device
Program Target Device • Release from Reset (Run)

Release from Reset

In most situations, it is not


necessary to hit the "Build"
or "Clean and Build" button
before hitting this button.

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 50
How to Build Applications
Gotchas – platform related errors

Relative paths should use '/' instead of '\':


#include "Graphics/Graphics.h"
'/' works on ALL platforms, including Windows
'\' works ONLY on Windows
Compiler on Linux cannot find files with paths
using '\', which is an escape character in the
Linux Bourne Again Shell (BASH)
Linux is case sensitive
#include <p24fj128ga010.h> won't be
found because filename is p24FJ128GA010.h

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 51
How to work with the editor

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 52
Editor
Live Parsing

IDE parses code as you type


Editor immediately marks errors
Tooltips and glyphs display compiler
hints,
warnings,
quick fixes
and
language
docs

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 53
Editor
Smart Code Completion

Not working quite right yet…


When typing in a function, a pop-up
should appear showing the parameter list
and data types
After typing in the first few letters of a
function or variable name, the editor may
provide suggestions for completing the
identifier

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 54
Editor
How to use the Task List

Automatically scans code for words like


TODO and FIXME within comments

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 55
Editor
How to add keywords to the task list parser

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 56
Editor
How to view two files side-by-side

Click and drag a tab away from the top of the editor pane.
The red outline indicates where it will snap into place when
released.

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 57
Editor
How to split the view of a single file

Right click on the file's tab and select


Clone Document from the pop-up menu

Click and drag


the duplicated
tab to its new
location

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 58
Editor
How to maximize/restore editor window

MAX MIN

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 59
Editor
How to list all open tabs and jump between them

Useful if you have more tabs open than


can be displayed across the top

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 60
Editor
How to configure the editor's settings

Select Tools ` Options from the menu,


then select Editor from the icons on top

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 61
How to work with the main toolbar

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 62
How to Work with the Main Toolbar
Default Buttons

New File Build

New Project Rebuild (Clean and Build)

Open Project Run Project (Build, Program, Run)

Save All Debug (Build, Program, Run)

Undo Profile Project

Redo Program Target

Project MPLAB® X Quick Search


Configuration Memory Usage

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 63
How to Work with the Main Toolbar
How to Customize the Toolbars

Right click on a toolbar


Select Customize…
Drag items from list to
desired location on
toolbar

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 64
Lab 2
How to convert an existing project
Instructor led hands-on exercise

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 65
Lab 2
Convert an Existing Project

Objective

Convert Graphics Object Layer Demo project from MAL


with the project wizard
Run program on Explorer 16 with Graphics Demo
Board (version 2 or 3)

Requirements: Explorer 16 Demo Board with PIC24FJ128GA010

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 66
Lab 2
Convert an Existing Project

Launch the New Project Wizard

Click on the New Project icon on the


toolbar, or select File ` New Project from
the menu

Unlike MPLAB® 8, you must use the wizard in MPLAB X because it creates
both the project directory itself as well as an entire hierarchy of
subdirectories that it needs to work properly. Manually creating a project is
not possible.

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 67
Lab 2
Convert an Existing Project

Choose Project

Microchip Embedded Existing MPLAB® IDE v8 Project

Click
Next >

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 68
Lab 2
Convert an Existing Project

Import Legacy Project

C:\Microchip Solutions\Graphics Object Layer Demo\GOLDemo PIC24.mcp

Click
Next >

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 69
Lab 2
Convert an Existing Project

Select Device

PIC24FJ128GA010
(Should be selected automatically)

Click
Next >

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 70
Lab 2
Convert an Existing Project

Select Tool

Select
Real ICE

Click
Next >

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 71
Lab 2
Convert an Existing Project

Select Compiler

Select
C30

Click
Next >

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 72
Lab 2
Convert an Existing Project

Keep or Copy Files

Click
Keep Files

Click
Next >

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 73
Lab 2
Convert an Existing Project

Select Project Name and Folder

Accept
Defaults

Click
Next >

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 74
Lab 2
Convert an Existing Project

Summary

Click
Finish

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 75
Lab 2
Convert an Existing Project

Build and test the project

Click on the Clean and Build button on the toolbar

If the build is successful, then the project converted


properly. Just to be absolutely sure, try it out on the
hardware by clicking the Debug button on the
toolbar

When done, click on Pause then End Debug


Session
© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 76
How to work with a debugger

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 77
How to Build Applications
Working with a Debugger
MPLAB® 8 MPLAB X

(No Equivalent) Finish Debugger Session


Halt Pause
Run Continue
Animate (No equivalent yet…)
Run to Cursor (Context Menu) Run to Cursor
Step Into Step Into
Step Over Step Over
Step Out Step Out
Reset Reset ICON CHANGED

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 78
Breakpoints
How to set a line breakpoint

Click on the line number in the left margin (glyph


margin) until a red square ( ) appears (breakpoint
set). Click again to clear the breakpoint.

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 79
Breakpoints
How to set a conditional line breakpoint

Select Debug ` New Breakpoint


Choose Line as the Breakpoint Type
Specify the data File and Line Number settings
(automatically populated
from cursor position)
Specify the Pass count
Condition

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 80
Breakpoints
How to set a data breakpoint

Select Debug ` New Breakpoint


Choose Data as the Breakpoint Type
Specify the data Address and Breaks on settings
Specify the Pass count
Condition

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 81
Breakpoints
How to view a list of all breakpoints in the project

Select Window ` Debugging ` Breakpoints

Double click to go to source

Right click in Breakpoints window to:


• Create new breakpoint
• Enable all breakpoints
• Disable all breakpoints
• Delete all breakpoints
• Group breakpoints (allows enable/disable by group)
• Change a breakpoint's settings
© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 82
Watches
How to display the watches tab

From the menu:


Window ` Debugging ` Watches
© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 83
Watches
How to add a variable to the watches tab

(Optional) Highlight
variable in editor

Right click in editor or


select from menu:
Debug ` New Watch…

Type in variable name


or just accept the one
that is there and click
on OK OK

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 84
Watches
Watches: Structure and Union Support

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 85
Watches
How to change a watch variable's radix

Right click on the value

From the pop-up menu select:


Display Value As ` radix

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 86
Watches
How to change a watch variable's value

Double click on the existing value


Type in the new value, hit Enter when done

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 87
Watches
How to remove a watch variable
Delete
Select watch variable and hit or right
click variable and select Delete from pop-
up menu

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 88
Watches
How to sort watch variables

Default Click on the column headings…


(Fields Sorted Numerically)
1st Click:
Sort Ascending (Alphabetically)

2nd Click:
Sort Descending (Alphabetically)

3rd Click:
Default

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 89
Memory Windows
How to view embedded memory

From the menu, select


Window ` Embedded Memory `
Mdb Memory View n

You can have up to 4 windows that


are any combination of:
• File Registers
• SFRs
• Program
• Configuration

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 90
Memory Windows
How to select the embedded memory type to display

Select the
memory
space to
display from
the Memory
combo box,
then select
the display
format from
the Format
combo box.

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 91
Memory Windows
Display Options

Option Value Description

Data Data memory (RAM)


Format
Code Program Memory (ROM)

RAM Physical All RAM memory on device


Flash Physical All Flash memory on device
Memory Peripheral All SFRs
CPU All CPU memory
Configuration Bits All Configuration registers

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 92
Memory Windows
How to change a memory location's value

Double click on
a cell and start
typing the new
value – hit
Enter when
done

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 93
Memory Windows
How to fill memory

Right click in
memory window and
select Fill Memory…
from the pop-up
menu

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 94
Memory Windows
How to quickly jump to a specific address

Right click in the memory window and


select Go To… from the pop-up menu

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 95
Call Stack
How to view the call stack

Select Window ` Debugging ` Call Stack

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 96
How to navigate a project
Search, Editor Features, and the Navigate Menu

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 97
Editor Toolbar

Last Edit – Cycle through edits Shift Line Left (Indent Less)
Previous Edit Shift Line Right (Indent More)
Next Edit Start Macro Recording
Find Selection Stop Macro Recording
Find Previous Occurrence Comment
Find Next Occurrence Uncomment
Toggle Highlight Search Go to Header/Source
Previous Bookmark
Next Bookmark
Toggle Bookmark

* Next and Previous Edit buttons become active after using Navigate ` Go to X…

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 98
How to search within a file
With a source file open in the editor, select
Edit ` Find from the menu

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 99
How to search in the project
Select Edit ` Find in Projects… from the
menu

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 100
How to search documentation
Type some text in the Quick Search box

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 101
How to find usages
Highlight a function or variable
Select Edit ` Find Usages from the menu

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 102
Editor
Go To File…

Sometimes
only finds
object files
(need to
investigate…)

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 103
Editor
Go To Type…

Find type definitions and jump right to


them by double clicking in the dialog's list
enum, struct, union in C

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 104
Editor
Go To Symbol…

Find symbol definitions and jump right to


them by double clicking on the dialog's list

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 105
Editor
Go to Declaration…

Highlight variable or function name, right


click, select Navigate ` Go to Declaration...
from the pop-up menu
© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 106
Editor
Go to Header…

Go to header with same base name as


current source file (if one exists)
e.g. MyFile.h from MyFile.c
© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 107
Editor
Navigation: Error Stripe
Represents full length of file Color Code
Warnings
Shows relative position of errors, Errors
warnings and occurrences of currently Occurrences
Breakpoint
highlighted item
Bookmark
Suggestion
Multiple Items

Error Stripe
Error
Clickable…

Scroll Bar Slider

Cursor
Position

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 108
Editor
Navigating to Errors and Warnings
Error Stripe
Pop-up showing error corresponding
to icon pointed to by mouse pointer
(arrow)

Pop-up showing error


corresponding to bar
pointed to by mouse
pointer (hand)

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 109
Editor
Navigation: Glyph Margin

Error and Bookmark on the same line


When multiple
glyphs are required
on a line, a small
black arrow
pointing down
appears to the right
of one glyph.

Clicking on the
arrow will cycle
through the glyphs.
© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 110
Editor
How to set / clear a bookmark

Right click on the line number in the


margin and select from the pop-up menu:
Bookmark ` Toggle Bookmark

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 111
Editor
Code Folding

Tools ` Options ` Editor ` General to enable or disable

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 112
Editor
How to View a Register's Bit Values

Hover mouse over a register variable…

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 113
How to navigate a project
How to work with the Navigator Window

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 114
How to Work with the Navigator

Lists all identifiers in selected file


Double click on entry to jump to
identifier's definition
(or declaration if extern)

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 115
How to Work with the Navigator
Filters
Right click in the Navigator
window and select Kind
Filters from the pop-up
menu to change which
items will be displayed in
the window

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 116
How to Work with the Navigator
Find Usages

Right click on symbol


name in navigator and
select Find Usages from
the pop-up menu

Results appear in output


window under Usages tab
(double click them to jump
to source file where used)
© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 117
How to Work with the Navigator
How to refactor a symbol name

Right click on symbol


name in navigator and
select Rename… from the
pop-up menu

Enter the new


name and click
Refactor
or
Preview
© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 118
How to Work with the Navigator
How to refactor a symbol name

allows you to see how the change


Preview

will be implemented before committing to


do the refactoring

Cycle through each instance in the preview windows on the right

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 119
How to navigate a project
Favorites

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 120
Favorites
How to view the favorites list

Select Window ` Favorites from the menu

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 121
Favorites
How to add a file to the favorites list

Right click in the open source file and select


Select in ` Favorites or Navigate ` Select in
Favorites from the main menu to open the Add
to Favorites dialog (if file is not already there)

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 122
Favorites
How to add a file to the favorites list

Right click in the Favorites window and select


Add to Favorites… from the pop-up menu
Not limited to code – can add any file (e.g. PDF
reference guide)

Double clicking the PDF will open up the file in your PDF
reader (e.g. Adobe Reader, Evince, etc.)

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 123
Favorites
How to remove a file from the favorites list

Right click on an item in the favorites


window and select Remove from Favorites

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 124
How to navigate a project
How to work with the Call Graph

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 125
How to Work with the Call Graph
Static Call Graph
Definition

Static Call Graph – A flow chart showing the calling


relationships of subroutines in a program. It represents every
possible path a function can take.

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 126
How to Work with the Call Graph
Generate Call Graph for a Function

Right click on a function and select Show Call


Graph from the pop-up menu

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 127
How to Work with the Call Graph
Two Modes of Operation

Who is called
from the
function?

Who calls this


function?

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 128
How to Work with the Call Graph
Navigation – Go to Declaration

Double click on top node to Go to Declaration of function

Cursor
placed at
function
header

Alternately, right click on top


node and select Go to
Declaration from pop-up menu
© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 129
How to Work with the Call Graph
Navigation – Go to Declaration

Double click on diagram block to Go to Declaration

Function
header is
highlighted

Alternately, right click on block


and select Go to Declaration
from pop-up menu
© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 130
How to Work with the Call Graph
Navigation – Go to Reference

Double click on child node to Go to Reference of function

Cursor
placed where
function:
calls
or is
called by
top node's
Alternately, right click on function
child node and select Go to
Reference from pop-up
menu, or double click on
arrow in graphical view
© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 131
How to Work with the Call Graph
View function calls with parameters

In the left pane, select a child node function

Select
Function

Lower pane shows how:


Top node function calls child node function
Top node function is called by child node function

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 132
How to Work with the Call Graph
Change focus to child node function

Select
Function

Focus On Alternatively, right click on function and select Focus On

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 133
How to Work with the Call Graph
Expand Callers

Method 1: Method 2:
In left pane, click on '+' next In right pane, right click on
to function name block and select Expand
Callers from pop-up menu

(Who calls the selected child function?)


© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 134
How to Work with the Call Graph
Expand Callees

Method 1: Method 2:
In left pane, click on '+' next In right pane, right click on
to function name block and select Expand
Callees from pop-up menu

(Who is called by the selected child function?)


© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 135
How to Work with the Call Graph
Export the graph as a PNG file

Right click anywhere in the call graph window and


select Export… from the pop-up menu

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 136
How to work with the local history

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 137
Local History
How to display the local history
Right click on file, select from pop-up menu:
Local History ` Show Local History

Shows list of changes and visual


diff of changes
© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 138
Local History
How to insert code from a previous version

Click on blue arrow in right margin…

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 139
Local History
How to undo changes

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 140
Local History
How to revert to an earlier version of a file

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 141
Appendix 1
MPLAB® 8 vs MPLAB X
Project Options Side by Side

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 142
Project Options
MPLAB® 8 MPLAB X

From the menu: From the menu:


Project`Build Options...` Project File`Project Properties (name)

Right click on project icon: Right click on project icon:


Select Build Options… from pop-up Select Properties from pop-up menu
menu

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 143
Project Options
Embedded Category: 3 in 1

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 144
Project Options
How to select the target device

MPLAB® 8 MPLAB X

From the menu: From the menu:


Configure`Select Device File`Project Properties (name)

Right click on project icon:


Select Properties from pop-up menu

ns…
ptio Select Embedded category
il dO
B u
ct>
r oje
ti nP
N o

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 145
Project Options
How to select the hardware tool

MPLAB® 8 MPLAB X
From the menu: From the menu:
Debugger ` Select Tool File`Project Properties (name)
Programmer ` Select Programmer
Right click on project icon:
Select Properties from pop-up menu

ns…
ptio Select Embedded category
il dO
B u
ct>
r oje
ti nP
N o

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 146
Project Options
How to select the build tool

MPLAB® 8 MPLAB X

From the menu: From the menu:


Project ` Select Language File`Project Properties (name)
Toolsuite…
Right click on project icon:
Select Properties from pop-up menu

ns…
ptio Select Embedded category
il dO
B u
ct>
r oje
ti nP
N o

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 147
Project Options
How to select the build tool

Build tool locations available under Tools


` Options, Embedded section

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 148
Project Options
Include Paths

MPLAB® 8 MPLAB X

Select Directories tab Select Compiler


Select Include Search Path Select General category
Add paths to Include directories
Quote paths, use forward slashes, separate paths by
semicolons, no spaces around semicolons:
"../MyDir";.;"../MyOtherDir"

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 149
Project Options
Paths

1. Quotes (") around paths containing spaces are


optional
2. Separate paths with a semi-colon (;)
3. Forward (Linux style) slashes (/) or back
(Windows style) slashes (\) are supported

Example
"../Board Support Package";.;"../Microchip/Include"

For relative paths:


. (one dot) represents the project directory
.. (two dots) represents the parent directory
© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 150
Project Options
Assembler Include Search Path

MPLAB® 8 MPLAB X

Select Directories tab Select Assembler


Select Asm. Incl. Search Path Select Symbols & Macros

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 151
Project Options
Library Paths

MPLAB® 8 MPLAB X

Select Directories tab Select Linker


Select Library Search Path Select Libraries category

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 152
Project Options
Intermediary Directory

MPLAB® 8 MPLAB X

Select Directories tab Not implemented…


Select Intermediary Directory MPLAB X specifies its own
intermediary directories within
the project directory

./build/Embedded/debug
./build/Embedded/production

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 153
Project Options
Output Directory

MPLAB® 8 MPLAB X

Select Directories tab Not implemented…


Select Output Directory MPLAB X specifies its own
output directory within
the project directory

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 154
Project Options
Compiler Settings (General)

MPLAB® 8 MPLAB X

Select Compiler tab Select Compiler


Select General category Select General category

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 155
Project Options
Compiler Settings (Memory Model)

MPLAB® 8 MPLAB X

Select Compiler tab Select Compiler


Select Memory Model category Select Memory Model category

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 156
Project Options
Compiler Settings (Optimization)

MPLAB® 8 MPLAB X

Select Compiler tab Select Compiler


Select Optimization category Select Optimization category

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 157
Project Options
Linker Settings (General)

MPLAB® 8 MPLAB X

Select Linker tab Select Linker


Select General category Select General category

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 158
Linker Option Differences
"Negative" versus "Positive" Options

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 159
Project Options
Linker Settings (Diagnostics)

MPLAB® 8 MPLAB X

Select Linker tab Select Linker


Select Diagnostics category Select Diagnostics category

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 160
Project Options
Linker Settings (Symbols & Macros)

MPLAB® 8 MPLAB X

Select Linker tab Select Linker


Select Symbols & Macros category Select Symbols & Macros category

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 161
Project Options
Linker Settings (Libraries)

MPLAB® 8 MPLAB X

Select Linker tab Select Linker


Select Libraries category Select Libraries category

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 162
Project Options
ASM/C Suite Settings

MPLAB® 8 MPLAB X

Select ASM/C Suite tab Not implemented yet…

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 163
Project Options
Assembler Settings (General)

MPLAB® 8 MPLAB X

Select Assembler tab Select Assembler


Select General Select Other Options

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 164
Project Options
Assembler Settings (Symbols & Macros)

MPLAB® 8 MPLAB X

Select Assembler tab Select Assembler


Select Symbols & Macros Select Symbols & Macros

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 165
Project Options
Custom Build Settings

MPLAB® 8 MPLAB X

Select Custom Build tab Could be implemented via


custom makefile – edit file in root of
project: "./makefile"
## .build-pre:
.build-pre: called before
called before 'build'
'build' target
target
# .build-post:
# .build-post: called after 'build' target
called after 'build' target
# .clean-pre:
# .clean-pre: called before
called before 'clean'
'clean' target
target
## .clean-post:
.clean-post: called after
called after 'clean'
'clean' target
target
## .clobber-pre:
.clobber-pre: called before
called before 'clobber'
'clobber' target
targe
# .clobber-post:
# .clobber-post: called after 'clobber' target
called after 'clobber' target
## .all-pre:
.all-pre: called before
called before 'all'
'all' target
target
## .all-post:
.all-post: called after
called after 'all'
'all' target
target
# .help-pre:
# .help-pre: called before
called before 'help'
'help' target
target
# .help-post:
# .help-post: called after 'help' target
called after 'help' target

GUI may be added later to handle


makefile modification.
Makefile modification provides more
flexibility and granularity.

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 166
Project Options
Trace Settings

MPLAB® 8 MPLAB X

Select Trace tab TBD…

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 167
Tools Options
Absolute / Relative Paths

Auto
Always Relative
Always Absolute

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 168
Trademarks
The Microchip name and logo, the Microchip logo, dsPIC, KeeLoq, KeeLoq logo,
MPLAB, PIC, PICmicro, PICSTART, PIC32 logo, rfPIC and UNI/O are registered
trademarks of Microchip Technology Incorporated in the U.S.A. and other countries.
FilterLab, Hampshire, HI-TECH C, Linear Active Thermistor, MXDEV, MXLAB, SEEVAL
and The Embedded Control Solutions Company are registered trademarks of
Microchip Technology Incorporated in the U.S.A.
Analog-for-the-Digital Age, Application Maestro, CodeGuard, dsPICDEM,
dsPICDEM.net, dsPICworks, dsSPEAK, ECAN, ECONOMONITOR, FanSense, HI-TIDE,
In-Circuit Serial Programming, ICSP, Mindi, MiWi, MPASM, MPLAB Certified logo,
MPLIB, MPLINK, mTouch, Octopus, Omniscient Code Generation, PICC,
PICC-18, PICDEM, PICDEM.net, PICkit, PICtail, REAL ICE, rfLAB, Select Mode,
Total Endurance, TSHARC, UniWinDriver, WiperLock and ZENA are trademarks of
Microchip Technology Incorporated in the U.S.A. and other countries.
SQTP is a service mark of Microchip Technology Incorporated in the U.S.A.
All other trademarks mentioned herein are property of their respective companies.
© 2010, Microchip Technology Incorporated, All Rights Reserved.

© 2010 Microchip Technology Incorporated. All Rights Reserved. 1415 IDE Slide 169

Potrebbero piacerti anche