1. Why I Replaced J-Link
- The official price is expensive.
- Counterfeit detection: the connected probe appears to be a J-Link clone.
- Connection failure: The connected J-Link is defective.
- Hardware damage.
Common counterfeit J-Link devices on the market have poor quality; I have at least seven or eight that have failed in my hands!
2. Why Choose DAPLink
1. Download speed is no longer a disadvantage.
Compared to the latest J-LINK-V12 speed, using the target chip STM32H743 and development environment MDK V5.39, I downloaded a 2558KB HEX file to internal FLASH using MicroLink and J-Link V12. Using a logic analyzer to test the clock pin, I calculated the total time for erasing, programming, and verification. The time taken by MicroLink was 24.205 seconds, while J-Link V12 took 33.439 seconds. The test data is shown below:
J-Link V12 Test Results:
MicroLink Test Results:
Clock waveform during download process:
Comparison of Test Results:
Debugger | Total Time (Erase, Program, Verify) |
---|---|
MicroLink | 24.205 seconds |
J-LINK V12 | 33.439 seconds |
2. USB to UART speed is exceptionally high.
MicroLink has a built-in USB to serial function, supporting a maximum 10M baud rate with no packet loss.
Using a logic analyzer to capture the waveform as shown, the time for each bit transmission is 1/10M=100ns.
3. Not enough? How about adding PikaPython?
The biggest advantage of DAPLink is its open-source nature! The greatest joy of open-source is that if you find something unsatisfactory, you can directly modify it yourself! We can have what J-Link has, and we can also have what J-Link does not have.
Thanks to the built-in PikaPython script engine in MicroLink, we can control MicroLink directly using familiar Python scripts without a complex development environment or the need to reflash firmware.
For example, you can do the following:
-
Write a script to periodically collect register data from the target chip and automatically print it to the serial port;
-
Write a script to implement a simple programming process, allowing you to drag files into a USB drive for one-click download;
-
Even quickly customize a set of upper computer interaction logic based on different customer needs, easily deploy it to your own production testing upper computer.
In summary: What used to be tasks only engineers could do can now be accomplished by anyone writing a script!
3. Achieve RTTView freedom from now on.
Have you heard of J-Link‘s RTT?
In simple terms, as long as you have a J-Link, you can enjoy the following conveniences:
- No need to occupy USART or USB to serial tools, redirecting printf to a virtual serial port provided by J-Link;
- Support for any chip claimed by J-Link;
- High-speed communication without affecting the chip’s real-time response.
However, its drawbacks are also obvious:
-
You must own a J-Link; if you are using third-party debugging tools like CMSIS-DAP or ST-Link, you cannot enjoy this benefit;
-
You can only use the unuser-friendly J-Link RTT Viewer upper computer;
If you have read this far, congratulations, because from this moment on, the limitations of RTT have been broken, and the drawbacks will no longer exist.
As long as you have MicroLink, you can enjoy the following conveniences:
- No need to occupy USART or USB to serial tools, redirecting printf to a virtual serial port provided by MicroLink;
- No need to use a dedicated RTTView upper computer, supporting any serial assistant;
- High-speed communication without affecting the chip’s real-time response.
To start the RTT function: Open any serial assistant, select the virtual serial port of MicroLink, and enter the following command:
RTTView.start(0x20000000,1024,0)
- 0x20000000: Starting address to search for the RTT control block;
- 1024: Search range size;
- 0: Start the RTT channel.
For example, to connect the shell command line tool to RTT channel 0:
uint16_t shell_read_data(kk_shell_t *ptObj, char *pchBuffer, uint16_t hwSize)
{
return SEGGER_RTT_Read(0,(uint8_t *)pchBuffer, hwSize);
}
uint16_t shell_write_data(kk_shell_t *ptObj, const char *pchBuffer, uint16_t hwSize)
{
return SEGGER_RTT_Write(0, pchBuffer,hwSize);
}
4. Downloading firmware has never been this easy, say goodbye to J-Flash.
If Keil supports the chip, MicroLink can support it.
Friends familiar with Keil know that when we want to download the compiled image to Flash, the first step is to select the appropriate Flash download algorithm, which is an FLM file:
The so-called Flash download algorithm is software responsible for erasing and downloading data to Flash. The Keil chip pack will include FLM files to support chip downloads.
Principle of parsing FLM files:
To parse an existing FLM file, take STM32F4xx_1024.FLM as an example: Copy the contents from the ARM:CMSIS Pack folder (usually located at D:\Users\Administrator\AppData\Local\Arm\Packs\Keil\STM32F4xx_DFP\2.15.0\CMSIS\Flash) to a new folder.
Open the command line tool and enter<span>arm-none-eabi-readelf -a STM32F4xx_1024.FLM:</span>
$ arm-none-eabi-readelf -a STM32F4xx_1024.FLM
...
Symbol table '.symtab' contains 17 entries:
Num: Value Size Type Bind Vis Ndx Name
0: 00000000 0 NOTYPE LOCAL DEFAULT UND
1: 00000000 0 NOTYPE LOCAL DEFAULT 1 $t
2: 00000122 0 NOTYPE LOCAL DEFAULT 1 $d
3: 00000144 0 NOTYPE LOCAL DEFAULT 2 $d.realdata
4: 00000148 0 NOTYPE LOCAL DEFAULT 3 $d.realdata
5: 00000000 0 FILE LOCAL DEFAULT ABS FlashPrg.c
6: 00000000 0 SECTION LOCAL DEFAULT 1 .text
7: 00000000 0 FILE LOCAL DEFAULT ABS FlashDev.c
8: 000001484256 SECTION LOCAL DEFAULT 3 .constdata
9: 00000000 0 NOTYPE GLOBAL HIDDEN ABS BuildAttributes$$THM_ISAv
10: 00000001 28 FUNC GLOBAL HIDDEN 1 GetSecNum
11: 0000001d 46 FUNC GLOBAL HIDDEN 1 Init
12: 0000004b 14 FUNC GLOBAL HIDDEN 1 UnInit
13: 00000059 44 FUNC GLOBAL HIDDEN 1 EraseChip
14: 00000085 76 FUNC GLOBAL HIDDEN 1 EraseSector
15: 000000d1 82 FUNC GLOBAL HIDDEN 1 ProgramPage
16: 000001484256 OBJECT GLOBAL HIDDEN 3 FlashDevice
No version information found in this file.
Displaying notes found at file offset 0x00002b9c with length 0x0000001c:
Owner Data size Description
ARM 0x0000000c Unknown note type: (0x40000000)
From the Symbol table information, we can find the locations of the Init, UnInit, EraseSector, and ProgramPage functions. What we need are the above functions, and the next task is to write an upper computer to extract these functions; I have already written this tool, as shown:
By opening the FLM download algorithm conversion tool, you can generate the corresponding download algorithm driver file. This is why MicroLink can support chips that Keil supports, as we leverage the FLM files provided by KEIL.
USB drag-and-drop download
Open the <span>flm_config.py</span>
script in the USB drive, the code is as follows:
import FLMConfig
ReadFlm = FLMConfig.ReadFlm()
res1 = ReadFlm.load("STM32/STM32F10x_512.FLM.o",0X08000000,0x20000000)
<span>ReadFlm.load</span>
function’s three parameters:
-
“STM32/STM32F10x_512.FLM.o”: Select the download algorithm converted by the FLM download algorithm conversion tool;
-
0X08000000: Default FLASH location for USB drag-and-drop download;
-
0x20000000: Base address of the microcontroller’s RAM;
Offline download
MicroLink has a built-in offline download Python function:
load.bin("boot.bin",0X8000000)
The meanings of the two parameters are:
“boot.bin”: The name of the file to be downloaded;0X8000000: The download address;
Copy the bin file to the USB drive, then use any serial assistant, open the virtual serial port, enter <span>load.bin("boot.bin",0X8000000)</span>
and press Enter, the effect is as follows:
5. What if the product has already shipped and there is no download port left for firmware upgrades?
Products often cannot reserve download ports for various reasons and can only upgrade firmware via serial port.
The most common serial upgrade protocol is the Ymodem transmission protocol, which has significant advantages:
-
Segmented transmission: Ymodem provides file checksum and segmented transmission mechanisms, improving the robustness of the transmission process.
-
Automatic retry mechanism: The Ymodem protocol includes a retry mechanism, ensuring that each data packet is automatically resent until successfully received, enhancing the transmission success rate.
Developing a bootloader and upper computer with Ymodem protocol requires a high level of technical skill, and improper operation may lead to device upgrade failures. This not only increases technical support costs but also reduces customer satisfaction, especially for users unfamiliar with this technology, making the upgrade process particularly cumbersome.
To avoid users developing complex upper computers, MicroLink has built-in Ymodem protocol support for reliable file transfer via serial port, making the upgrade process straightforward.
4. From the open-source community, giving back to the open-source community
It is thanks to the selfless sharing of countless open-source projects that MicroLink has been able to integrate such powerful capabilities in a short time. From underlying protocols to toolchain support, from debugging experience to script engines, we always stand on the shoulders of the open-source community. Special thanks to the authors of the following open-source projects:
CherryDAP open-source project:
👉 https://github.com/cherry-embedded/CherryDAP
PikaPython open-source project:
👉 https://github.com/pikastech/pikapython
Technical support from R-lao of Xianji;
👉 https://github.com/RCSN/hpm_sdk_extra
MicroBoot open-source project:
👉 https://github.com/Aladdin-Wang/MicroBoot
Therefore, I also choose to open-source the code and schematics of MicroLink, hoping to give back to the community and ignite more creative sparks.
👉 Project address: https://github.com/Aladdin-Wang/MicroLink
Welcome to Fork, Star, and also welcome to submit Issues and PRs — not just users, you can also become a co-builder of MicroLink!
“The deeper the source, the longer the flow; the firmer the roots, the more abundant the branches.”
If you find MicroLink interesting and are willing to support me in continuing to explore, please click the purchase link below, allowing this “micro-link” to go further.
Every bit of support gives me the confidence to keep moving forward, thank you!
Now, in addition to the original free Type-C data cable, you will also receive two extra soft Type-C data cables!
5. Easter Egg
Shocking! SystemView can also be supported?
If you think the article is good, please click the upper right corner to send it to friends or share it in your Moments. Your support and encouragement are my greatest motivation. Follow the public account, send “join group”, and be added to the technical exchange group.
Long press the QR code
Follow the public account