JLink Usage Tips: Merging Programming Files

Introduction

IAP (In-application programming) allows firmware updates over the network without disassembling the device. The firmware of an IAP system typically consists of two parts: the BootLoader Code and the Application Code, stored at different starting addresses:

JLink Usage Tips: Merging Programming Files

During system operation, the Bootloader program runs first to check the status and determine whether to execute the application program or upgrade the firmware. In actual development, these two programs are usually written separately, generating two Bin files. To facilitate the download process, these two files can be merged into one, saving a lot of time. This article will explain how to use JFlash to merge two Bin files or two Hex files.

Preparation

  • File to merge 1: bootloader.hex, starting address: 0x8000000

  • File to merge 2: app.hex, starting address: 0x20001000. If it’s a Bin file, ensure the starting address is confirmed.

  • JFlash software

Create Project

Just like downloading a program, first create a new project.

1. Open JFlash

JLink Usage Tips: Merging Programming Files

2. Create New Project

Click File -> New Project

JLink Usage Tips: Merging Programming Files

3. Select Chip Model

This supports many ARM Cortex core chips. Select the corresponding chip; I will choose the STM32F103RE series.

JLink Usage Tips: Merging Programming Files

4. Open the Program File to Merge 1: bootloader.hex

Click File -> Open data file to open the bootloader program.

JLink Usage Tips: Merging Programming Files

JLink Usage Tips: Merging Programming Files

5. Open the Program File to Merge 2: app.hex

Click File -> Merge data file to open the app program.

JLink Usage Tips: Merging Programming Files

JLink Usage Tips: Merging Programming Files

Ensure that the starting address of the bootloader program plus the size of the bootloader code does not exceed the starting address of the app program, as shown in the figure below:

JLink Usage Tips: Merging Programming Files

6. Save the Merged File

Click File -> Save data file as to save the merged file, and choose the file type as needed.

JLink Usage Tips: Merging Programming Files

JLink Usage Tips: Merging Programming Files

Note

If the files to be merged are Bin files, they do not carry address information, so you will need to specify addresses without overlapping. It is best to save various files in a format that carries address information, such as hex. For the difference between Hex files and Bin files, you can refer to the article: What Are the Differences Between BIN, HEX, AXF, and ELF File Formats

JLink Usage Tips: Merging Programming Files

JLink Usage Tips: Merging Programming Files

This article is authorized for publication by the author ‘wcc149’, from the public account ‘Electronic Circuit Development Learning‘.

Leave a Comment