Copyright © 2011 ARM Ltd. All rights reserved
STMicroelectronics Cortex-M3 Lab with STM3240G-EVAL board www.keil.com
For the ST STM3240G-EVAL Evaluation Board with STM32F407
STMicroelectronics STM32: Cortex™-M4 Lab
ARM® Keil™ MDK Toolkit featuring Serial Wire Viewer and ETM Trace
For the STM3240G-EVAL board Version 0.72 Robert Boys bob.boys@arm.com
Introduction:
The purpose of this lab is to introduce you to the STMicroelectronics Cortex™-M4 processor family using the ARM® Keil™
MDK toolkit featuring the IDE μVision®. W e will use the Serial Wire Viewer (SWV) and ETM trace on the STM3240G-
EVAL eval uati on board from STMicroelectroncs. At the end of this tutoria l, you will be able to confidently work with
STM32 processors and MDK. Keil offers a similar board: MCBSTM32F400™. Examples are provided for both boards.
Keil MDK comes in an evaluation version that limits code a nd data size to 3 2 Kbytes. Nearly all Keil examples will compile
within this 32K limit. The addition of a licen se number will turn it into the f ull, unrestricted version. Contact Keil sales for a
temporary full version license if you need to evaluate MDK with programs greater than 32K. MDK includes a full vers io n of
Keil RTX™ RTOS. No royalty payments are required. RTX source code is now included with all versions of Keil MDK™.
Why Use Keil M D K ?
MDK provides these features particularly suited for Cortex-M3 and
Cortex-M4 users:
1. µVision IDE wit h Integrat ed Debug ger, Flash programmer
and the ARM® Compiler toolchain. MDK is a turn-key
product with included examples.
2. Serial Wire V iewer and ETM trace ca pability is included.
A full feature Keil RTOS ca lle d RTX is included with
MDK with source code.
3. RTX Kernel Awareness window is updated in real-time.
Kernel Awareness exists for Ke i l RTX, CMX, Qua dros
and Micrium. All RTOSs can compile with MDK.
Awareness can be provided by the supplier.
4. Choice of adapters: ULINK2™, ULINK-ME™, ULINKpro™ or Segger J-Link (version 6 or later). ST-Link is
supported but it has no S WV or ETM support at this time. SWV for ST -Link is planned for 4Q11.
5. Keil Technical Support is included for one year and is renewable. This helps you get your pr oject completed faster.
This document details these features:
1. Serial Wire Viewer (SWV) with ULINK2, ULINK-ME a nd ULINKpro. ETM Trace using ULINKpro.
2. Real-time Read and Write to memory locations for Watch, Memory and RTX Tasks windows. These are non-
intrusive to your program. No CPU cycles are stolen. No instrumentation code is added to your so urc e fil es.
3. Six Hardware Breakpoints (ca n be set/unset on-the-fly) and four Wat chpoints (also called Access Breaks).
4. RTX Viewer: a kernel awareness program for the Keil RTX RTOS that updates while the program is running.
Serial Wire Viewer (SWV):
Serial Wire Viewer (SWV) displays PC S amples, Exceptio ns (including i nterrupts), data reads and writes, IT M (printf),
CPU counters and a timestamp. This information co mes from the ARM CoreSight™ debug module integrated into the
Cortex-M4. SWV is outp ut on the Seria l Wire Output (SWO) pin found on the JTAG/SWD adapter connector.
SWV does not steal any CPU cycles and is completely non-intrusive except for ITM Debug printf Viewer. SWV is provided
by the Keil ULINK2, ULINK-ME, ULINKpro and t he Segger J-Link. Best results are with a ULINK family adapter. The
STMicroelectronics ST-Link adapter does no t support SWV at this time.
Embedded Trace Macrocell (ETM):
ETM adds all the program counter values to the data provided by SWV. This allows advan ced debugging feature s incl udi ng
timing of areas of code (Exec ution Profili ng), Code Coverage, Performance Analysis and program flow debugging and
analysis. ETM requires a special debugger adapter s uch as the ULIN Kpro or Segger J-Trace. This document us es a
ULINKpro for ETM. A ULINK2 or ULINK-ME is used for the Serial Wire Viewer exercises in this lab.