
Copyright © 2011 ARM Ltd. All rights reserved
STMicroelectronics Cortex-M3 Lab with STM3240G-EVAL board www.keil.com
STM32 Evaluation Boards:
Keil makes six STM32 evaluation boards plus several with STR7 and STR9 pr ocesso rs. Examples are provided.
Keil part number Processor Characteristics Debug Conne ctors ST board equi valent
MCBSTM32™ STM32F103VB monochrome LCD JTAG/SWD STM32F10X-128K-EVAL (color LCD)
MCBSTM32E™ replaced by EXL STM32F103ZE color LCD Cortex Debug and ETM STM3210E-EVAL
MCBSTM32EXL™ STM32F103ZG color LCD Cortex Debug and ETM STM3210E-EVAL
MCBSTM32C™ STM32F107VC color touch LCD Cortex Debug and ETM STM3210C-EVAL
MCBSTM32F200™ Cortex-M4: MCBSTM32F400™
Keil MDK provides example projects for these STMicroelectronics boards:
CQ-STARM EK-STM32F STM32-Discovery STM32F10X-EVAL STM32L152-EVAL
STM32100E-EVAL Cortex-M4: STM3240G-EVAL STM32F4-Discovery (M DK h as example s f or this board)
Five Steps to Get Conne c t e d and Configured:
1. Physically connect a ULINK to the STM3240G or other target board. Power both of these appropriately.
2. Configure µVision to use a ULINK2, ULINK-ME or ULINKpro to communicate with the JTAG or SWD port.
3. Configure the F lash programmer inside µVisio n to program the STM32 internal flash memory.
4. If desired, configure the Serial Wire Viewer. Add the STM32F4xx_SWO.ini initialization file (see belo w).
5. If desired, configure the ETM trace with the ULINKpro. Ad d th e STM32F4xx_TP.ini initializatio n file (see below).
STM32 processors need a special .ini file that configures the CoreSight Serial Wire Viewer and ETM trace. If you do not
intend to use SWV or ETM you do not need this file. It is entered in the Options for Target window under the Debug tab. It
can be configured for either SWO or 4 bit Trace Port operation. Instructions are provided on Page 30.
Software Installation:
This doc ument was written for Keil MDK 4.22a or later which contains µVision 4. The evaluation copy of MDK is available
free on the Keil website. Do not confuse µVision4 with MDK 4.0. The number “4” is a coincidence.
To obtain a copy of MDK go to www.keil.com/arm and select the Download icon:
You c an use the eval uation version of MDK and a ULINK2, ULINK-ME, ULINKpro or J-Li nk for this lab. You must ma ke
cer t ain adjustments for no n-ULINK adapters such as the S T-Link and not all features shown here will be available.
The addition of a license numbe r co nverts t he evaluation into a full, unrestricted copy of MDK.
The ULINKpro adds Cortex-M3 ETM trace support. It also adds faster programming time and better trace display. Most
STMicroelectronics Cortex-M3/M4 parts are equipped with ET M . All have SWV.
JTAG and SWD Definitions: It is useful to have an unde rstand ing of these terms:
JTAG: JTAG provides access to the CoreSight debugging module located on the STM32 processor. It uses 4 to 5 pins.
SWD: Serial Wire Debug is a two pin alternative to JT AG and has about the same capabilities except no Bo undary Scan.
SWD is referenced as SW in the µVision Cortex-M Target Driver Setup. See page 5, middle picture.
SWV: Serial Wire Vie wer: A trace capa bility providing dis play of reads, writes, exceptions, PC Sa mple s and printf.
SWO: Serial Wire Output: SWV frames usually come out this one pin output. It shares the JTAG signal TDIO.
Trace Port: A 4 bit port that ULINKpro use s t o output ETM frames and opti onally SWV (rather than the SWO p i n).
ETM: Embedded Trace Macrocell: Provides all the program counter values. Only the ULINKpro works with ETM .
Example Programs: See www.keil.com/st for additional information.
Example projects for STMicroelectronics boards are found in C:\Keil\ARM\boards\ST and in C:\Keil\ARM\boards\Keil for
Keil boards. Most example projects are pre-configured to use a ULINK2 or a ULINK-ME. Serial Wire Vie wer is not
usual ly configured: you can do this yourself easily. Projects that contain a Ulp in their name are configured to use a
ULINKpro and SWV and ETM are pre-configured. It is easy to select different debug adapters in µVision.
Most exa mple projects will compile within the 32 K c ode and d a ta limit of the evaluation version of MDK. An exception is
LCD_Blinky. A compiled executable called Blinky.axf file is provide d to allow you to run, evaluate and debug these
programs. If you attempt to compile t hese pro jects, the Blinky.axf file will be erased. It is a good idea to ba c k this file u p.