1
1
/*********************************************************************
2
- * SEGGER Microcontroller GmbH & Co. KG *
2
+ * SEGGER Microcontroller GmbH *
3
3
* The Embedded Experts *
4
4
**********************************************************************
5
5
* *
6
- * (c) 2015 - 2017 SEGGER Microcontroller GmbH & Co. KG *
6
+ * (c) 1995 - 2019 SEGGER Microcontroller GmbH *
7
7
* *
8
8
* www.segger.com Support: support@segger.com *
9
9
* *
17
17
* *
18
18
* SEGGER strongly recommends to not make any changes *
19
19
* to or modify the source code of this software in order to stay *
20
- * compatible with the RTT protocol and J-Link. *
20
+ * compatible with the SystemView and RTT protocol, and J-Link. *
21
21
* *
22
22
* Redistribution and use in source and binary forms, with or *
23
23
* without modification, are permitted provided that the following *
24
- * conditions are met: *
24
+ * condition is met: *
25
25
* *
26
26
* o Redistributions of source code must retain the above copyright *
27
- * notice, this list of conditions and the following disclaimer. *
28
- * *
29
- * o Redistributions in binary form must reproduce the above *
30
- * copyright notice, this list of conditions and the following *
31
- * disclaimer in the documentation and/or other materials provided *
32
- * with the distribution. *
33
- * *
34
- * o Neither the name of SEGGER Microcontroller GmbH & Co. KG *
35
- * nor the names of its contributors may be used to endorse or *
36
- * promote products derived from this software without specific *
37
- * prior written permission. *
27
+ * notice, this condition and the following disclaimer. *
38
28
* *
39
29
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
40
30
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
52
42
* *
53
43
**********************************************************************
54
44
* *
55
- * SystemView version: V2.52d *
45
+ * SystemView version: 3.10 *
56
46
* *
57
47
**********************************************************************
58
48
---------------------------END-OF-HEADER------------------------------
59
49
File : SEGGER_RTT_Conf.h
60
50
Purpose : Implementation of SEGGER real-time transfer (RTT) which
61
51
allows real-time communication on targets which support
62
52
debugger memory accesses while the CPU is running.
63
- Revision: $Rev: 12706 $
53
+ Revision: $Rev: 17066 $
64
54
65
55
*/
66
56
@@ -77,18 +67,29 @@ Revision: $Rev: 12706 $
77
67
*
78
68
**********************************************************************
79
69
*/
70
+ #ifndef SEGGER_RTT_MAX_NUM_UP_BUFFERS
71
+ #define SEGGER_RTT_MAX_NUM_UP_BUFFERS (3) // Max. number of up-buffers (T->H) available on this target (Default: 3)
72
+ #endif
80
73
81
- #define SEGGER_RTT_MAX_NUM_UP_BUFFERS (3) // Max. number of up-buffers (T->H) available on this target (Default: 3)
82
- #define SEGGER_RTT_MAX_NUM_DOWN_BUFFERS (3) // Max. number of down-buffers (H->T) available on this target (Default: 3)
74
+ #ifndef SEGGER_RTT_MAX_NUM_DOWN_BUFFERS
75
+ #define SEGGER_RTT_MAX_NUM_DOWN_BUFFERS (3) // Max. number of down-buffers (H->T) available on this target (Default: 3)
76
+ #endif
83
77
84
- #define BUFFER_SIZE_UP (1024) // Size of the buffer for terminal output of target, up to host (Default: 1k)
85
- #define BUFFER_SIZE_DOWN (16) // Size of the buffer for terminal input to target from host (Usually keyboard input) (Default: 16)
78
+ #ifndef BUFFER_SIZE_UP
79
+ #define BUFFER_SIZE_UP (1024) // Size of the buffer for terminal output of target, up to host (Default: 1k)
80
+ #endif
86
81
87
- #define SEGGER_RTT_PRINTF_BUFFER_SIZE (64u) // Size of buffer for RTT printf to bulk-send chars via RTT (Default: 64)
82
+ #ifndef BUFFER_SIZE_DOWN
83
+ #define BUFFER_SIZE_DOWN (16) // Size of the buffer for terminal input to target from host (Usually keyboard input) (Default: 16)
84
+ #endif
88
85
89
- #define SEGGER_RTT_MODE_DEFAULT SEGGER_RTT_MODE_NO_BLOCK_SKIP // Mode for pre-initialized terminal channel (buffer 0)
86
+ #ifndef SEGGER_RTT_PRINTF_BUFFER_SIZE
87
+ #define SEGGER_RTT_PRINTF_BUFFER_SIZE (64u) // Size of buffer for RTT printf to bulk-send chars via RTT (Default: 64)
88
+ #endif
90
89
91
- #define USE_RTT_ASM (0) // Use assembler version of SEGGER_RTT.c when 1
90
+ #ifndef SEGGER_RTT_MODE_DEFAULT
91
+ #define SEGGER_RTT_MODE_DEFAULT SEGGER_RTT_MODE_NO_BLOCK_SKIP // Mode for pre-initialized terminal channel (buffer 0)
92
+ #endif
92
93
93
94
/*********************************************************************
94
95
*
@@ -102,7 +103,9 @@ Revision: $Rev: 12706 $
102
103
* This is may be required with memory access restrictions,
103
104
* such as on Cortex-A devices with MMU.
104
105
*/
105
- #define SEGGER_RTT_MEMCPY_USE_BYTELOOP 0 // 0: Use memcpy/SEGGER_RTT_MEMCPY, 1: Use a simple byte-loop
106
+ #ifndef SEGGER_RTT_MEMCPY_USE_BYTELOOP
107
+ #define SEGGER_RTT_MEMCPY_USE_BYTELOOP 0 // 0: Use memcpy/SEGGER_RTT_MEMCPY, 1: Use a simple byte-loop
108
+ #endif
106
109
//
107
110
// Example definition of SEGGER_RTT_MEMCPY to external memcpy with GCC toolchains and Cortex-A targets
108
111
//
@@ -124,20 +127,21 @@ Revision: $Rev: 12706 $
124
127
// In case of doubt mask all interrupts: 1 << (8 - BASEPRI_PRIO_BITS) i.e. 1 << 5 when 3 bits are implemented in NVIC
125
128
// or define SEGGER_RTT_LOCK() to completely disable interrupts.
126
129
//
127
-
128
- #define SEGGER_RTT_MAX_INTERRUPT_PRIORITY (2 << 5) // Interrupt priority to lock on SEGGER_RTT_LOCK on Cortex-M3/4 (Default: 0x20)
130
+ #ifndef SEGGER_RTT_MAX_INTERRUPT_PRIORITY
131
+ #define SEGGER_RTT_MAX_INTERRUPT_PRIORITY (0x20) // Interrupt priority to lock on SEGGER_RTT_LOCK on Cortex-M3/4 (Default: 0x20)
132
+ #endif
129
133
130
134
/*********************************************************************
131
135
*
132
136
* RTT lock configuration for SEGGER Embedded Studio,
133
137
* Rowley CrossStudio and GCC
134
138
*/
135
- #if (defined __SES_ARM ) || ( defined __CROSSWORKS_ARM ) || ( defined __GNUC__ )
136
- #if (defined __ARM_ARCH_6M__ ) || ( defined __ARM_ARCH_8M_BASE__ )
139
+ #if (defined( __SES_ARM ) || defined( __CROSSWORKS_ARM ) || defined( __GNUC__ ) || defined( __clang__ )) && !defined ( __CC_ARM )
140
+ #if (defined( __ARM_ARCH_6M__ ) || defined( __ARM_ARCH_8M_BASE__ ) )
137
141
#define SEGGER_RTT_LOCK () { \
138
142
unsigned int LockState; \
139
143
__asm volatile ("mrs %0, primask \n\t" \
140
- "mov r1, $1 \n\t" \
144
+ "movs r1, $1 \n\t" \
141
145
"msr primask, r1 \n\t" \
142
146
: "=r" (LockState) \
143
147
: \
@@ -150,8 +154,7 @@ Revision: $Rev: 12706 $
150
154
: \
151
155
); \
152
156
}
153
-
154
- #elif (defined(__ARM_ARCH_7M__ ) || defined(__ARM_ARCH_7EM__ ))
157
+ #elif (defined(__ARM_ARCH_7M__ ) || defined(__ARM_ARCH_7EM__ ) || defined(__ARM_ARCH_8M_MAIN__ ))
155
158
#ifndef SEGGER_RTT_MAX_INTERRUPT_PRIORITY
156
159
#define SEGGER_RTT_MAX_INTERRUPT_PRIORITY (0x20)
157
160
#endif
@@ -195,9 +198,6 @@ Revision: $Rev: 12706 $
195
198
: "r0", "r1" \
196
199
); \
197
200
}
198
- #else
199
- #define SEGGER_RTT_LOCK ()
200
- #define SEGGER_RTT_UNLOCK ()
201
201
#endif
202
202
#endif
203
203
@@ -308,14 +308,44 @@ Revision: $Rev: 12706 $
308
308
#endif
309
309
#define SEGGER_RTT_LOCK () { \
310
310
unsigned int LockState; \
311
- LockState = OS_GetBASEPRI(); \
312
- OS_SetBASEPRI(SEGGER_RTT_MAX_INTERRUPT_PRIORITY);
311
+ LockState = _set_interrupt_priority(SEGGER_RTT_MAX_INTERRUPT_PRIORITY);
313
312
314
- #define SEGGER_RTT_UNLOCK () OS_SetBASEPRI (LockState); \
313
+ #define SEGGER_RTT_UNLOCK () _set_interrupt_priority (LockState); \
315
314
}
316
315
#endif
317
316
#endif
318
317
318
+ /*********************************************************************
319
+ *
320
+ * RTT lock configuration for CCRX
321
+ */
322
+ #ifdef __RX
323
+ #define SEGGER_RTT_LOCK () { \
324
+ unsigned long LockState; \
325
+ LockState = get_psw() & 0x010000; \
326
+ clrpsw_i();
327
+
328
+ #define SEGGER_RTT_UNLOCK () set_psw(get_psw() | LockState); \
329
+ }
330
+ #endif
331
+
332
+ /*********************************************************************
333
+ *
334
+ * RTT lock configuration for embOS Simulation on Windows
335
+ * (Can also be used for generic RTT locking with embOS)
336
+ */
337
+ #if defined(WIN32 ) || defined(SEGGER_RTT_LOCK_EMBOS )
338
+
339
+ void OS_SIM_EnterCriticalSection (void );
340
+ void OS_SIM_LeaveCriticalSection (void );
341
+
342
+ #define SEGGER_RTT_LOCK () { \
343
+ OS_SIM_EnterCriticalSection();
344
+
345
+ #define SEGGER_RTT_UNLOCK () OS_SIM_LeaveCriticalSection(); \
346
+ }
347
+ #endif
348
+
319
349
/*********************************************************************
320
350
*
321
351
* RTT lock configuration fallback
0 commit comments