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... Step 1.13 Click on the ‘Run’
Trang 1Seeing 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
Trang 2Lab #1 – Setup
Trang 3Step 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
Trang 4Step 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
Trang 5Step 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
Trang 6Testing 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’
Trang 7Step 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
Trang 8Step 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
Trang 9Writing 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
Trang 10What 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!
Trang 11Lab #2 – Advanced Controls
Trang 122 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
Trang 13Step 2.4 Drag-and-Drop the ‘Text Tool’ onto the Data Screen It should look as shown below
(1) Miscellaneous (2) Text Tool
Trang 14Step 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
Trang 15Adding 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
Trang 16Bitmap 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
Trang 17Step 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:
Trang 18Select ‘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
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
Trang 19Push 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
Trang 20µ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
Trang 21Of 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