Infineon XMC1200 Boot Kit: Cortex-M0 Lab · In I T to K th li M a A W M T O M R M a fineon XMC120...

48
In I T to K th li M a A W M T O M R M a nfineon XMC120 Infine ARM Kei For the Inf Introducti The purpose of oolkit featuring Keil provides a his complimen imit. MDK in Middleware: K and a Flash File ARM Compile Why Use K MDK provides 1. μVisio Comp with in 2. A full It has 3. An RT 4. DAVE 5. Choic Link a 6. All Co 7. Keil T faster 8. Keil a This documen 1. Real-t These 2. Four H 3. System 4. A DSP 5. Three Other Infi MDK supports, Relax, XMC45 MDK supports advanced debug 00 Cortex-M0 Lab on XMC l MDK 5 T fineon XMC ion: f this lab is to in g the IDE μVis a free MDK lic ntary license. I cludes a full ve Keil has a suite e system. It is er Qualificatio Keil MDK ? these features on IDE with In iler/Assembler ncluded examp feature RTOS a BSD license TX Kernel Aw E compatible. e of adapters: and J-Link Lite oreSightdebu Technical Supp and more relia lso supports In t details these time Read upda are non-intrus Hardware Brea m and Thread V P example with examples usin neon boa , with example 500 Application Serial Wire V gging features. b with XMC1200 The latest C1200 Toolkit 1200 Boot ntroduce you t sion ® . This tut ense for use w If you do not in ersion of Keil R e of commerci a component o on Kit: For sa ? particularly su ntegrated Debu r and Linker to ples and is easy called RTX is and was create areness window See www.kei ULINK2, U e. μVision also ugger features port is included ably. nfineon 8051 an e features: ate for Watch, sive to your pro akpoints (can b Viewer: a kern h variables upd ng DAVE to co rds suppo es, other evalua n Kit, XMC110 iewer (data tra . These feature 0 Boot Kit board version of this Boot K Su Kit Version o the Infineon torial will use t ith Infineon XM nstall a license, RTXRTOS al grade middl of MDK-Profe afety certificatio uited for Cortex ugger, Flash pro oolchain. MDK y to get running s included with ed and is main w that is updat l.com/appnote LINK-ME, UL o supports CM are supported d for one year a nd C166 proce Memory and R ogram. No CP e set/unset on- nel awareness p dated in real-tim onfigure and cr orted: ation boards fro 00 2Go Kit and ace) and ETM ( es are describe 1 s document is Kit: Cor mmer 201 2.0 Robert Bo Cortex™-M0 the on-board J- MC1000 proce , you can still u . RTX source leware for Infin ssional. See w on applications x-M processor ogrammer and K is a turn-key g. h MDK with so tained by Keil ted in real-time s/files/apnt_25 LINKpro or Se SIS-DAP. in the μVision and is easily ren essors. See ww RTX Threads w U cycles are st -the-fly) and fo program for RT me as the progr reate μVision B om Infineon us d XMC4500 H (instruction tra ed in their respe Copyright © www.keil here: www.ke rtex-M0 14 oys bob.boys processor fam -Link Lite debu essors. See ww use this lab. M code is includ neon processor www.keil.com/ s: www.keil.c r users: the ARM product ource code. . e. 58.pdf egger J- n debugger. newable. This ww.keil.com/dd windows. Mem tolen. No instr our Watchpoint TX RTOS that ram is running Blinky, RTX_B sing ARM proc HiLight. See w ace) on those C ective labs. © 2014 ARM Ltd. All rig l.com eil.com/appnot 0 Lab @arm.com mily using the A ug adapter. ww.keil.com/in MDK will then ded with MDK. rs. This includ /arm/mdk for m om/pr/article/1 s helps you get d for the compl mory and SVD rumentation co ts (also called A updates while g using a Watch Blinky and PW cessors. These www.keil.com/i Cortex-M4 proc ghts reserved tes/docs/apnt_ ARM ® Keil ® M nfineon/mdk to have a 32K co . des TCP/IP, US more informatio 1262.htm your project c ete list. D also have Wri ode is added. Access Breaks the program is h window. WM_Blinky pro e include XMC infineon. cessors that inc _263.asp MDKo obtain ompile SB, CAN on. completed ite access. s). s running. ojects. C4500 clude these

Transcript of Infineon XMC1200 Boot Kit: Cortex-M0 Lab · In I T to K th li M a A W M T O M R M a fineon XMC120...

In

ITto

Kthli

Ma

A

WM

T

OMR

Ma

nfineon XMC120

Infine ARM KeiFor the Inf

IntroductiThe purpose ofoolkit featuring

Keil provides ahis complimenimit. MDK in

Middleware: Kand a Flash File

ARM Compile

Why Use KMDK provides

1. µVisioCompwith in

2. A full It has

3. An RT

4. DAVE

5. ChoicLink a

6. All Co

7. Keil Tfaster

8. Keil a

This documen

1. Real-tThese

2. Four H

3. System

4. A DSP

5. Three

Other InfiMDK supports,Relax, XMC45

MDK supports advanced debug

00 Cortex-M0 Lab

on XMCl MDK 5 T

fineon XMC

ion: f this lab is to ing the IDE μVis

a free MDK licntary license. Icludes a full ve

Keil has a suitee system. It is

er Qualificatio

Keil MDK ?these features

on IDE with Iniler/Assemblerncluded examp

feature RTOSa BSD license

TX Kernel Aw

E compatible.

e of adapters: and J-Link Lite

oreSight™ debu

Technical Suppand more relia

lso supports In

t details these

time Read updaare non-intrus

Hardware Brea

m and Thread V

P example with

examples usin

neon boa, with example

500 Application

Serial Wire Vgging features.

b with XMC1200

The latest

C1200 Toolkit 1200 Boot

ntroduce you tsion®. This tut

ense for use wIf you do not inersion of Keil R

e of commercia component o

on Kit: For sa

? particularly su

ntegrated Debur and Linker toples and is easy

called RTX isand was create

areness window

See www.kei

ULINK™2, Ue. µVision also

ugger features

port is includedably.

nfineon 8051 an

e features:

ate for Watch, sive to your pro

akpoints (can b

Viewer: a kern

h variables upd

ng DAVE to co

rds suppoes, other evaluan Kit, XMC110

iewer (data tra. These feature

0 Boot Kit board

version of this

Boot K Su

Kit Version

o the Infineon torial will use t

ith Infineon XMnstall a license,RTX™ RTOS

al grade middlof MDK-Profe

afety certificatio

uited for Cortex

ugger, Flash prooolchain. MDKy to get running

s included withed and is main

w that is updat

l.com/appnote

LINK-ME, ULo supports CM

are supported

d for one year a

nd C166 proce

Memory and Rogram. No CP

e set/unset on-

nel awareness p

dated in real-tim

onfigure and cr

orted: ation boards fro00 2Go Kit and

ace) and ETM (es are describe

1

s document is

Kit: Cormmer 201 2.0 Robert Bo

Cortex™-M0 the on-board J-

MC1000 proce, you can still u. RTX source

leware for Infinssional. See w

on applications

x-M processor

ogrammer and K is a turn-key g.

h MDK with sotained by Keil

ted in real-time

s/files/apnt_25

LINKpro or SeSIS-DAP.

in the µVision

and is easily ren

essors. See ww

RTX Threads wU cycles are st

-the-fly) and fo

program for RT

me as the progr

reate µVision B

om Infineon usd XMC4500 H

(instruction traed in their respe

Copyright ©

www.keil

here: www.ke

rtex-M014 oys bob.boys

processor fam-Link Lite debu

essors. See wwuse this lab. Mcode is includ

neon processorwww.keil.com/

s: www.keil.c

r users:

the ARM product

ource code. .

e.

58.pdf

egger J-

n debugger.

newable. This

ww.keil.com/dd

windows. Memtolen. No instr

our Watchpoint

TX RTOS that

ram is running

Blinky, RTX_B

sing ARM procHiLight. See w

ace) on those Cective labs.

© 2014 ARM Ltd. All rig

l.com

eil.com/appnot

0 Lab

@arm.com

mily using the Aug adapter.

ww.keil.com/inMDK will then ded with MDK.

rs. This includ/arm/mdk for m

om/pr/article/1

s helps you get

d for the compl

mory and SVDrumentation co

ts (also called A

updates while

g using a Watch

Blinky and PW

cessors. Thesewww.keil.com/i

Cortex-M4 proc

ghts reserved

tes/docs/apnt_

ARM® Keil® M

nfineon/mdk tohave a 32K co.

des TCP/IP, USmore informatio

1262.htm

your project c

ete list.

D also have Wriode is added.

Access Breaks

the program is

h window.

WM_Blinky pro

e include XMCinfineon.

cessors that inc

_263.asp

MDK™

o obtain ompile

SB, CAN on.

completed

ite access.

s).

s running.

ojects.

C4500

clude these

Copyright © 2014 ARM Ltd. All rights reserved

Infineon XMC1200 Cortex-M0 Lab with XMC1200 Boot Kit board www.keil.com

2

Index:

Part A: Obtaining and Installing MDK and the Examples: 1. Keil Software Download and Installation:: 3

2. Complimentary µVision License: 3

3. The on-board J-Link Lite Debug Adapter: 3

4. Example Programs: 3

5. Getting Started MDK 5 book: 3

6. µVision Software Packs Download and Install Process: 4

7. Testing the J-Link Lite Connection to the XMC1200: 5

8. Installing the J-Link Lite USB Drivers (if necessary) 5

Part B: Stand-alone Project Examples: 9. Blinky Example Program using the XMC1200: 6

10. Hardware Breakpoints: 6

11. Call Stack + Locals Window 7

12. Watch and Memory Windows: 8

13. How to View Local Variables in Watch or Memory Windows: 9

14. System Viewer (SV): 10

15. Access Breakpoints (Watchpoints): Conditional Breakpoints 11

16. RTX_Blinky example program with Keil RTX RTOS: 12

17. RTX Kernel Awareness: 13

18. DSP SINE example using ARM CMSIS-DSP Libraries: 14

19. Creating Your Own MDK 5 project from scratch: 17

Changing the Processor Clock Speed: 19

20. Creating Your Own RTX MDK 5 project from scratch: 20

Part C: Projects created with Infineon DAVE: 21. Blinky: 23

22. RTX_Blinky 30

23. PWM_Blinky 38

Appendix:

24. Document Resources: 47

25. Keil Products and contact information: 48

In

P

1

2Wr

Ka

3TUa

4Tn

5

M

F

A

I

nfineon XMC120

Part A: O

1) Keil So1. Down

2. Install

3. We re

4. If you

5. The ex

6. You d

2) ComplWithout a licenreferred to MD

Keil offers a coa license. Insta

3) The onThe on-board JUSB drivers coas well as instru

4) ExampThe example prnext page descr

5) Getting

More Inform

For more inform

ARM Commu

Infineon Comm

ConcepIn order register bmanual tUsing DYou canproject wDAVE Asoftwarebecome add that Once DAplug-ins DAVE aDAVE wYour pro

Docume

DAVE tuDAVE HUsing D

00 Cortex-M0 Lab

btaining a

oftware Dnload MDK 5.1

l MDK into the

commend you

install MDK o

xamples Blinky

do not need any

imentary nse, MDK funcK Lite. You c

omplimentary Mallation instruct

n-board J-J-Link Lite adaome with DAVuctions on inst

ple Prograrograms are avribes where to

g Started

mation and K

mation about K

unity Forums:

munity Forum

pt: Why Usto successfullybits in complictasks rather easAVE for even

n develop and dwith the periphApps are progre that configureC source files are specific to

AVE creates a for µVision or

and the new filewill not modifyojects can use R

entation and H

utorials are avaHelp is availabAVE with MD

b with XMC1200

and Instal

ownload a1a or later from

e default direct

use the defaul

or the example

y5, RTX_Blink

y external debu

MDK Licections but is limcan use MDK L

MDK license ftions are also a

-Link Lite apter is used exVE download an

alling the USB

ams: vailable where install these ex

MDK 5: O

Keil Contacts:

Keil support for

www.keil.com

m: www.infine

se DAVE ? y configure mocated data sheesily. DAVE tamildly compli

debug your proheral configuraams that are sees elements sucthat are compiyour project. project, you car DAVE are nees will be impoy or delete themRTX RTOS or

Help:

ailable on wwwle by selecting

DK 5: www.ke

0 Boot Kit board

lling MDK

and Instam the Keil web

tory. You can

lt examples dir

s into a differe

ky5, DSP5 and

ug adapters: jus

ense: mited to a 32K Lite for this tut

for Infineon XMavailable at this

Debug Adxclusively in thnd are also incl

B drivers. This

you obtained txamples.

Obtain this usef

:

r Infineon prod

m/forum and

eonforums.com

odern microconts is required.

akes care of theicated developmograms either wations that you elected and conch as peripherailed by DAVE

an easily imporeeded. Do not orted into µVism. r not. Using RT

w.infineon.com Help/Help Co

eil.com/appnote

3

and the E

llation: bsite. www.ke

install into any

ectories for thi

ent directory, y

d PWM_Blinky

st the Boot Kit

compilation siorial. Adding

MC1100 proces URL.

dapter: is lab. Instructluded with MD

s document use

this document a

ful book here: w

ducts please vi

http://commun

m/

ntrollers periphDAVE is a gra

e many details ment can save

with MDK by itselect.

nfigured to youals and other coand/or MDK.

rt this into µVimodify any DA

sion. Create, a

TX simplifies y

m/dave. ontents from ines/files/apnt_2

Copyright ©

www.keil

Examples

eil.com/mdk5/in

y directory, but

is tutorial. We

you will have to

y are available

board, a USB

ize and a few oa license remo

essors. Go to w

tions on configDK. Page 5 cones DAVE 3.1.1

at www.keil.co

www.keil.com

sit www.keil.c

nity.arm.com/g

herals the studyaphical configuthat you do nea great deal oftself or by usin

ur specificationomponents of t They become

ision by doubleAVE created f

add and modify

your developm

nside DAVE. N258.pdf

© 2014 ARM Ltd. All rig

l.com

:

nstall

t this lab uses t

e will use C:\M

o adjust for the

where you got

cable and MD

other limitationoves the limitat

www2.keil.com

guring the J-Linntains a test fo0.

om/appnotes/d

m/mdk5/.

com/infineon

groups/tools/co

y of minute deturation program

eed to understanf time and avoing DAVE to cr

ns. DAVE usethe Infineon prthe base to the

e-clicking on thfiles: do this asy your own sou

ment and provid

Note the conten

ghts reserved

the default C:\K

MDK\ for the ex

e directory diffe

t this documen

DK installed on

ns. In this modtions.

m/infineon/mdk

nk are given. or the J-Link Li

ocs/apnt_263.a

ontent

tails such as m that avoids tnd completely.id many errors.reate the initial

s them to creatrocessor. These source files y

he gpdsc file. necessary with

urce files and

des useful bene

nt list on the le

Keil_v5

xamples.

ferences.

nt.

n your PC.

de, MDK is

k/ to obtain

J-Link ite drivers

asp. The

these . . l

te se you

No hin

efits.

eft.

Copyright © 2014 ARM Ltd. All rights reserved

Infineon XMC1200 Cortex-M0 Lab with XMC1200 Boot Kit board www.keil.com

4

6) µVision Software Packs Download and Install Process: 1) Start µVision and open Pack Installer:

1. Connect your computer to the internet. This is normally needed to download the Software Packs.

2. Start µVision by clicking on its desktop icon.

3. Open the Pack Installer by clicking on its icon: A Pack Installer Welcome screen will open. Read and close it.

4. This window opens up: Select the Boards tab: Select Infineon XMC1200 Boot Kit and then select the Packs tab as shown: The Packs tab is now filtered to list only the relevant Pack to the Boot Kit.

5. Note “ONLINE” is displayed at the bottom right. If “OFFLINE” is displayed, connect to the Internet before continuing.

6. If there are no entries shown because you were not connected to the Internet when Pack Installer opened, select Packs/Check for

Updates or to refresh once you have connected to the Internet.

2) Install The XMC1000 Software Pack: The Packs tab should be selected by default.

1. Initially, the Software Pack ARM::CMSIS is installed by default. These contain system headers and source files.

2. Select Infineon::XMC1000_DFP and click on Install. This Software Pack will download and install to C:\Keil_v5\ARM\Pack\Infineon\XMC1000\ by default. This download can take two to four minutes.

3. A Software Pack status is indicated by the “Up to date” icon:

TIP: If you click on the Devices tab, you can select the processor you are using and only the relevant Packs are displayed.

3) Install the CMSIS-RTOS Blinky MDK 5 Example:

1. Select the Examples tab.

2. Select CMSIS-RTOS Blinky as shown:

3. Select Copy as shown here:

4. The next window opens up: Select Use Pack Folder Structure and unselect Launch µVision:

5. Type in C:\MDK. Click OK to copy the RTX_Blinky project.

6. This will copy to C:\MDK\Boards\Infineon\XMC1200 Boot Kit\. Pack Installer creates the rest of the directory tree after C:\MDK\.

TIP: The default directory for copied examples the first time you install MDK is C:\Users\<user>\Documents. For simplicity, we will use the default directory of C:\MDK\ in this tutorial. You can use any directory you prefer.

7. Close the Pack Installer. You can open it any time by clicking on its icon.

8. Select Yes when Reload Packs? box is displayed. This updates the µVision Pack database.

4) Install the Blinky5, RTX_Blinky5 and DSP5 examples from Keil.com:

1. Obtain the example software zip file from www.keil.com/appnotes/docs/apnt_263.asp.

2. Unzip this into the directory C:\MDK\Boards\Infineon\XMC1200 Boot Kit\.

3. Blinky5, DSP5, PWM_Blinky, RTX_text and RTX_Blinky5 folders will be created:

TIP: An Update icon means there is an updated Software Pack available for download.

TIP: If you look in C:\Keil_v5\ARM\Pack\Infineon\XMC1000_DFP\1.0.2\Boards\Infineon\XMC1200 Boot Kit, you will find another RTX_ Blinky. This is the read-only version that you downloaded for backup purposes. Use only the projects you copied over from the Examples tab to the directory you chose: in this tutorial we have used C:\MDK.

The next page has a few notes on Software Packs Maintenance plus how to test the J-Link debug connection:

In

S

7

Tths

8Tin

TT W

nfineon XMC120

Software 1. Softw

2. You c

3. The Pa

Pack b

4. To com

5. If an u

6. Examp

7. Pack f

7) Testing

1. Start µ

2. Select

3. Select

4. Select

5. Click an ICOcontin

6. A num

7. If noth

8. Make to 3.3Vare setUSB D

9. If you driverthe Co

10. Click

TIP: To refreshis window. T

setting.

8) InstallThe DAVE 3.1nstall the J-Lin

1. Unplu

2. To use

3. Plug in

4. Run th

5. If the i

TIP: MDK 5 aThey are also a

We recommen

00 Cortex-M0 Lab

Packs Maare Packs are d

an delete a Pac

ack is now rem

by clicking on

mpletely remov

updated Pack is

ple files, if pro

file is not avail

g the J-Li

µVision i

t Project/Open

t the Blinky pro

t Target Option

on Settings: anODE and Devinue with this tu

mber in the SN:

hing or an error

sure the DIP sV. Confirm Pot correctly, seeDrivers:

see a proper ds are installed p

oreSight debug

OK twice to cl

sh the SW DevThe XMC1200

ling the J-.10 download

nk separately fr

ug the Boot Kit

e the UART fe

n the Boot Kit

he test above ag

installer asks y

also contains J-available here:

nd you use the

b with XMC1200

intenancedownloaded an

ck by double-c

moved but the o

this icon:

ve it: right-clic

s available, the

ovided by a Pac

able on-line. I

nk Lite Co

if it is not alrea

Project.

oject C:\MDK\

ns or ALT

nd the window ce name is disp

utorial. Click o

: box means µV

r is displayed i

witches are allort: is set to SW the next step:

display as showproperly and µ

g module in the

lose these wind

vice box, in the will not work

-Link Lite contains the co

from DAVE. T

t board. Install

ature make sur

board and it w

gain to confirm

you to replace t

-Link drivers hGo to www2.k

J-Link driver

0 Boot Kit board

e Notes: nd installed on

licking on it. A

original compre

ck on the Pack

e Update icon a

ck, can be copi

It might be loca

onnection

ady running. C

\Boards\Infineo

-F7 and select

below opens uplayed, J-Link

on OK twice to

Vision is succe

in this SW Dev

l ON and the juW and not JTA

8) Installing th

wn, your J-LinkµVision is conne Infineon proc

dows. Continu

Port: box selewith JTAG se

USB Driveorrect J-Link UThis is easy to d

l the software i

re the J-Link-O

will enumerate n

m everything is

the drivers in M

here: C:\Keil_vkeil.com/infine

rs that came w

5

your computer

A Remove icon

essed file you

name or Unpa

appears. You c

ied into a direc

ally downloade

:

Connect the Bo

on\XMC1200 B

the Debug tab

up: Select SW Lite is workin return to the µ

essfully connec

vice box, this m

umper is set G. If these he J-Link

k USB nected to essor.

ue to the next p

ct JTAG and thlected, only SW

ers: (this iUSB driver softdo. This file is

in the usual fas

OB with CDC i

normally.

s operating prop

MDK or µVisio

v5\ARM\Seggeon/mdk/ and s

with your vers

Copyright ©

www.keil

r with the Insta

n appears. Cli

downloaded is

ack icon and se

can download t

tory of your ch

ed on your com

oot Kit board to

Boot Kit\Blink

b:

in the Port: bong. You can µVision main m

cted to the J-Li

must be correct

page since your

hen select SW W. But, this is

is needed otware for the Bs Setup_JLinkA

shion using the

is selected:

perly.

on, select or al

ger\USBDriver\select:

sion of DAVE

© 2014 ARM Ltd. All rig

l.com

all icon.

ck on this.

s still present:

elect Delete Pac

this update (or

hoice.

mputer.

o your PC with

ky5\Blinky.uvp

ox. If

menu.

ink Lite adapte

ted before you

r J-Link driver

again. You cas a useful way t

nly if the abBoot Kit board.ARM_V484f.e

e suggested def

low this.

\CDC for the B

. These should

ghts reserved

You can reinst

ck.

r not).

h a USB cable.

projx.

er.

can continue.

s are correctly

an also exit theto refresh the S

bove test fa. You must maexe for DAVE

faults.

Boot Kit board

d be V 4.84f fo

tall the

operating.

en re-enter SW

ils) anually 3.1.10.

d.

for 3.1.10.

In

P9Wth

1

Tthc

T

Tpw

nfineon XMC120

Part B: St9) Blinky We will conneche on-board J-

1. Conne

2. Start µ

3. SelectC:\MD

4. Comp

5. Progra

6. Enter Note:

7. Click

The five LE

Now you kn

Note: The b

10) Hardw1. With B

Blinky

2. A red

3. The ye

4. The cyClick indica

5. Each tit reac

6. Note yprogra

7. The Xdoes nimportseries

8. If you Sometfor on

9. Remo

TIP: If you gethe relationship

compiler optim

This level is set

TIP: Enable Uprograms. If yowill not generat

00 Cortex-M0 Lab

tand-alon Example ct the Keil MDLink Lite. It is

ect your Boot K

µVision by clic

t Project/Open DK\Boards\Infi

ile the source f

am the XMC F

Debug mode bµVision is con

on the RUN ic

EDs on the B

now how to co

board will start

ware BreaBlinky runningy.c in the main

circle is create

ellow arrow is

yan arrow is a mon a line in on

ated in the other

time you click ches the next br

you can set andam is running w

XMC1200 has 4not execute the tant feature forCortex-M4 ha

set too many btimes µVision e of its interna

ove the hardwa

t multiple cyanp between the C

mization to Leve

t in Options fo

Use MicroLIB uour program iste any errors.

b with XMC1200

e Project Program

DK developmens easy to config

Kit board to yo

cking on its des

Project. Openfineon\XMC12

files by clickin

Flash by clickin

by clicking on tnfigured to pro

con. Note

Boot Kit bo

ompile a prog

Blinky stand-a

akpoints: g, click in the le() function as s

ed and soon the

where the prog

mouse selectede window and r window.

on RUN, the preakpoint.

d unset hardwawith ARM Cor

4 hardware breinstruction it i

r effective debus 6 hardware b

breakpoints, µVwill use one ofl operation suc

are breakpoin

n arrows or havC source and asel 0 and rebuild

r Target u

under the Targs allowed to use

0 Boot Kit board

Examples using thent system usinggure µVision t

our computer w

sktop icon.

n the MDK Blin00 Boot Kit\Bl

ng on the Rebui

ng on the Load

the Debug iconogram the Flash

e: you stop the

oard will no

gram, load it

alone. Blinky i

eft margin on ashown below:

e program will

gram counter i

d pointer and isthis place will

program will ex

are breakpointsreSight technol

akpoints. A bris set to. This iugging. The X

breakpoints.

Vision will notf the available ch as single ste

nt(s).

ve trouble undessembly, try loding your proj

under the C/C+

get tab to createe MicroLIB, th

6

s: e XMC1200g the XMC evato use any othe

with a USB cab

nky5 project filinky5\Blinky.

ild icon. .

icon: Pro

n. Select Oh when enterin

e program with

ow blink in s

into the XMC

s now perman

a darker gray b

stop at this po

s pointing to in

s associated wibe

xecute until

while the logy.

reakpoint is a very

XMC4000

tify you. breakpoints pping.

erstanding owering the ect.

++ tab.

e smaller he compiler

Copyright ©

www.keil

0 Boot Kitaluation board.er supported ad

ble.

ile that you copuvprojx.

You can also

ogress will be i

OK if the Evalung Debug mode

h the STOP ico

sequence.

C processor Fl

ently program

block somewhe

oint.

n both the disa

ith the yellow b

© 2014 ARM Ltd. All rig

l.com

t board: This project i

dapter.

pied on page 4

use the Build i

indicated in the

uation Mode be. You do not

on.

lash, run it an

med in the Fla

ere appropriate

assembly and so

band in the dis

ghts reserved

is pre-configur

:

icon beside it.

e Output Wind

box appears. have to use Lo

nd stop it.

ash until reprog

e in the while(1

ource windows

sassembly wind

red to use

dow.

oad.

grammed.

1) loop in

s.

dow.

Copyright © 2014 ARM Ltd. All rights reserved

Infineon XMC1200 Cortex-M0 Lab with XMC1200 Boot Kit board www.keil.com

7

11) Call Stack + Locals Window: Local Variables: The Call Stack and Local windows are incorporated into one integrated window. Whenever the program is stopped, the Call Stack + Locals window will display call stack contents as well as any local variables belonging to the active function. If possible, the values of the local variables will be displayed and if not, the message <not in scope> will be displayed.

1. Stop the program and open the Call Stack and Locals window by clicking on its tab.

2. Shown below is the Locals window for the main function when the program counter is in the Delay function. This program spends most of its time in Delay() so it will probably nearly always stop there.

3. Click on Step Out (Ctrl-F11) . Only the main() function will be displayed since the program has exited Delay().

TIP: The contents of the local variables are displayed as well as names of active functions. Each function name will be displayed as it is called from the function before it or from an interrupt or exception. Exactly which local variable that will be visible or not depends on precisely where you stop the program.

When a function exits, it is removed from the list.

The last called function is at the top of this table.

This table is active only when the program is stopped.

4. Click inside the body of the Disassembly window.

5. Click on the Step In icon or F11 until you re-enter Delay():

6. Variables will update as appropriate.

7. Click on the StepOut icon Ctrl-F11 to exit the Delay function to return to main().

8. Remove any breakpoints when you are done. You can click on them individually or Ctrl-B and select Kill All.

TIP: You can modify a variable value in the Call Stack & Locals window when the program is stopped.

TIP: If the Disassembly window is in focus, using Step will cause steps at the assembly code level. If a source file is in focus, steps will be at the C or C++ level.

Call Stack: The list of called functions is displayed when the program is stopped. This is very useful for debugging when you need to know which functions have been called and are stored on the stack.

9. Set a breakpoint in the SysTick Handler function near line 27 in Blinky.c. Click on RUN if necessary.

10. The program will very soon stop executing.

11. The window below will display. Note the three functions displayed:

12. Right click on a function name and try the Show Callee Code and Show Caller Code options as shown here: The appropriate code will be shown in the source and/or disassembly windows.

13. Click on Step and you will soon exit all functions except Main() and will soon be back in Delay.

14. Remove any breakpoints you set.

TIP: Use the Symbol window to locate and view components of your program including variables, structures and arrays. Select View/Symbol Window while in Debug mode.

TIP: For help finding Fault Exceptions see: www.keil.com/appnotes/docs/apnt_209.asp

In

1

WA

T

TWm

Ty

To

M

TS

TP

nfineon XMC120

12) WatcThe WatchCoreSight into the Memanually.

Watch windoAdd a global v

1. Stop th

2. Declar

3. Add th

4. Select

5. Click

6. Enter

TIP: You can

7. Select

8. In Blinopen.

9. count

TIP: You can Watch or Memmanually by do

TIP: To view you copy variab

TIP: To Drag ‘opens, move yo

Memory win1. Right

2. Note taddres

3. Add an

4. Right

5. The da

6. Both t

7. Right-select variab

TIP: No CPU Structures can a

These Read andPort (DAP), wh

00 Cortex-M0 Lab

h and Memh and Memory debugging techemory windowYou can also

ow: variable: Call

he processor

re a global vari

unsigned

he statements n

counter+

if (count

t File/Save All

on Rebuild

Debug mode.

configure a W

t View and sele

nky.c, right cli counter will

ter will update

also block a vamory windows. ouble-clicking

variables and bles from here

‘n Drop into a our mouse into

ndow: click on count

the value of coss a pointer is p

n ampersand “

click in the me

ata contents of

the Watch and

-click with the Modify Memo

ble on-the-fly w

cycles are usedalso be display

d Write accesshich provides o

b with XMC1200

mory Winwindows will hnology that is

w in real-time. right click on a

Stack, Watch

and exit Deb

iable is the usu

d int counter =

near line 61 jus

++;

ter > 0xF) cou

or .

and program

Click on R

Watch window w

ect Periodic W

ck on counterl be displayed a

e in real time.

ariable name dYou can also

<Enter express

their location uthey will be en

tab that is not ao the appropriat

ter and select

ounter is disppointing to: but

“&” in front of

emory window

f counter is di

Memory wind

mouse cursor ory. You can cwhile the progra

d to perform thyed and expand

es are handled on-the-fly mem

0 Boot Kit board

ndows anddisplay updates a component It is possible t

a variable and

and Memory w

bug mode.

ual manner (I c

= 0;

st after Delay(1

unter = 0;

m the Flash wit

RUN .

while the progr

indow Update

r and select Adas shown here:

drag and drop itenter a variablsion> or press

use the Symbontered fully qu

active, pick upte window and

t Add counter t

playing its addrt this not what

the variable na

w and select Un

isplayed as sho

dows are update

over the desirechange a memoam is still runn

hese operationsded.

by the Serial Wmory accesses.

8

d how to ued variable valuof Cortex-M p

to “drag and drselect Add var

windows can’t

alled it counte

1);

th Load .

ram is running.

if necessary:

dd counter to …:

t into e F2 and use cop

l window. Selualified.

p the variable and release the va

to … and selec

ress in Memorywe want to see

ame and press

nsigned/Int.

own here:

ed in real-time

ed data field anory location or ning.

s. You can hav

Wire Debug (SThe next page

Copyright ©

www.keil

use them:ues in real-timeprocessors. It irop” variable nrname to.. and

see local varia

ter) near line 2

. You can also

… and select W

py and paste or

lect View/Sym

and hold it overariable.

ct the Memory

y 1 as if it is a e at this time.

Enter. The ph

.

nd

ve more than o

SWD) connectie describes how

© 2014 ARM Ltd. All rig

l.com

e. It does this is also possible

names into windselect the appr

ables unless sto

20 in Blinky.c

o do this with a

Watch 1. Watc

r typing the var

mbol Window w

r the tab you w

1 window.

pointer. This

hysical address

one variable dis

ion via the Corw this works.

ghts reserved

using the ARMe to “put” or indows or enter tropriate window

opped in their f

:

a Memory wind

ch 1 will autom

riable name.

while in Debug

want to open; w

is useful to see

is (0x2000_01

splayed.

reSight Debug

M nsert values them w.

function.

dow.

matically

g mode. If

when it

e what

184).

Access

In

1

HA

T

Tinoaqli

T

Ts

u

Hµavw

nfineon XMC120

13) How 1. With t

2. There

3. Enter

4. Note i

5. Stop this becafunctio

6. Click

7. Stop th

8. The on

9. µVisiofunctio

10. Stop th

How to viewAll you need to

1. In the

TIP: You can a

2. Comp

3. To pro

4. Note c

5. Stop t

6. Click

TIP: You musnitially stoppin

open the View/automatically fqualified is \\Bline directly int

7. You c

8. Stop th

TIP: View/Per

TIP: To progrselect the “Upd

using the LOAD

How It WoµVision uses Aalways non-intrvalues without writes to the sa

00 Cortex-M0 Lab

to view Lothe program sti

is a local varia

curTicks into

it says <cannot

he program ause this progron and therefor

on Step Out

he program if i

nly time a loca

on is unable to on Delay is run

he program if i

w local variao do is to make

declaration for 32

also make a va

ile the source f

ogram the Flash

curTicks is sti

the program.

on RUN and c

st fully qualify ng the program/Symbols windfully qualifies tlinky\Blinky.c\to the Watch or

an also enter a

he CPU fo

riodic Window

am the Flash adate Target befo

D icon. Pr

orks: ARM CoreSighrusive. While stealing any Cme memory lo

b with XMC1200

ocal Variaill running:

able curTicks

Watch 1 wind

t evaluate> or “

and the valueram spends more is very likely

Ctrl-F11 a

it is running

al variable valu

determine the nning. It disap

it is running

bles updatee curTicks stat

r curTicks, adstatic

ariable global o

files by clickin

h, click on the

ll not updated

. The progr

curTicks will n

a variable in om while it is in sdow and copy tthe variable. In\Delay\curTickr Memory win

a variable into a

or the next step

w Update must

automatically wfore Debugging

rogramming th

ht technology tothe CPU is fetc

CPU cycles. Thocation at exact

0 Boot Kit board

ables in th

declared near l

dow by right cli

“not in scope”.

e of local will dst of its time iny to stop in it.

few times to e

. will now re

ue will be displ

value of curTippears in functi

. Exit Debug

ed in real-timtic where it is d

dd the staticuint32_t cur

or have it as par

ng on the Rebui

Load icon.

in real-time. Y

ram will probab

now update in r

order for it to upscope. To do tthe variable fron this case, curks. You also cadows from the

a Memory win

p. Select File/S

be selected. O

when you enterg” box. This is

he Flash will be

o read or write ching instructihis can be slightly the same tim

9

he Watch o

line 32 in Blink

icking on it and

display. This n the Delay

exit Delay.

ead “Not in Sco

ayed is if the p

icks when the ions and handle

g mode.

me: declared in Blin

c keyword like rTicks;

rt of a structure

ild icon .

. Enter Debu

You must first

bly stop in Del

real-time.

pdate without this, you can om there. This rTicks fully an enter this te

e Symbol windo

dow. Rememb

Save All or

Otherwise varia

r Debug mode s set by default

e automatically

memory locatons at full spee

htly intrusive inme. Then, the

Copyright ©

www.keil

or Memor

ky.c in the Del

d selecting Ad

ope”

program happen

program is runers outside of D

nky.c !

this:

e so it will upd

Select File/Sav

ug mode. C

show it to µVi

lay() and a valu

ext ow.

ber to prefix it

.

ables update on

select Target Ot in the two Bli

y done when yo

tions without sted, the CoreSign the unlikely eCPU will be st

© 2014 ARM Ltd. All rig

l.com

ry window

lay() function:

dd curTicks to

ns to stop whil

nning because Delay.

date in real-tim

ve All or .

Click on RUN

ision by stoppin

ue for curTick

with an &.

nly when the pr

Options , seinky projects.

ou enter Debug

tealing any CPght debug modevent the CPUtalled to allow

ghts reserved

ws:

uint32_t cur

.... Watch 1.

le it is in scope

it exists only w

me.

.

ng when it is in

ks will now be

rogram is stopp

elect the UtilitiThis means yo

g mode. .

PU cycles. Thidule can read o

U and µVision rthis access to

Ticks;

e.

when the

n scope.

displayed.

ped.

ies tab and ou can skip

s is nearly r write

reads or occur.

In

1Tvath

G

Tdw

Sti

S

Tptip

Ypinf

nfineon XMC120

14) SysteThe System Viviews are updatare two ways tohe Core Periph

1. Click

GPIO Port 1:

2. Select

3. This w

4. You c

TIP: If you clidescription abowindow.

SysTick Timerimer to determ

Select Peripher

1. The PP

2. Note ttechno

3. Expanthe Sy

4. Note tprogracan ch

5. In the

6. The bl

7. Replac

8. You c

9. When

TIP: It is true:program is runniming value ch

program, run cy

You must makeproperly react tndiscriminately

find problems.

00 Cortex-M0 Lab

em Viewerewer provides ted in real-timeo access these Vherals are also

on RUN. You

t Peripherals/Sy

window opens u

an now see the

ick on a registeout this register

r: This programine the period

rals/System Vie

PB window sh

this window upology as the W

nd the SYST_RysTick_Config(

that it is set to 0ammed into Syhange how ofte

RELOAD reg

linking LEDs w

ce RELOAD w

an look at othe

you are done,

you can modining. This is vhanges instead ycle.

e sure a given pto such a changy is a good wa

b with XMC1200

r (SV): the ability to ve while your prViews: a) Vieavailable: Not

u can open SV w

ystem Viewer

up. Expand OU

e pins update:

er in the properr will appear at

am uses the Corof the LEDs.

ewer and then

hown below op

pdates in real-tiWatch and Mem

RVR register. T(SystemCoreC

0xC34FF (dec ysTick_Config(en the SysTick

ister in the Sys

will speed up.

with 0xC34FF.

er Peripherals c

stop the progr

ify values in thvery useful for of the usual m

peripheral regige. Changing say to cause seri

0 Boot Kit board

view and modifrogram is runn

ew/System Viewte the various p

windows when

and then PORT

UT:

rties column, at the bottom of

rtex-M0 SysTi

select PPB.

ens:

ime while yourmory windows.

This is the relolock /10); line

799,999). Thi() in main() in timer creates i

sTick window,

This will conv

A CPU RESE

contained in th

am and clo

e SV while themaking slight

modify, compile

ister allows andsuch values ous and difficu

10

fy registers in tning. These Viewer and b) Perperipherals ava

n your program

TS and select P

a f the

ick

r program runs

oad register valin main().

is results from Blinky.c. Chaits interrupt 15

while the prog

vince you of th

ET will als

e System View

ose all the Syst

e

e,

d will

ult to

Copyright ©

www.keil

the CPU core aews are availabripherals/Systeailable:

m is running.

PORT0.

s. These windo

lue. This is set

the hex value anging the varia.

gram is runnin

he power of AR

so do this. The

w windows.

tem Viewer wi

© 2014 ARM Ltd. All rig

l.com

and in peripherble only while em Viewer. In

ows use the sam

t during the Sy

of (8,000,000/able passed to

ng, type in 0x50

RM CoreSight

e program will

indows that are

ghts reserved

rals. In most cin Debug modthe Peripheral

me CoreSight D

ysTick configur

/10)-1 that is this function is

0000 and press

debugging.

l restart after R

e open.

cases, these de. There ls menu,

DAP

ration by

s how you

s Enter !

RESET.

In

1TWW

Tc

YwL

Twb

TBdnYK

Ttw

TA

nfineon XMC120

15) AccesThe XMC1100Watchpoints arWatchpoint is h

1. Use th

2. We wi

3. Select

4. Select

5. In the

TIP: An Accecounter) is not

You can use <, works with anyLite. This featu

6. Click

7. Click

8. Enter

9. Set co

10. Click

11. When shown

12. Click

13. countturnedis becaMinim

14. Stop th

15. SelectKill A

16. Exit D

TIP: You cannwhile the progrbreakpoints.

TIP: To edit anBreakpoints widown into the cnow. Clicking You should delKill Selected or

TIP: The checkemporarily uns

without deletin

TIP: Raw addrAn example is:

00 Cortex-M0 Lab

ss Breakp0 Cortex-M0 prre referred to ashit, µVision mu

he same Blinky

ill use the glob

t Debug in the m

t Access to Rea

Expression bo

ss Breakpoint intrusive. It is

> and ==. Cuy Keil ULINK. ure will be add

on Define or p

on Close.

the variable co

ounter to zero in

on RUN. .

the program dn below: In thi

on RUN twice

ter might not ud off in µVisionause µVision m

mize this by sel

he CPU if it is

t Debug/BreakpAll and then sele

Debug mode.

not configure Aram is running

n Access Breakindow and its inconfiguration aon Define will

lete the old oner try the next T

kbox beside thselect or disablg it.

resses can be u *((unsigned l

b with XMC1200

points: Conrocessor has tws Access Breakust test the mem

y configuration

bal variable cou

main µVision w

ad. (or write or

ox enter: “coun

that does not us the test that is

urrently, in MD It does not wo

ded in a future v

press Enter and

ounter in Wat

n the Watch w

.

detects a read ais case the valu

e and the progra

update in the Wn for speed conmust test the colecting only Re

running.

points (or Ctrl-ect Close.

Access Breakpolike you can w

kpoint: double-nformation wil

area. Make youl create anothee by highlightinTIP:

e expression alle an Access B

sed with a Acclong *)0x20000

0 Boot Kit board

nditional Brwo Watchpointsks in Keil documory location.

n as the previou

unter you cre

window and th

r both if you pr

nter > 0x5”

use a data values intrusive.

DK 5.10, counteork with the J-version of MD

d the expression

tch 1 if it is no

indow. This p

ccess of > 0x5ue is 6.

am will run to

Watch windownsiderations duondition by stopead or Write Ac

-B) and delete

oints on-the-flywith hardware

-click on it in tll be dropped ur modificationr Watchpoint. ng it and click

llows you to Breakpoint

cess Breakpoin0004)

11

reakpoints s. Watchpoint

uments. Cortex Cortex-M3/M

us page. Stop t

eated in Blinky

hen select Brea

refer)

” without the qu

e (i.e.

er == 0x5 Link

DK.

n will be move

t already there

uts counter to

to counter a

the next read o

w depending on uring the test. Ypping the progccess and not b

the Watchpoin

y

the

ns on

nt.

Copyright ©

www.keil

ts can be thougx-M0 WatchpoM4 Watchpoint

the program if

y.c to explore W

akpoints or pres

uotes. This wi

ed into the Curr

e.

less than 0x5 w

as you selected

or write to coun

n how fast the vYou will also n

gram when the both.

nt with

© 2014 ARM Ltd. All rig

l.com

ght of as conditoints are slightlts are not intru

necessary.

Watchpoints.

ss Ctrl-B.

indow will disp

rent Breakpoin

which is the tes

d, the program w

nter. It will sk

variable is channotice the progwrite or read o

ghts reserved

tional breakpoily intrusive. Wsive for the equ

Stay in debug

play:

nts box as show

st value.

will stop. See

kip values 0 thr

nged. This featgram slows dowoccurs to coun

ints. When the

uality test.

g mode.

wn below:

Watch 1

rough 5.

ture is wn. This nter.

In

1KavR

T

Gim

nfineon XMC120

16) RTX_Keil provides Rand no royalty pversions. See wRTX. Keil wil

1. Start µexamp

2. Exit D

3. Select

4. Comp

5. To pro

6. Enter

7. The L

8. Click

The Configu1. In the

2. Click

3. Click

4. Open u

5. See ho

6. This is

7. You c

8. This sSee w

Getting Stmplementing a

00 Cortex-M0 Lab

_Blinky ExRTX, a full featpayments are rwww.arm.com/l work with an

µVision by clicple previously.

Debug mode if

t Project/Open

ile the source f

ogram the Flash

Debug mode b

EDs will blink

on STOP .

ration WizaProject window

on the RTX_C

on Configurati

up the individu

ow easy it is to

s a great featur

an create Conf

cripting languaww.keil.com/s

tarted MDand managing R

Text Edito

b with XMC1200

xample Proture RTOS. Rrequired. RTX/cmsis and C:\K

ny RTOS. A re

cking on its ico Instructions a

necessary.

Project and op

files by clickin

h manually, cli

by clicking on t

k according to t

rd for RTX: w, double click

Conf_CM.c sou

ion Wizard at t

ual directories

modify these

re as it is much

figuration Wiza

age is shown bsupport/docs/27

K 5: ObtainRTX.

or: Source Co

0 Boot Kit board

ogram witRTX is includedX has a BSD typ

Keil_v5\ARMeal-time awaren

on if not alreadyare provided on

pen C:\MDK\B

ng on the Rebui

ick on the Loa

the debug icon

the four thread

k on RTX_Con

urce file tab as

the bottom and

to show the va

settings here a

h easier changin

ards in any sou

elow in the Te735.htm for ins

n this book here

ode

12

th Keil RTd as part of the pe license. RT\Pack\ARM\Cness viewer for

y running. n the bottom of

Boards\Infineon

ild icon.

d icon. . A

n and click

ds in this progra

nf_CM.c to op

shown below o

d your view wil

arious configur

s opposed to fi

ng items here t

urce file with th

ext Editor as costructions to ad

e: www.keil.co

Copyright ©

www.keil

TX RTOS: Keil MDK too

TX with sourceCMSIS\4.1.0\CM

r RTX is provi

You must hf page 4.

n\XMC1200 B

. They will co

A progress bar w

k on the RUN ic

am.

en it in a Sourc

on the left belo

ll change to the

ration items ava

inding and cha

than in the sour

he scripting lan

omments startindd this feature

om/mdk5/. It h

Confi

© 2014 ARM Ltd. All rig

l.com

ol suite. It cane code is providMSIS_RTX. Tided with µVis

have installed t

Boot Kit\RTX_

ompile with no

will be at the b

con.

ce window or w

ow if it is not in

e Configuratio

ailable.

anging entries i

rce code.

nguage as used

ng such as a </to your own so

has very useful

iguration Wiz

ghts reserved

n have up to 25ded with all MThis example esion.

the RTX_Blink

_Blinky5\Blink

errors or warn

bottom left.

with File/Open

n focus.

n Wizard.

in the source co

d in the Text Ed

/h> or <i>. ource code.

l information o

zard

5 tasks MDK

explores

ky5

ky.uvprojx.

nings.

n.

ode.

ditor.

on

In

1Uuc

D

B

MIRinTT

nfineon XMC120

17) RTX KUsers often wanusually stored icompanies also

1. Run R

2. Open grab thread w

3. Select

1. You wNo insexecut

2. µVisioseries VieweCoreSwindodoes hcan beWire V

Demonstrating

Blinky.c contai

1. The gr

2. Set a b

3. Set a b

4. Click

5. When updateis runnindicaabove the run

6. Click

7. Look i

8. Remov

More InformIt is very benefRTX source, vandex.html is th

There are two vThis second on

00 Cortex-M0 Lab

Kernel Awnt to know the in a structure oo provide aware

RTX_Blinky by

Debug/OS Suphe window and

write technolog

t View and sele

will not have tostrumentation cting the os_idle

on also has an does not have

er (SWV) compSight that is neeow. The XMC4have SWV and e displayed as wViewer feature

g States: (not

ins four threads

ray areas oppo

breakpoint on o

breakpoint in o

on RUN .

the program sted in the RTX ning when the ated with a “Ru

shows the pron state. The sta

on RUN .

in the Call Stac

ve the breakpo

mation of obficial to use an arious ports anhe entry point iversions of RTne is CMSIS-RT

b with XMC1200

wareness: number of the

or memory areaeness plug-ins

y clicking on th

pport and selecd move it into tgy as used in th

ect Periodic W

o stop the progrcode needs to be_demon. The

Event Viewer the Serial Wirponent of eded for this 4000 Cortex-M

the Event Viewell as other Ses.

e: Tasks and T

s that blink the

site the line nu

one of these in

one or two othe

tops, this inforTasks windowprogram stopp

unning” state. Tgram stopped ates of the othe

The other thre

ck and Locals w

oints and close

taining andRTOS. RTX id documentatiointo the documX: The first coTOS complian

0 Boot Kit board

e current operata by the RTOSfor µVision.

he Run icon.

ct System and Tthe center of th

he Watch and M

indow Update

ram to view thibe inserted intoe processor spe

which displaysre

M4 wer erial

Threads are use

e LEDs. Threa

umbers indicate

Thread 1 as sh

er threads.

rmation will bew. The Task thaped will be The window and phaseA is er tasks are dis

ead will show a

window to disp

the RTX Task

using RTX:is a good choicon are here: C

mentation. omes with MD

nt and this is the

13

ting task and th. Keil provide

Thread Viewerhe screen. TheMemory windo

if these values

is data. No CPo your source. ends relatively

s RTX threads

ed interchangea

ad 1 (phaseA) i

e there is valid

hown: (but not

e at

in splayed as well

as “Running”.

play the stack.

ks window. Ex

ce. It is small,

C:\Keil_v5\ARM

DK 4.7x and eare one you wan

Copyright ©

www.keil

he status of it aes a Task Awar

r. The windowese values are uows.

s do not change

PU cycles are u In this exampllittle time in ea

in a graphical

ably in Keil M

is shown below

assembly code

t on the void p

l.

Each time you

xit Debug mode

efficient and eM\Pack\ARM\

arlier. The secont to use.

© 2014 ARM Ltd. All rig

l.com

and the other tare window for R

w below opens updated in real-

e:

used. Your prole, most of theach task. You

format. The X

DK documenta

w:

e located here.

phase line)

u click RUN, th

e:

easy to use yet \CMSIS\4.1.0\

ond comes with

ghts reserved

asks. This infoRTX. Other R

up. You migh-time using the

ogram runs at f time the CPU can change th

XMC1000 Cor

ation)

he next thread

it is full featurCMSIS_RTX.

h MDK 5.10 a

ormation is RTOS

ht have to e same

full speed. is

is.

rtex-M0

will run.

red.

and later.

In

1AMta

T

Tac

Tli

TC

S

TmS

Iw

S

nfineon XMC120

18) DSP SARM CMSIS-DMDK in C:\Keab: C:\Keil_v5

The appropriate

This example cadded, and thencontain each ta

This example inicense. Source

To obtain this eC:\MDK\Board

1. Stop th

2. Select

3. Build

4. Progra

5. Enter

6. Click

7. Open

8. Four gIf thesproper

9. Each o

Serial Wire Vi

The Infineon Xmentioned abovSWV so this sc

If you use an Inwindows plus m

See www.keil.c

00 Cortex-M0 Lab

SINE examDSP libraries ail_v5\ARM\Pa5\ARM\Pack\A

e DSP library i

creates a sine wn the noise is fisk.

ncorporates Kee code is provi

example file, gds\Infineon\XM

he program an

t Project/Open

the files.

am the XMC12

Debug mode b

on the RUN ic

Watch 1 by sel

global variablese variables arerly.

of these variab

iewer (SWV) a

XMC4000 Cortve will be dispcreen is shown

nfineon XMC4many other Ser

com/appnotes/d

b with XMC1200

mple usinare offered for ack\ARM\CMSARM\CMSIS\4

is selected in th

wave to which ailtered out leav

eil RTX RTOSded.

o to www.keilMC1200 Boot K

d exit Debug m

Project and op

There will be

200 Flash by cl

by clicking on t

con.

lecting View/W

s will be displae changing the

les represent th

and ETM Inst

ex-M4 processlayed in the Lofor reference o

4000 Cortex-Mrial Wire View

docs/apnt_231

0 Boot Kit board

g ARM CMCortex-M0, Co

SIS\4.1.0\CMS4.1.0\CMSIS \i

he RTE window

another sine waving the origina

S. RTX is avai

l.com/appnoteKit\. A \DSP5

mode if necessa

pen: C:\MDK\B

e no errors or w

licking on the L

the Debug icon

Watch/Watch 1

ayed in Watch program is mo

he value of one

truction Trace

sors have Seriaogic Analyzer only to give yo

M4 and with anywer (SWV) feat

.asp. This doc

14

MSIS-DSP ortex-M3 and C

SIS\DSP_Lib. index.html

w:

ave (to represeal sine wave. F

lable free with

es/docs/apnt_2 directory will

ary.

Boards\Infineo

warnings.

Load icon:

n. Select O

1 if necessary.

1 as shown heost likely worki

e of four wavef

e: (only for ref

al Wire Vieweras shown below

ou an idea on w

y Keil ULINK tures. Infineon

cument shows h

Copyright ©

www.keil

LibrariesCortex-M4 proDocumentatio

ent noise) is Four threads

h a BSD type

263.asp and cobe created. Y

on\XMC1200 B

Progress will

OK if the Evalu

ere: ing

forms created b

ference)

r (SWV). The w. The Infineo

what is happeni

or a J-Link, yon Cortex-M4 pr

how SWV and

© 2014 ARM Ltd. All rig

l.com

: ocessors. DSPon can be acces

opy the MDK 5You might have

Boot Kit\DSP5

l be indicated i

uation Mode b

by the DSP pro

four waveformon XMC1000 ing in this exam

ou can use thisrocessors also h

d ETM trace wo

ghts reserved

libraries are pssed here: Selec

5 version into e already done

5\sine.uvprojx.

in the Output W

box appears.

ogram.

ms of the globaseries does notmple.

s Logic Analyzhave ETM trac

orks on the XM

provided in ct the DSP

this.

Window.

al variables t have

zer ce.

MC4000.

In

R

T

Tf

T

Taa

nfineon XMC120

RTX Tasks a

3. Click

4. Open

5. This wThe pr

6. Set a b

H

1)

7. The prnoise_

8. The os

TIP: os_idle_d

9. Set an

10. Each tstate.

TIP: Remembfor run to main

TIP: Recall th

TIP: You migand this featureadapter.

00 Cortex-M0 Lab

nd System:

on the RUN ic

Debug/OS Sup

window updaterocessor spend

breakpoint in o

Here are the fou

) sine_gen (88

rogram will sto_gen thread: Y

s_idle_demon

demon has a Pr

nother breakpoi

time you click

ber you have on() and single-s

his window use

ght have noticee is available on

b with XMC1200

con if the progr

pport and selec

s in real-time. ds relatively litt

one of the threa

ur threads with

8) 2) noise_ge

op here and theYou can see tha

is Ready to run

riority of 0 wh

int in a differen

on RUN, the p

nly 4 hardwaretepping. If you

es the CoreSigh

ed the Event Vin the Infineon

0 Boot Kit board

ram is not runn

ct System and T

Note nearly altle time in each

ads in DirtyFilt

their approxim

en (106) 3) d

e Task windowat noise_gen wa

n when noise_g

hich is the lowe

nt task. Click o

program will st

e breakpoints anu select too ma

ht DAP read an

iewer in DebugXMC4000 Co

15

ning.

Thread Viewer

ll the processoh thread. You

ter.c by clickin

mate starting lin

disturb_gen (12

w will be updateas running whe

gen is finished

est priority poss

on the RUN ic

top at one of th

nd sometimes any breakpoint

nd write techno

g/OS Support. rtex-M4 proce

Copyright ©

www.keil

r. A window s

or time is spent can change thi

ng in the left m

ne numbers:

26) 4) filter_t

ed accordinglyen the breakpo

d. No other task

sible. Every o

on.

he two tasks an

µVision mightts, µVision wil

ology to updat

This uses Seressors with any

© 2014 ARM Ltd. All rig

l.com

similar to below

t in the idle daeis if you need t

argin on a grey

tsk (146) 5) sy

y. Here, I set a oint was activat

k is Ready.

other task has a

nd this is indica

t commandeer ll notify you.

te this window

rial Wire Viewy Keil ULINK

ghts reserved

w opens up.

emon os_idle_dto.

y area.

ync_tsk (166)

breakpoint in ted.

a higher priority

ated by the Run

one for its use

in real-time.

er to get its infor Segger J-Lin

demon.

the

y.

nning

e, usually

formation nk debug

In

C

Tw

TT

T

nfineon XMC120

Call Stack an1. Click

windo

2. Each tprograthis inthread

3. Right Callerthere:

4. Stop th

5. Remov

6. Exit D

TIP: Recall thwere set on the

This is the eThe next sectio

The section afte

00 Cortex-M0 Lab

nd Locals: on the Call Sta

ow opens up:

time you click am stops on onnformation is upd is running.

click on an eler Code to go

he program.

ve all breakpoi

Debug mode.

he Call Stack aprevious page

end of the ston describes ho

er that describe

b with XMC1200

ack + Locals ta

on RUN ane of the breakppdated depend

ement and selec

ints.

and Locals wine.

tand-alone eow to create pro

es how to use I

0 Boot Kit board

ab. This

and the points you set, ing on which

ct Callee or

ndow updates o

examples. ojects from scr

Infineon DAVE

16

only when the p

ratch using MD

E to create proj

Copyright ©

www.keil

program is stop

DK 5.

ojects that you c

© 2014 ARM Ltd. All rig

l.com

pped by one of

can easily imp

ghts reserved

f the two break

ort into µVisio

kpoints that

on.

Copyright © 2014 ARM Ltd. All rights reserved

Infineon XMC1200 Cortex-M0 Lab with XMC1200 Boot Kit board www.keil.com

17

19) Creating your own MDK 5 project from scratch: (without DAVE) All examples provided by Keil are pre-configured. All you have to do is compile them. You can use them as a template for your own projects. However, we will start an example project from the beginning to illustrate how easy this process is. Once you have the new project configured; you can build, load and run a bare Blinky example. It will have an empty main() function so it does not do much. However, the processor startup sequences are present and you can easily add your own source code and/or files. You can use this process to create any new project, including one using RTX.

Install the Infineon Software Pack for your processor:

1. Start µVision and leave in Edit mode. Do not be in Debug mode.

2. Pack Installer: The XMC1000 processor series Pack must be installed. This has already been done on page 4.

3. You do not need to copy any examples over.

Create a new Directory and a New Project:

1. Click on Project/New µVision Project…

2. In the window that opens, go to the folder C:\MDK\Boards\Infineon\XMC1200 Boot Kit:

3. Right click in this window and select New and create a new folder. I called it BlinkyNEW.

4. Double click on BlinkyNew to open it or highlight it and select Open.

5. In the File name: box enter Blinky. Click on Save.

6. This creates the project Blinky.uvproj in C:\MDK\Boards\Infineon\XMC1200 Boot Kit\BlinkyNEW.

7. As soon as you click on Save, the next window opens:

Select the Device you are using:

1. Expand Infineon and then XMC1000 Series, then expand XMC1201 and then select XMC1200-TO38x0200 as shown here:

TIP: Processor icons in green are from the Software Packs. Grey icons are from MDK 4.7x.

2. Click OK and the Manage Run Time window shown below bottom right opens.

Select the CMSIS components you want:

1. Expand all the items and select CMSIS/CORE and Device/Startup as shown below. They will be highlighted in Green indicating there are no other files needed. Click OK.

2. Click on File/Save All or select the Save All icon:

3. The project Blinky.uvproj will now be copied to Blinky.uvprojx.

4. You now have a new project list as shown on the bottom left: The appropriate CMSIS files you selected have been automatically entered and configured for the processor you chose. There are no user source files yet.

5. Note the Target Selector says Target 1. Highlight Target 1 in the Project window.

6. Click once on it and change its name to XMC1200 Flash and press Enter. The Target selector name will change.

What has happened to this point:

You have created a blank µVision project using MDK 5 Software Packs. All you need to do now is add your own source files.

TIP: Other components such as File System, Graphics, Network and USB are part of Keil Middleware in MDKpro. Consult Keil tech support.

In

C

A

T

C

T

nfineon XMC120

Create a blank

1. Right

2. This w

3. Highli

4. In the

5. Click

6. Click

7. Expanand Bl

8. It will

Add Some Cod

1. In the

2. Click

3. Build

TIP: You coul

Configure the

1. Select

2. Enter

3. Select

4. Select

5. In the

6. Doubl

7. Click

8. Click

9. Select

10. Selectconne

11. Click

12. Click one fo

13. Click

14. Click

15. Build

The Next Step

00 Cortex-M0 Lab

k C Source Fil

click on Sourc

window opens u

ight the upper l

Name: field, e

on Add to clos

on File/Save A

nd Source Groulinky.c will no

also open in th

de to Blinky.c

blank Blinky.c

on File/Save A

the files.

ld also add exi

Target XMC

t the Target Op

32 in Xtal (MH

t Use MicroLIB

t the Output ta

Browse for Fo

le click on Flas

on the Listing

on the Debug

t the Settings: i

t SW as shown cted to your PC

on OK once to

on the Utilitiesor the Infineon

on OK twice to

on File/Save A

the files.

? Let us run

b with XMC1200

le:

ce Group 1 in th

up:

left icon: C fil

enter Blinky.

se this window

All or

up 1 in the Prow display.

he Source wind

:

c, add the C co

All or

There will be#include

unsigned

/*------ MAIN f *------int main while(

}

sting source fil

1200 Flash: P

ptions icon

Hz). This is us

B to compile sm

ab. Click on Se

older window t

sh to enter this

s tab. Click on

tab. Select J-L

icon.

here in the PoC, you must se

o go back to the

s tab. Select SXMC1200 boa

o return to the

All or

There will be n

your program

0 Boot Kit board

he Project win

le (.c):

.

oject window

dow.

ode below:

e no errors or we "XMC1200.h"

d int counter

--------------function --------------n (void) {

(1) { counter++; if (counter >}

les:

Please complet

. Select the T

sed for timing c

maller code siz

elect Folder for

that opens: righ

folder and clic

n Select Folder

Link/J-Trace C

rt: box: ee a valid IDCO

e Target Confi

ettings and conard:

main menu.

no errors or wa

m and see wha

18

dow and select

warnings if all s

= 0;

--------------

--------------

> 0x0F) counter

te these instruc

Target tab.

calculations.

ze.

r Objects…:

ht click and cre

ck OK. Compi

r for Objects…

Cortex in the U

A JTAGODE and Devic

guration windo

nfirm the corre

arnings if all w

at happens ! B

Copyright ©

www.keil

t

source code wa

-------------

-------------*/

r = 0;

ctions carefully

eate a new fold

ilation files wil

…: Double click

Use: box:

G selection wilce Name in the

ow. Or, fix the

ect Flash algori

was entered cor

But first the cl

© 2014 ARM Ltd. All rig

l.com

as entered corr

/

We wil not d

ly to prevent un

der called Flash

ll now be store

k on Flash and

ll not work. Ife SW Device b

e connection pr

ithm is present

rrectly. If there

lock ! Please

ghts reserved

.

rectly.

do this in this tu

nusual problem

h.

ed in this Flash

d click OK to cl

f your Boot Kitbox at this time

roblem if you h

t: Shown is the

e are, please fix

turn the page

tutorial.

ms…

h folder.

lose.

t board is e.

have one.

e correct

x them !

….

In

C

T

R

Tw

C

WIin

Tc

I

nfineon XMC120

Changing the

This is really ea

1. Open

2. Click

3. Expan

4. Unsele

5. Select

6. To Blithe lin

7. Click

8. Build global

Running Your

1. Conne

2. Progra

3. Enter

4. Click

5. No LE

6. With t

7. count

8. DoublSystemHexad

9. The cl

10. You cdo this

11. You c

TIP: The Watcwithout any tim

Cleaning up yo

We modified thIf you did a Bun .\Flash to kee

1. Exit µ

2. Open C:\MD

3. Delete

4. You c

5. Restar

TIP: If you wacontents are eas

If they need the

00 Cortex-M0 Lab

Processor Clo

asy to do in µV

the file startup

on the Configu

nd the elements

ect “do not mo

t 32 MHz in the

inky.c, just befne SystemCoreC

on File/Save A

the files. l variable Syste

r Program:

ect your XMC1

am the XMC12

Debug mode b

on the RUN ic

EDs will blink

the program ru

ter will be upd

le-click on <EnmCoreClock indecimal Display

lock speed 32 M

an also set a brs, remove the b

ould now be ab

ch 1 window isme delays inser

our Project: (

he folder whereuild before this ep the project m

µVision. Other

Microsoft ExpDK\Boards\Inf

e all files and fo

an also leave a

rt µVision. Sto

ant to save or sesily reconstruc

e .axf executab

b with XMC1200

ock Speed:

Vision. By def

_XMC1200.s b

uration Wizard

s so you can se

ove CLK_Val1

e drop down bo

fore the while(ClockUpdate()

All or

The line SysteemCoreClock t

1200 Boot Kit

200 Flash by cl

by clicking on t

con. Note

since there is n

unning, right cli

dating as show

nter expressionnto Watch 1. Ry.

MHz will displ

reakpoint in Blbreakpoint.

ble to add your

s updated periorted, the values

(you only need

e the output anwas done, thermore organized

rwise, you can’

plorer and navigfineon\XMC12

folders except t

any backup or µ

oring all compi

end the projectcted with a Buil

ble and interme

0 Boot Kit board

fault to process

by double-clic

d at the bottom.

ee these:

to SCU…:

ox:

1) loop, add );

emCoreClockUthat you can di

board to your P

licking on the L

the Debug icon

e: you stop the

no source to ac

ick on counter

wn here:

n> and type theRight click on t

lay in Watch 1

linky.c and the

r own source c

dically, not whs in Watch 1 wi

d to do this onc

nd listings files re will be files d and neat.

’t delete files th

gate to: 200 Boot Kit\B

these: (you can

µVision files th

ilation files sto

t files to someold.

ediary files and

19

sor is set to 8 M

king on it in th

. You can easi

Update is not neisplay in Watch

PC with a USB

Load icon:

n .

e program with

ccomplish this t

r in Blinky.c an

e global variablthe variable and

.

e program shou

ode to create a

hen a variable vill appear to ju

ce: this is not a

are stored. Thin your projec

hat it still has o

BlinkyNEW\.

n delete Flash –

hat use your co

ored in the .\Fla

one, delete the

d are unable to

Copyright ©

www.keil

MHz. We will

he Project wind

ily change valu

eeded to changh 1 to display w

B cable.

Progress wil

h the STOP ico

task. You wou

and select Add

le d unselect

uld stop at this

a meaningful pr

value changes.ump and skip se

a critical step)

his was in Stepct root directory

open.

– a Build will r

omputer or use

ash folder mak

folder Flash to

compile them,

© 2014 ARM Ltd. All rig

l.com

change it to 32

dow or selectin

ues in our sourc

ge the clock spewhat the freque

ll be indicated

on.

uld have to add

counter to … a

point if it is ru

roject. You ca

. Since Blinkyequential value

ps 3 through 7 oy. We want the

recreate it.)

er name to retai

kes it cleaner.

o reduce file siz

, do not delete

ghts reserved

2 MHz.

ng its tab.

ce code here.

eed but providency is.

in the Output W

d such code yo

and select Wat

unning properly

an do this later.

y is running veres you know m

on the precedinem only

in your setting

ze. This folder

them.

des the

Window.

urself.

tch 1.

y. If you

.

ry fast must exist.

ng page.

s.

r and its

In

2TM

Ce

C

B

W

nfineon XMC120

20) CreatThe MDK SoftMDK 4.7x and

Configuring RTexample. You

1. Using

2. In Blin

3. Open

4. Expan

5. Select

6. Appro

7. Click

Configure RTX

1. In the

2. Doubl

3. Select

4. The w

5. Set Tithe set

6. Unsele

7. Click

Build and Run

1. Build

2. Enter

3. Selectwindo

4. You cThe mthreadadded

What you hav

1. You mconfig

2. Progre

Getting Stbook here:includes inand mainta

00 Cortex-M0 Lab

ting your otware Packs maearlier. The s

TX is easy in Mcan use these p

the same exam

nky.c, at the to

the Manage Ru

nd all the eleme

t Keil RTX as s

opriate RTX fil

on File/Save A

X:

Project window

le click on RTX

t the Configura

window is displ

mer clock valutting you select

ect User Timer

on File/Save A

n Your RTX P

the files. P

Debug mode:

t Debug/OS Suow below open

an see two thremain thread is thds to create a re

to this window

e to do now:

must add the RTgured to your n

ess to the next

tarted MDK 5 www.keil.com

nformation on iaining RTX.

b with XMC1200

own RTX akes it easy to econd comes w

MDK 5.10 and procedures to c

mple from the p

op, add this lin

un-Time Envir

ents as shown h

shown and clic

les will be adde

All or

w, expand the

X_Conf_CM.c

ation Wizard ta

ayed here:

ue: to 3200000ted (or not) on

rs. Use default

All or

Program:

Program the Fl

Click on

upport/System as up.

ead listed: os_ihe only one runeal RTX prograw.

TX frameworkneeds.

page.

5: Obtain this m/mdk5/. It implementing

0 Boot Kit board

MDK 5 prconfigure an R

with MDK 5.10

later. These sconvert an exis

preceding page

ne: #include "c

ronment windo

here:

ck OK.

ed to your proj

CMSIS group

to open it.

ab: Select Expa

00 as shown: ( the previous p

ts for the other

lash: .

the RUN icon

and Thread Vi

idle_demon annning. As youam, these will a

k into your code

20

oject fromRTX project. T0 and later. Th

teps use the sasting project to

es, Stop the pro

cmsis_os.h" Th

ow:

ect. See the Pr

.

and All.

(32 MHz) or topage.

r settings.

.

ewer. The

nd main. u add more automatically b

e and create yo

Copyright ©

www.keil

m scratch:There are two vhis second one

ame configuratio operate using

ogram and

he error is OK.

roject window

o

be

our threads to m

© 2014 ARM Ltd. All rig

l.com

: (withoutversions of RTXis CMSIS-RT

ion as in the prRTX.

d Exit Debug m

.

w.

make this into

ghts reserved

t DAVE) X: The first co

TOS compliant.

receding Blink

mode.

a real RTX pro

omes with .

ky

oject

In

AAec

O

nfineon XMC120

Add RTX ConA copy of Blinkexisting Blinkycorrectly.

1. Stop th

2. Add t#i

3. Decla

unun

4. Add a

osos

5. Add T

// Th

vo

6. Add T

// Th

vo

7. Define

osos

8. int ma

9. Creat

titi

10. Send

osos

11. While

12. Select

On the next pa

00 Cortex-M0 Lab

nfiguration souky.c is provide

y.c with this file

he program:

his header fileinclude "RTE_

re Two Globa

nsigned int cnsigned int c

a Thread ID fo

sThreadId tidsThreadId tid

Thread 1: (sta

hread 1 'pha

oid phaseA (vfor (;;) { osDelay(25 os co if os osSignal

}}

Thread 2: (sta

hread 2 'pha

oid phaseB (vfor (;;) { osDelay(25 os co if os os

}}

e each thread:

sThreadDef(phsThreadDef(ph

ain(void) is alr

e the two Thr

id_phaseA = oid_phaseB = o

a signal to Th

sSignalSet(tisDelay(osWait

e(1){ } is alread

t File/Save All

age we will com

b with XMC1200

urce lines to Bed in C:\MDK\e or cut and pa

Exit Debug

es: You now s_Components.h

al Variables: (s

countA = 0; countB = 0;

or the two Thr

d_phaseA; d_phaseB;

arting at near

seA': Phase

void const *a

50); SignalWait(0untA++; (countA > 0

Delay(500); lSet(tid_phas

arting at near

seB': Phase

void const *a

50); SignalWait(0untB++; (countB > 0

Delay(500); SignalSet(ti

: (starting nea

haseA, osPriohaseB, osPrio

ready located

reads phaseA a

osThreadCreatosThreadCreat

hread 1 to star

id_phaseA, 0xtForever);

dy located at t

or .

mpile and run

0 Boot Kit board

Blinky.c: We w\Boards\Infineoaste to modify i

g mode:

should have thh"

starting near

reads: (startin

line 12 before

A output

argument) {

x0001, osWai

x10) countA seB, 0x0001);

line 24 before

B output

argument) {

x0001, osWai

x10) countB d_phaseA, 0x

ar line 36 befo

orityNormal, orityNormal,

at this point:

and phaseB: (

te(osThread(pte(osThread(p

rt it: (starting

x0001);

this point: (ne

n your new RT

21

will create twoon\XMC1200 Bit. This file ha

In Blinky.c ad

hree header fil

line 6)

ng near line 9

/* Thread /* Thread

e main())

tForever);

= 0; /; /

e main())

tForever);

= 0; /

x0001); /

ore main() afte

1, 0); 1, 0);

(starting nea

(starting near

phaseA), NULLphaseB), NULL

g near line 45 i

/* send

ear line 49)

TX Blinky pro

Copyright ©

www.keil

o threads in BBoot Kit\RTX_

as a few extra it

dd these lines:

iles.

9 before main(

d id of thread id of threa

/* delay 25 /* wait fo

/* delay 250m/* send signa

/* delay 25 /* wait fo

/* delay 250m/* send signa

er )

ar line 39)

r line 43 in ma

L); L);

in main() befo

d signal to p

oject.

© 2014 ARM Ltd. All rig

l.com

Blinky.c: phas_text. You cantems but the so

:

())

ad: phase_a ad: phase_b

50ms or an event f

ms */ al to phaseB

50ms or an event f

ms al to phaseA

ain() before th

ore the while(1

phaseA thread

ghts reserved

seA and phasen either replaceource below wi

*/ */

*/flag 0x0001 *

*/

*/flag 0x0001 *

*/ A */

he while(1) )

1) )

d */

eB. e the ill run

*/

*/

Copyright © 2014 ARM Ltd. All rights reserved

Infineon XMC1200 Cortex-M0 Lab with XMC1200 Boot Kit board www.keil.com

22

Compile and Run Your RTX BlinkyNEW Project:

1. Build the files. If there are errors or warnings please fix these before continuing.

2. Program the Flash:

3. Enter Debug mode: Click on the RUN icon.

4. No LEDS will blink. This program does not use them.

Add the two global variables countA and countB to the Watch 1 window.

5. Right click on countA and select Add countA to… and select Watch 1.

6. Right click on countB and select Add countB to… and select Watch 1.

7. These two variables will be displayed in Watch 1 and will be incrementing as shown here:

Congratulations: Your First RTX program is running correctly !

TIP: counter and SystemCoreClock are left over from previous steps.

Open the System and Threads Viewer:

8. Select Debug/OS Support and select System and Threads Viewer. the following window opens up: You probably have to drag into the middle of your screen.

9. The various elements will be updating in real-time as your RTX program is running.

10. Note the idle daemon is running most of the time. You can change this ratio if you want to.

11. Set a breakpoint in each thread.

12. Each time you click on RUN the program will advance to the next thread repeatedly.

13. The active thread will display Running in the State column.

This ends the exercise creating your own RTX Blinky project. You can easily add more threads and modify the timing. When you are finished, stop the program and leave Debug mode. Obtain the Keil Getting Started MDK 5 manual: www.keil.com/mdk. It contains valuable information of using RTX. Extensive help files are included with MDK 5. So far, we have created projects from scratch or a fundamental beginning. The next section deals with creating projects using Infineon DAVE.

Copyright © 2014 ARM Ltd. All rights reserved

Infineon XMC1200 Cortex-M0 Lab with XMC1200 Boot Kit board www.keil.com

23

PART C: Creating projects with Infineon DAVE and MDK 5: This document uses DAVE 3.1.10 to create both a Blinky and an RTX_Blinky project. Please install DAVE to your computer in the usual manner. This action will install the correct J-Link USB drivers. Select Help/Check for Updates to make sure you have the latest software.

You must have downloaded the XMC1000 Packs into µVision as shown on page 4.

21) Blinky using DAVE: We will create a µVision project using DAVE to blink the two LEDs on the Boot Kit board. Two PWMs will be created and configured: each one blinks one LED. DAVE will then create a µVision project and µVision will then import it.

Start DAVE and create a DAVE project:

1. Start DAVE by clicking on its icon:

2. Select File/New/Dave Project and this window will open:

3. Select DAVE CE Project: Always select CE.

4. In Project Name box enter Blinky as shown here:

5. Select Next > and the Target Selection Page opens:

6. Select XMC1200-TO38F200 or the processor you are using as shown in the Target Selection window:

7. Confirm Add/Update startup files is enabled.

8. Click on Finish. DAVE will create your project.

9. The Blinky project will be displayed in the DAVE C/C++ Projects window as shown below.

10. Expand some of the elements.

11. You will see a Main.c and two CMSIS startup files.

12. Double click on Main.c, it will open in a window.

13. You can see DAVE has created a template Main.c with an int main(void) function but not much else.

14. If you open the startup files found in the Startup folder, you can see startup_XMC1200.s which contains processor initialization code and system_XMC1200.c contains mostly clock settings.

TIP: DAVE dynamically saves all your work as you progress into your default workspace: C:\DAVE3_workspace. You can manually save your work with File/Save or Ctrl-S.

15. We will next create two PWMs to blink the LEDs.

In

DDuto

C

To

nfineon XMC120

DAVE Apps: DAVE includesuses to create tho make sure yo

1. Apps a2. Scroll 3. Enter 4. If you

will di5. We wi

blink e

Create Two PW1. Under

the PWConne

2. Doubl3. The A

app/cc4. Click 5. The se6. Your

one sh7. Note t

/0 andclock These

TIP: App Helpopen.

00 Cortex-M0 Lab

s Apps that youhe source codeou have the lat

are listed in thethrough them pwm in the Sehover your mo

isplay. See theill use two insteach LED on a

WMs to Blinkr the heading PWMSP001 Thiectivity View. le click again o

Apps Shareabilicu4global/0 as on OK. econd instance S/W App Con

hown below: Ythere are two ind /1), a CaptureApp. last two Apps

p: Select Help

b with XMC1200

u can graphicae files that will est software.

e App Selectioto see your op

earch filter as souse over an Ae TIP: below ftances of the Aand off.

k the LEDs: WM Generatios will be added

on the same PWity window wilshown below:

will now be adnnectivity ViewYou can move ynstances of PWe/CompareUnit

are automatica

p and click on H

0 Boot Kit board

ally configure tbecome part o

on View. tions. hown here:

App, a descriptifor more details

App PWMSP00

on: double clicd in the S/W A

WMSP001 Appll open. Select

dded: w will be similayour Apps arou

WMSP001 (dent 4 and a CLK0

ally inserted by

Help Contents.

24

to create prograof your µVision

ion of it s.

01 to

ck on App

p. t

ar to the und.

noted by 002/0

y Dave.

On the left si

ConcepThe resouresourcesavailable the resourconnectivpad / pin constraintWith the msuch pin c

Copyright ©

www.keil

ams to suit youn project. Sele

ide, click on DA

pt: Manual Pi

urce solver intes that are requirchip resourcesrces assignmen

vity requiremenassignments, itts of the HW Pmanual pin assconstraints for

© 2014 ARM Ltd. All rig

l.com

ur needs. Thesect Help/Check

AVE Apps. A

in Assignmen

egrated into DAred by the DAVs. The resourcents are conflictnts are fulfilledt is often requi

PCB design aresignment functthe resource so

ghts reserved

se are programsk for DAVE Ap

A listing of the A

t:

AVE assigns VE Apps to thees solver ensurt free and all d. In particularired that specife also consideretionality in DAolver can be de

s DAVE pp Updates

Apps will

e res that

r for fic ed.

AVE efined.

Copyright © 2014 ARM Ltd. All rights reserved

Infineon XMC1200 Cortex-M0 Lab with XMC1200 Boot Kit board www.keil.com

25

Configure PWM /0:

1. Right click on PWMSP001/0 and select UIEditor. This window opens up: 2. Set Start to Start during initialization: 3. Set CCU4 Resolution to 32000 nsec. 4. Set PWM freq to 1 Hz: 5. Select the Signal Configurations tab and set

the Output Level to Passive High. 6. Leave all else at their defaults.

Connect PWM /0 output to GPIO Port Pin P0.0:

1. Right click on PWMSP001/0 again and select Manual Pin Assignment and the next window opens up.

2. Select Resource to pin_directoutput and Port Pin number P0.0/ #17 as shown below:

3. Select Solve And Save and then Close to assign this pin.

Configure PWM /1:

1. Right click on PWMSP001/1 and select UIEditor and a similar window opens up. 2. Set Start to Start during initialization: 3. Set CCU4 Resolution to 32000 nsec. 4. Set PWM freq to 1 Hz: 5. Select the Signal Configurations tab and set the Output Level to Passive Low. This puts PWMMSP001/1 180 º out

of phase with PWMMSP001/0. When one LED is on, the other will be off. Connect PWM /1 output to GPIO Port Pin P0.7:

1. Right click on PWMSP001/1 again and select Manual Pin Assignment and the next window opens up. 2. Select Resource to pin_directoutput and Port Pin number P0.7/ #24 as shown below:

Note: P0.0 is no longer listed. DAVE knows you have already assigned Pin 0.0 so it removes it from the list.

3. Select Solve And Save and then Close to assign this pin. 4. The PWMs are now completely configured. All we need do is Build the project and export it into µVision 5.

TIP: If your entries do not seem to work: ensure they are accepted by pressing Enter or clicking on another element.

Copyright © 2014 ARM Ltd. All rights reserved

Infineon XMC1200 Cortex-M0 Lab with XMC1200 Boot Kit board www.keil.com

26

Generator Package Description (gpdsc) File: DAVE produces a complete µVision project and in addition a gpdsc file. This file is used to start, import and configure the appropriate files into µVision.

Configure DAVE to create a gpdsc file: (you only have to do this once in DAVE for all your projects)

1. In the DAVE main window, select Window/Preferences and this window opens up:

2. Expand Dave and select DAVE CE Preferences as shown here:

3. Select Generate gpdsc file as shown:

4. Click on OK.

Generate the Code:

5. Click on the Generate Code icon or select DAVE/Generate Code.

6. The appropriate files will be created and a progress bar will be displayed.

7. The C/C++ Projects window will display the files in this project.

8. Blinky.gpdsc will be visible in the window as shown below right:

TIP: If you do not want another instance of µVision running, close the running instance(s) before double clicking on the gpdsc file. Running multiple instances of µVision is permitted but a conflict with the J-Link Lite might arise in this case. Import into µVision:

1. Close µVision running. See the TIP: above.

2. Double click on Blinky.gpdsc and a new instance of µVision will be started.

TIP: At this time you can shut DAVE down if you prefer. It is not needed again unless you want to add or modify any settings that must be done in DAVE. Otherwise, µVision can work stand alone with the files DAVE created for it.

On the next page, we will configure µVision, build the project, program it to Flash and run it.

In

C

Ac

Ty

.

Tth

C

A

nfineon XMC120

Configure µVi

After double clcreated are liste

This is almost cyour own, or us

1. Right

2. In the

3. Main.c

TIP: If you crehat you can ch

Configure the

1. In µVi

2. Select

3. Select

4. Select

5. Select

6. Select

7. ConfirIf this your BEnsureUSB d

8. The SNconneSW Dalso coproces

9. Click

10. SelectDebug

11. SelectSelectkB FlaThe Fldisplay

12. Click return windo

13. Select

At this point, y

00 Cortex-M0 Lab

ision:

licking on Blined in the Projec

complete: youse the one DAV

click on Sourc

Add Files win

c will now be a

eate and add yohoose from.

Debug Adapt

ision, select th

t the Target tab

t the Debug tab

t J-Link / J-Tra

t Settings: on th

t SW and not JT

rm you see an Ibox is blank, o

Boot Kit board e you have the drivers installed

N: box indicatected to the J-L

Device box indionnected to thessor CoreSight

on OK to leave

t the Utilities tag Driver as sho

t Settings. A lit XMC 1200 Xash and then Alash algorithm y as shown her

on OK to closeto the main µV

ow.

t File/Save All

ou have now c

b with XMC1200

nky.gpdsc, µVict window as s

u must now addVE created. W

ce Group 1 and

ndow, highlight

added to Sourc

our own new f

ter and Flash p

e Options for T

b and select Use

b.

ace Cortex as sh

he right side of

TAG as shown

IDCODE and Dor an error is dis plugged in. correct J-Link

d.

es µVision is ink Lite. The cates µVision e XMC1200 debug module

e this window.

ab: Select Useown:

ist appears. XMC 200 Add again.

will re.

e and Vision

or .

configured µVi

0 Boot Kit board

sion will be stashown here:

d a file containiWe will use the

d select Add Ex

t main.c and se

ce Group 1. Ex

file, you can se

programming

Target Options

e MicroLIB to

hown here:

f this window.

n here in the Po

Device Name iisplayed, you m

k

is

e.

ision to be able

27

arted. The sou

ing a main() fuone DAVE cre

xisting Files to

elect Add and t

xpand Source G

lect Add New

g:

s icon: Options

compile for sm

ort: box:

in SW Device must fix this be

e to build and ru

Copyright ©

www.keil

urce files DAVE

unction. You ceated.

Group ….:

then Close. Group 1 to see

Item to Group

s or ALT-F

maller program

box: efore you can c

run the project

© 2014 ARM Ltd. All rig

l.com

E

can add

it. p… and some te

F7.

m size:

continue. Che

that DAVE cre

ghts reserved

emplates will b

eck your cables

eated.

be offered

s and make

In

B

T

Tw

R

nfineon XMC120

Conce1.

2.

3.

4.

Build the µVis

1. Comp

TIP: You will

2. Progra

TIP: Since Upwill automatica

3. Enter

4. Click

5. Two L

Run Time Env

1. In µVi

2. Click

3. This w

4. The co

5. The grTwo in

6. The C7. Clicki

00 Cortex-M0 Lab

pt: SoftwarDuring your dcreated by DAExisting filesor replace the

You should nthe DAVE3 g

To change anadditions withwhen notifiedinside µVisio

At this point, project direct

sion project cr

ile the source f

probably get a

am the XMC12

pdate Target beally program th

Debug mode b

on the RUN ic

LEDs will blink

vironment:

ision, stop the

on the Manage

window display

omponents crea

reen arrow cannstances of DA

CMSIS CORE ang on any blue

b with XMC1200

re Developmdevelopment cAVE. Right cl or New Files a

e main.c file it

not modify any group name. U

nything you creh DAVE and thd files have chaon, your change

if you do not ytly from your D

reated by DAV

files by clickin

a warning abou

200 Flash by cl

efore Debugginhe Flash if there

by clicking on t

con. Note

k at 1 second in

program.

e Run-Time En

ys the compone

ated by DAVE

n be used to staAVE cannot shand Startup filee line will displ

0 Boot Kit board

ment Informycle, you will lick on a Groupas appropriate.initially produ

files with µViUse DAVE to m

eated in DAVEhe updated fileanged outside oes will be lost.

yet to change aDAVE workspa

VE:

ng on the Rebui

ut the line Retu

licking on the L

ng is selected (e is a new exec

the Debug icon

e: you stop the

ntervals. Each

and exit Debug

nvironment ico

ents of your pr

E are listed und

art DAVE. If Dhare the same wes were also crlay information

28

mation Noteadd your own p name (such a. Modify theseced and you su

ision that were make any modi

E, such as a peres will be impoout of µVision

anything in DAace rather than

ild icon. .

urn() in Main.c

Load icon:

see the previoucutable .axf file

n. Select O

e program with

h LED is contro

g mode.

on: The w

oject from µVi

der DAVE3. T

DAVE is alreadworkspace. reated by DAVn from the web

Copyright ©

www.keil

es: source files to

as Source Groue files to your nubsequently mo

created by DAifications to the

ripheral configuorted into µVisn. If you had ch

AVE, you can cn double-clickin

You can also

c not reachable

Progress wil

us page), you ce available.

OK if the Evalu

h the STOP ico

olled by its ow

window below o

ision.

These cannot be

dy running, an

VE. b about this sel

© 2014 ARM Ltd. All rig

l.com

the µVision prup 1) and selecneeds. DAVE odified.

AVE. These arese files.

uration, make ion. You musthanged any DA

close it and selng on the gpds

use the Build i

. You can igno

ll be indicated

can skip step 2

uation Mode b

on.

wn PWM you cr

opens up.

e changed in th

error will be g

lection using y

ghts reserved

roject after it it either Add will not modif

re located unde

modifications t select YES AVE created fi

ect your µVisic file.

icon beside it.

ore this warnin

in the Output W

. Entering Deb

box appears.

reated in DAV

his menu.

generated.

your default bro

s

fy

er

or

iles

on

ng.

Window.

bug mode

VE.

owser.

In

HWc

C

TRcS

nfineon XMC120

How to UpdatWe will changecreated files thi

1. In µVi

2. In the 3. Chang

4. Click 5. When 6. There

for all

7. Select

Compile, Load

1. Comp

2. Enter

3. Click 4. One o5. The so

TIP: Do not seRTOS001 Appcontrol and ensSee the next pa

00 Cortex-M0 Lab

e Configuratioe the frequencyis way rather th

ision, stop the

DAVE S/W Cge PWM freq fr

on the Generatit has completwill one or moof these. File

t File/Save All

d into Flash an

ile the source f

Debug mode.

on the RUN icf the LEDs wilource files you

elect RTX in th. A future vers

sures the latest age that shows

b with XMC1200

ons inside DAy of one of the han modifying

program.

Connectivity Vifrom 1 to 5 Hz.

te Code icon ted, bring µVisore indications s modified by D

or .

nd RUN:

files by clickin

The Flash

con. ll blink at 5 timadded are not

he µVision RTsion of MDK wversion of RTXhow to create a

0 Boot Kit board

AVE: PWMs to demthese files dire

and exit Debug

iew, right click Press Enter o

or select DAsion back into fthat has been DAVE are imp

ng on the Rebui

h will automati

mes per secondreplaced or mo

TE window if ywill allow the sX is always avan RTX_Blink

29

monstrate changectly in µVisio

g mode. D

k on one of the or click in anoth

AVE/Generate focus. changed: Clicported into µV

ild icon. .

cally be progra

reflecting the odified by DAV

your project is uselection of RTvailable from thky project using

Copyright ©

www.keil

ging DAVE coon.

Do not exit µV

PWMSP001 Aher box to ente

Code. A new

ck on Yes Vision.

ammed.

change you mVE.

using RTX. DTX from the Sohe Software pag DAVE.

© 2014 ARM Ltd. All rig

l.com

onfiguration file

Vision.

Apps and selecer this new sett

project will be

made it DAVE.

DAVE supplies oftware Packs. acks on the web

ghts reserved

es. Modify DA

ct UIEditor. ting.

e generated.

RTX using the This allows b

b.

AVE

e better

Copyright © 2014 ARM Ltd. All rights reserved

Infineon XMC1200 Cortex-M0 Lab with XMC1200 Boot Kit board www.keil.com

30

22) Create an RTX_Blinky project using DAVE and MDK 5: We will create a µVision project using DAVE to blink the two LEDs on the Boot Kit board. RTX is used. We will use direct software control of Ports 0.0 and 0.7 to blink the LEDS using two simple threads. DAVE will then create a µVision project and µVision will then import it. It is easy to add additional threads.

TIP: It is useful in DAVE to click on Help/Check for Updates and also DAVE App Updates.

Start DAVE and create a DAVE project:

1. Start DAVE by clicking on its icon:

2. Select File/New/Dave Project and this window will open:

3. Select DAVE CE Project: Always use DAVE CE.

4. In Project name box enter RTX_Blinky as shown here:

5. Select Next > and the Target Selection Page opens:

6. Select XMC1200-TO38F200 or the processor you are using as shown in the Target Selection window:

7. Confirm Add/Update startup files is enabled.

8. Click on Finish. DAVE will create your project.

9. The Blinky project will be displayed in the C/C++ Projects window as shown below.

10. Expand some of the elements.

11. You will see a Main.c and two CMSIS startup files.

12. Double click on Main.c, it will open in a window.

13. You can see DAVE has created a template main.c with an int main(void) function but not containing much else.

14. If you open the startup files, you can see startup_XMC1200.s which contains processor initialization code and system_XMC1200.c which contains mostly clock settings.

TIP: DAVE dynamically saves all your work as you progress with your workspace. You can manually save your work with File/Save or Ctrl-S.

15. On the next page, we will create and configure the two IO ports to blink the LEDs.

Copyright © 2014 ARM Ltd. All rights reserved

Infineon XMC1200 Cortex-M0 Lab with XMC1200 Boot Kit board www.keil.com

31

DAVE Apps:

Dave includes Apps that you can graphically configure to create programs to suit your needs. We will use the RTOS001 App and two instances of the Software Controlled IO App IO004 to create our demonstration program. TIP: You can also create a project with the RTOS App and implement RTX using µVision as described on page 20.

TIP: Your version numbers listed for each App might be different from the ones shown in the screens here. Always use the versions shown or later only.

In this project, RTX RTOS files are supplied by DAVE.

Apps available are listed in the App Selection View.

1. Scroll through them to see your options.

2. If you hover your mouse over an App, a description of it will display as shown in this window.

3. We will use two instances of the App IO004 to blink each LED on and off directly through the GPIO ports.

4. Enter io in the Search filter as shown here: Press Enter to make it active.

Create Two IO ports to Control the LEDs:

6. Under the heading I/O Ports/Software Controlled I/O App, double click on IO04 as shown here:

7. This will be added in the S/W App Connectivity View.

8. Double click again on the same IO04 App.

9. The second instance will now be added:

10. Your S/W App Connectivity View will contain the two IO Apps. There are two instances of IO04 (denoted by /0 and /1)

Create the RTX RTOS001 Instance:

11. Enter rtos in the Search filter as shown here: Press Enter to make it active.

12. Double-click on RTOS001. This will be entered in your project.

13. The clock CLK002/0 is inserted automatically by DAVE.

14. Your completed App Connectivity View will look like the one below. You can move the icons around.

15. The next steps will configure the IO and RTOS Apps.

TIP: To use the RTX that comes with µVision, do not create an RTOS001 above. In the Manage Run-time Environment select RTX. See page 35 under Manage RTE in step 6.

TIP: App Help: Select Help and click on Help Contents. On the left click on DAVE Apps. A listing of the Apps will open.

Copyright © 2014 ARM Ltd. All rights reserved

Infineon XMC1200 Cortex-M0 Lab with XMC1200 Boot Kit board www.keil.com

32

Configure IO004/0: 1. Right click on IO004/0 and select UIEditor. This window opens up: 2. Enable Output Enable as shown here: 3. Set Default Output level to High: This will cause the

LEDs to blink alternatively. 4. Leave all else at their defaults.

Connect IO004/0 output to GPIO Port Pin P0.0: 5. Right click on IO004/0 again and select Manual Pin

Assignment and the next window opens up. 6. Select pin in the Resource box. Select P0.0/ #17 in

the Port Pin Number box as shown below: 7. Select Solve And Save and then Close to assign this

pin. Configure IO004/1:

1. Right click on IO004/1 and select UIEditor and a similar window to the one above opens up. 2. Enable Output Enable as shown above the same way you configured IO004/0. 3. Unselect Default Output level/ High. This will cause the LEDs to blink alternatively.

Connect IO004/1 output to GPIO Port Pin P0.7:

4. Right click on IO004/1 again and select Manual Pin Assignment and the Manual Pin Assignment window opens. 5. Select Resource to pin and Port Pin number P0.7/ #24 similar to the above screen. 6. Select Solve And Save and then Close to assign this pin. 7. The IO ports are now configured.

Configure RTOS001/0:

1. Right click on RTOS001/0 and select UIEditor, The window that opens has four tabs:

2. We can use the default values. 3. Click on each tab to view the selections available.

Leave everything at their default values. 8. It is possible to modify the same settings in the file in

µVision. It is best to make any modifications inside DAVE rather than from µVision.

9. RTX is now completely configured. All we need do is Build the project and export it into µVision 5. We will need to add an application source code to Main.c.

Copyright © 2014 ARM Ltd. All rights reserved

Infineon XMC1200 Cortex-M0 Lab with XMC1200 Boot Kit board www.keil.com

33

Generator Package Description (gpdsc) File: DAVE produces a complete µVision project and in addition a gpdsc file. This file is used to start, import and configure the appropriate files into µVision.

Configure DAVE to create a gpdsc file: TIP: You need set the Generate gpdsc bit only once for all your DAVE projects.

1. In the DAVE main window, select Window/Preferences and this window opens up:

2. Expand Dave and select DAVE CE Preferences as shown here:

3. Select Generate gpdsc file as shown:

4. Click on OK.

Generate Code.

1. Click on the Generate Code icon or select DAVE/Generate Code.

2. The appropriate files will be created and a progress bar will be displayed.

3. The C/C++ Projects window will display the files in this project.

4. Blinky.gpdsc will be visible as shown in the screen below right:

.

Import into µVision:

1. Close µVision. This prevents multiple instances from opening.

2. Locate the file Blinky.gpdsc as shown here:

3. Double click on Blinky.gpdsc and a new instance of µVision will be started.

TIP: If you do not want another instance of µVision running, close the running instance(s) before double clicking on the gpdsc file. Running multiple instances of µVision is permitted but a conflict concerning the J-Link Lite might arise in this case. On the next page, we will configure µVision, add source files, build the project, program the Flash and run it.

4. You can optionally close DAVE now. We will not need it.

In

CAa

Eth

.

Tt

C

AM

nfineon XMC120

Configure µViAfter double clare listed in the

Enter Main.c: he one DAVE

1. Right

2. In the

3. Select

TIP: If you creemplates will b

Configure the 1. Plug in

2. In µVi

3. Select

4. Enter

5. Select

6. Select

7. Select

8. ConfirIf this your B

9. The SNLink Lconnemodul

10. Click

11. Select

12. SelectAdd:

13. A list 1200 Xthen A

14. Click return windo

15. Select

At this point, yMain.c does no

00 Cortex-M0 Lab

ision: licking on Bline project windo

You must addcreated. We w

click on Sourc

Add Files win

t File/Save All

eate and add yobe offered that

Debug Adaptn your Boot Ki

ision, select th

t Use MicroLIB

32 MHz in the

t the Debug tab

t Settings: on th

t SW and not JT

rm you see an Ibox is blank, o

Boot Kit board

N: box indicateLite. The SW Dcted to the XMle.

on OK to close

t the Utilities ta

t Settings and th

appears. SelecXMC 200 kB F

Add again. The

OK twice to clto the main µV

ow.

t File/Save All

ou have configot yet have the

b with XMC1200

nky.gpdsc, µViow as shown he

d a file containwill use the one

ce Group 1 and

ndow, highlight

or .

our own file, yyou can choos

ter and Flash pit to your PC w

e Options for T

B for smaller c

e Xtal (MHz) b

b. Select J-Link

he right side of

TAG as shown

IDCODE and Dor an error is dis plugged in.

es µVision is cDevice box ind

MC1200 proces

e this window.

ab: Select Use

hen select

ct XMC Flash and e Flash algorith

lose and Vision

or .

gured µVisionnecessary RTX

0 Boot Kit board

sion will be staere:

ning a main() fue DAVE create

d select Add Ex

t Main.c and se

you can select Ase from.

programmingwith a USB cab

Target Options

ompiled execu

ox.

k / J-Trace Cor

f this window.

n here in the Po

Device Name iisplayed, you m Ensure the co

connected to thdicates µVisionssor CoreSight

Debug Driver

hm will display

to be able to bTX components

34

arted. The sou

unction. You ced.

xisting Files to

elect Add. Sel

Add New Item

g: ble.

s icon: Options

utable:

rtex as shown h

ort: box:

in SW Device must fix this be

orrect J-Link U

he J-n is debug

r:

y as shown her

build and run ts to make a com

Copyright ©

www.keil

urce files DAVE

can add your o

Group ….:

lect Close.

m to Group… an

s or ALT-F

here:

box: efore you can c

USB drivers are

re:

the RTX_Blinmplete RTOS s

© 2014 ARM Ltd. All rig

l.com

E created

own, or use

nd some

F7 and select th

continue. Chee installed.

ky project thatsolution.

ghts reserved

he Target tab.

eck your cables

t DAVE create

s and make

ed.

In

B

Tth

Tw

N

M

nfineon XMC120

Build the µVis

1. Comp

TIP: You willhis line out or

2. Progra

TIP: Since Upwill automatica

3. Enter

4. Click

5. One Lalmost

6. Select

7. If you 255 anRunnithis po

NOTE: At thi

8. We ne

Manage Run T

1. Stop th

2. Click

3. This w

The compo

4. The grTwo in

5. The C

6. Note t

7. Clicki

8. The co

9. Click

00 Cortex-M0 Lab

sion project cr

ile the source f

probably get aignore the war

am the XMC12

pdate Target beally program th

Debug mode b

on the RUN ic

LED will come t blank. This w

t Debug/OS Su

see the os_idlend main as ID ng, everything

oint.

is writing, con

eed to add som

Time Environ

he program

on the Manage

window display

onents created

reen arrow cannstances of DA

CMSIS CORE a

that Infineon R

ng on any blue

omponents (no

on OK to close

b with XMC1200

reated with DA

files by clickin

an inconsequenrning.

200 Flash by cl

efore Debugginhe Flash if there

by clicking on t

con. Note

on indicating twill be rectified

upport and selec

e_demon as ID1 and

g is correct to

ntinuing develo

e source code t

ment:

and exit Deb

e Run-Time En

ys the compone

by DAVE are

n be used to staAVE cannot sh

and Startup file

RTX is selected

e line will displ

ot shown above

e the RTE wind

0 Boot Kit board

AVE:

ng on the Rebui

ntial warning a

licking on the L

ng is selected (e is a new file

the Debug icon

e: you stop the

the two IO Appd on the next p

ct System and

D

opment of the

to create the R

ug mode .

nvironment (RT

ents of your pr

listed under D

art DAVE. If Dhare the same w

es were also cr

d and not Keil R

lay information

e) are the Keil M

dow.

35

ild icon. .

about the line R

Load icon:

see the previouavailable.

n. Select O

e program with

ps are activatedpage.

Thread Viewe

e DAVE RTOS

RTX environme

TE) icon:

oject.

AVE3. These

DAVE is alreadworkspace.

reated by DAV

RTX. DAVE a

n from the web

Middleware. C

Copyright ©

www.keil

You can also

Return() in Mai

Progress wil

us page), you c

OK if the Evalu

h the STOP ico

d. Recall the m

er. This window

S App is causi

ent and to blink

The window b

e cannot be cha

dy running, an

VE.

automatically m

b about this app

Contact Keil sa

© 2014 ARM Ltd. All rig

l.com

use the Build i

in.c not reacha

ll be indicated

can skip step 2

uation Mode b

on.

main() function

w will open:

ing this windo

k the LEDs. T

below opens u

anged in this m

error will be g

made this selec

p using your d

ales or tech sup

ghts reserved

icon beside it.

able. You can c

in the Output W

. Entering Deb

box appears.

n created by D

ow to be blank

This is on the ne

up:

menu.

generated.

ction.

default browser

pport for inform

comment

Window.

bug mode

AVE is

k.

ext page.

r.

mation.

In

AAC

nfineon XMC120

Add RTX ConA copy of MainC:\MDK\Board

1. Stop th

2. Open

3. Add t#i

#i

4. Note:

5. Add a

osos

6. Add T

/* * *vo

7. Add T

/* * *vo

8. Define

osos

9. int ma

10. Initial

os

11. Creat

titi

12. Start

os

13. while(

14. Add in

os

15. Comm

16. Select

00 Cortex-M0 Lab

nfiguration soun.c is providedds\Infineon\XM

he program:

Main.c by dou

he RTX headeinclude "cmsi

include "RTE_

All other nece

a Thread ID fo

sThreadId tidsThreadId tid

Thread 1: (sta

*------------* Thread*------------oid phaseA (vfor (;;) { IO004_ToggosDelay(25}}

Thread 2: (sta

*------------* Thread*------------oid phaseB (vfor (;;) { IO004_ToggosDelay(25}}

e each thread:

sThreadDef(phsThreadDef(ph

ain(void) is loc

lize RTX: (sta

sKernelInitia

e the two Thr

id_phaseA = oid_phaseB = o

the RTX Ker

sKernelStart

(1){ } is alread

nside the whil

sThreadYield

ment out return

t File/Save All

b with XMC1200

urce lines to Md in the softwarMC Boot Kit\R

Exit Debug

uble-clicking on

er file: Add this_os.h"

_Components.h

essary header fi

or the two Thr

d_phaseA; d_phaseB;

arting at near

-------------d 1 'phaseA':-------------void const *a

glePin(IO004_50);

arting at near

-------------d 2 'phaseB':-------------void const *a

glePin(IO004_50);

: (starting at

haseA, osPriohaseB, osPrio

cated at this p

arting near lin

alize ();

reads phaseA a

osThreadCreatosThreadCreat

rnel: (starting

();

dy located at th

le loop near lin

();

n 0; and add a c

or .

0 Boot Kit board

Main.c: We wre package that

RTX_text. You

g mode:

n it in the Proje

hese two lines n

h"

files are provide

reads: (startin

line 18)

-------------: Phase A out-------------arg) {

_Handle0);

line 28 int ma

-------------: Phase B out-------------arg) {

_Handle1);

near line 37) b

orityNormal, orityNormal,

point: (startin

ne 44) just afte

and phaseB: (

te(osThread(pte(osThread(p

g near line 49)

his point: (ne

ne 52:

carriage return

36

will create twot accompanies tu can copy the

ect window in

near line 13 ju

ed by #include

ng at near line

/* Thread /* Thread

-------------tput: Contro-------------

/

ain(void) )

-------------tput C-------------

/

before int mai

1, 0); 1, 0);

ng near line 40

er DAVE_Init

(starting near

phaseA), NULLphaseB), NULL

before while(

ear line 50)

(Enter) at the

Copyright ©

www.keil

threads in mathis documententire contents

µVision.

ust after #includ

e <DAVE3.h>

e 15 int main(

d id of thread id of threa

------------ols Port 0.0------------

/* delay 250m

------------Controls Port------------

/* delay 250m

in(void) )

0)

t(); inside int m

r line 47) befor

L); L);

(1)

very end of the

© 2014 ARM Ltd. All rig

l.com

ain.c: phaseAfor your conve

s into Main.c o

de <DAVE3.h>

which is alread

(void) )

ad: phase_a ad: phase_b

------------- LED

-------------

ms */

-------------t 0.7 LED -------------

ms

main(void) )

re while(1)

e file.

ghts reserved

A and phaseB.enience. It is f

or type in the so

>:

dy in main.c.

*/ */

------

-----*/

------

-----*/

*/

found in ource.

In

C

T

Ta

N

HW

C

nfineon XMC120

Compile, Load

1. Comp

TIP: You will

2. Progra

TIP: Since Upautomatically p

3. Enter

4. Click

5. The tw

6. Open

7. phaseA

NOTE: At thi

How to UpdatWe will not act

1. In µVi

2. In DAclick o

3. Click

4. When

5. There for all

6. Select

Compile, Load1. Comp

2. Enter

3. Click

4. The ch

5. The so

00 Cortex-M0 Lab

d and RUN yo

ile the source f

probably get a

am the XMC12

pdate Target beprogram the Fla

Debug mode b

on the RUN ic

wo LEDs will b

Debug/System

A and phaseB w

is writing, con

e Configuratiotually demonst

ision, stop the

AVE, Make youon Enter or clic

on the Generat

done, bring µV

will one or moof these. File

t File/Save All

d into Flash anile the source f

Debug mode.

on the RUN ic

hanges you ma

ource files you

b with XMC1200

our Program:

files by clickin

a warning abou

200 Flash by cl

efore Debugginash if there is a

by clicking on t

con. Note

blink.

m and Threads V

will take turns

ntinuing develo

ons inside DAtrate this. Whe

program.

ur modificationck in another b

te Code icon

Vision back int

ore indications s modified by D

or .

nd RUN: files by clickin

The Flash

con.

ade in DAVE w

added are not

0 Boot Kit board

ng on the Rebui

ut the line Retu

licking on the L

ng is selected (a new file avail

the Debug icon

e: you stop the

Viewer and thi

running provin

opment of the

AVE: en files are mod

and exit Debug

ns. You can tryox to enter this

or select DA

to focus.

that has been DAVE are imp

ng on the Rebui

h will automati

will be reflected

replaced or mo

37

ild icon. .

urn() in main.c

Load icon:

see page 34), ylable.

n. Select O

e program with

is window open

ng the program

e DAVE RTOS

dified in DAVE

g mode.

y enabling Defs new setting.

AVE/Generate

changed: Clicported into µV

ild icon in µVi

cally be progra

d in your updat

odified.

Copyright ©

www.keil

You can also

not reachable.

Progress wil

you can skip st

OK if the Evalu

h the STOP ico

ns up:

m is working co

S App is causi

E they can be i

fault Output lev

Code. A new

ck on Yes Vision.

ision.

ammed.

ated project.

© 2014 ARM Ltd. All rig

l.com

use the Build i

. You can com

ll be indicated

tep 2. Entering

uation Mode b

on.

orrectly.

ing this windo

imported into µ

vel to High in I

project will be

ghts reserved

icon beside it.

mment this line

in the Output W

g Debug mode

box appears.

ow to be blank

µVision as foll

IO004/0. Mak

e generated.

out.

Window.

will

k.

lows:

ke sure you

Copyright © 2014 ARM Ltd. All rights reserved

Infineon XMC1200 Cortex-M0 Lab with XMC1200 Boot Kit board www.keil.com

38

23) PWM Controlled Blinky using DAVE We will create a µVision project using DAVE to blink one LED on the Boot Kit board. A PWM App will be used and configured: it blinks the LED (slowly changing the brightness). Also, a Counter App will be used to count the PWM pulses. An interrupt on the count match toggles between increasing and decreasing the brightness intensity of the LED. DAVE will then create a µVision project and µVision will then import it.

Start DAVE and create a DAVE project:

1. Start DAVE by clicking on its icon:

2. Select File/New/Dave Project and this window will open:

3. Select DAVE CE Project: Always select CE.

4. In Project Name box enter PWM_Blinky as shown here:

5. Select Next > and the Target Selection Page opens:

6. Select XMC1200-TO38F200 or the processor you are using as shown in the Target Selection window:

7. Confirm Add/Update startup files is enabled.

8. Click on Finish. DAVE will create your project.

9. The Blinky project will be displayed in the DAVE C/C++ Projects window as shown below.

10. Expand some of the elements.

11. You will see a Main.c and two CMSIS startup files.

12. Double click on Main.c, it will open in a window.

13. You can see DAVE has created a template Main.c with an int main(void) function but not much else.

14. If you open the startup files found in the Startup folder, you can see startup_XMC1200.s which contains processor initialization code and system_XMC1200.c which contains mostly clock settings.

TIP: DAVE dynamically saves all your work into the default workspace: C:\DAVE3_workspace. You can manually save your work with File/Save or Ctrl-S.

15. We will next create two PWMs to blink the LEDs.

Copyright © 2014 ARM Ltd. All rights reserved

Infineon XMC1200 Cortex-M0 Lab with XMC1200 Boot Kit board www.keil.com

39

DAVE Apps:

DAVE includes Apps that you can graphically configure to create programs to suit your needs. These are programs DAVE uses to create the source code files that will become part of your µVision project.

1. Apps are listed in the App Selection View.

2. Scroll through them to see your options.

3. If you hover your mouse over an App, a description of it will display.

4. We will use one instance of the App PWMSP001 to blink the LED on and off.

5. We will use one instance of the App CNT001 to count the number of PWM pulses.

6. We will use two instances of the App NVIC002 to react on interrupts on the PWMSP001 and CNT001.

Create the Apps:

1. Enter pwm in the Search filter as shown here:

2. Under the heading PWM Generation, double click on the App PWMSP001 as shown here:

3. This will be added in the S/W App Connectivity View. 4. Enter cnt in the Search filter. 5. Under the heading Signal Capture, double click on the App

CNT001. 6. The Apps Shareability window will open. Select

app/ccu4global/0 as shown below on the right: 7. Click on OK. 8. Enter nvic in the Search filter. 9. Under the heading NVIC (Nested Vectored Interrupt

Controller), double click on the App NVIC002. 10. It will be added to the S/W App Connectivity View. 11. Double click again on the same NVIC002 App. A second

instance of it will be added. 12. Your S/W App Connectivity View will be similar to the

one shown below: You can move your Apps around. 13. Note there are two instances of NVIC002 (denoted by /0

and /1), a Capture/CompareUnit 4 and a CLK002/0 clock App.

14. These last two Apps are automatically inserted by DAVE.

Copyright © 2014 ARM Ltd. All rights reserved

Infineon XMC1200 Cortex-M0 Lab with XMC1200 Boot Kit board www.keil.com

40

Configure PWMSP001/0:

1. Right click on PWMSP001/0 and select UIEditor. The window below opens up: 2. First, in the Timer Configuration, set CCU resolution units to usec. 3. Then set CCU4 Resolution to 10. 4. Set PWM freq to 100 Hz 5. In the Interrupts area, enable Period Match: Enable at initialization. 6. Select the Signal Configurations tab and set the Output Level to Passive High. 7. Leave all other settings at their defaults.

Connect PWMSP001/0 output to GPIO Port Pin P0.0:

1. Right click on PWMSP001/0 again and select Manual Pin Assignment and the next window opens up. 2. In the Resource column, select pin_directoutput and Port Pin number P0.0/ #17 as shown below: 3. Select Solve And Save and then Close to assign this pin.

Copyright © 2014 ARM Ltd. All rights reserved

Infineon XMC1200 Cortex-M0 Lab with XMC1200 Boot Kit board www.keil.com

41

Configure CNT001:

1. Right click on the App CNT001/0 and select UIEditor. The window below opens up. 2. Set Event Count Match to 400. 3. In the Interrupts area, select Count Match to Enable at initialization as shown below:

Add User Labels to the NVIC002:

1. Right click NVIC002/0 and select Add User Label. 2. Enter PWM_Period and click OK. 3. Right click NVIC002/1 and select Add User Label. 4. Enter CountMatch and click OK. 5. Your apps will now look like this with labels attached:

They are probably in different physical locations.

Configure NVIC002/0 (PWM_Period):

1. Right click NVIC002/0 (PWM_Period) and select UIEditor and the window below opens:

2. Set the Preemption Priority to 2. 3. Select Enable interrupt at initialization. 4. Set the User defined interrupt handler to PWM_Period_Handler. 5. Press Enter or click away to ensure this handler is accepted.

Configure NVIC002/1 (CountMatch):

1. Right click NVIC002/1 (CountMatch) and select UIEditor.

2. A similar screen opens. 3. Set the Preemption Priority to 3. 4. Select Enable interrupt at initialization 5. Set the User defined interrupt handler to

CountMatch_Handler. 6. Press Enter to ensure this handler is accepted.

Copyright © 2014 ARM Ltd. All rights reserved

Infineon XMC1200 Cortex-M0 Lab with XMC1200 Boot Kit board www.keil.com

42

Configure Signal Connections: One of the advanced features of DAVE3 is the option for the user to connect signals between different DAVE Apps. An important use for this feature is the connection of an event signal with the interrupt signal of an NVIC (interrupt) App.

PWMSP001/0 Signal Connections:

1. In the S/W App Connectivity View Right click on PWMSP001/0 and select Signal Connection. The window below opens:

Connect NVIC002/0

2. In the first Signal column, select Period Match Interrupt. 3. In the App column, select the NVIC002/0 App to connect to. 4. In the second Signal column, select Interrupt Node. 5. Click Solve and Save. Do not select Close yet. We are not quite done.

Connect CNT001/0

6. A new signal row will be created. 7. In the first Signal column, select PWM Status. 8. In the App column, select CNT001/0 to connect to. 9. In the second Signal column, select Input as the Signal. 10. Click Solve and Save. Your window will like the one below. If not, please make any changes and Solve and Save. 11. Click Close.

CNT001/0 Signal Connections:

1. In the S/W App Connectivity View, right click on CNT001/0 App and select Signal Connection. The window below opens.

2. In the first Signal column, select Event Count Match Interrupt. 3. In the App column, select NVIC002/1 (Count Match) to connect to. 4. In the second Signal column, select Interrupt Node as the Signal. 5. Click Solve and Save. Your window will look like the one below. If not, please edit and Solve and Save. 6. Click Close.

At this point, all the Apps we need for the PWM_Blinky project are now configured.

Copyright © 2014 ARM Ltd. All rights reserved

Infineon XMC1200 Cortex-M0 Lab with XMC1200 Boot Kit board www.keil.com

43

Generator Package Description (gpdsc) File: DAVE produces a complete µVision project and in addition a gpdsc file. This file is used to start, import and configure the appropriate files into µVision. DAVE must be configured to generate this gpdsc file.

If you did this task on page 26, you do not need to repeat it. Jump to Generate the Code below:

Configure DAVE to create a gpdsc file: (you only have to do this once in DAVE for all your projects)

1. In the DAVE main window, select Window/Preferences and this window opens up:

2. Expand Dave and select DAVE CE Preferences as shown here:

3. Select Generate gpdsc file… as shown:

4. Click on OK.

Generate the Code:

5. Click on the Generate Code icon or select DAVE/Generate Code.

6. The appropriate files will be created and a progress bar will be displayed.

7. The C/C++ Projects window will display the files in this project.

8. PWM_Blinky.gpdsc will be visible in the window as shown below right:

9. You are ready to import this into µVision.

Import into µVision:

1. Close any instances of µVision. See the TIP below.

2. Double click on PWM_Blinky.gpdsc and a new instance of µVision will be started.

TIP: If you do not want another instance of µVision running, close any running instance(s) of µVision before double clicking on the gpdsc file. Running multiple instances of µVision is permitted but a conflict with the J-Link Lite might arise in this case. TIP: At this time you can shut DAVE down if you prefer. It is not needed again unless you want to add or modify any settings that must be done in DAVE. Otherwise, µVision can work stand alone with the files DAVE created for it.

On the next page, we will configure µVision, add some source code to PWM_Blinky.c, build the project, program it to Flash and run it.

In

C

AP

TYc

.

TG

C

A

nfineon XMC120

Configure µVi

After double clProject window

This is almost cYou can add yocreated. It is ca

4. Right

5. In the

6. Main.c

TIP: If you creGroup… and so

Configure the

14. In µVi

15. Select

16. Select

17. Select

18. Select

19. Select

20. ConfirIf this your BEnsureUSB d

21. The SNconneSW Dalso coproces

22. Click

23. SelectDebug

24. Select

25. A list 1200 Xthen Aalgoritshown

26. Click return

27. Select

At this point, y

00 Cortex-M0 Lab

ision:

licking on PWMw in µVision as

complete: youour own, or usealled Main.c.

click on Sourc

Add Files win

c will now be a

eate and add yoome templates

Debug Adapt

ision, select th

t Use MicroLIB

t the Debug tab

t J-Link / J-Tra

t Settings: on th

t SW and not JT

rm you see an Ibox is blank, o

Boot Kit board e you have the drivers installed

N: box indicatected to the J-L

Device box indionnected to thessor CoreSight

on OK to leave

t the Utilities tag Driver as sho

t Settings and th

appears. SelecXMC 200 kB F

Add again. Thethm will displan here:

OK twice to clto µVision ma

t File/Save All

ou have now c

b with XMC1200

M_Blinky.gpdss shown here:

u must now adde the one DAV

ce Group 1 and

ndow, highlight

added to Sourc

our own new fwill be offered

ter and Flash p

e Options for T

B to compile fo

b.

ace Cortex as sh

he right side of

TAG as shown

IDCODE and Dor an error is dis plugged in. correct J-Link

d.

es µVision is ink Lite. The cates µVision e XMC1200 debug module

e this window.

ab: Select Useown here:

hen select Add

ct XMC Flash and e Flash ay as

lose and ain window.

or .

configured µVi

0 Boot Kit board

sc, µVision wi

d a file containiVE created. We

d select Add Ex

t Main.c and se

ce Group 1. file, you can sed that you can

programming

Target Options

or smaller prog

hown here:

f this window.

n here in the Po

Device Name iisplayed, you m

k

is

e.

d:

ision. You now

44

ill be started. T

ing a main() fue will use the o

xisting Files to

elect Add and t

lect Add New choose from.

g:

s icon: Options

gram size:

ort: box:

in SW Device must fix this be

w must add som

Copyright ©

www.keil

The source file

unction. one DAVE

Group ….:

then Close.

Item to

s or ALT-F

box: efore you can c

me files to mai

© 2014 ARM Ltd. All rig

l.com

es DAVE create

F7 and select th

continue. Che

in.c on the next

ghts reserved

ed are listed in

he Target tab.

eck your cables

t page.

n the

s and make

Copyright © 2014 ARM Ltd. All rights reserved

Infineon XMC1200 Cortex-M0 Lab with XMC1200 Boot Kit board www.keil.com

45

Add Application Code to Main.c:

Under Source Group 1, double click on Main.c in the Project window to display it. The code below is contained in the file Main.c or PWM.txt in C:\MDK\Boards\Infineon\XMC1200 Boot Kit\PWM_Blinky.

1. Add the following variable declarations below line 13 after #include <DAVE3.h>:

#include "XMC1200.h" float LED_duty = 0; enum bright {up, down}; enum bright LED_bright = up; uint32_t PWMerrorcount = 0; uint32_t CNTerrorcount = 0; uint32_t CountVal; PWMSP001_TimerRegsType TimerVal;

2. Add these two handler functions that have been declared for the DAVE Apps near line 27 before main(void): void PWM_Period_Handler(void) { status_t status; switch (LED_bright) { case up: {if (LED_duty > 99) LED_duty = 0; LED_duty++; } break; case down: {if (LED_duty < 1) LED_duty = 100; LED_duty--; } } status = PWMSP001_SetDutyCycle(&PWMSP001_Handle0, LED_duty); if (status != DAVEApp_SUCCESS) PWMerrorcount++; } void CountMatch_Handler(void) { status_t status; switch (LED_bright) { case up: LED_bright = down; LED_duty = 100; break; case down: LED_bright = up; LED_duty = 0; } status = CNT001_Stop(&CNT001_Handle0); if (status != DAVEApp_SUCCESS) CNTerrorcount++; status = CNT001_ResetCounter(&CNT001_Handle0); if (status != DAVEApp_SUCCESS) CNTerrorcount++; status = CNT001_Start(&CNT001_Handle0); if (status != DAVEApp_SUCCESS) CNTerrorcount++; }

3. Uncomment the declaration of the variable status in main. 4. Add these lines after DAVE_Init(); which is near line 70:

status = PWMSP001_Start(&PWMSP001_Handle0); if (status != DAVEApp_SUCCESS) PWMerrorcount++; status = CNT001_Start(&CNT001_Handle0); if (status != DAVEApp_SUCCESS) CNTerrorcount++;

5. Add these lines inside the while loop: status = PWMSP001_GetTimerRegsVal((PWMSP001_HandleType*)&PWMSP001_Handle0, &TimerVal); if (status != DAVEApp_SUCCESS) PWMerrorcount++; status = CNT001_GetEvtCountValue((CNT001_HandleType*)&CNT001_Handle0, &CountVal); if (status != DAVEApp_SUCCESS) CNTerrorcount++;

In

C

B

E

Tclo

S

Tdto

nfineon XMC120

Configure µVi

1. Select

2. Select

3. Select entry himmat

7. Click

4. In Ma

Build, Flash an

1. Comp

2. Progra

3. Enter Note:

4. Click

Note:

5. You h

Examining Som

1. With p

2. Right

3. Count

4. Add Lsame w

5. These

TIP: These vacycles are stoleocal variables

Symbol Table:

1. Select

This window bdisplayed with o a Watch or M

00 Cortex-M0 Lab

ision Build Op

t Target Option

t Use MicroLIB

t the C/C++ tab

has a double daterial warnings

on OK. Select

in.c, the last lin

nd Run the pr

ile the source f

am the XMC F

Debug mode bµVision is con

on the RUN ic

you stop the p

have successful

me Variables:

program till run

clink on Count

tVal will appea

LED_bright (neway to Watch

variables will

ariables are upden to read thesewhile the prog

:

t View/Symbol

elow opens. Etheir locations

Memory windo

b with XMC1200

ptions:

ns or ALT

B – this will res

b and in the Mi

ash preceding ds being display

t File/Save All

ne return 0; wi

rogram !

files by clickin

Flash by clickin

by clicking on tnfigured to pro

con. The

program with t

lly created a pr

:

nning, in Main

tVal and select

ar in Watch 1 a

ear line 17) and1.

be now display

dated in real time memory locatgram is running

ls Window in t

Expand Main.c s. You can copow and they wi

0 Boot Kit board

-F7. Select the

sult in smaller

isc Controls bo

diag: - - diag. ed.

or .

ill cause an imm

ng on the Rebui

ng on the Load

the Debug iconogram the Flash

LED at P0.0 w

the STOP icon.

rogram using D

n.c, find the glo

t Add CountVa

and will be upd

d TimerVal (ne

yed and update

me. Nearly alwtions. You areg.

the main menu

and its variablpy variables froll be fully qual

46

e Target tab.

programs. En

ox enter: --dia

This will prev

material warnin

ild icon. .

icon: Pro

n. Select Oh when enterin

will change in b

.

DAVE and µVi

obal variable C

al to… and sele

dating (if the pr

ear line 23) in t

ed as shown he

ways, no CPU e not able to vie

.

les are om here lified.

Thi

Copyright ©

www.keil

nter 32 in Xtal (

g_suppress=1

vent some

ng. Either igno

You can also

ogress will be i

OK if the Evalung Debug mode

brightness..

ision to modify

CountVal near l

ect Watch 1.

rogram is runn

the

ere:

ew

is is the end

© 2014 ARM Ltd. All rig

l.com

(MHz).

188

ore this or com

use the Build i

indicated in the

uation Mode be. You do not

y the brightnes

line 21.

ning) as shown

d of the PWM

ghts reserved

mment this line

icon beside it.

e Output Wind

box appears. have to use Lo

s of a LED.

here:

M_Blinky t

This

out.

dow.

oad.

tutorial.

Copyright © 2014 ARM Ltd. All rights reserved

Infineon XMC1200 Cortex-M0 Lab with XMC1200 Boot Kit board www.keil.com

47

23) Document Resources: See www.keil.com/infineon Books:

1. NEW! Getting Started MDK 5: Obtain this free book here: www.keil.com/mdk5/.

2. There is a good selection of books available on ARM processors. A good list of books on ARM processors is found at www.arm.com/university by selecting “Teaching Resources”. You can also select ARM Related Books but make sure to also select the “Books suited for Academia” tab to see the full selection.

3. µVision contains a window titled Books. Many documents including data sheets are located there.

4. A list of resources is located at: www.arm.com/products/processors/cortex-m/index.php Click on the Resources tab. Or search for “Cortex-M3” on www.arm.com and click on the Resources tab.

5. The Definitive Guide to the ARM Cortex-M0/M0+ by Joseph Yiu. Search the web for retailers.

6. The Definitive Guide to the ARM Cortex-M3/M4 by Joseph Yiu. Search the web for retailers.

7. Embedded Systems: Introduction to Arm Cortex-M Microcontrollers (3 volumes) by Jonathan Valvano.

Application Notes: 1. NEW! ARM Compiler Qualification Kit: Compiler Safety Certification: www.keil.com/pr/article/1262.htm

2. Using DAVE with µVision: µVision is DAVE compatible. www.keil.com/appnotes/files/apnt_258.pdf

8. Using Cortex-M3 and Cortex-M4 Fault Exceptions www.keil.com/appnotes/files/apnt209.pdf

9. Segger emWin GUIBuilder with µVision™ www.keil.com/appnotes/files/apnt_234.pdf

10. Porting mbed Project to Keil MDK™ www.keil.com/appnotes/docs/apnt_207.asp

11. MDK-ARM™ Compiler Optimizations www.keil.com/appnotes/docs/apnt_202.asp

12. Using µVision with CodeSourcery GNU www.keil.com/appnotes/docs/apnt_199.asp

13. RTX CMSIS-RTOS in MDK 5 C:\Keil_v5\ARM\Pack\ARM\CMSIS\4.1.0\CMSIS_RTX

14. Download RTX CMSIS-RTX www.keil.com/demo/eval/rtx.htm and www.arm.com/cmsis

15. Barrier Instructions http://infocenter.arm.com/help/topic/com.arm.doc.dai0321a/index.html

16. Lazy Stacking on the Cortex-M4: www.arm.com and search for DAI0298A

17. Cortex Debug Connectors: www.arm.com and search for cortex_debug_connectors.pdf or

www.keil.com/coresight/coresight-connectors

18. Sending ITM printf to external Windows applications: www.keil.com/appnotes/docs/apnt_240.asp

Keil Tutorials for Infineon Boards: www.keil.com/infineon 1. XMC1200 Boot Kit (this document) www.keil.com/appnotes/docs/apnt_263.asp

2. XMC1100 2Go Kit: www.keil.com/appnotes/docs/apnt_260.asp

3. XMC4500 Relax Kit: coming… See www.keil.com/infineon

4. XMC4500 Application Board Kit: coming… See www.keil.com/infineon

5. Hitex XMC-HiLight XMC4500 board: www.keil.com/appnotes/docs/apnt_231.asp

ARM Community Forums: www.keil.com/forum and http://community.arm.com/groups/tools/content

Infineon Community Forum: www.infineonforums.com/

ARM University program: www.arm.com/university. Email: [email protected]

ARM Accredited Engineer Program: www.arm.com/aae

mbed™: http://mbed.org

For comments or corrections on this document please email [email protected]

For more information on the ARM CMSIS standard: www.arm.com/cmsis

In

2

K

U

T

A

K

CST

A

A

Cv

Kpli

FK

K

F

F

C

nfineon XMC120

24) Keil P

Keil Micro MDK- MDK X

NEW MDK- MDK-

NEW

USB-JTAG ULINK ULINK ULINK NEW Contact sa

Contact sa

For spec

The Keil RTX

All versions, in

Keil includes fr

Call Keil Sales Sales can also pThey will help

All products ar

All products in

Call Keil Sales view various pr

Keil supports mprocessors. Seeist of Infineon

For more Keil Sales In U

Keil Technical

For comments

For the latest ve

CMSIS docume

00 Cortex-M0 Lab

Products a

controllerLite (EvaluatXMC1000 - $

W !! MDK-ARStandard (unProfessional

W !! ARM Co

G adapter K2 - (ULINK2K-ME – sold oKpro – Faster

W !! [email protected]

[email protected]

cial promotio

RTOS is now p

ncluding MDK

ree DSP librari

for details on provide adviceyou find variou

e available from

clude Technica

for special unirograms and re

many other Infie the Keil Devsupport. This

informatioUSA: sales.us@

l Support in U

or corrections

ersion of this d

entation: www

b with XMC1200

and Conta

r Develoption version) $0

RM-CM™ (for nlimited comp(Includes Fla

ompiler Qualif

(for Flash2 and ME - Sonly with a bor operation anro D – Faster om 800-348

com +49 89/

onal or quan

provided under

-Lite, includes

ies for the Cort

current pricing about the varius labs and app

m stock.

al Support for

iversity pricingesources.

ineon processoice Database® information is

on: @keil.com or 80

USA: support.u

please email b

document, go to

w.arm.com/cms

0 Boot Kit board

act Inform

ment Kit - $0

Cortex-M sepile and debu

ash File, TCP/IP

fication Kit:

h programWV only – nooard by Keil ond Flash prog operation an8-8051 for USA

/456040-20 for

ntity pricing

r a BSD type l

Keil RTX RT

tex-M0, Cortex

g, specials and ious tools optiopnotes that are

1 year. This is

g. Go to www

rs including 80on www.keil.c

s also included

00-348-8051.

[email protected] or

ob.boys@arm.

o www.keil.co

sis

48

mation: Se

(MDK-ARM

eries processoug code and dP, CAN and US

for Safety Ce

mming tooo ETM) or OEM. gramming, Cond Flash progA prices.

r pricing in othe

g and offers,

icense. This m

TOS with sourc

x-M3 and Cort

quantity discoons available to useful.

s easily renewe

.arm.com/univ

051 and C166 com/dd for the in MDK.

Outside the US

r 800-348-8051

.com.

om/infineon and

Copyright ©

www.keil

ee www.keil.c

M™)

ors only – undata size) SB driver librar

ertification Ap

o)

ortex-Mx SWramming, Co

er countries.

, please con

makes it free.

ce code !

tex-M4.

ounts. o you.

ed.

versity to

series complete

S: sales.intl@

1. Outside the

d for more Infi

© 2014 ARM Ltd. All rig

l.com

com/infineon

limited code

ries and Graph

pplications

WV & ETM tracortex-Mx SWV

ntact Keil Sa

@keil.com or +4

e US: support.i

fineon specific

ghts reserved

n

limit)

ic User Interfac

ce. V, no ETM tra

ales.

49 89/456040-2

[email protected].

information.

ce (GUI))

ace.

20

.