You are on page 1of 11

Objetivo: As ferramentas de desenvolvimento da IAR Systems so conhecidas

mundialmente devido a eficincia na gerao de cdigo, tanto para tamanho quanto


para performance, e tambm devido as facilidades avanadas de debug alm do
suporte. Atravs do IAR Eclipse Plugin possvel integrar o compilador, linker e
debugger proprietrio da IAR ao Freescale Kinetis Design Studio (KDS). Com isto o
desenvolvedor tem todo o ambiente da Freescale a disposio desde a gerao do
projeto pelo project wizard e mxima eficincia no cdigo gerado e controle total
sobre a aplicao durante o debug. Mais referncias em www.eembc.org/coremark
.
Integration of Freescale Kinetis Design Studio with the IAR Embedded
Workbench
This hands on has the purpose of showing the easy integration of the
professional IAR build components (compiler & linker) and the C-SPY debugger into
the Kinetis Design Studio. The integration is done through the IAR Eclipse Plugin.
More info can be found at www.iar.com/eclipse .
Pre-Installed Software and components
The software is already installed for your convenience. If you want to repeat the
same exercise later, notice the following steps:
1. Install the KDS (KDS-v1.1.1):
https://www.freescale.com/webapp/sps/download/license.jsp?colCode=KDS-
WINDOWS_IDE&prodCode=KDS_IDE&appType=file1&location=null&DOWNLOAD_I
D=null
2. Install the IAR Embedded Workbench for ARM (EWARM V7.30):
http://supp.iar.com/Download/SW/?item=EWARM-EVAL
You will be requested to register and get an evaluation license after the
installation. Just follow the step in the activation wizard.
3. Download the J-Link OpenSDA for the Freedom KL25Z:
http://www.segger.com/admin/uploads/userfiles/file/J-Link/JLink_OpenSDA.zip
The update procedure is described in the chapter Re-program the OpenSDA MCU
with the J-Link OpenSDA .
4. Download the IAR Plugin for the KDS/Eclipse:

http://eclipse-update.iar.com/arm/7.20/eclipse-iar-arm-7.10-201409291247.zip
The steps for the installation of the plugin can be found at
http://youtu.be/Bt7NHUmwdho .


Re-program the OpenSDA MCU with the J-Link OpenSDA!
Currently the IAR Plugin for Eclipse only supports the I-JET, J-link and Simulator for
debugging. It will be necessary to update the OpenSDA to J-Link OpenSDA.
1. The Freedom Board (FRDM-KL25Z) as shipped has the MSD (mass-storage
device) Flash Programmer OpenSDA Application preinstalled. With the USB
cable from Laptop PC to USB Mini-B SDA connector shown below,
power-up the board.

2. On power-up the Freedom board should enumerate as a removable USB storage
drive with a volume label of FRDM-KL25Z.
3. We will now place the Freedom board in BOOTLOADER mode by holding-
down the RST push-button (SW1 on Freedom board) while powering-up the
board.
4. When you hear the USB detect dual-tone from the laptop, release RESET.
5. The green led D4 will flash at a 1 second rate. The K25Z OpenSDA MCU is now in
BOOTLOADER mode and ready to be programmed with an .SDA /.S19 / .SREC
file.
6. The K25Z will have enumerated as a USB mass storage device (with FAT16 file
system) connected to your PC called BOOTLOADER.
7. In the OpenSDA Applications folder (in previously downloaded FRDM-KL25Z
Quick Start Package), locate the file JLink_OpenSDA.sda using Windows File
Explorer (\Desktop\IAR Hands On\JLink_OpenSDA\ JLink_OpenSDA.sda).
8. Drag & Drop (or Copy & Paste) this file to the BOOTLOADER drive.
9. Cycle the power to the Freedom board OFF-then-ON again (unplug and plug the
USB cable).
The OpenSDA interface is now configured with the JLink_OpenSDA App. The
mass storage drive will no longer be visible in the host laptops file system and
the SDA LED will not illuminate until debugging or programming.
10. If/when you later want to reconfigure the interface with one of the other SDA
Apps, the companion K25 micrcontroller is again put into BOOTLOADER mode by
powering-on with RESET button held-in.


Getting started with the KDS + IAR EWAM Eclispe Plugin!

1. Start KDS by clicking on its desktop icon.
2. Select the path to the new workspace that will be created for KDS. The
suggested path is Desktop\KDS\workspace.kds:


3. Point to the binaries of the IAR compiler, IAR linker and debugger through the
Window->Preferences-IAR Embedded Workbench options. Choose the correct
path to the EWARM components through the browse option. It will probably
look like C:\Program Files (x86)\IAR Systems\Embedded Workbench X.XX,
where X.XX means the version.

4. Open and import the IAR IDE project through File->Import->IAR Embedded
Workbench:

5. Select the workspace file FRDM_KL25ZDemo.EWW from \
Desktop\hands_on\FRDM-KL25Z\build\iar\blinky\FRDM_KL25ZDemo and
choose Finish. You should see the automatic conversion status:


6. Once the conversion is finished, it will also build the project automatically.
Confirm any message that says that it may be that some option has been lost or
not totally imported.





















7. Once the build is finished, you will see the binary file and build status:




8. In order to debug your project using the J-Link OpenSDA, right click on the .OUT
file and choose the Debug As -> Debug Configurations option:


9. Once you are in the debug settings, double click on C/C++ Application or choose
the New button. The IAR C-SPY debugger needs to be selected. Notice that the
Use specific configuration settings needs to be active. Confirm with OK.



10. The last step before of programming the board and starting the debug session is
to select the correct driver for the JTAG probe. Make sure to select the J-Link
driver through the Setup menu. Once you are done, press Debug:



11. If everything compiled, linked and downloaded fine you should land at the main
function:


12. All features available in the IDE from IAR systems are also available now on
Eclipse. The complete list of features can be found at Window->Show View-
>Other->C-SPY:



13. Lets make a try on the Live Watch feature. Once you clicked on the C-SPY Live
Watch from the last picture, you will get the window on the right side. Please
add the variables cnt and counter to it:


14. After leaving the target, running you should see the values being updated during
runtime. Feel free to test the other C-SPY features.



15. All the step in, step out, resume, stop debug options are listed on the top:


The integration from the IAR tools to the KDS makes it easy to migrate, import any
PEX project, mbed, or even reference project from the IAR IDE.

Thank you!