Tải bản đầy đủ (.pdf) (30 trang)

Seeing Inside your Target at Run-Time with µC_Probe_LabProcedures

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (1.23 MB, 30 trang )

LAB PROCEDURE
Micriµm’s µC/Probe Page 1 of 30

Seeing Inside your Target at Run-Time with µC/Probe
RX Architecture - RX63N
Description: This lab will show you how to use Micriµm’s highly innovative product called µC/Probe.
This Windows-based application allows you to visualize run-time variables in your target using numeric
indicators, gauges, meters, bitmaps, graphs and more. You can also change the value of variables using
sliders, buttons and other objects. You can use µC/Probe very early in your product development, during
the testing phases of your product and even in the field.


































Lab Sections
1 Lab #1 - Setup 3
2
Lab #2 - Advanced Controls 12
3
Lab #3 - Graphs 23
4
Lab #4 – Save/Restore and Line Graphs in Scope Mode 29






Lab Objectives
1. Become familiar with Micriµm’s µC/Probe

2. Monitor run-time data on the RX


3. Change the value of run-time target variables



Skill Level
1. Understand Embedded Systems
2. Understand C
Time to Complete Lab
15 Minutes Each
Lab Materials
• RX63N Development Kit (YRDKRX63N)
• µC/Probe V3.1.xx.yyy


• Target code .ELF file
• µC/Probe Workspaces

µC/Probe provided images
LAB PROCEDURE
Micriµm’s µC/Probe Page 2 of 30



























µC/Probe
Lab #1 – Setup
LAB PROCEDURE
Micriµm’s µC/Probe Page 3 of 30

1 Lab #1 - Setup
Overview:
The latest version of µC/Probe is already pre-loaded onto the PC you will be using in the lab. The board
for the lab is also pre-loaded with all the example code we will be using for these labs. There is no need
to setup any tools beyond simply connecting the YRDKRX63N using the USB cable to the PC.


Board Setup

Step 1.1 Remove the YRDKRX63N from its packaging.
Step 1.2 Connect one end of the USB cable provided in the blister-pack into a free USB port on the PC.
Step 1.3 Connect the other end into the ‘USER USB’ connector on the bottom right of the YRDKRX63N
board. You should see LED activity on the circular LED display.



Setting up µC/Probe
Step 1.4 Start µC/Probe by clicking on the µC/Probe icon:





After a few seconds, you should see the following Splash Screen, followed by the µC/Probe
application.
The µC/Probe application is located in C:\Micrium\µC-Probe directory in case
you can’t find it on the task bar.
Insert the small end of
the USB cable here
Circular
LED
Display
LAB PROCEDURE
Micriµm’s µC/Probe Page 4 of 30









Step 1.5

Your target should be running but, µC/Probe needs to know what the names of all the
variables, their memory location and their data types are in order to assign them to µC/Probe
objects.
Step 1.6

Load the .ELF file for the project. You do this by clicking on the green PLUS-sign on the
bottom left of the µC/Probe screen as shown below.
LAB PROCEDURE
Micriµm’s µC/Probe Page 5 of 30




Step 1.7

The ELF file of the code already loaded into the RX63N evaluation board is found in the
C:\Renesas\DevCon2012\Micrium\Micrium-uC-Probe-RX63N.ELF file. Simply
browse to that directory as shown below and double click on the file to load it into µC/Probe.


Step 1.8

1) Click on the ‘Settings’ menu as shown below
2) Select the J-Link interface


3) Move the slider to set the ‘Speed’ to 12000. This will allow the J-Link connection to
communicate with the target as fast as it can.

4) Browse to the path where the J-Link DLL is located. For convenience, we placed the DLL
into the same directory (i.e. Folder) as the ELF file:



C:\Renesas\DevCon2012\Micrium\JLink.DLL
5) Click ‘OK’ when done.



Add Symbol Table
LAB PROCEDURE
Micriµm’s µC/Probe Page 6 of 30




Testing with one variable
Step 1.9

Click on the ‘Numerics’ object (bottom left) in the ‘Toolbox’ and click on the ‘Numeric 2’ icon
(top left) as shown below.

(1) Click Here
(3) Move the slider to 12000 KHz
(4) Browse to the latest ‘Segger J-Link DLL’
(2) Select ‘Segger J-Link’

(1) Select ‘Numerics’
(2) Select ‘Numeric 2’
LAB PROCEDURE
Micriµm’s µC/Probe Page 7 of 30


Step 1.10

Drag-and-Drop ‘Numeric 2’ onto ‘DataScreen1’ as shown below.



Step 1.11

Type the name ‘OSTickCtr’ in the ‘Symbol Browser’ window as shown below.


Step 1.12

Double click to the left of the variable name (OSTickCtr). You will see OSTickCtr appear
below the numeric indicator.
Step 1.13

Click on the ‘Run’ icon on the upper left corner of µC/Probe. You should see the value of
OSTickCtr update live on the numeric indicator. If the number ‘overflows’ the numeric
indicator, simply click on the ‘Stop’ button on the upper left and ‘resize’ the numeric indicator
by grabbing and moving one of the corners of the numeric indicator.
LAB PROCEDURE
Micriµm’s µC/Probe Page 8 of 30






Step 1.14

Since this is a large number, we’d like to separate thousands with ‘commas’. You can easily
do that by ‘stopping’ µC/Probe (the target is not stopped) and click on the numeric object. You
should see a ‘Property’ screen as shown below:


Step 1.15

Simply click on the ‘Thousand Separator’ checkbox and then click on the ‘Run’ button.

What µC/Probe is doing is its asking the target (through the J-Link) for the latest
value of OSTickCtr and displaying it using the numeric indicator. Since there is only one
object on the screen, µC/Probe will continuously ask for the same variable, as quickly as
it can to update the value.

Properties Editor
Thousand Separator
LAB PROCEDURE
Micriµm’s µC/Probe Page 9 of 30




Writing and Reading variables
Step 1.16


Click on the object and press the ‘Delete’ key to delete the numeric indicator and thus clear
the data screen.
Step 1.17
Now, drag and drop two objects: ‘Linear Gauge 2’ (see ‘Linear Gauges’ in the Toolbox) and
‘Slider’ (see ‘Slider’ in the ‘Writable Controls’). Then, assign ‘AppSlider1’ (from the symbol
browser. Click on the ‘Run’ icon. Move the slider and you should see the linear gauge move
proportionally.


Edit Mode Run Mode
Now, if you click on the ‘Run’ button in µC/Probe, the number should be easier to
read because thousands are separated by a comma.

Each object has a ‘Properties Editor’ allowing you to adjust the behavior of each object to
your liking. Some properties are obvious and you can thus easily figure out what the
property does. Others are not as obvious and we’ll explain each one as needed.

The ‘Scaling Factor’ property allows you to multiply the variable by a ‘factor’. For
example, I might decide that I’d like the value to be multiplied by 100 or 0.01.

The ‘Scaling Offset’ property allows you to add a value to the multiplied property.

Both of these allow you to create a simple equation of the form: y = m * X + b which you
should be able to recognized as being a linear equation where ‘m’ is the scaling factor, ‘X’
is the symbol (or variable) assigned to the indicator and ‘b’ is the scaling offset. An
example of this is to convert degrees Celsius to Degrees Fahrenheit. So, if ‘X’ (the
variable being monitored) reads a degrees C temperature sensor but, you’d like to display
the value in µC/Probe in degrees Fahrenheit then you’d set the ‘Scaling Factor’ to 1.8
and the ‘Scaling Offset’ to 32.


Unfortunately, at this time, µC/Probe doesn’t allow you to go the other way because we’d
need to first subtract 32 from the sensor and then divide by 1.8.

LAB PROCEDURE
Micriµm’s µC/Probe Page 10 of 30


What we did here is assign a control (slider) to change the value of a variable
‘AppSlider1’. We also assigned ‘AppSlider1’ to a display object (the linear gauge) in
order to see the behavior of the slider. ‘AppSlider1’ is a variable that resides in the
target (i.e. RX63N board) and is declared as follows:

static CPU_INT16U AppSlider1;

In the application on the RX63N, AppSlider1 is not actually used in the code (the variable
is simply declared). µC/Probe simply reads the current value and displays it on the linear
gauge.

It’s important to notice that:

We never had to stop the target nor did we have to rebuild the code!
LAB PROCEDURE
Micriµm’s µC/Probe Page 11 of 30























µC/Probe
Lab #2 – Advanced Controls
LAB PROCEDURE
Micriµm’s µC/Probe Page 12 of 30

2 Lab #2 - Advanced Controls
Overview:
In this second lab, we will examine some of the advanced controls provided in µC/Probe. There are four
categories of advanced controls: Text, Bitmaps, Writable Controls and Graphs. We will cover the first
three in this lab and discuss graphs in the next lab.


New Workspace
Step 2.1 Create a ‘New Workspace’ by clicking on the ‘File’ then ‘New Workspace’ item. Answer

‘Don’t Save’ when prompted.

Step 2.2 Load the same symbol table ‘Micrium-uC-Probe-RX63N.ELF’ from the
‘C:\Renesas\DevCon2012\Micrium’ directory.



The ‘Text’ Object

Step 2.3 The first control we’ll look at in this second lab is the ‘Text Tool’ which can be found in the
‘Miscellaneous’ toolbox as shown below.

LAB PROCEDURE
Micriµm’s µC/Probe Page 13 of 30


Step 2.4 Drag-and-Drop the ‘Text Tool’ onto the Data Screen. It should look as shown below.




(1) Miscellaneous
(2) Text Tool
LAB PROCEDURE
Micriµm’s µC/Probe Page 14 of 30

Step 2.5 At this point, you have two choices:
1) You can assign the ‘Text’ control to a symbol as you have done in the previous lab. In this
case, you can also change some properties which affect a numerical value (Scaling
Factor, Scaling Offset, Decimal Places, Leading Zeros and Thousand Separator).

2) If you DO NOT assign a symbol to the ‘Text’ control then you can use it as a ‘comment’ or
‘label’ for other controls.
Either way, you can change the properties of the ‘Text’ (Font type, Font size, horizontal
alignment, Color, etc.).

For now, change the ‘0’ in the Text to ‘Slider Value’ as shown below, select ‘Center
Alignment’ and change the font size to 36 points. You screen should look like this:



Adding a slider
Step 2.6 You can how add a slider to you screen and move the text either above or below the slider.
You can assign ‘AppSlider1’ to your slider. Your screen should look as shown below. As
you can see, we used the Text Tool as a label.



LAB PROCEDURE
Micriµm’s µC/Probe Page 15 of 30


Adding a variable to a ‘text object’
Step 2.7 Add another Text object right next to the slider but this time, assign AppSlider1 to that
object. Click on the ‘Run’ button and move the slider. You will notice that the first text object
remains as a comment and the second one tracks the value of the slider.






Step 2.8 Click on the ‘Stop’ button and now change the property of the slider as follows:

Range, Max = 10
Uncheck ‘Show Slider Label’ box
Check the ‘Use Discrete Values’ box

Click on the ‘Run’ button and you should see the screen as shown below.

Recall that ‘AppSlider1’ is a variable in the target that µC/Probe can read and/or
modify.
LAB PROCEDURE
Micriµm’s µC/Probe Page 16 of 30








Bitmap Animations (Variable value mapping to a picture)
Step 2.9 Now add the ‘Bitmap Animation’ next to the numeric value and assign the bitmap object to
‘AppSlider1’ as shown below.

You will notice that the number on the bottom right of the slider has disappeared.
This is because you unchecked the ‘Show Slider Label’.

You should also notice that as you move the slider around, it snaps to where the tick
marks are. That’s because you selected the ‘Use Discrete Values’ option. This feature is
very useful to use the slider as a ‘selector’ of options. We’ll demonstrate this next.

LAB PROCEDURE
Micriµm’s µC/Probe Page 17 of 30



Step 2.10 Click on the ‘Bitmap’ object’s properties. You should see the following screen.



Step 2.11 Click on the ‘…’ button of the ‘Path’ settings and browse to the
C:\Renesas\DevCon2012\Micrium\Bitmap directory and select the ‘Small Renesas
Logo’ image called ‘Logo-Renesas-200px.jpg’. Set the ‘value’ property for this image to 0.
You should see the following screen:

LAB PROCEDURE
Micriµm’s µC/Probe Page 18 of 30


Select ‘Image 2’ in the properties of the bitmap object and this time, select the green ‘traffic
light’ image called ‘Traffic-G-S.jpg’. Set its ‘Value’ property to 1.

Click on the red ‘+’ of the Images property and select the ‘Traffic-Y-S.jpg’ image. Set its
‘Value’ property to 2.

Click on the red ‘+’ of the Images property and select the ‘Traffic-R-S.jpg’ image. Set its
‘Value’ property to 3.

Click on the red ‘+’ of the Images property and select the ‘uC_Probe_Logo.jpg’ image. Set its
‘Value’ property to 4.



Step 2.12 Click on the ‘Run’ button and move the slider between values 0 to 4. The image you will see
will depend on the slider value.



You will notice that the image is being displayed in its saved resolution. The
‘Renesas’ logo is 200 pixels wide, the traffic lights are much smaller and, the µC/Probe
logo is huge, comparatively.

You should also note that if you don’t define images to slider values 5 through 10 then
µC/Probe will not display anything. This might actually be used as a feature if you display
‘error messages’ or ‘error pictures/icons’; no error, no image.

You could ‘draw’ bitmaps that represent ‘rotary switches’ (each bitmap could represent a
position of the rotary switch), of course, traffic lights to test a traffic light controller,
pictures of an elevator with its different states, shows the different states of a washing
machine, etc.
LAB PROCEDURE
Micriµm’s µC/Probe Page 19 of 30


Push Button
Step 2.13 Click on the ‘Writable Controls’ in the toolbox and, Drag-and-Drop the ‘Toggle Button’ onto
the data screen as shown below. Assign ‘AppSw1’ to this button.

Step 2.14 Drag-and-Drop another ‘Bitmap’ control above the button. Assign ‘AppSw1’ to this bitmap
object. This time, you’ll add an LED image. A zero state will be dark and a 1 state will be lit
(red). Your data screen should look as shown below. Click on the ‘Run’ button and notice
that the LED changes state whenever you click on the toggle button.






As with all of the controls, you can change some of the properties of push button
switches. Should the button display a label when it’s in the OFF state? How about in the
ON state? Do you want the word ‘Toggle’ to appear on the bottom right of the push
button switch? Do you want to change the ON or OFF value? Etc.

You should note that µC/Probe defines other types of buttons: ‘Push Button’ and
‘Repeat Button’. The push button sends the ON value when the button is pushed. The
repeat button sends the ‘on’ value every so many milliseconds to the target. The delay is
changeable.

There are other types of ‘Writable Controls’ such as the ‘Custom Slider’ which allows you
to add an image at each end of the slider. For example, if this slider is used as a volume
control, you can put an icon of an ‘off’ speaker on the left and a ‘full blast’ speaker on the
right. These types of icons makes the use of the slider highly intuitive to the user.
LAB PROCEDURE
Micriµm’s µC/Probe Page 20 of 30

µC/OS-III Kernel Awareness Screen
Step 2.15 The last advanced control we will cover in this lab is the ‘µC/OS-III Kernel Awareness’ screen.
µC/Probe has built-in awareness of µC/OS-III and thus, displays the state of many µC/OS-III
variables at run-time. This is a highly useful feature because you can quickly see how much
CPU time each task takes, how much time each task disables interrupts for, how much stack
space a task is using, and much, much more.

To see all this information, simply click on the ‘OS-3’ icon in the ‘Workspace Explorer’ on to

top-right portion of the µC/Probe window as shown below.





Step 2.16 Click on the ‘Run’ button and see the ‘Task(s)’ tab update with the target’s run-time task
information. The screen might require scrolling left and right to see all the information
collected for each task.



(1) OS-3 icon
(2) The µC/OS-II Kernel Aware
(i.e. KA) screen will appear.
LAB PROCEDURE
Micriµm’s µC/Probe Page 21 of 30

Of particular interest are:

1) The ‘Item’ indicates the order in which tasks were created. The largest number
indicates the first task created. In this case, ‘13’ is the item number for the ‘Idle
Task’.

2) The ‘Priority’ indicates the relative priority of a task. A low number indicates a
high-priority. With µC/OS-III, multiple tasks can have the same priority.

3) ‘CPU Usage’ indicates the CPU usage on a per task basis. On a lightly loaded
system, the idle task should have a high number.


4) The ‘CtxSwCtr’ indicates the number of times a task executed. If this number
doesn’t increase then the task is either waiting for an event to occur or is
somehow inactive.

5) The ‘Stack Usage’ indicates the ‘worst case’ stack usage of the task. When the
usage exceeds 70%, the bargraph changes to yellow. When the stack usage
exceeds 90%, the bargraph goes red. A yellow or red bargraph should signal to
the user that the stack might be too small for the task and you would most likely
need to reconsider the amount of stack you allocated to the task.

6) tasks in your As with all of the controls, you can change some of the properties of
push button switches. Should the button display a label when it’s in the OFF
state? How about in the ON state? Do you want the word ‘Toggle’ to appear on
the bottom right of the push button switch? Do you want to change the ON or
OFF value? Etc.

There are plenty of other fields in the Task(s) tab and you can refer to the µC/OS-III
user’s manual for an explanation of each.
LAB PROCEDURE
Micriµm’s µC/Probe Page 22 of 30























µC/Probe
Lab #3 – Graphs
LAB PROCEDURE
Micriµm’s µC/Probe Page 23 of 30


3 Lab #3 - Graphs
Overview:
If you thinks of a tool like µC/Probe, one of the first thing you think about is “Can I plot the value of a
variable?”. Of course, the answer is yes. In fact, the current version of µC/Probe implements 3 types of
graphs:

1) Stripchart
2) Scope
3) Burst

In stripchart-mode, the data is updates on the right hand side of the graphs and ‘scrolls’ to the left
revealing previous values. The leftmost values are thus the oldest values and the rightmost value is the

latest.

Scope-mode emulates an oscilloscope where the data starts on the left, new values are placed to the
right of the previous value and when the graph is full, the data is plotted from the left.

In burst-mode, the data is displayed from an array that resides in the target’s memory. All points of the
array are read and displayed at once. It’s the application’s responsibility to update the array, whether
circularly or once.


New Workspace
Step 3.1 Create a ‘New Workspace’ by clicking on the ‘File’ then ‘New Workspace’ item. Answer
‘Don’t Save’ when prompted.

Step 3.2 Load the same symbol table ‘Micrium-uC-Probe-RX63N.ELF’ from the
‘C:\Renesas\DevCon2012\Micrium’ directory.


‘Line Graph’ in Strip chart mode
Step 3.3 Drag-and-Drop the ‘Line Chart’ graph from the ‘Graphs’ toolbox. Your µC/Probe screen
should look as shown below.

LAB PROCEDURE
Micriµm’s µC/Probe Page 24 of 30


Step 3.4 Assign ‘ECG_Value’ to the line chart.

Step 3.5 Click on the ‘Run’ button and you will see a ‘simulated’ ECG waveform as shown below:




LAB PROCEDURE
Micriµm’s µC/Probe Page 25 of 30



Step 3.6 Delete the ECG waveform by clicking on it and by pressing the ‘Delete’ key on your keyboard.


‘Line Graph’ in Burst Mode
Step 3.7 Drag-and-Drop another ‘Line Chart’ graph from the ‘Graphs’ toolbox.

Step 3.8 Assign the variable ‘Dimmer_VoltageTbl’ to the line chart. This variable is actually an array
declared as: ‘CPU_FP32 Dimmer_VoltageTbl[360]’ in the application that is running on
the RX63N evaluation board.

Step 3.9 Click on the chart and select to change the properties of this graph. You need to change the
properties as follows:
- Min = -400
- Max = 400
- Tick Mark Steps = 50
- Max Samples = 360
- Update Stype: Burst



Burst-mode allows you to update the graph with ALL the data points of an array.

You need to specify (in the properties) the expected minimum and maximum values (Y-

axis) of the array as well as the number of points (or entries) in the array (x-axis).

When running, µC/Probe will read all the values of the array and display them all at once.
Of course, the ECG waveform is simulated since we are not actually connected to
a patient. Also, the ECG waveform is played back at a slower rate because µC/Probe
doesn’t sample the data from the target fast enough to play the data at live speed. In this
case, we are simulating 60 BPM but slowed down by a factor of 10.

The default ‘mode’ for graphs is ‘strip chart’. This modes takes a single value and plots
the current value on the screen on the right-hand side and scrolls previous values to the
left.

µC/Probe allows for two other modes as we’ll see shortly: Scope and Burst.

×