mirror of
https://github.com/apache/nuttx.git
synced 2026-06-02 17:48:54 +08:00
drivers/segger:Add config option to allow defining the macro as variable
we are using segger RTT protocol over shared memory for two core log/trace: one is NuttX another Linux/Windows. But the base address of shared memory can only be known at runtime, so we change SEGGER_RTT_UNCACHED_OFF from macro to global variable, and update to the correct g_segger_offset after the shared memory is initialized by: g_segger_offset = (uintptr_t)ishmem - (uintptr_t)&_SEGGER_RTT; Signed-off-by: liwenxiang1 <liwenxiang1@xiaomi.com>
This commit is contained in:
@@ -33,9 +33,16 @@ config SEGGER_RTT_CPU_CACHE_LINE_SIZE
|
|||||||
---help---
|
---help---
|
||||||
Largest cache line size (in bytes) in the target system.
|
Largest cache line size (in bytes) in the target system.
|
||||||
|
|
||||||
|
config SEGGER_RTT_UNCACHED_OFF_VARIABLE
|
||||||
|
bool
|
||||||
|
default n
|
||||||
|
---help---
|
||||||
|
Converting the macro for Segger RTT uncached offset to variable representation
|
||||||
|
|
||||||
config SEGGER_RTT_UNCACHED_OFF
|
config SEGGER_RTT_UNCACHED_OFF
|
||||||
int "Segger RTT uncached offset"
|
int "Segger RTT uncached offset"
|
||||||
default 0
|
default 0
|
||||||
|
depends on !SEGGER_RTT_UNCACHED_OFF_VARIABLE
|
||||||
---help---
|
---help---
|
||||||
Address alias where RTT CB and buffers can be accessed uncached
|
Address alias where RTT CB and buffers can be accessed uncached
|
||||||
|
|
||||||
|
|||||||
@@ -41,6 +41,10 @@
|
|||||||
extern struct rspinlock_s g_segger_lock;
|
extern struct rspinlock_s g_segger_lock;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_SEGGER_RTT_UNCACHED_OFF_VARIABLE
|
||||||
|
extern ptrdiff_t g_segger_offset;
|
||||||
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Pre-processor Definitions
|
* Pre-processor Definitions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -53,7 +57,11 @@ extern struct rspinlock_s g_segger_lock;
|
|||||||
|
|
||||||
/* Address alias where RTT CB and buffers can be accessed uncached */
|
/* Address alias where RTT CB and buffers can be accessed uncached */
|
||||||
|
|
||||||
#define SEGGER_RTT_UNCACHED_OFF CONFIG_SEGGER_RTT_UNCACHED_OFF
|
#ifdef CONFIG_SEGGER_RTT_UNCACHED_OFF_VARIABLE
|
||||||
|
# define SEGGER_RTT_UNCACHED_OFF g_segger_offset
|
||||||
|
#else
|
||||||
|
# define SEGGER_RTT_UNCACHED_OFF CONFIG_SEGGER_RTT_UNCACHED_OFF
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Number of up-buffers (T->H) available on this target */
|
/* Number of up-buffers (T->H) available on this target */
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
struct rspinlock_s g_segger_lock = RSPINLOCK_INITIALIZER;
|
struct rspinlock_s g_segger_lock = RSPINLOCK_INITIALIZER;
|
||||||
|
ptrdiff_t g_segger_offset = PTRDIFF_MAX;
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
|
|||||||
Reference in New Issue
Block a user