Syntax
-swofreq <SWOFreq>
Example
-swofreq 6000
3.7.3
Configure SWO output after device reset
Example code for enabling SWO out of the target application
#define ITM_ENA
#define ITM_TPR
#define ITM_TCR
#define ITM_LSR
#define DHCSR
#define DEMCR
#define TPIU_ACPR
#define TPIU_SPPR
#define DWT_CTRL
#define FFCR
U32 _ITMPort = 0; // The stimulus port from which SWO data is received and displayed.
U32 TargetDiv = 1;// Has to be calculated according to
static void _EnableSWO() {
U32 StimulusRegs;
//
// Enable access to SWO registers
//
DEMCR |= (1 << 24);
ITM_LSR = 0xC5ACCE55;
//
// Initially disable ITM and stimulus port
// To make sure that nothing is transferred via SWO
// when changing the SWO prescaler etc.
//
Stimulusregs = ITM_ENA;
StimulusRegs &= ~(1 << _ITMPort);
ITM_ENABLE = StimulusRegs;
ITM_TCR
= 0;
//
// Initialize SWO (prescaler, etc.)
//
TPIU_SPPR
= 0x00000002;
TPIU_ACPR
= TargetDiv - 1;
ITM_TPR
= 0x00000000;
DWT_CTRL
= 0x400003FE;
FFCR
= 0x00000100;
//
// Enable ITM and stimulus port
//
ITM_TCR
ITM_ENA
}
3.7.4
Target example code for terminal output
/*********************************************************************
*
*
Solutions for real time microcontroller applications
**********************************************************************
*
*
(c) 2012-2013
*
*
www.segger.com
J-Link / J-Trace (UM08001)
(*(volatile unsigned int*)0xE0000E00) // ITM Enable
(*(volatile unsigned int*)0xE0000E40) // Trace Privilege Register
(*(volatile unsigned int*)0xE0000E80) // ITM Trace Control Reg.
(*(volatile unsigned int*)0xE0000FB0) // ITM Lock Status Register
(*(volatile unsigned int*)0xE000EDF0) // Debug register
(*(volatile unsigned int*)0xE000EDFC) // Debug register
(*(volatile unsigned int*)0xE0040010) // Async Clock
(*(volatile unsigned int*)0xE00400F0) // Selected Pin Protocol
(*(volatile unsigned int*)0xE0001000) // DWT Control Register
(*(volatile unsigned int*)0xE0040304) // Formatter and flush
// the CPU speed and the output baud rate
= 0x1000D;
= StimulusRegs | (1 << _ITMPort));
SEGGER MICROCONTROLLER GmbH & Co KG
SEGGER Microcontroller GmbH & Co KG
Support: support@segger.com
// presacler register
// Register
// Control Register
// Disable ITM stimulus port
// Disable ITM
// Select NRZ mode
// Example: 72/48 = 1,5 MHz
// Enable ITM
// Enable ITM stimulus port
© 2004-2013 SEGGER Microcontroller GmbH & Co. KG
105
\
\
\
\
*
*
*
*
*
*
Need help?
Do you have a question about the J-Link and is the answer not in the manual?