124 lines
7.0 KiB
C
124 lines
7.0 KiB
C
/*********************************************************************
|
|
* SEGGER Microcontroller GmbH *
|
|
* The Embedded Experts *
|
|
**********************************************************************
|
|
* *
|
|
* (c) 1995 - 2019 SEGGER Microcontroller GmbH *
|
|
* *
|
|
* www.segger.com Support: support@segger.com *
|
|
* *
|
|
**********************************************************************
|
|
* *
|
|
* SEGGER RTT * Real Time Transfer for embedded targets *
|
|
* *
|
|
**********************************************************************
|
|
* *
|
|
* All rights reserved. *
|
|
* *
|
|
* SEGGER strongly recommends to not make any changes *
|
|
* to or modify the source code of this software in order to stay *
|
|
* compatible with the RTT protocol and J-Link. *
|
|
* *
|
|
* Redistribution and use in source and binary forms, with or *
|
|
* without modification, are permitted provided that the following *
|
|
* conditions are met: *
|
|
* *
|
|
* o Redistributions of source code must retain the above copyright *
|
|
* notice, this list of conditions and the following disclaimer. *
|
|
* *
|
|
* o Redistributions in binary form must reproduce the above *
|
|
* copyright notice, this list of conditions and the following *
|
|
* disclaimer in the documentation and/or other materials provided *
|
|
* with the distribution. *
|
|
* *
|
|
* o Neither the name of SEGGER Microcontroller GmbH *
|
|
* nor the names of its contributors may be used to endorse or *
|
|
* promote products derived from this software without specific *
|
|
* prior written permission. *
|
|
* *
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
|
|
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
|
|
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
|
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
|
|
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
|
|
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
|
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
|
|
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
|
|
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
|
|
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
|
|
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
|
|
* DAMAGE. *
|
|
* *
|
|
**********************************************************************
|
|
* *
|
|
* RTT version: 6.44i *
|
|
* *
|
|
**********************************************************************
|
|
---------------------------END-OF-HEADER------------------------------
|
|
File : SEGGER_RTT_Conf.h
|
|
Purpose : Implementation of SEGGER real-time transfer (RTT) which
|
|
allows real-time communication on targets which support
|
|
debugger memory accesses while the CPU is running.
|
|
Revision: $Rev: 13430 $
|
|
|
|
*/
|
|
|
|
#ifndef SEGGER_RTT_CONF_H
|
|
#define SEGGER_RTT_CONF_H
|
|
|
|
#ifdef __IAR_SYSTEMS_ICC__
|
|
#include <intrinsics.h>
|
|
#endif
|
|
|
|
/*********************************************************************
|
|
*
|
|
* Defines, configurable
|
|
*
|
|
**********************************************************************
|
|
*/
|
|
|
|
#define SEGGER_RTT_MAX_NUM_UP_BUFFERS (2) // Max. number of up-buffers (T->H) available on this target (Default: 3)
|
|
#define SEGGER_RTT_MAX_NUM_DOWN_BUFFERS (2) // Max. number of down-buffers (H->T) available on this target (Default: 3)
|
|
|
|
#define BUFFER_SIZE_UP (1024) // Size of the buffer for terminal output of target, up to host (Default: 1k)
|
|
#define BUFFER_SIZE_DOWN (16) // Size of the buffer for terminal input to target from host (Usually keyboard input) (Default: 16)
|
|
|
|
#define SEGGER_RTT_PRINTF_BUFFER_SIZE (128u) // Size of buffer for RTT printf to bulk-send chars via RTT (Default: 64)
|
|
|
|
#define SEGGER_RTT_MODE_DEFAULT SEGGER_RTT_MODE_NO_BLOCK_SKIP // Mode for pre-initialized terminal channel (buffer 0)
|
|
|
|
/*********************************************************************
|
|
*
|
|
* RTT memcpy configuration
|
|
*
|
|
* memcpy() is good for large amounts of data,
|
|
* but the overhead is big for small amounts, which are usually stored via RTT.
|
|
* With SEGGER_RTT_MEMCPY_USE_BYTELOOP a simple byte loop can be used instead.
|
|
*
|
|
* SEGGER_RTT_MEMCPY() can be used to replace standard memcpy() in RTT functions.
|
|
* This is may be required with memory access restrictions,
|
|
* such as on Cortex-A devices with MMU.
|
|
*/
|
|
#define SEGGER_RTT_MEMCPY_USE_BYTELOOP 0 // 0: Use memcpy/SEGGER_RTT_MEMCPY, 1: Use a simple byte-loop
|
|
//
|
|
// Example definition of SEGGER_RTT_MEMCPY to external memcpy with GCC toolchains and Cortex-A targets
|
|
//
|
|
//#if ((defined __SES_ARM) || (defined __CROSSWORKS_ARM) || (defined __GNUC__)) && (defined (__ARM_ARCH_7A__))
|
|
// #define SEGGER_RTT_MEMCPY(pDest, pSrc, NumBytes) SEGGER_memcpy((pDest), (pSrc), (NumBytes))
|
|
//#endif
|
|
|
|
//
|
|
// Target is not allowed to perform other RTT operations while string still has not been stored completely.
|
|
// Otherwise we would probably end up with a mixed string in the buffer.
|
|
// If using RTT from within interrupts, multiple tasks or multi processors, define the SEGGER_RTT_LOCK() and SEGGER_RTT_UNLOCK() function here.
|
|
#if !defined(SEGGER_RTT_ASM)
|
|
#include "ch.h"
|
|
#define SEGGER_RTT_LOCK() do { \
|
|
syssts_t LockState = chSysGetStatusAndLockX()
|
|
#define SEGGER_RTT_UNLOCK() chSysRestoreStatusX(LockState); \
|
|
} while(0)
|
|
#endif
|
|
#endif
|
|
/*************************** End of file ****************************/
|