Skip to content

Commit 0e3771b

Browse files
committed
modules: add segger module locally, and update to 3.30
Move Zephyr related files into modules/ and update to 3.30 Signed-off-by: Anas Nashif <[email protected]>
1 parent 77b7ec2 commit 0e3771b

File tree

4 files changed

+80
-1
lines changed

4 files changed

+80
-1
lines changed

modules/segger/CMakeLists.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
if(CONFIG_USE_SEGGER_RTT)
2+
3+
zephyr_library()
4+
set(SEGGER_DIR ${ZEPHYR_CURRENT_MODULE_DIR})
5+
zephyr_include_directories_ifdef(CONFIG_USE_SEGGER_RTT
6+
${SEGGER_DIR}/SEGGER
7+
${SEGGER_DIR}/Config
8+
.
9+
)
10+
zephyr_library_sources(
11+
${SEGGER_DIR}/SEGGER/SEGGER_RTT.c
12+
SEGGER_RTT_zephyr.c
13+
)
14+
zephyr_library_sources_ifdef(CONFIG_SEGGER_SYSTEMVIEW ${SEGGER_DIR}/SEGGER/SEGGER_SYSVIEW.c)
15+
endif()

modules/segger/SEGGER_RTT_zephyr.c

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* Copyright (c) 2018 omSquare s.r.o.
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include <kernel.h>
8+
#include <init.h>
9+
#include "SEGGER_RTT.h"
10+
11+
/*
12+
* Common mutex for locking access to terminal buffer.
13+
* Note that SEGGER uses same lock macros for both SEGGER_RTT_Write and
14+
* SEGGER_RTT_Read functions. Because of this we are not able generally
15+
* separate up and down access using two mutexes until SEGGER library fix
16+
* this.
17+
*
18+
* If sharing access cause performance problems, consider using another
19+
* non terminal buffers.
20+
*/
21+
22+
K_MUTEX_DEFINE(rtt_term_mutex);
23+
24+
static int rtt_init(const struct device *unused)
25+
{
26+
ARG_UNUSED(unused);
27+
28+
SEGGER_RTT_Init();
29+
30+
return 0;
31+
}
32+
33+
SYS_INIT(rtt_init, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_OBJECTS);
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
* Copyright (c) 2020 Intel Corporation
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
#pragma once
7+
8+
#include <stdint.h>
9+
#include <irq.h>
10+
11+
#define SEGGER_SYSVIEW_GET_TIMESTAMP sysview_get_timestamp
12+
#define SEGGER_SYSVIEW_GET_INTERRUPT_ID sysview_get_interrupt
13+
14+
uint32_t sysview_get_timestamp(void);
15+
uint32_t sysview_get_interrupt(void);
16+
17+
#define SEGGER_SYSVIEW_RTT_BUFFER_SIZE CONFIG_SEGGER_SYSVIEW_RTT_BUFFER_SIZE
18+
#define SEGGER_SYSVIEW_POST_MORTEM_MODE CONFIG_SEGGER_SYSVIEW_POST_MORTEM_MODE
19+
20+
#if defined(CONFIG_SEGGER_SYSVIEW_SECTION_DTCM)
21+
#define SEGGER_SYSVIEW_SECTION ".dtcm_data"
22+
#endif
23+
24+
/* Lock SystemView (nestable) */
25+
#define SEGGER_SYSVIEW_LOCK() { \
26+
unsigned int __sysview_irq_key = \
27+
irq_lock()
28+
29+
/* Unlock SystemView (nestable) */
30+
#define SEGGER_SYSVIEW_UNLOCK() irq_unlock(__sysview_irq_key); \
31+
}

west.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ manifest:
112112
revision: cdb9570901e87ab247aed0a96ccd8f94beee5834
113113
path: modules/lib/openthread
114114
- name: segger
115-
revision: 38c79a447e4a47d413b4e8d34448316a5cece77c
115+
revision: 2aa031c081426dcd0626185af45c40bd05811b68
116116
path: modules/debug/segger
117117
- name: sof
118118
revision: 52dc9c5ad8d0d2a5df0bb51ea30e54f8d7890639

0 commit comments

Comments
 (0)