Download and install the latest J-Link from SEGGER official website
Edit the corresponding xxx_jlink.bat to adjust the path of JLink.exe
Connect J-Link
Double-click {SDK}\amebadplus_gcc_project\utils\jlink_script\cm4_jlink.bat. Follow the prompts to enter connect and Enter (default value). As shown below, confirm successful connection between KM4 and J-Link:
Double-click {SDK}\amebadplus_gcc_project\utils\jlink_script\cm0_jlink.bat. Follow the prompts to enter connect and Enter (default value). As shown below, confirm successful connection between KM0 and J-Link:
Double-click {SDK}\amebalite_gcc_project\utils\jlink_script\km4_jlink_combination.bat. Follow the prompts to enter connect and Enter (default value). As shown below, confirm successful connection between KM4 and J-Link:
Double-click {SDK}\amebalite_gcc_project\utils\jlink_script\kr4_jlink_combination.bat. Follow the prompts to enter connect and Enter (default value). As shown below, confirm successful connection between KR4 and J-Link:
Double-click {SDK}\amebalite_gcc_project\utils\jlink_script\km4_jlink_combination.bat. Follow the prompts to enter connect and Enter (default value). As shown below, confirm successful connection between KM4 and J-Link:
Double-click {SDK}\amebalite_gcc_project\utils\jlink_script\kr4_jlink_combination.bat. Follow the prompts to enter connect and Enter (default value). As shown below, confirm successful connection between KR4 and J-Link:
Double-click {SDK}\amebalite_gcc_project\utils\jlink_script\km4_jlink_combination.bat. Follow the prompts to enter connect and Enter (default value). As shown below, confirm successful connection between KM4 and J-Link:
Double-click {SDK}\amebalite_gcc_project\utils\jlink_script\kr4_jlink_combination.bat. Follow the prompts to enter connect and Enter (default value). As shown below, confirm successful connection between KR4 and J-Link:
Double-click {SDK}\amebalite_gcc_project\utils\jlink_script\km4_jlink_combination.bat. Follow the prompts to enter connect and Enter (default value). As shown below, confirm successful connection between KM4 and J-Link:
Double-click {SDK}\amebalite_gcc_project\utils\jlink_script\kr4_jlink_combination.bat. Follow the prompts to enter connect and Enter (default value). As shown below, confirm successful connection between KR4 and J-Link:
Double-click {SDK}\amebasmart_gcc_project\utils\jlink_script\ca32_jlink_core0.bat. Follow the prompts to enter connect and Enter (default value). As shown below, confirm successful connection between CA32 Core0 and J-Link:
Double-click {SDK}\amebasmart_gcc_project\utils\jlink_script\ca32_jlink_core1.bat. Follow the prompts to enter connect and Enter (default value). As shown below, confirm successful connection between CA32 Core1 and J-Link:
Double-click {SDK}\amebasmart_gcc_project\utils\jlink_script\cm4_jlink.bat. Follow the prompts to enter connect and Enter (default value). As shown below, confirm successful connection between KM4 and J-Link:
Double-click {SDK}\amebasmart_gcc_project\utils\jlink_script\cm0_jlink.bat. Follow the prompts to enter connect and Enter (default value). As shown below, confirm successful connection between KM0 and J-Link:
Download and install the latest GDB Server from SEGGER official website
Edit the corresponding xxx_jlinkGDBSever.bat to adjust the path of JLinkGDBServer.exe
Connect JLinkGDBSever
Double-click {SDK}\amebadplus_gcc_project\utils\jlink_script\cm4_jlinkGDBSever.bat. As shown below, confirm successful connection between KM4 and JLinkGDBSever:
Caution
Keep this window open for subsequent operations
Connect JLinkGDBSever
Double-click {SDK}\amebadplus_gcc_project\utils\jlink_script\cm0_jlinkGDBSever.bat. As shown below, confirm successful connection between KM0 and JLinkGDBSever:
Connect JLinkGDBSever
Double-click {SDK}\amebalite_gcc_project\utils\jlink_script\km4_jlinkGDBSever_combination.bat. Confirm KM4 and JLinkGDBSever connection as shown:
Caution
Keep this window open for KM4 subsequent operations
Connect JLinkGDBSever
KM4 uses SWD and KR4 uses Cjtag in the system. In EVB, both share the same set of Debug pins. Since the default working mode is SWD, if switch to Cjtag mode, you need to connect KM4 via SWD and configure the internal circuit working state.
Close KM4 JLinkGDBSever connection
Double-click {SDK}\amebalite_gcc_project\utils\jlink_script\kr4_jlinkGDBSever_combination.bat. Confirm KR4 and JLinkGDBSever connection as shown:
Caution
Keep this window open for KR4 subsequent operations
Connect JLinkGDBSever
Double-click {SDK}\amebalite_gcc_project\utils\jlink_script\km4_jlinkGDBSever_combination.bat. Confirm KM4 and JLinkGDBSever connection as shown:
Caution
Keep this window open for KM4 subsequent operations
Connect JLinkGDBSever
KM4 uses SWD and KR4 uses Cjtag in the system. In EVB, both share the same set of Debug pins. Since the default working mode is SWD, if switch to Cjtag mode, you need to connect KM4 via SWD and configure the internal circuit working state.
Close KM4 JLinkGDBSever connection
Double-click {SDK}\amebalite_gcc_project\utils\jlink_script\kr4_jlinkGDBSever_combination.bat. Confirm KR4 and JLinkGDBSever connection as shown:
Caution
Keep this window open for KR4 subsequent operations
Connect JLinkGDBSever
Double-click {SDK}\amebalite_gcc_project\utils\jlink_script\km4_jlinkGDBSever_combination.bat. Confirm KM4 and JLinkGDBSever connection as shown:
Caution
Keep this window open for KM4 subsequent operations
Connect JLinkGDBSever
KM4 uses SWD and KR4 uses Cjtag in the system. In EVB, both share the same set of Debug pins. Since the default working mode is SWD, if switch to Cjtag mode, you need to connect KM4 via SWD and configure the internal circuit working state.
Close KM4 JLinkGDBSever connection
Double-click {SDK}\amebalite_gcc_project\utils\jlink_script\kr4_jlinkGDBSever_combination.bat. Confirm KR4 and JLinkGDBSever connection as shown:
Caution
Keep this window open for KR4 subsequent operations
Connect JLinkGDBSever
Double-click {SDK}\amebalite_gcc_project\utils\jlink_script\km4_jlinkGDBSever_combination.bat. Confirm KM4 and JLinkGDBSever connection as shown:
Caution
Keep this window open for KM4 subsequent operations
Connect JLinkGDBSever
KM4 uses SWD and KR4 uses Cjtag in the system. In EVB, both share the same set of Debug pins. Since the default working mode is SWD, if switch to Cjtag mode, you need to connect KM4 via SWD and configure the internal circuit working state.
Close KM4 JLinkGDBSever connection
Double-click {SDK}\amebalite_gcc_project\utils\jlink_script\kr4_jlinkGDBSever_combination.bat. Confirm KR4 and JLinkGDBSever connection as shown:
Caution
Keep this window open for KR4 subsequent operations
Connect JLinkGDBSever
Double-click {SDK}\amebasmart_gcc_project\utils\jlink_script\ca32_jlinkGDBSever_core0.bat. As shown below, confirm successful connection between ca32_Core0 and JLinkGDBSever:
Connect JLinkGDBSever
Double-click {SDK}\amebasmart_gcc_project\utils\jlink_script\ca32_jlinkGDBSever_core1.bat. As shown below, confirm successful connection between ca32_Core1 and JLinkGDBSever:
Connect JLinkGDBSever
Double-click {SDK}\amebasmart_gcc_project\utils\jlink_script\cm4_jlinkGDBSever.bat. As shown below, confirm successful connection between KM4 and JLinkGDBSever:
Caution
Keep this window open for subsequent operations
Connect JLinkGDBSever
Double-click {SDK}\amebasmart_gcc_project\utils\jlink_script\cm0_jlinkGDBSever.bat. As shown below, confirm successful connection between KR4 and JLinkGDBSever:
Deploy GDB Server with these steps:
Download latest J-Link package
Execute installation command:
$ dpkg -i JLink_Linux_V840_x86_64.deb
Edit the corresponding xxx_jlinkGDBSever.bat to adjust the path of JLinkGDBServer.exe
Connect JLinkGDBSever
Run /amebadplus_gcc_project/utils/jlink_script/cm4_jlinkGDBSever.sh. As shown below, confirm successful connection between KM4 and JLinkGDBSever:
Keep this window open for KM4 subsequent operations
Connect JLinkGDBSever
KM4 uses SWD and KR4 uses Cjtag in the system. In EVB, both share the same set of Debug pins. Since the default working mode is SWD, if switch to Cjtag mode, you need to connect KM4 via SWD and configure the internal circuit working state.
Close the KM4 JLinkGDBServer connection, and then establish a KR4 connection.
Run /amebalite_gcc_project/utils/jlink_script/kr4_jlinkGDBSever.sh. As shown below, confirm successful connection between KR4 and JLinkGDBSever:
Keep this window open for KM4 subsequent operations
Connect JLinkGDBSever
KM4 uses SWD and KR4 uses Cjtag in the system. In EVB, both share the same set of Debug pins. Since the default working mode is SWD, if switch to Cjtag mode, you need to connect KM4 via SWD and configure the internal circuit working state.
Close the KM4 JLinkGDBServer connection, and then establish a KR4 connection.
Run /amebalite_gcc_project/utils/jlink_script/kr4_jlinkGDBSever.sh. As shown below, confirm successful connection between KR4 and JLinkGDBSever:
Keep this window open for KM4 subsequent operations
Connect JLinkGDBSever
KM4 uses SWD and KR4 uses Cjtag in the system. In EVB, both share the same set of Debug pins. Since the default working mode is SWD, if switch to Cjtag mode, you need to connect KM4 via SWD and configure the internal circuit working state.
Close the KM4 JLinkGDBServer connection, and then establish a KR4 connection.
Run /amebalite_gcc_project/utils/jlink_script/kr4_jlinkGDBSever.sh. As shown below, confirm successful connection between KR4 and JLinkGDBSever:
Keep this window open for KM4 subsequent operations
Connect JLinkGDBSever
KM4 uses SWD and KR4 uses Cjtag in the system. In EVB, both share the same set of Debug pins. Since the default working mode is SWD, if switch to Cjtag mode, you need to connect KM4 via SWD and configure the internal circuit working state.
Close the KM4 JLinkGDBServer connection, and then establish a KR4 connection.
Run /amebalite_gcc_project/utils/jlink_script/kr4_jlinkGDBSever.sh. As shown below, confirm successful connection between KR4 and JLinkGDBSever:
Keep this window open for KR4 subsequent operations
Connect JLinkGDBSever
Run /amebasmart_gcc_project/utils/jlink_script/ca32_jlink_core0.sh. As shown below, confirm successful connection between ca32_Core0 and JLinkGDBSever:
Run /amebasmart_gcc_project/utils/jlink_script/ca32_jlink_core1.sh. As shown below, confirm successful connection between ca32_Core1 and JLinkGDBSever:
Run build.py-debug to enter GDB mode, as shown below:
GDB CMD : cd E:\sdk0508\amebadplus_gcc_project\project_km4/asdk && C:/rtk-toolchain/asdk-10.3.1-4365/mingw32/newlib/bin/arm-none-eabi-gdb.exe -x E:\sdk0508\amebadplus_gcc_project\project_km4/asdk\gnu_utility/gnu_script\rtl_gdb_debug.txt
GNU gdb (Realtek ASDK-10.3.1 Build 4365) 12.1.90.20221114-git
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "--host=x86_64-w64-mingw32 --target=arm-none-eabi".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
warning: No executable has been specified and target does not support
determining executable automatically. Try using the "file" command.
0x3000a304 in ?? ()
Notification of completion for asynchronous execution commands is off.
(gdb)
Connect J-Link and launch Ozone to create a new project by following steps:
Enter the main interface and create a new project, as shown below:
Select the target device and svd file, as shown below:
Configure connection settings: choose the interface and confirm the J-Link device, as shown below:
Select the debug file, as shown below:
Set initialization options
Initialization settings: Set Initial PC and Stack Pointer to Donotset.
Select the corresponding JLinkScript file from the amebaxxxx_gcc_project/utils/jlink_script directory, as shown below:
Handle Plugin installation warning
Install: Click Apply to install automatically. The installation result will be shown in the Console window.
Do not install: Click Continue to proceed without installing.
Project created successfully
Save Project Configuration: Click File > Save Project as, you can import and use it next time directly.
Edit Project Configuration: Click File > Edit Project File, the settings displayed below in the red frame can be modified.
After confirming that the development board has been flashed with firmware and is correctly connected to J-Link, Reset the development board to enter working mode. Ozone provides three modes for running projects:
Download & Reset Program: This mode is not supported.
Attach to Running Program: After starting the project, CPU will be in the running state. As shown below, click Stop to pause the CPU..
Attach & Halt Program: After running the project, the CPU will be in the halted state. As shown below, click start to run the CPU.
Caution
Do not reset the development board after running the project in Ozone; otherwise, J-Link will disconnect.
In this section, commonly used debug features are introduced.
Click View to see the debug functions supported by Ozone.
Adding Breakpoints
Code breakpoint: In the C file opened in the File Scope area, click the gray dot to the left of the code line to add a breakpoint.
Data breakpoint: In the Break&TracePoints window, right-click on a blank area and use the drop-down menu to add a breakpoint by variable name or address. Alternatively, right-click a variable name in the global or local variable window and select the option to add it as a breakpoint.
Removing Breakpoints
Code breakpoint: Click the red dot to the left of the code line. When it changes to a gray dot, the breakpoint is removed.
In the Break & TracePoints window: Right-click on a blank area and use the drop-down menu to remove a breakpoint.
Enable/disable: In the Break&TracePoints window, click √ to the left of the breakpoint to enable or disable it.
Viewing Breakpoints
When the program reaches a breakpoint, it will pause and the corresponding line of code will be highlighted in green, as shown below:
Caution
The number of breakpoints that can be set is limited. If exceed this limit, the following error message will appear SetBreakpoint:JLINKAPIcallfailed.
Restart the development board from a known initial state. This facilitates troubleshooting problems related to power-on initialization and peripheral configuration. There are three reset modes:
Reset & Break at Symbol: Resets and automatically pauses at the specified symbol (the entry to the main function usually ).
Reset & Halt: Resets and stops at the address of the reset vector.
Reset & Run: Performs initialization and continues execution until a breakpoint is hit or the program ends normally.
There are three types of single-step debugging operations:
Step Into: Executes the program one statement at a time. If the current statement is a function call, it enters the function and executes from its first statement.
Step Over: Executes the program one statement at a time. When encountering a function call, it executes the entire function but does not step into it, stopping at the next statement in the current function.
Step Out: Executes until the current function returns, then stops at the next statement in the calling function.
Displays the program’s current execution position and the nesting of function calls. Each stack frame corresponds to a function context. This view shows the order of all function calls from program entry to the current breakpoint and is a critical tool for analyzing program flow and tracing exceptions.
On chips with two independent CPU cores, you can set breakpoints, watch variables, single-step, and analyze call stacks for both cores simultaneously or alternately.
Debugging method: Create separate projects for the two CPU cores, and after connecting successfully, debug each core as needed.
The Global Variables window is grayed out and not editable while the CPU is running. When the CPU is paused, the window displays the current values. If a value has changed during execution, it will be highlighted in red.
Double-click the value you want to edit. After modifying it, the new value will appear in red.
The Local Variables window shows parameters and variables exclusively for the current function context when the CPU is paused.
The Local Variables window is grayed out and not editable while the CPU is running. When the CPU is paused, the window displays the current values. If a value has changed during execution, it will be highlighted in red.
Double-click the value you want to edit. After modifying it, the new value will appear in red.
Right-click a variable in the global or local variables window and select Watch to add it to the Watched Data window. Double-click in the Refresh column to edit the refresh rate.
Open the Memory window to view data at memory addresses. To edit a value, double-click it. After you make a change, the modified value is highlighted in red.
The Registers window is divided into CPU registers and peripheral registers.
The Register window is grayed out and not editable while the CPU is running. When the CPU is paused, the window displays the current values. If a value has changed during execution, it will be highlighted in red.
Double-click the value you want to edit. After modifying it, the new value will appear in red.
The Ozone debugger supports checking program status and tracing errors during execution. To view all available commands, enter help in the Console window.
Responses are provided by Realtek's AI chatbot and may contain inaccuracies. Realtek is not liable for any damages from its use and offers no warranties.