# JLink debug. Breakpoint in main

**URL:** <https://forum.amebaiot.com/t/jlink-debug-breakpoint-in-main/1851>\
**Category:** SDK\
**Tags:** rtl872xd\
**Created:** [May 10, 2023, 10:06pm UTC](https://forum.amebaiot.com/t/jlink-debug-breakpoint-in-main/1851 "2023-05-10T22:06:22Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![dakamaster](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.amebaiot.com/dakamaster/32/3588_2.png) [@dakamaster](https://forum.amebaiot.com/u/dakamaster)\
**Post date:** [May 11, 2023, 3:31am UTC](https://forum.amebaiot.com/t/jlink-debug-breakpoint-in-main/1851/2 "2023-05-11T03:31:38Z")

</div>

Hi @Tuxford,

> Note:  
> For the same question regarding GDB, please add your further questions in your previous post [GDB server for KM4](https://forum.amebaiot.com/t/gdb-server-for-km4/1575).  
> You NEED NOT create a new topic for the same question.

* * *

1. Please specify the requirement you would like to fulfill. Debug or upload an image (flash) to your RTL8720DN.  
`make debug`: is to enter the debug mode  
`make flash`: is to download all 3 necessary images to your flash chip

* * *

1. 

> [@Tuxford](#):
>
> According AN after starting two JLink servers next is uploading images and start debugging.  
> But after make flash and make debug. Then I should enter “monitor reset” and set one bit by “x/1wx 0x480003f8” and “set {unsigned}0x480003f8=0x02000201”…

According to AN0400 Chapter 1.4.2 Setting Debugger - JLink, there is nowhere indicating that you need to start two JLink servers. Besides, there is not necessary to enter “monitor reset” and any other commands as you described. PLEASE STRICTLY FOLLOW THE APPLICATION NOTE STEP BY STEP!

* * *

1. Steps to reset KM0 and KM4 are different.

- For KM0, you need to use the “monitor reset” instruction in the corresponding `rtl_gdb_debug.txt` to reset it under debug. The default path of this file is under `\project\realtek_amebaD_va0_example\GCC-RELEASE\project_lp\asdk\gnu_utility\gnu_script\rtl_gdb_debug.txt`.

- For KM4, you need to use the “monitor reset” instruction in the corresponding `rtl_gdb_debug.txt` first. Then, set the bit[25] of memory address 0x4800\_03f8 to 1 because the boot process of KM4 is controlled by KM0. Without this operation, the KM4 can’t jump out of the boot function. Details of this operation are as follows:

Please refer to **AN0400 Chapter 1** for full details.

* * *

1. 

> [@Tuxford](#):
>
> Is it mandatory to upload firmware via make flash or using flashing tool also possible?

You are allowed to upload via both `make flash` and `Image Tool`. We recommend open source users to use `Image Tool` to upload the firmware.

Please refer to **AN0400 Chapter 8 Image Tool**

* * *

1. 

> [@Tuxford](#):
>
> Is it possible to debug by Eclipse? There is JLink plug in but I dont have any ideas how download image using eclipse.

For anything that is not covered in the AN0400, you may proceed to ask for the [NDA](https://forum.amebaiot.com/t/buying-ic-nda-sdk-related/1037) version of SDK and require further support from a dedicated FAE (Field Application Engineer).

Thank you.

---

_[View the full topic](https://forum.amebaiot.com/t/jlink-debug-breakpoint-in-main/1851)._
