|
| 1 | +## Segger module for Zephyr RTOS |
| 2 | + |
| 3 | +This repository is the Zephyr project module for integrating Segger [RTT][1] ([wiki][2]), |
| 4 | +[SystemView][3] ([wiki][4]) and [Monitor mode debugging][5] with Zephyr RTOS. |
| 5 | + |
| 6 | +The code here is predominantly untouched public Segger source code with changes to support Zephyr |
| 7 | +RTOS. |
| 8 | + |
| 9 | +This README identifies the origin of upstream Segger files and suggests a procedure to follow when |
| 10 | +updating to a new Segger release. |
| 11 | + |
| 12 | +### Upstream Segger source code |
| 13 | +Segger's [official GitHub repository][6] is not currently actively maintained, hence Segger code is |
| 14 | +obtained from publicly accessible download links posted on Segger's website. |
| 15 | + |
| 16 | +#### RTT and SystemView |
| 17 | +[Download][7] "SystemView, Target Sources" from the SystemView downloads [webpage][8]. This |
| 18 | +download contains both RTT and SystemView sources. |
| 19 | + |
| 20 | +#### Monitor mode debugging |
| 21 | +[Download][9] "Example project" from the Monitor mode debugging [webpage][10]. |
| 22 | + |
| 23 | +### Updating to a new Segger release |
| 24 | +Upgrading to a new Segger release means migrating existing Zephyr changes to the latest Segger |
| 25 | +code. There are many tools (`diff`, `patch`, `git diff`, etc.) and different approaches to |
| 26 | +accomplishing this -- use what you are familiar with. The following procedure is a guide to |
| 27 | +achieving the desired result. |
| 28 | + |
| 29 | +1. Obtain the updated Segger code and prepare for subsequent steps |
| 30 | + 1. Download upstream code from the links above |
| 31 | + 2. Extract the SystemView update and delete the `Samples` directory |
| 32 | + 3. Extract the Monitor mode example and delete _non_-JLINK_MONITOR* files |
| 33 | + 4. Organize the files to match the directory structure of this repository |
| 34 | + 5. Convert line endings of all files to Unix style LF (`\n`) |
| 35 | + 6. Strip trailing white space of all files |
| 36 | +2. Establish the Zephyr patches that will be applied in step 3 |
| 37 | + 1. Download the SystemView release this repository is _currently_ based on (refer to |
| 38 | + "SystemView version: x.yy" in the source files to determine the current release) |
| 39 | + 2. Repeat step 1 parts ii-vi for these downloaded files |
| 40 | + 3. Compare the files of this repository to those of step 2 part ii to identify the existing |
| 41 | + Zephyr changes (the "diff", or "patch") needed for step 3 |
| 42 | +3. Apply the Zephyr changes to the new Segger release |
| 43 | + 1. Apply the patches from step 2 part iii to the files of step 1 |
| 44 | + 2. Sanity check the result and revise as needed |
| 45 | +4. Review/update the list of patched files below |
| 46 | +5. Commit the updated + modified Segger files and push the change |
| 47 | +6. Open a pull-request to merge the change into this repository |
| 48 | + |
| 49 | +### Patched files |
| 50 | +Segger source files with Zephyr specific changes: |
| 51 | +1. `Config/SEGGER_RTT_Conf.h` |
| 52 | + * Defines related to RTT buffers, memory region, locking mechanism |
| 53 | +2. `Config/SEGGER_SYSVIEW_Conf.h` |
| 54 | + * Defines related to SystemView buffers, memory region, locking mechanism |
| 55 | +3. `SEGGER/SEGGER_RTT.c` |
| 56 | + * RTT initialization options |
| 57 | + |
| 58 | +[1]: https://www.segger.com/products/debug-probes/j-link/technology/about-real-time-transfer |
| 59 | +[2]: https://wiki.segger.com/RTT |
| 60 | +[3]: https://www.segger.com/products/development-tools/systemview |
| 61 | +[4]: https://wiki.segger.com/SystemView |
| 62 | +[5]: https://www.segger.com/products/debug-probes/j-link/technology/monitor-mode-debugging |
| 63 | +[6]: https://github.com/SEGGERMicro |
| 64 | +[7]: https://www.segger.com/downloads/jlink/systemview_target_src |
| 65 | +[8]: https://www.segger.com/downloads/systemview |
| 66 | +[9]: https://www.segger.com/downloads/pub/Generic_Cortex-M_MonitorModeSystickExample_SES.zip |
| 67 | +[10]: https://www.segger.com/products/debug-probes/j-link/technology/monitor-mode-debugging |
0 commit comments