Beruflich Dokumente
Kultur Dokumente
By Daniel Widyanto
September 2010
Contents
LPCXpresso Introduction
LPCXpresso Layout
Importing Project
Creating New Project
Exporting Project
LPCXpresso Tricks
– Generate Intel Hex, binary, and adding checksum
– View disassembled code
Debugging Blinky
– View core registers value
– View Timer value
2
LPCXpresso Introduction
3
LPCXpresso Introduction
(* )
4
LPCXpresso Introduction
Getting it:
– IDE: http://lpcxpresso.code-red-tech.com/LPCXpresso/
– Boards: Please ask your NXP representative
Support:
– Code examples / FAQ / Schematic: http://ics.nxp.com/support/lpcxpresso/
– Forum: http://knowledgebase.nxp.com/lpcxpresso.php
Upgrade option
– http://www.code-red-tech.com/purchase.php?
– USD 1 for each 1KByte of JTAG download capability
5
LPCXpresso Layout
6
LPCXpresso Layout
1
7
LPCXpresso Layout
8
LPCXpresso Projects:
Importing Project
9
Importing Project
3
1
10
LPCXpresso Projects:
Creating New Project
11
Creating New Project
12
Creating New Project
13
LPCXpresso Projects:
Exporting Project
14
Exporting Project
3
1
15
LPCXpresso Tricks
16
LPCXpresso Tricks:
Generate Intel Hex, Binary, and Adding
Checksum
1
17
LPCXpresso Tricks:
Generate Intel Hex, Binary, and Adding
Checksum
3
18
LPCXpresso Tricks:
Generate Intel Hex, Binary, and Adding
Checksum
To generate Intel HEX file:
– arm-none-eabi-size ${BuildArtifactFileName}; arm-none-
eabi-objcopy -O ihex ${BuildArtifactFileName} $
{BuildArtifactFileBaseName}.hex ;
To generate plain binary file:
– arm-none-eabi-size ${BuildArtifactFileName}; arm-none-
eabi-objcopy -O binary ${BuildArtifactFileName} $
{BuildArtifactFileBaseName}.bin ;
To generate checksum-ed binary file*:
– arm-none-eabi-size ${BuildArtifactFileName}; arm-none-
eabi-objcopy -O binary ${BuildArtifactFileName} $
{BuildArtifactFileBaseName}.bin ; checksum -p $
{TargetChip} -d ${BuildArtifactFileBaseName}.bin;
20
Debugging Blinky
21
Debugging Blinky
4 OR
22
Debugging Blinky
1
2
23
Debugging Blinky
OR
1
2
24
Debugging Blinky
1
2
25
26
LPCXPRESSO HANDS ON
By Daniel Widyanto
September 2010
1
Contents
LPCXpresso Introduction
LPCXpresso Layout
Importing Project
Creating New Project
Exporting Project
LPCXpresso Tricks
– Generate Intel Hex, binary, and adding checksum
– View disassembled code
Debugging Blinky
– View core registers value
– View Timer value
2
2
LPCXpresso Introduction
3
LPCXpresso Introduction
(* )
• What is LPCXpresso ?
• NXP's low-cost fully integrated development tool platform for the LPC MCU
family
• As an end-to-end solution for creating applications all the way from initial
evaluation to production
4
LPCXpresso Introduction
Getting it:
– IDE: http://lpcxpresso.code-red-tech.com/LPCXpresso/
– Boards: Please ask your NXP representative
Support:
– Code examples / FAQ / Schematic: http://ics.nxp.com/support/lpcxpresso/
– Forum: http://knowledgebase.nxp.com/lpcxpresso.php
Upgrade option
– http://www.code-red-tech.com/purchase.php?
– USD 1 for each 1KByte of JTAG download capability
5
LPCXpresso Layout
6
LPCXpresso Layout
1
The LPCXpresso has many panes / views to show different functions of the IDE that can
be put inside the workspace area
Here’s some of the pane / view names and function:
• Project Explorer View: The ‘Project Explorer’ gives you a view of all the projects in
your current ‘Workspace’. A ‘Workspace’ is a collection of projects that are stored in
a single Workspace Directory on your computer.
• Editor: To modify and saving the source code as well as setting breakpoints in debug
mode.
• Console View: The Console View displays status information on compiling and
debugging, as well as program output.
• Problem View: The Problem View shows all compiler errors and will navigate the
Editor View to the error location.
• Quick Start View: To display fast links to commonly used features.
7
LPCXpresso Layout
TODO: Close all views and open : Project Explorer, Console, Quickstart. Rearrange
according to your taste
8
LPCXpresso Projects:
Importing Project
9
Importing Project
3
1
10
Importing project is useful if you want to import the source code from other parties without
losing the project’s configuration (compiler settings, debugger settings, etc)
For archive file, you could pack several project files into single archive and restore it all of
them at once or select it.
10
LPCXpresso Projects:
Creating New Project
11
11
Creating New Project
12
1. Use ‘Quickstart’ -> ‘Start here’ -> ‘New project…’ -> ‘NXP LPC1100 C Project’
2. Fill the name of the project: LPC1114_Demo.
3. Click ‘Next’
12
Creating New Project
13
1. Select the MCU that you will use. This will be used as JTAG settings, linker and
startup file generation.
2. Tick the ‘Use CMSIS’ then click ‘Next’. CMSIS will provide you with basic LPC11xx
header files to access registers and basic core functions (such as setting up the PLL)
3. Click ‘Next’
13
LPCXpresso Projects:
Exporting Project
14
14
Exporting Project
3
1
15
Exporting project is useful if you want to send / save the source code without losing the
project’s configuration (compiler settings, debugger settings, etc)
For archive file, you could pack several project files into single archive and restore it all of
them at once or select it.
15
LPCXpresso Tricks
16
16
LPCXpresso Tricks:
Generate Intel Hex, Binary, and Adding
Checksum
1
17
17
LPCXpresso Tricks:
Generate Intel Hex, Binary, and Adding
Checksum
3
18
18
LPCXpresso Tricks:
Generate Intel Hex, Binary, and Adding
Checksum
To generate Intel HEX file:
– arm-none-eabi-size ${BuildArtifactFileName}; arm-none-
eabi-objcopy -O ihex ${BuildArtifactFileName} $
{BuildArtifactFileBaseName}.hex ;
To generate plain binary file:
– arm-none-eabi-size ${BuildArtifactFileName}; arm-none-
eabi-objcopy -O binary ${BuildArtifactFileName} $
{BuildArtifactFileBaseName}.bin ;
To generate checksum-ed binary file*:
– arm-none-eabi-size ${BuildArtifactFileName}; arm-none-
eabi-objcopy -O binary ${BuildArtifactFileName} $
{BuildArtifactFileBaseName}.bin ; checksum -p $
{TargetChip} -d ${BuildArtifactFileBaseName}.bin;
Checksum is needed for to indicate valid user code. Usually it is inserted by FlashMagic if
the firmware is downloaded through ISP. For firmware that is programmed through USB
ISP, the checksum needs to be added into the binary file first.
19
LPCXpresso Tricks:
View Disassembled Code
20
1. After the program compiled. Right click into its binary result (*.axf)
2. Select ‘Binary Utilities’
3. Select ‘Disassemble’
20
Debugging Blinky
21
21
Debugging Blinky
4 OR
22
1. First compile the Blinky. Right click the ‘Blinky’ project on ‘Project Explorer’ view
2. Select ‘Build Project’ and let the project compiled
3. Make sure that the project compiled successfully. You will see the size of the
compiled firmware after it is built.
4. Start the debugging session using the debug icon on toolbar or ‘Debug <Project
Name>’ on Quickstart Pane.
22
Debugging Blinky
1
2
23
The ‘Debug’ panel shows important information regarding the debugged program
• Call stack: shows the order of function calling until it reach current position. It shows
function name, source file and line no, and function location in memory
• The buttons to control the debugging (from left to right): Reset, Run, Suspend (not
available until the firmware is run), Stop (exit debugging mode), Disconnect (not
available in LPCXpresso), Step into, Step over, Step return, Drop to frame,
Instruction Stepping Mode, Use Step Filters
• The arrows shows current PC location. The dot shows breakpoint position
• The ‘Instruction Stepping Mode’ can be used to debug the assembly code.
23
Debugging Blinky
OR
1
2
24
The local variables (and function parameters) will be displayed in ‘Variables’ view, or,
alternatively, once the program is paused, you can move your cursor into the variable
name and getting it’s value.
If you want to view variable, you can use ‘Watch Expression’ feature. To use it:
• Select the variable name and right click. Select ‘Add Watch Expression…’
• Make sure the variable name is correct and press ‘OK’.
• The variable value can be viewed from ‘Expressions’ view.
24
Debugging Blinky
1
2
25
25
26
26