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

Quick Start

  • Getting Started Guide
  • Product Documentation Summary

Software Development

  • SDK Programming Guide
  • API Documentation
  • Solution Programming Guide
  • FAQ Frequently Asked Questions
    • Questions related to development tools
      • 1 Compilation Related
      • 2 Jlink
      • 3 KEIL
      • 4 Ozone
      • 5 SiFli
      • 6 Trace32
      • 7 SystemView
      • 8 Serial Port
      • 9 Source Insight Related
    • Issues concerning chips
      • 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 issue
      • 1 Common Issues in LCD Debugging
      • 2 Common Issues in Sensor Debugging
      • 3 Common Issues in Flash Debugging
      • 4 Common Issues in Motor Debugging
    • Software Debugging Related Issues
      • 1 Log Debugging
      • 2 Online Debugging Methods
      • 3 Dump Memory to Recover Crash Scene
      • 4 Methods for Saving Crash Dump
  • Application Note
    • SF32LB52X Boot and Low Power Process
    • Low Power Development Guide
    • NandFlash_BBM Parsing Guide
  • Best Practices
    • AI XiaoZhi

Hardware Development

  • Sifli Selection Manual
  • Chip Hardware Design Guide
    • SF32LB52x - Hardware Design Guide
    • SF32LB52X - Hardware Design Guide
    • SF32LB56xU - Hardware Design Guide
    • SF32LB56xV - Hardware Design Guide
    • SF32LB58x - Hardware Design Guide
    • SF32LB55x - Hardware Design Guide
  • Development Boards
    • SF32LB52-DevKit-LCD Development Board User Guide
    • Sich Dev Board LCM Adapter Board Guide
    • SF32LB52-DevKit-ULP Development Board User Guide
    • SF32LB52-DevKit-Nano Development Board User Guide
    • SF32LB56-DevKit-LCD Development Board User Guide
    • SF32LB58-DevKit-LCD Development Board User Guide
  • Module

Software Tools

  • Summary of Software and Hardware Tools
    • Firmware Burning Tool Impeller
    • Graphics Conversion Tool
    • Storage Debugging Tools
      • Flash Chipid and Type Configuration Guide
    • Screen Module Debugging
      • Introduction to Screen Modules
      • Screen Module Framework Introduction
      • Directory Structure Introduction
      • Adding Screen Module (1) – Adding Files (Copying Files)
      • Add Screen Module (2) – Modify the Copied Driver File
      • Add Screen Module (3) – Modify Kconfig/Menuconfig
      • Adding Screen Module Operation Examples
      • FAQ
      • Appendix
        • Screen Driver Callback Functions
        • Application Layer vs. Module Driver Layer Function Correspondence Table
        • List of Supported Screen Modules
    • sftool

Product Introduction

  • About SiFli Technologies

On this page

  • 2.1 How to Print Log Information Using JLINK RTT?
  • 2.2 Hcpu Log Not Printed via Jlink Segger
  • 2.3 Jlink Read and Write Flash Content
  • 2.4 Other Common Jlink Commands
  • 2.5 Connecting Jlink Using SiFliUsartServer Without SWD Port
OpenSiFli/SiFli-Wiki 0 0
Edit this page
  1. SiFli-Wiki /
  2. FAQ Frequently Asked Questions /
  3. Questions related to development tools /
  4. 2 Jlink

2 Jlink¶

2.1 How to Print Log Information Using JLINK RTT?¶

Currently, by default, the log of the Hcpu software is output from uart1 PA17/PA19 (SF32LB555), PA49/51 (SF32LB551)
The log of the Lcpu is output from uart3,
The customer only exposed uart3 PB45/PB46, or uart1 is occupied.
Solution:
Considering that uart3 is connected to the lcpu, and the lcpu also needs to output logs, you can change the configuration to use SWD for log output via menuconfig.
Method to modify Jlink SWD to print Hcpu logs:

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

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

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

  4. Connect the Jlink. Method 1: Open C:\Program Files (x86)\SEGGER\JLink\jlink.exe -> connect ->? -> s -> default 4000kHz -> connection successful, as shown in the following figure:
    alt text
    Method 2: Open C:\Program Files (x86)\SEGGER\JLink\JLinkRTTViewer.exe and configure the menu File -> Connect, connection successful will show the following prompt: LOG: RTT Viewer connected.
    alt text
    alt text

  5. Run Xshell, SecureCRT, etc., and connect to the Jlink RTT viewer via telnet (hostname: 127.0.0.1 port: 19021) to view the logs; supports input and output, as shown in the following figure:
    alt text
    Note If the Hcpu wakes up from standby or restarts, you need to reconnect the Jlink RTT viewer.
    If the above configuration still does not work, refer to #2.2 for troubleshooting.

2.2 Hcpu Log Not Printed via Jlink Segger¶

Root cause:
In the new version of the SDK, to optimize memory, the Jlink Control block address: _SEGGER_RTT variable was moved from HPSYS SRAM 0x20000000 to the memory region HPSYS ITCM RAM 0x00010000 0x0001FFFF 64*1024, as shown in the following figure:
alt text

By default, Jlink searches memory starting from 0x20000000, so it cannot find the address, 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, which can be found in the map file, as shown in the following figure:
alt text
Solution 2:
Use Ozone.exe, which can find the address in the axf file, as shown in the following figure, with the SetRTTAddr address command:
alt text

Solution 3:
Create a JLinkScript command to automatically set or search for the Control block address range when Jlink starts, as shown in the following command:
You can modify and choose as needed:
alt text

Corresponding: xml file modification:
alt text

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

2.3 Jlink Read and Write Flash Content¶

  1. After successfully connecting with Jlink, use mem32 to read, w4 to write, and erase to erase and write

mem32 0x40014000 1 # read 1 32-bit register value
mem32 0x64000000 10 # read 10 bytes starting from flash2 address 0x64000000
w4 0x64000000 0x2f 0x2f 0x2f 0x2f 0x2f 0x2f # write memory or register values starting from flash2 address 0x64000000, write the subsequent data
  1. Use jflash to read and write In the same directory as jlink.exe, there is a jflash tool, as shown in the menu below to read flash content, alt text

  2. Use savebin command to read

savebin d:\1.bin 0x101b4000 0x100000 

As shown above, 0x101b4000 is the memory address, and 0x100000 is the read/write memory size in bytes. To save the bin and then reprogram it:

loadbin  d:\1.bin 0x101b4000

2.4 Other Common Jlink Commands¶

  1. halt, go commands Entering the command h will stop the CPU and allow you to check the position of the PC pointer Entering the command g will resume the CPU’s operation, alt text

  2. Set the PC pointer Often used in conjunction with the __asm(“B .”); instruction. When the code executes this instruction, it will pause. As shown in the figure, if the PC pointer is at 0x10140D28, adding 2 to the PC pointer and entering setpc 0x10140D2A will 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———reset 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 the breakpoint stops, you can continue running with the g command Regs——-read the register organization wreg——-write to a register mem——–read memory w4——–write memory

2.5 Connecting Jlink Using SiFliUsartServer Without SWD Port¶

After the 52 series, MCUs no longer have an SWD interface. If you want to debug using Jlink or Ozone, you can use the SiFliUsartServer.exe tool. The Jlink usage method is set as shown in the figure below: alt text

Previous
1 Compilation Related
Next
3 KEIL

2025, SiFli

Made with Sphinx and Shibuya theme.