SiFli Solution is now fully open: a production-ready solution set that accelerates projects from prototype to mass production. Solution Documentation.

SiFli-Wiki SiFli-Wiki SiFli-Wiki
  • User Guide
  • Examples
  • API Documentation
  • About Us
/
  • English
  • 中文

Quick Start

  • Getting Started
  • Product Documentation Summary

Software Development

  • SDK Programming Guide
  • API Documentation
  • Solution Programming Guide
  • FAQ Frequently Asked Questions
    • Development Tool-Related Issues
      • 1 Compilation-Related
      • 2 Jlink
      • 3 KEIL
      • 4 Ozone
      • 5 SiFli
      • 6 Trace32
      • 7 SystemView
      • 8 UART
      • 9 Source Insight-related
    • Chip-Related Issues
      • 1 GPIO-related
      • 2 Timer-Related
      • 3 Interrupt-related
      • 4 Watchdog-Related
      • 5 RTC Related
      • 6 ADC Related
      • 7 I2C-related
      • 8 Low Power-Related
      • 9 PWM
      • 10 System
      • 11 Bluetooth
      • 12 USB-Related
      • 13 UART-Related
      • 14 Dual-core Related
      • 15 I2S-related
      • 13 SPI Related Issues
    • Peripheral Driver Debugging Issues
      • 1 Common LCD Debugging Issues
      • 2 Common Sensor Debugging Issues
      • 3 Common Flash Debugging Issues
      • 4 Common Motor Debugging Issues
    • Software Debugging-Related Issues
      • 1 Log Debugging
      • 2 Online Debugging Method
      • 3 Restoring the Crash Context from a Memory Dump
      • 4 Methods for Saving the Crash Context
  • Application Notes
    • Low-Power Development Guide
    • Application Startup Flow
    • NandFlash_BBM Analysis Guide
    • SF32LB52-DevKit-Core-3p3 Development Board Test Guide
  • Best Practices
    • AI Xiaozhi

Hardware Development

  • SiFli Selection Guide
    • SiFli Chip Model Guide
    • Module Model Guide
  • Chip Hardware Design Guide
    • SF32LB52x Hardware Design Guide
    • SF32LB52X Hardware Design Guide
    • SF32LB56xU Hardware Design Guide
    • SF32LB56xV Hardware Design Guide
    • SF32LB58x Hardware Design Guide
    • SF32 Series UART Automatic Flashing Design
    • SF32LB55x Hardware Design Guide
    • SF32LB52-MOD-1 Module EPD Display Design Guide
  • Development board
    • Development Board Model Guide
    • SF32LB52-DevKit-LCD Development Board User Guide
    • Guide to Making an LCM Adapter Board for SiFli Development Boards
    • Lichuang Huangshan Pi Development Board User Guide
    • SF32LB52-DevKit-Nano Development Board User Guide
    • SF32LB52-DevKit-Core-3p3 Development Board User Guide
    • SF32LB52-OED-6’-EPD Development Board User Guide
    • SF32LB56-DevKit-LCD Development Board User Guide
    • SF32LB58-DevKit-LCD Development Board User Guide
  • Module

Software Tools

  • Software and Hardware Tool Summary
    • Firmware flashing tool Impeller
    • Graphics Conversion Tool
    • Storage debugging tools
      • Flash Chipid and Type Configuration Guide
    • Screen module debugging
      • Screen module introduction
      • Display module framework introduction
      • Directory structure introduction
        • External
        • Built-in
      • Add display module (1) – Add files (copy files)
      • Add display module (2) – Modify the copied driver files
        • Modify the screen driver
        • Modify the screen TP driver
        • Modify the screen backlight driver
      • Add display module (3) – Modify Kconfig/Menuconfig
      • Example operations for adding a display module
        • SF32LB52x-DevKit-LCD example: adding an SPI-LCD (external)
        • Example: adding a QSPI-LCD on 525 (built-in)
        • Example: adding a DPI-LCD on 566 (built-in)
      • FAQ
      • Appendix
        • Display driver callback functions
        • Mapping table between application-layer functions and module driver-layer functions
        • List of adapted display modules
      • LCD frame-rate calculator
    • sftool

Product Introduction

  • About SiFli

On this page

  • 2.1 How to Print Log Information Using JLINK RTT?
  • 2.2 Hcpu Logs Cannot Be Printed Through Jlink segger
  • 2.3 Jlink Reads and Writes Flash Contents,
  • 2.4 Other Common Jlink Commands
  • 2.5 Method for Connecting Jlink Using SiFliUsartServer When There Is No SWD Port
SiFli-Wiki 0 0
Edit this page
  1. SiFli-Wiki /
  2. FAQ Frequently Asked Questions /
  3. Development Tool-Related Issues /
  4. 2 Jlink
View as Markdown Open in ChatGPT Open in Claude

2 Jlink¶

2.1 How to Print Log Information Using JLINK RTT?¶

Currently, by default, the software Hcpu log is output from uart1 PA17/PA19(SF32LB555), PA49/51(SF32LB551)
The Lcpu log is output from uart3,
The customer only routed out uart3 PB45/PB46, or Uart1 is occupied
Solution:
Considering that uart3 is connected to lcpu, and lcpu will also need to output logs later, You can use menuconfig to change the log output to swd
Modification method for printing the hcpu log through Jlink swd:

  1. Enter the SDK\example\rt_driver\project\ec-lb555 directory

  2. menuconfig->Third party packages->select Segger RTT package
    alt text

  3. menuconfig->RTOS -> RT-Thread Kernel->Kernel Device Object->change the devices name for console to segger
    alt text

  4. Connect jlink. Method 1: Open C:\Program Files (x86)\SEGGER\JLink\jlink.exe -> connect ->? ->s->default 4000khz->connection succeeds, as shown below:
    alt text
    Method 2: Open C:\Program Files (x86)\SEGGER\JLink\JLinkRTTViewer.exe, configure it, and use the menu File -> Connect, After a successful connection, you can see the following LOG: RTT Viewer connected. This indicates that the connection is successful.
    alt text
    alt text

  5. Run software such as Xshell or secureCRT, connect to jlink RTT viewer through telnet(hostname: 127.0.0.1 port: 19021), and view the log; output and input are supported, as shown below:
    alt text
    Note If Hcpu wakes up from standby or restarts, you need to reconnect jlink RTT viewer.
    F. If Segger still does not print after the above configuration, refer to #2.2 for troubleshooting.

2.2 Hcpu Logs Cannot Be Printed Through Jlink segger¶

Root cause:
To optimize memory in the new sdk version, the Jlink Control block address: _SEGGER_RTT variable has been relinked from HPSYS SRAM0x20000000 to the memory region HPSYS ITCM RAM0x00010000 0x0001FFFF 64*1024 As shown in the following figure:
alt text

However, Jlink starts searching memory from 0x20000000 by default, so it cannot find it and the connection fails,
In the old version 0.9.7, the compiled address was after 0x20000000, and jlink could automatically connect and find it.
Solution 1:
Specify the address in J-Link RTT Viewer.exe. This address can be found by searching the map file, as shown below:
alt text
Solution 2:
Switch to Ozone.exe. Ozone.exe can find this address from the axf file. As shown below, the SetRTTAddr address command exists:
alt text

Solution 3:
Create a JLinkScript command that will be automatically called when jlink starts to set or search the Control block address range. The command is shown below:
You can modify and select it yourself:
alt text

Corresponding xml file modification:
alt text

JLink.exe and J-Link RTT Viewer.exe can still connect automatically as before, which is much more convenient.
It is recommended to use rttview.exe and telnet 127.0.0.1 to view the log! The file patch is attached. Copy it to the corresponding Jlink installation directory:
Program Files (x86).7z

2.3 Jlink Reads and Writes Flash Contents,¶

  1. After jlink connects successfully, use mem32 to read, w4 to write, and erase to erase.

mem32 0x40014000 1 #读1个32bit的寄存器值
mem32 0x64000000 10 #读10个byte从flash2地址0x64000000开始,
w4 0x64000000 0x2f 0x2f 0x2f 0x2f 0x2f 0x2f #写内存或者寄存器值 从flash2地址0x64000000开始, 写入后续的数据
  1. Read and write using jflash
    In the same directory as jlink.exe, there is a jflash tool. Use the menu shown below to read the flash contents, alt text

  2. Read using the savebin command

savebin d:\1.bin 0x101b4000 0x100000 

In the above, 0x101b4000 is the memory address, and 0x100000 is the memory read/write size in bytes. d. Method for writing the saved bin back

loadbin  d:\1.bin 0x101b4000

2.4 Other Common Jlink Commands¶

  1. halt and go commands
    Enter the command h to stop the CPU and view the location of the PC pointer
    Enter the command g to let the CPU continue running, alt text

  2. Set the PC pointer
    It is often used together with the __asm(“B .”); instruction. When the code executes this instruction, it stops,
    As shown above, if the PC pointer is at 0x10140D28 at this time, add 2 to the PC pointer and enter setpc 0x10140D2A to skip the __asm(“B .”); instruction and continue running.

  3. Other commands
    erase 0x00000000.0x0000FFFF
    loadbin

    – Download the filename file to the address
    usb——–Connect to the target board
    r———Restart the target board
    halt——-Stop the program running on the cpu
    loadbin—-Load an executable binary file
    g——-Jump to the code segment address and execute
    s——-Single-step execution (for debugging)
    setpc—–Set the value of the pc register (for debugging)
    setbp—–Set a breakpoint. After stopping at the breakpoint, you can use the command g to continue running
    Regs——-Read the register set
    wreg——-Write register
    mem——–Read memory
    w4——–Write memory

2.5 Method for Connecting Jlink Using SiFliUsartServer When There Is No SWD Port¶

After the 52 series, the MCU no longer has an SWD interface. If you want to use Jlink or Ozone for debug, you can use the SiFliUsartServer.exe tool. The Jlink usage is configured as shown below: alt text

Previous
1 Compilation-Related
Next
3 KEIL

2025, SiFli

Made with Sphinx and Shibuya theme.