mirror of
https://github.com/apache/nuttx.git
synced 2026-05-29 04:19:37 +08:00
note/sysview: add Segger System View support
Reference: https://www.segger.com/products/development-tools/systemview https://github.com/SEGGERMicro/SystemView https://github.com/SEGGERMicro/RTT Signed-off-by: chao.an <anchao@xiaomi.com>
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
/****************************************************************************
|
||||
* drivers/segger/config/Global.h
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __DRIVERS_SEGGER_CONFIG_GLOBAL_H
|
||||
#define __DRIVERS_SEGGER_CONFIG_GLOBAL_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define U8 uint8_t
|
||||
#define I8 int8_t
|
||||
#define U16 uint16_t
|
||||
#define I16 int16_t
|
||||
#define U32 uint32_t
|
||||
#define I32 int32_t
|
||||
#define U64 uint64_t
|
||||
#define I64 int64_t
|
||||
#define PTR_ADDR uintptr_t
|
||||
|
||||
#endif /* __DRIVERS_SEGGER_CONFIG_GLOBAL_H */
|
||||
@@ -0,0 +1,84 @@
|
||||
/****************************************************************************
|
||||
* drivers/segger/config/SEGGER_RTT_Conf.h
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __DRIVERS_SEGGER_CONFIG_SEGGER_RTT_CONF_H
|
||||
#define __DRIVERS_SEGGER_CONFIG_SEGGER_RTT_CONF_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <nuttx/spinlock.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Take in and set to correct values for Cortex systems with CPU cache */
|
||||
|
||||
/* Largest cache line size (in bytes) in the current system */
|
||||
|
||||
#define SEGGER_RTT_CPU_CACHE_LINE_SIZE CONFIG_SEGGER_RTT_CPU_CACHE_LINE_SIZE
|
||||
|
||||
/* Address alias where RTT CB and buffers can be accessed uncached */
|
||||
|
||||
#define SEGGER_RTT_UNCACHED_OFF CONFIG_SEGGER_RTT_UNCACHED_OFF
|
||||
|
||||
/* Number of up-buffers (T->H) available on this target */
|
||||
|
||||
#define SEGGER_RTT_MAX_NUM_UP_BUFFERS CONFIG_SEGGER_RTT_MAX_NUM_UP_BUFFERS
|
||||
|
||||
/* Number of down-buffers (H->T) available on this target */
|
||||
|
||||
#define SEGGER_RTT_MAX_NUM_DOWN_BUFFERS CONFIG_SEGGER_RTT_MAX_NUM_DOWN_BUFFERS
|
||||
|
||||
/* Size of the buffer for terminal output of target, up to host */
|
||||
|
||||
#define BUFFER_SIZE_UP CONFIG_SEGGER_RTT_BUFFER_SIZE_UP
|
||||
|
||||
/* Size of the buffer for terminal input to target from host */
|
||||
|
||||
#define BUFFER_SIZE_DOWN CONFIG_SEGGER_RTT_BUFFER_SIZE_DOWN
|
||||
|
||||
/* Mode for pre-initialized terminal channel */
|
||||
|
||||
#define SEGGER_RTT_MODE_DEFAULT SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL
|
||||
|
||||
/* 0: Use memcpy/SEGGER_RTT_MEMCPY, 1: Use a simple byte-loop */
|
||||
|
||||
#define SEGGER_RTT_MEMCPY_USE_BYTELOOP 0
|
||||
|
||||
/* RTT lock configuration */
|
||||
|
||||
/* Lock RTT (nestable) (i.e. disable interrupts) */
|
||||
|
||||
#define SEGGER_RTT_LOCK() irqstate_t __flags = spin_lock_irqsave(NULL)
|
||||
|
||||
/* Unlock RTT (nestable) (i.e. enable previous interrupt lock state) */
|
||||
|
||||
#define SEGGER_RTT_UNLOCK() spin_unlock_irqrestore(NULL, __flags)
|
||||
|
||||
/* Disable RTT SEGGER_RTT_WriteSkipNoLock */
|
||||
|
||||
#define RTT_USE_ASM 0
|
||||
|
||||
#endif /* __DRIVERS_SEGGER_CONFIG_SEGGER_RTT_CONF_H */
|
||||
@@ -0,0 +1,79 @@
|
||||
/****************************************************************************
|
||||
* drivers/segger/config/SEGGER_SYSVIEW_Conf.h
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __DRIVERS_SEGGER_CONFIG_SEGGER_SYSVIEW_CONF_H
|
||||
#define __DRIVERS_SEGGER_CONFIG_SEGGER_SYSVIEW_CONF_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Function macro to retrieve the Id of the currently active interrupt.
|
||||
* Call user-supplied function SEGGER_SYSVIEW_X_GetInterruptId().
|
||||
*/
|
||||
|
||||
#define SEGGER_SYSVIEW_GET_INTERRUPT_ID sysview_get_interrupt_id
|
||||
|
||||
/* Function macro to retrieve a system timestamp for SYSVIEW events.
|
||||
* Call user-supplied function SEGGER_SYSVIEW_X_GetTimestamp().
|
||||
*/
|
||||
|
||||
#define SEGGER_SYSVIEW_GET_TIMESTAMP sysview_get_timestamp
|
||||
|
||||
/* Number of bytes that SystemView uses for the RTT buffer. */
|
||||
|
||||
#define SEGGER_SYSVIEW_RTT_BUFFER_SIZE CONFIG_SEGGER_SYSVIEW_RTT_BUFFER_SIZE
|
||||
|
||||
/* Largest cache line size (in bytes) in the target system. */
|
||||
|
||||
#define SEGGER_SYSVIEW_CPU_CACHE_LINE_SIZE CONFIG_SEGGER_RTT_CPU_CACHE_LINE_SIZE
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
#define EXTERN extern "C"
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
unsigned int sysview_get_interrupt_id(void);
|
||||
unsigned int sysview_get_timestamp(void);
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __DRIVERS_SEGGER_CONFIG_SEGGER_SYSVIEW_CONF_H */
|
||||
Reference in New Issue
Block a user