Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions Config/Global.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.58 *
* *
**********************************************************************
----------------------------------------------------------------------
File : Global.h
Purpose : Global types
Expand Down
20 changes: 16 additions & 4 deletions Config/SEGGER_RTT_Conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2024 SEGGER Microcontroller GmbH *
* (c) 1995 - 2021 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: [email protected] *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* 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 SystemView and RTT protocol, and J-Link. *
* 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 *
Expand All @@ -42,9 +42,10 @@
* *
**********************************************************************
* *
* SystemView version: 3.58 *
* RTT version: 8.56a *
* *
**********************************************************************

---------------------------END-OF-HEADER------------------------------
File : SEGGER_RTT_Conf.h
Purpose : Implementation of SEGGER real-time transfer (RTT) which
Expand Down Expand Up @@ -443,5 +444,16 @@ void OS_SIM_LeaveCriticalSection(void);
#define SEGGER_RTT_UNLOCK() // Unlock RTT (nestable) (i.e. enable previous interrupt lock state)
#endif

/*********************************************************************
*
* If SEGGER_RTT_SECTION is defined but SEGGER_RTT_BUFFER_SECTION
* is not, use the same section for SEGGER_RTT_BUFFER_SECTION.
*/
#ifndef SEGGER_RTT_BUFFER_SECTION
#if defined(SEGGER_RTT_SECTION)
#define SEGGER_RTT_BUFFER_SECTION SEGGER_RTT_SECTION
#endif
#endif

#endif
/*************************** End of file ****************************/
12 changes: 6 additions & 6 deletions Config/SEGGER_SYSVIEW_Conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.58 *
* *
**********************************************************************
-------------------------- END-OF-HEADER -----------------------------

File : SEGGER_SYSVIEW_Conf.h
Expand Down Expand Up @@ -84,10 +80,14 @@ uint32_t sysview_get_interrupt(void);

#define SEGGER_SYSVIEW_RTT_BUFFER_SIZE CONFIG_SEGGER_SYSVIEW_RTT_BUFFER_SIZE
#define SEGGER_SYSVIEW_POST_MORTEM_MODE CONFIG_SEGGER_SYSVIEW_POST_MORTEM_MODE
#define SEGGER_SYSVIEW_RTT_CHANNEL CONFIG_SEGGER_SYSVIEW_RTT_CHANNEL
#define SEGGER_SYSVIEW_RTT_CHANNEL CONFIG_SEGGER_SYSVIEW_RTT_CHANNEL

#if defined(CONFIG_SEGGER_SYSVIEW_SECTION_DTCM)
#define SEGGER_SYSVIEW_SECTION ".dtcm_bss"
#define SEGGER_SYSVIEW_SECTION ".dtcm_bss"
#endif

#if !(defined SEGGER_SYSVIEW_SECTION) && (defined SEGGER_RTT_BUFFER_SECTION)
#define SEGGER_SYSVIEW_SECTION SEGGER_RTT_BUFFER_SECTION
#endif

extern unsigned int zephyr_rtt_irq_lock(void);
Expand Down
36 changes: 36 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@

SEGGER Microcontroller GmbH
The Embedded Experts

(c) 1995 - 2021 SEGGER Microcontroller GmbH
www.segger.com Support: [email protected]

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
condition is met:

- Redistributions of source code must retain the above copyright
notice, this condition and the following disclaimer.

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.
44 changes: 23 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,12 @@ This README identifies the origin of upstream Segger files and suggests a proced
updating to a new Segger release.

### Upstream Segger source code
Segger's [official GitHub repository][6] is not currently actively maintained, hence Segger code is
obtained from publicly accessible download links posted on Segger's website.
RTT and SystemView target source code is available from Segger's GitHub repositories
- [RTT][6]
- [SystemView][7]

#### RTT and SystemView
[Download][7] "SystemView, Target Sources" from the SystemView downloads [webpage][8]. This
download contains both RTT and SystemView sources.

#### Monitor mode debugging
[Download][9] "Example project" from the Monitor mode debugging [webpage][10].
Monitor mode source can be [downloaded][8] as "Example project" from the Monitor mode debugging
[webpage][9].

### Updating to a new Segger release
Upgrading to a new Segger release means migrating existing Zephyr changes to the latest Segger
Expand All @@ -28,23 +25,29 @@ achieving the desired result.

1. Obtain the updated Segger code and prepare for subsequent steps
1. Download upstream code from the links above
2. Extract the SystemView update and delete the `Samples` directory
2. Delete `RTT/Examples`, `SystemView/Sample` and other unnecessary files
3. Extract the Monitor mode example and delete _non_-JLINK_MONITOR* files
4. Organize the files to match the directory structure of this repository
5. Convert line endings of all files to Unix style LF (`\n`)
6. Strip trailing white space of all files
2. Establish the Zephyr patches that will be applied in step 3
1. Download the SystemView release this repository is _currently_ based on (refer to
"SystemView version: x.yy" in the source files to determine the current release)
1. Download the RTT and SystemView code this repository is _currently_ based on (see
[Current release](#current-release))
2. Repeat step 1 parts ii-vi for these downloaded files
3. Compare the files of this repository to those of step 2 part ii to identify the existing
Zephyr changes (the "diff", or "patch") needed for step 3
3. Compare the files of this repository to those of step 2 part ii to identify existing
Zephyr specific changes (the "diff", or "patch") needed for step 3
3. Apply the Zephyr changes to the new Segger release
1. Apply the patches from step 2 part iii to the files of step 1
2. Sanity check the result and revise as needed
4. Review/update the list of patched files below
5. Commit the updated + modified Segger files and push the change
6. Open a pull-request to merge the change into this repository
4. Review/update references to the Segger releases below
5. Review/update the list of patched files below
6. Commit the updated + modified Segger files and push the change
7. Open a pull-request to merge the change into this repository

### Current release
This repository integrates the following Segger releases:
- RTT v8.56a [GitHub](https://github.com/SEGGERMicro/RTT/tree/ad6970d813bb12b8a5e34aa94b3a1999f7bd0b6b)
- SystemView v3.62c [GitHub](https://github.com/SEGGERMicro/SystemView/tree/62bc0ad84a6812dc4d5b044ef6f0727f0b488b9e)

### Patched files
Segger source files with Zephyr specific changes:
Expand All @@ -60,8 +63,7 @@ Segger source files with Zephyr specific changes:
[3]: https://www.segger.com/products/development-tools/systemview
[4]: https://wiki.segger.com/SystemView
[5]: https://www.segger.com/products/debug-probes/j-link/technology/monitor-mode-debugging
[6]: https://github.com/SEGGERMicro
[7]: https://www.segger.com/downloads/jlink/systemview_target_src
[8]: https://www.segger.com/downloads/systemview
[9]: https://www.segger.com/downloads/pub/Generic_Cortex-M_MonitorModeSystickExample_SES.zip
[10]: https://www.segger.com/products/debug-probes/j-link/technology/monitor-mode-debugging
[6]: https://github.com/SEGGERMicro/RTT
[7]: https://github.com/SEGGERMicro/SystemView
[8]: https://www.segger.com/downloads/pub/Generic_Cortex-M_MonitorModeSystickExample_SES.zip
[9]: https://www.segger.com/products/debug-probes/j-link/technology/monitor-mode-debugging
4 changes: 0 additions & 4 deletions SEGGER/SEGGER.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.58 *
* *
**********************************************************************
----------------------------------------------------------------------
File : SEGGER.h
Purpose : Global types etc & general purpose utility functions
Expand Down
17 changes: 6 additions & 11 deletions SEGGER/SEGGER_RTT.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2024 SEGGER Microcontroller GmbH *
* (c) 1995 - 2021 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: [email protected] *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* 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 SystemView and RTT protocol, and J-Link. *
* 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 *
Expand All @@ -42,9 +42,10 @@
* *
**********************************************************************
* *
* SystemView version: 3.58 *
* RTT version: 8.56a *
* *
**********************************************************************

---------------------------END-OF-HEADER------------------------------
File : SEGGER_RTT.c
Purpose : Implementation of SEGGER real-time transfer (RTT) which
Expand Down Expand Up @@ -121,12 +122,6 @@ Additional information:
#define SEGGER_RTT_MAX_NUM_DOWN_BUFFERS 2 // Number of down-buffers (H->T) available on this target
#endif

#ifndef SEGGER_RTT_BUFFER_SECTION
#if defined(SEGGER_RTT_SECTION)
#define SEGGER_RTT_BUFFER_SECTION SEGGER_RTT_SECTION
#endif
#endif

#ifndef SEGGER_RTT_ALIGNMENT
#define SEGGER_RTT_ALIGNMENT SEGGER_RTT_CPU_CACHE_LINE_SIZE
#endif
Expand Down Expand Up @@ -208,7 +203,7 @@ Additional information:
#define SEGGER_RTT_PUT_SECTION(Var, Section) RTT_PRAGMA(location=Section) \
Var
#elif (defined __CC_ARM)
#define SEGGER_RTT_PUT_SECTION(Var, Section) __attribute__ ((section (Section), zero_init)) Var
#define SEGGER_RTT_PUT_SECTION(Var, Section) __attribute__ ((section (Section))) Var
#else
#error "Section placement not supported for this compiler."
#endif
Expand Down
46 changes: 27 additions & 19 deletions SEGGER/SEGGER_RTT.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2024 SEGGER Microcontroller GmbH *
* (c) 1995 - 2021 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: [email protected] *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* 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 SystemView and RTT protocol, and J-Link. *
* 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 *
Expand All @@ -42,9 +42,10 @@
* *
**********************************************************************
* *
* SystemView version: 3.58 *
* RTT version: 8.56a *
* *
**********************************************************************

---------------------------END-OF-HEADER------------------------------
File : SEGGER_RTT.h
Purpose : Implementation of SEGGER real-time transfer which allows
Expand Down Expand Up @@ -133,7 +134,12 @@ Revision: $Rev: 25842 $
#define _CORE_HAS_RTT_ASM_SUPPORT 1
#define _CORE_NEEDS_DMB 1
#define RTT__DMB() __asm volatile ("dmb\n" : : :);
#elif ((defined __ARM_ARCH_7A__) || (defined __ARM_ARCH_7R__)) // Cortex-A/R 32-bit ARMv7-A/R
#elif \
((defined __ARM_ARCH_7A__) || (defined __ARM_ARCH_7R__)) || \
((defined __ARM_ARCH_8A__) || (defined __ARM_ARCH_8R__))
//
// Cortex-A/R ARMv7-A/R & ARMv8-A/R
//
#define _CORE_NEEDS_DMB 1
#define RTT__DMB() __asm volatile ("dmb\n" : : :);
#else
Expand Down Expand Up @@ -163,7 +169,12 @@ Revision: $Rev: 25842 $
#define _CORE_HAS_RTT_ASM_SUPPORT 1
#define _CORE_NEEDS_DMB 1
#define RTT__DMB() __asm volatile ("dmb\n" : : :);
#elif ((defined __ARM_ARCH_7A__) || (defined __ARM_ARCH_7R__)) // Cortex-A/R 32-bit ARMv7-A/R
#elif \
(defined __ARM_ARCH_7A__) || (defined __ARM_ARCH_7R__) || \
(defined __ARM_ARCH_8A__) || (defined __ARM_ARCH_8R__)
//
// Cortex-A/R ARMv7-A/R & ARMv8-A/R
//
#define _CORE_NEEDS_DMB 1
#define RTT__DMB() __asm volatile ("dmb\n" : : :);
#else
Expand Down Expand Up @@ -212,20 +223,17 @@ Revision: $Rev: 25842 $
#define RTT__DMB() asm VOLATILE ("DMB");
#endif
#endif
#if (defined __ARM7A__)
#if (__CORE__ == __ARM7A__) // Cortex-A 32-bit ARMv7-A
#define _CORE_NEEDS_DMB 1
#define RTT__DMB() asm VOLATILE ("DMB");
#endif
#endif
#if (defined __ARM7R__)
#if (__CORE__ == __ARM7R__) // Cortex-R 32-bit ARMv7-R
#define _CORE_NEEDS_DMB 1
#define RTT__DMB() asm VOLATILE ("DMB");
#endif
#if\
((defined __ARM7A__) && (__CORE__ == __ARM7A__)) || \
((defined __ARM7R__) && (__CORE__ == __ARM7R__)) || \
((defined __ARM8A__) && (__CORE__ == __ARM8A__)) || \
((defined __ARM8R__) && (__CORE__ == __ARM8R__))
//
// Cortex-A/R ARMv7-A/R & ARMv8-A/R
//
#define _CORE_NEEDS_DMB 1
#define RTT__DMB() asm VOLATILE ("DMB");
#endif
// TBD: __ARM8A__ => Cortex-A 64-bit ARMv8-A
// TBD: __ARM8R__ => Cortex-R 64-bit ARMv8-R
#else
//
// Other compilers
Expand Down
Loading