services/debugging/debugmon.html · services/debugging/debugmon.rst 공식 원문 ↗

Zephyr 3.7.0 · Debugging

Cortex-M Debug Monitor

Breakpoint 대기 중에도 높은 우선순위 interrupt를 실행해 시간 민감 application을 debug합니다.

Official pathservices/debugging/debugmon.html
Source fileservices/debugging/debugmon.rst
Source versionZephyr 3.7.0
TranslationFull · reviewed

본문 기준: Zephyr 3.7.0 LTS3 · 이후 유지보수 패치는 별도입니다.

Part 1

요약·해설

Debug Monitor exception priority, SEGGER J-Link 연결과 custom ISR override 절차를 설명합니다.

Mode

Non-halting

ISR

z_arm_debug_monitor

Probe

SEGGER J-Link

Part 2

접을 수 있는 영어 원문 전체

영어 원문 전체 펼치기
원문 SHA-256 13A0EB403FF28F878927F2A2B343CFF71BC746BBC80AD3BABBD293DD956AC930
.. _debugmon:

Cortex-M Debug Monitor
######################

Monitor mode debugging is a Cortex-M feature, that provides a non-halting approach to
debugging. With this it's possible to continue the execution of high-priority interrupts,
even when waiting on a breakpoint.
This strategy makes it possible to debug time-sensitive software, that would
otherwise crash when the core halts (e.g. applications that need to keep
communication links alive).

Zephyr provides support for enabling and configuring the Debug Monitor exception.
It also contains a ready implementation of the interrupt, which can be used with
SEGGER J-Link debuggers.

Configuration
*************

Configure this module using the following options.

* :kconfig:option:`CONFIG_CORTEX_M_DEBUG_MONITOR_HOOK`: enable the module. This option, by itself,
  requires an implementation of debug monitor interrupt that will be executed
  every time the program enters a breakpoint.

With a SEGGER debug probe, it's possible to use a ready, SEGGER-provided implementation
of the interrupt.

* :kconfig:option:`CONFIG_SEGGER_DEBUGMON`: enables SEGGER debug monitor interrupt. Can be
  used with SEGGER JLinkGDBServer and a SEGGER debug probe.


Usage
*****

When monitor mode debugging is enabled, entering a breakpoint will not halt the
processor, but rather generate an interrupt with ISR implemented under
``z_arm_debug_monitor`` symbol.  :kconfig:option:`CONFIG_CORTEX_M_DEBUG_MONITOR_HOOK` config configures this interrupt
to be the lowest available priority, which will allow other interrupts to execute
while processor spins on a breakpoint.

Using SEGGER-provided ISR
=========================

The ready implementation provided with :kconfig:option:`CONFIG_SEGGER_DEBUGMON` provides functionality
required to debug in the monitor mode using regular GDB commands.
Steps to configure SEGGER debug monitor:

1. Build a sample with :kconfig:option:`CONFIG_CORTEX_M_DEBUG_MONITOR_HOOK`` and :kconfig:option:`CONFIG_SEGGER_DEBUGMON`
   configs enabled.

2. Attach JLink GDB server to the target.
   Example linux command: ``JLinkGDBServerCLExe -device <device> -if swd``.

3. Connect to the server with your GDB installation.
   Example linux command: ``arm-none-eabi-gdb --ex="file build/zephyr.elf" --ex="target remote localhost:2331"``.

4. Enable monitor mode debugging in GDB using command: ``monitor exec SetMonModeDebug=1``.

After these steps use regular gdb commands to debug your program.


Using other custom ISR
======================
In order to provide a custom debug monitor interrupt, override ``z_arm_debug_monitor``
symbol. Additionally, manual configuration of some registers is required
(see :ref:`debug monitor sample<debugmon-sample>`).

Part 3

한국어 전문 번역

Monitor mode debugging은 processor를 멈추지 않는 Cortex-M debugging 기능입니다. Breakpoint에서 기다리는 동안에도 high-priority interrupt 실행을 계속할 수 있습니다. 따라서 communication link를 계속 유지해야 하는 application처럼 core가 정지하면 crash하는 time-sensitive software를 debug할 수 있습니다.

Zephyr는 Debug Monitor exception을 enable하고 설정하는 기능을 제공합니다. SEGGER J-Link debugger와 함께 사용할 수 있는 interrupt 구현도 포함합니다.

설정

다음 option으로 module을 설정합니다.

  • CONFIG_CORTEX_M_DEBUG_MONITOR_HOOK: module을 enable합니다. 이 option만 사용하면 program이 breakpoint에 들어갈 때마다 실행할 Debug Monitor interrupt 구현을 application이 제공해야 합니다.
  • CONFIG_SEGGER_DEBUGMON: SEGGER가 제공하는 Debug Monitor interrupt를 enable합니다. SEGGER JLinkGDBServer와 SEGGER debug probe에서 사용할 수 있습니다.

사용법

Monitor mode debugging을 enable하면 breakpoint가 processor를 halt하지 않고 z_arm_debug_monitor symbol에 구현된 ISR interrupt를 발생시킵니다. CONFIG_CORTEX_M_DEBUG_MONITOR_HOOK은 이 interrupt를 가능한 가장 낮은 priority로 설정해 processor가 breakpoint에서 대기하는 동안 다른 interrupt가 실행되게 합니다.

SEGGER 제공 ISR 사용

CONFIG_SEGGER_DEBUGMON의 준비된 구현은 일반 GDB command로 monitor mode debugging을 수행하는 데 필요한 기능을 제공합니다.

  1. CONFIG_CORTEX_M_DEBUG_MONITOR_HOOK과 CONFIG_SEGGER_DEBUGMON을 enable해 sample을 build합니다.
  2. J-Link GDB server를 target에 연결합니다. Linux 예: JLinkGDBServerCLExe -device <device> -if swd.
  3. GDB에서 server에 연결합니다. Linux 예: arm-none-eabi-gdb --ex="file build/zephyr.elf" --ex="target remote localhost:2331".
  4. GDB에서 monitor exec SetMonModeDebug=1을 실행해 monitor mode debugging을 enable합니다.

이후 일반 GDB command로 program을 debug합니다.

다른 custom ISR 사용

Custom Debug Monitor interrupt를 제공하려면 z_arm_debug_monitor symbol을 override합니다. 일부 register도 수동으로 설정해야 하며 Debug Monitor sample을 참고합니다.

Source

출처

영어 원문에는 문단, 문서 지시문, 표, 코드, 코드 심벌, 경로를 그대로 보존했습니다.