Keil ULINKpro Leitfaden

Using Keil™ ULINKpro with the
AT&T® Cellular IoT Starter Kit
Make problems easier to solve with the right tools…

P a g e 1 | 13
Table of Contents
Overview........................................................................................................................................................................2
Why Use Keil MDK?...................................................................................................................................................2
ULINKpro features .....................................................................................................................................................2
Introduction to the MDK ...........................................................................................................................................2
Installing the Software...................................................................................................................................................3
Download and Install.................................................................................................................................................3
Selecting Software Packs...........................................................................................................................................3
Locate & Install the IoT Operational Software ..........................................................................................................4
Import into Keil IDE ...................................................................................................................................................5
Connecting and Configuring Debug Adapter .................................................................................................................5
Configuring μVision v5...................................................................................................................................................7
Updating the Project Files .............................................................................................................................................9
Modifying IoT Software for ULINKpro .........................................................................................................................10
Source Code Changes..............................................................................................................................................10
Running/Debugging the Program............................................................................................................................11
Summary of Steps........................................................................................................................................................12
Useful Definitions/Terms.............................................................................................................................................12
References ...................................................................................................................................................................13
Books.......................................................................................................................................................................13
Application Notes....................................................................................................................................................13
Useful ARM Websites..............................................................................................................................................13

P a g e 2 | 13
Overview
The purpose of this paper is to discuss and demonstrate how to use the ARM Keil MDK toolkit with μVision® IDE
with the Avnet-AT&T Cellular IoT Kit at http://cloudconnectkits.org/product/att-cellular-iot-starter-kit.
The paper uses the Avnet-AT&T Cellular IoT Kit software which is located at
https://developer.mbed.org/users/JMF/code/Avnet_ATT_Cellular_IOT/ and focuses on how to connect the
ULINKpro JTAG debugger to the hardware, what to modify in the software, and how to configure the μVision IDE.
Additional information on the ULINK tools & Keil Environment can be found in the following App Notes from Keil,
NXP K64 Freedom: www.keil.com/appnotes/docs/apnt_287.asp and NXP K64 Tower:
www.keil.com/appnotes/docs/apnt_288.asp.
Why Use Keil MDK?
Development on the NXP/FRDM-K64F is simplified for users by having OpenSDA tools pre-installed when it is
delivered. While this environment is suitable for many development activities, it lacks the hardware and
performance specific capabilities that a USB-JTAG/SW Debug and Trace Unit provide. Using the Keil μVision IDE
and ULINKpro environment, users enjoy the following:
A μVision IDE with Integrated Debugger and Flash programmer
The ARM® Compiler tool chain
USB-JTAG Debugging (and/or Serial Wire Debug) with CoreSight™ Serial Wire Viewer and ETM trace
capability
Other Keil tools such as ULINK2 and ULINK-ME and the Segger J-Link can be used in place of the ULINKpro but
these units do not support the ETM, Performance Analysis, and Code Coverage features.
Finally, being able to switch between the online development at mbed.org and the ARM/Keil environment is the
goal of this paper. While integrating the Avnet WNC-Shield board, more extensive hardware debug capabilities
were needed which drove the need for this capability.
ULINKpro features
The specific features of the ULINKpro that were needed are as follows:
1. Serial Wire Viewer (SWV) data trace including exceptions and ETM instruction trace
2. Real-time read and write to memory locations for watch, and memory windows
3. Hardware breakpoints and watchpoints (also called access breaks)
Introduction to the MDK
This paper uses MDK 5.20 and Software Pack 1.4.0. Install MDK 5 Core first and then download the required
Software Packs. Software Packs are an ARM CMSIS standard
1
.
1
See www.keil.com/CMSIS or www.keil.com/dd2/pack for the complete list of software packs.

P a g e 3 | 13
Installing the Software
Download and Install
1. Download MDK Core from the Keil website at www.keil.com/mdk5/install.
2. Install MDK into the default folder. You can install into any folder, but for this example the default is C:\Keil_v5.
Selecting Software Packs
This μVision utility provides the ability to choose various Software Pack versions to be installed.
1. Start μVision and open Pack Installer.
After the first MDK install is complete, and if you are connected to the Internet, μVision and software packs will
automatically start. Otherwise, connect your computer to the Internet to download the software packs and start
μVision by clicking the desktop icon. (Initially, the pack list must be downloaded from the Web).
2. Click the Pack Installer icon. A Pack Installer Welcome screen opens.
3. Select the Boards tab.
4. Type FRDM-K64F in the Search box to filter the listings.
5. Select FRDM-K64F. You can also select individual processors under the Devices tab.
NOTE: If there are no entries shown, you were not connected to the Internet when Pack Installer opened; select
Packs/Check for Updates or refresh once you have connected to the Internet. This is not done automatically.

P a g e 4 | 13
6. Install the Kinetis K60 Device Family Pack (K60_DFP) by performing the following steps:
a. Click the Packs tab. Initially, the Software Pack ARM::CMSIS is installed by default.
b. Select Keil::Kinetis_K60_DFP and click Install. The latest Pack downloads and installs to
C:\Keil_v5\ARM\Pack\Keil\Kinetis_K60_DFP\ by default. This download can take two to four minutes.
The status updates and indicates “Up-to-date”.
7. Repeat the above process for the Kinetis K60 Software Development Kit (SDK_DFP).
Locate & Install the IoT Operational Software
The following assumes you are working with the Avnet AT&T Cellular IoT Kit software.
1. Export from developer.mbed.org.
2. Open your browser and navigate to https://developer.mbed.org/users/JMF/code/Avnet_ATT_Cellular_IOT/.
The page displayed will look like the following:
3. On this page, select the Export to desktop IDE button. The area shown in the circle appears.
4. Select FRDM-K64F and μVision 5.
5. Click the Export button to generate a ZIP file, with the project in it, and automatically download it to your
download folder.
6. Using Windows Explorer, open the ZIP file and extract it to your desired location (e.g., Documents folder).
Once it is extracted, you are ready to import it into the Keil IDE.

P a g e 5 | 13
Import into Keil IDE
1. Open the Keil IDE and choose the Project menu item in the menu bar.
2. Select Open Project. A Dialog box opens similar to the one below:
3. Navigate to the location where you saved the Avnet_ATT_Cellular_IOT project.
4. Select the Avnet_ATT_Cellular_IOT.uvprojx. You have now imported the project from the mbed.org IDE.
Connecting and Configuring Debug Adapter
The ULINKpro supports all SWV features and has ETM Trace support. It also provides Flash programming
capabilities.
NOTE: When you use the flash programming capabilities, the FRDM-K64F Flash is erased and the OpenSDA boot
loader that was previously in the Flash is gone. If you want to return to using OpenSDA, you must reprogram the
OpenSDA bootloader.
Because you want to use Serial Wire Viewer, it is necessary to install the 20 to 10 pin CoreSight cable to the JTAG
unit. This new cable is provided with the ULINKpro unit.
This cable is replaced

P a g e 6 | 13
The new cable provided with the ULINKpro unit may have pin 7 filled with a plastic plug. If so, remove the plastic
plug before connecting to the Kinetis target. This is easily done with a sharp needle. Merely pry the plastic pin out.
NOTE: Do not remove or disturb the battery. The ULINKpro will not operate if battery power is lost.
With the 20 to 10 pin adapter installed on the ULINKpro unit and any pin plugs removed, connect the cable to the
J9-JTAG connector (shown circled below). Note the location of Pin 1 will correspond to Pin 1 on the connector (the
plug is not keyed).
When using OpenSDA, the computer is connected to the SDA-USB port. Ensure this is NOT connected when the
ULINKpro is used. Instead, insert the USB cable in the USB port (as shown above). This provides power to the K64F
board. Once the JTAG unit is connected to the FRDM-K64F board, install the WNC-Shield board and make the
necessary connections (e.g., antenna, power).
Plug that needs to
be removed

P a g e 7 | 13
Configuring μVision v5
With the board assembled and connected to the ULINKpro JTAG unit, perform the tool configuration tasks.
These tasks are all performed from the Options dialog. This dialog box is found under the Project menu or button.
1. Enter the Debug tab. From the Options tab, modify the “Debug”, “Linker”, and “C/C++” tabs.
2. From the Use selector, choose “ULINKpro Cortex Debugger” (highlighted). The software connects to the
ULINKpro debugger.
3. Select the Settings button to select specific features. The dialog opens as follows:
4. Ensure the Connect & Reset Options are set as indicated above. That is, SWJ is selected and Port: is set to SW.

P a g e 8 | 13
5. Move to the Trace tab to set up the trace configuration.
6. Ensure Port 7..0 and Pin 0 is selected so information can be output to the Printf (debug) window. Also verify
that Serial Wire Output –Manchester is selected. uVision uses Port 0 and 31. All other ports are not used at
this time.
NOTE: The Core Clock should be set to 120.0 MHz to match the operating environment to ensure the timing
values in various trace windows are correct.
7. Return to the Options dialog and select the Linker tab. You need to select a different scatter file for this project.
8. In the Scatter File box, use file picker to open a file navigator dialog.
9. Go to the .\mbed\TARGET_K64F\TOOLCHAIN_ARM_STD\ directory and select the MK64FN1M0xxx12.sct file
as shown:

P a g e 9 | 13
10. From the Options dialog, select the C/C++ tab. At this point, you will add a new define to the project call
_ULINK_PRINT. This is added to the end of the Preprocessor Symbols Define filed as shown:
Updating the Project Files
Because debug/information output is sent to the Debug
(printf) viewer when using the ULINK, you need to include 2
new files into the project that will accomplish this.
These files redefine two macros, PRINTF and PUTS, which
are implemented differently for either OpenSDA or ULINK.
To add these two files go to the Project window, right click
the Source Files selection, and select Add Existing File to
Group. From within the dialog box that opens, select
itm_output.cpp
Inhaltsverzeichnis

















