Debug Mode Entry Process

  1. Build Image and Connect J-Link

  2. Execute Debug Commands

    1. Navigate to SDK root directory

    2. Run build.py -debug

    3. Select device-specific command:

    • KM4:

      "{Jlink_path}\JLink.exe" -device Cortex-M33 -if SWD -speed 4000 -autoconnect 1
      
    • KM0:

      "{Jlink_path}\JLink.exe" -device Cortex-M23 -if SWD -speed 4000 -autoconnect 1
      

Note

  • {Jlink_path}: J-Link installation path (Default is C:\Program Files (x86)\SEGGER\JLink)

  • {script_path}: {SDK}\amebaxxx_gcc_project\utils\jlink_script

GDB Core Command Set

Command quick reference

Command (Full)

Shortcut

Syntax

Description

Halt

H

Suspend CPU execution

Go

G

Resume CPU execution

Mem

/

Mem <Address> <ByteCount>

Read memory (ASCII format)

SaveBin

/

SaveBin <File> <Address> <ByteCount>

Dump memory to binary file

Exit

/

Disconnect J-Link

Official documentation: https://wiki.segger.com/J-Link_Commander

Note

  • Track PC values via multiple H/G executions

  • Use mem <sp_address> to inspect call stack

GDB Debugger Guide

GNU Debugger enables runtime state inspection and error tracing (Reference: Debug Mode Entry Process)

Complete documentation: GDB User Manual

Functional command reference

Function Module

Command

Operation Guide

Breakpoint Management

break (b)

Set execution pause points

Data Watchpoints

watch

Monitor variable changes (watch/rwatch/awatch)

Note

Recommended watch scope <20 bytes.

Breakpoint List

info

Display active breakpoints/watchpoints

Breakpoint Removal

delete (d)

Remove specified breakpoint

Execution Resume

continue (c)

Continue program execution

Step Into

step (s)

Enter function execution

Step Over

next (n)

Execute current line and jump to next

Debug Session Exit

quit (q)

Terminate debugging session

Call Trace

backtrace (bt)

Display function call stack

Source Code View

list (l)

Display contextual code

Data Inspection

print (p)

Output variable/expression values