当前位置: 首页 > 工具软件 > Bigger link > 使用案例 >

J-Link Device Support Kit

晏华奥
2023-12-01

1. J-Link Device Support Kit

JLink 在 V770d 版本上不再沿用之前的添加新设备的方式支持新设备下载,而是使用了一种新的方式。

支持新设备通常需要一个闪存加载器(flashloader),在某些情况下还需要一个脚本来定义设备所需的特殊连接和复位序列。虽然 SEGGER 继续使用新设备更新 J-Link 软件,但在此过程中仍可能遗漏设备。为了使客户能够自行填补空白,我们提供了 J-Link 设备支持套件 (DSK:Device Support Kit)。

为了尽可能轻松地创建支持,J-Link DSK 附带了 SEGGER 闪存加载器 (SFL:SEGGER Flash Loader) 以及一组用于需要特殊处理的各种设备的示例脚本文件。

1.1 Adding a new device

<Database>
  <Device>
    <ChipInfo Vendor="SEGGER" Name="SEGGER_Device0" Core="JLINK_CORE_CORTEX_M0"/>
  </Device>
  <Device>
    <ChipInfo Vendor="SEGGER" Name="SEGGER_Device1" Core="JLINK_CORE_CORTEX_M4"/>
  </Device>
</Database>

更多详见 ChipInfo-tag

如果设备需要特殊的连接/重置/…序列,需要通过 ChipInfo-JLinkScriptFile 指定 J-Link 脚本文件:

<Database>
  <Device>
    <ChipInfo Vendor="SEGGER" Name="SEGGER_Device0" Core="JLINK_CORE_CORTEX_M0" JLinkScriptFile="SEGGER/Example.jlinkscript"/>
  </Device>
</Database>

1.2 Inheriting from an existing device

有时,通过同一个XML文件添加多个设备,其中许多设备共享其许多属性。对于这种情况,可以使用 ChipInfo-InheritFrom 属性从父设备继承所有属性,然后覆盖选择性属性,从而简化操作:

<Database>
  <Device>
    <ChipInfo Vendor="SEGGER" Name="SEGGER_Device0" Core="JLINK_CORE_CORTEX_M0" JLinkScriptFile="SEGGER/Example.jlinkscript"/>
  </Device>
  <Device>
    <ChipInfo InheritFrom="SEGGER_Device0" Name="SEGGER_Device1"/>
  </Device>
</Database>

1.3 Adding a flash loader

有关如何编写 SFL 的更多信息,请参阅 SEGGER Flash Loader wiki article

设备条目 ( device entry) 也可能与该设备的一个或多个闪存加载程序相关联。通常,J-Link DSK 支持以下组合:

  • 1: 0:0 = 1 device, 0 flash banks, 0 flash loaders associated
  • 1: 1: 1 = 1 device, 1 flash bank, 1 flash loader associated
  • 1: 1: n = 1 device, 1 flash bank, n flash loaders associated
  • 1: m: n = 1 device, n flash banks, m flash loader associated per flash bank (number of loaders may be different for each bank)

1:m:n 关联对于提供多个闪存组的复杂设备有意义,并且这些闪存组中至少有一个可能提供多种配置。例如:具有内部代码闪存、内部数据闪存、外部QSPI闪存的设备。虽然代码闪存只有 1 个加载程序和数据闪存有 1 个加载器,但 QSPI 闪存可能连接到各种引脚对,因此 QSPI 连接可能因硬件而异。对于这种情况,有多个加载器可供选择是有意义的,例如每个加载器都为特定的引脚配置提供支持。

根据上面的示例,设备条目可能如下所示:

<Database>
  <Device>
    <ChipInfo Vendor="SEGGER" Name="SEGGER_Device0" WorkRAMAddr="0x20000000" WorkRAMSize="0x8000" Core="JLINK_CORE_CORTEX_M4" />
    <!-- 512 KB internal code flash bank with 1 loader -->
    <FlashBankInfo Name="Internal code flash" BaseAddr="0x08000000" AlwaysPresent="1" >
      <LoaderInfo Name="Default" MaxSize="0x80000" Loader="Flashloader_Device0_InternalCodeFlash.elf" LoaderType="FLASH_ALGO_TYPE_OPEN" />
    </FlashBankInfo>
    <!-- 4 KB internal data flash bank with 1 loader -->
    <FlashBankInfo Name="Internal data flash" BaseAddr="0x09000000" AlwaysPresent="1" >
      <LoaderInfo Name="Default" MaxSize="0x1000" Loader="Flashloader_Device0_InternalDataFlash.elf" LoaderType="FLASH_ALGO_TYPE_OPEN" />
    </FlashBankInfo>
    <!-- Max. 16 MB external QSPI flash with 3 loaders. Real size + sectorization is determined by loader at runtime -->
    <FlashBankInfo Name="Internal code flash" BaseAddr="0x60000000" AlwaysPresent="1" >
      <LoaderInfo Name="CLK@PIO0_D0@PIO1_D1@PIO2_D2@PIO3_D3@PIO4_CS@PIO5" MaxSize="0x1000000" Loader="Flashloader_Device0_ExternalQSPIFlash_PinConfig0.elf" LoaderType="FLASH_ALGO_TYPE_OPEN" />
      <LoaderInfo Name="CLK@PIO20_D0@PIO21_D1@PIO22_D2@PIO23_D3@PIO24_CS@PIO25" MaxSize="0x1000000" Loader="Flashloader_Device0_ExternalQSPIFlash_PinConfig1.elf" LoaderType="FLASH_ALGO_TYPE_OPEN" />
      <LoaderInfo Name="CLK@PIO30_D0@PIO31_D1@PIO32_D2@PIO33_D3@PIO34_CS@PIO35" MaxSize="0x1000000" Loader="Flashloader_Device0_ExternalQSPIFlash_PinConfig2.elf" LoaderType="FLASH_ALGO_TYPE_OPEN" />
    </FlashBankInfo>
  </Device>
</Database>

更多信息,详见 ChipInfo-tagFlashBankInfo-tagLoaderInfo-tag

1.4 JLinkDevices folder

为了使 J-Link 软件知道新设备,需要将先前创建的 XML 文件放在中央 JLinkDevices 文件夹中。如果该文件夹不存在,则可以创建该文件夹。

OSLocation
WindowsC:\Users<USER>\AppData\Roaming\SEGGER\JLinkDevices
Linux$HOME/.config/SEGGER/JLinkDevices
macOS$HOME/Library/Application Support/SEGGER/JLinkDevices

JLinkDevices 文件夹的结构:

\---JLinkDevices
    +---Vendor1
    |   +---DevFamily1
    |   |       Devices.xml
    |   |
    |   +---DevFamily2
    |   |       Devices.xml
    |   |
    |   \---DevFamily3
    |           Devices.xml
    |
    +---Vendor2
    |   +---DevFamily1
    |   |       Devices.xml
    |   |
    |   +---DevFamily2
    |   |       Devices.xml
    |   |
    |   \---DevFamily3
    |           Devices.xml
    |
    \---Vendor3
        +---DevFamily1
        |       Devices.xml
        |
        +---DevFamily2
        |       Devices.xml
        |
        \---DevFamily3
                Devices.xml

使用安装程序可以自动将 XML 文件(以及潜在的闪存加载程序、脚本文件等)放置(即复制)到所需位置的过程。

J-Link DSK 附带一个适用于 Microsoft Windows 的安装程序模板。

2. Device XML file

J-Link 设备 XML 文件与 J-Link DSK 一起使用,以添加对新设备的支持或扩展对现有设备的支持。

本节介绍 J-Link 设备 XML 文件的结构、标签、属性等。

下面将介绍有效的 XML 标记及其可能的属性。

一般规则:

  • 属性只能出现在开始标记内

  • 属性值必须用引号引起来

Tag Description

TagDescription
Opens the XML file top-level tag.
Opens the description for a new device.
Specifies basic information about the device to be added, like the core it incorporates etc.
Specifies a flash bank for the device.

2.1 XML-tag Database

示例

TBD xxx

打开 XML 文件顶级标记。每个 XML 文件仅存在一次。

2.1.1 Attributes

此标记没有属性 Note:

  • Must only occur once per XML file

  • Must be closed via

3.1 XML-tag Device

示例

TBD xxx

打开新设备的说明。

3.1.1 Attributes

ParameterMeaning
InheritFromString that specifies the name of a parent device which the DLL already knows. The new child device will inherit all properties from the parent to use as a base.

If the child inherits from a parent that was defined through *.XML, the parent and child must be defined in the same *.XML file and the parent must be defined before the child.

Other configurations may lead to unspecified behavior.

This attribute is optional. E.g. InheritFrom=“STM32F767NI”.

Note:

  • Must be closed via .

  • May occur multiple times in an XML file.

4.1 XML-tag ChipInfo

示例

TBD xxx

指定有关要添加的设备的基本信息,例如它包含的内核等。

4.1.1 Attributes

ParameterMeaning
VendorString that specifies the name of the vendor of the device. This attribute is mandatory. E.g. Vendor=“ST”.
NameName of the device. This attribute is mandatory. E.g. Name=“STM32F407IE”
WorkRAMAddrHexadecimal value that specifies the address of a RAM area that can be used by J-Link during flash programming etc. Should not be used by any DMAs on the device. Cannot exist without also specifying WorkRAMSize. If no flash banks are added for the new device, this attribute is optional. E.g. WorkRAMAddr=" 0x20000000 "
WorkRAMSizeHexadecimal value that specifies the size of the RAM area that can be used by J-Link during flash programming etc. Cannot exist without also specifying WorkRAMAddr. If no flash banks are added for the new device, this attribute is optional. E.g. WorkRAMSize=" 0x10000 "
CoreSpecifies the core that the device incorporates. If a new device added, this attribute is mandatory. E.g. Core=" JLINK_CORE_CORTEX_M0 "For a list of valid attribute values, please refer to Attribute values - Core.
JLinkScriptFileString that specifies the path to a J-Link script file if required for the device. Path can be relative or absolute. If path is

relative, it is relative to the location of the JLinkDevices.xml file. This attribute is optional. E.g. JLinkScriptFile=“ST/Example.jlinkscript”

Note:

  • No separate closing tag. Directly closed after attributes have been specified: <ChipInfo … />

  • Must not occur outside a  tag.

4.1.1.1 Attribute values - Core

有关 Core 属性的所有可用值的列表,请展开以下列表:

| JLINK_CORE_CORTEX_M1

JLINK_CORE_CORTEX_M3

JLINK_CORE_CORTEX_M3_R1P0

JLINK_CORE_CORTEX_M3_R1P1

JLINK_CORE_CORTEX_M3_R2P0

JLINK_CORE_CORTEX_M3_R2P1

JLINK_CORE_CORTEX_M0

JLINK_CORE_CORTEX_M_V8BASEL

JLINK_CORE_CORTEX_M4

JLINK_CORE_CORTEX_M7

JLINK_CORE_CORTEX_M_V8MAINL

JLINK_CORE_CORTEX_M23

JLINK_CORE_RV32

JLINK_CORE_RV64

JLINK_CORE_ARM7

JLINK_CORE_ARM7TDMI

JLINK_CORE_ARM7TDMI_R3

JLINK_CORE_ARM7TDMI_R4

JLINK_CORE_ARM7TDMI_S

JLINK_CORE_ARM7TDMI_S_R3

JLINK_CORE_ARM7TDMI_S_R4

JLINK_CORE_CORTEX_A8

JLINK_CORE_CORTEX_A7

JLINK_CORE_CORTEX_A9

JLINK_CORE_CORTEX_A12

JLINK_CORE_CORTEX_A15

JLINK_CORE_CORTEX_A17

JLINK_CORE_ARM9

JLINK_CORE_ARM9TDMI_S

JLINK_CORE_ARM920T

JLINK_CORE_ARM922T

JLINK_CORE_ARM926EJ_S

JLINK_CORE_ARM946E_S

JLINK_CORE_ARM966E_S

JLINK_CORE_ARM968E_S

JLINK_CORE_ARM11

JLINK_CORE_ARM1136

JLINK_CORE_ARM1136J

JLINK_CORE_ARM1136J_S

JLINK_CORE_ARM1136JF

JLINK_CORE_ARM1136JF_S

JLINK_CORE_ARM1156

JLINK_CORE_ARM1176

JLINK_CORE_ARM1176J

JLINK_CORE_ARM1176J_S

JLINK_CORE_ARM1176JF

JLINK_CORE_ARM1176JF_S

JLINK_CORE_CORTEX_R4

JLINK_CORE_CORTEX_R5

JLINK_CORE_RX

JLINK_CORE_RX62N

JLINK_CORE_RX62T

JLINK_CORE_RX63N

JLINK_CORE_RX630

JLINK_CORE_RX63T

JLINK_CORE_RX621

JLINK_CORE_RX62G

JLINK_CORE_RX631

JLINK_CORE_RX65N

JLINK_CORE_RX21A

JLINK_CORE_RX220

JLINK_CORE_RX230

JLINK_CORE_RX231

JLINK_CORE_RX23T

JLINK_CORE_RX24T

JLINK_CORE_RX110

JLINK_CORE_RX113

JLINK_CORE_RX130

JLINK_CORE_RX71M

JLINK_CORE_CORTEX_A5

JLINK_CORE_POWER_PC

JLINK_CORE_POWER_PC_N1

JLINK_CORE_POWER_PC_N2

JLINK_CORE_MIPS

JLINK_CORE_MIPS_M4K

JLINK_CORE_MIPS_MICROAPTIV

JLINK_CORE_EFM8_UNSPEC


JLINK_CORE_CIP51

5.1 XML-tag FlashBankInfo

示例

<Database>
  <Device>
    <ChipInfo Vendor="SEGGER" Name="SEGGER_Device0" WorkRAMAddr="0x20000000" WorkRAMSize="0x8000" Core="JLINK_CORE_CORTEX_M4" />
    <!-- 512 KB internal code flash bank with 1 loader -->
    <FlashBankInfo Name="Internal code flash" BaseAddr="0x08000000" AlwaysPresent="1" >
      <LoaderInfo Name="Default" MaxSize="0x80000" Loader="Flashloader_Device0_InternalCodeFlash.elf" LoaderType="FLASH_ALGO_TYPE_OPEN" />
    </FlashBankInfo>
  </Device>
</Database>

指定设备的 flash bank。这允许将 J-Link 闪存下载功能与 IDE、调试器和其他使用此设备的 J-Link DLL(例如 J-Link Commander)的软件一起使用。然后,可以通过 J-Link DLL 的正常闪存下载功能对闪存组进行编程。有关 Flash 下载的更多信息,请参阅 Flash 下载 。有关新添加的闪存库的可能限制等,请参阅添加。 信息/注意事项/限制。

3.1.1 Attributes

AttributeImplementationTypeExampleExplanation
NameMandatoryStringName=“SPIFI flash”Specifies the name of the flash bank. Only used for visualization. Can be freely chosen.
BaseAddrMandatoryHexadecimal valueBaseAddr=“0x08000000”Specifies the start address of the flash bank. The J-Link software uses this attribute together with MaxSize to determine which memory write accesses performed by the debugger, shall be redirected to the flash loader instead of being written directly to the target as normal memory access.
AlwaysPresentOptionalBoolean (0/1)AlwaysPresent=“1”Specifies if a flash bank is always present (e.g. internal flash). If this element is set to 1, this flash bank will be affected by the “erase” command.

Note:

  • Must not occur outside a tag

6.1 XML-tag LoaderInfo

示例

TBD xxx

指定设备的闪存加载程序。

6.1.1 Attributes

ParameterMeaning
NameString that specifies the name of the flash loader. Only used for visualization.

sName may only contain the following characters:

a-z

A-Z

0-9

@

_ (underscore)

This attribute is mandatory. E.g. Name=“SPIFI flash loader”
MaxSizeHexadecimal value that specifies the max. size of the flash bank in bytes. For many flash loader types the real bank size may depend on the actual flash being connected (e.g. SPIFI flash where the loader can handle different SPIFI flashes so size may differ from hardware to hardware). Also, for some flash loaders the sectorization is extracted from the flash loader at runtime. The real size of the flash bank may be smaller than MaxSize but must never be bigger. The J-Link DLL uses this attribute together with BaseAddr to determine which memory write accesses performed by the debugger, shall be redirected to the flash loader instead of being written directly to the target as normal memory access. This attribute is mandatory. E.g. MaxSize=" 0x80000 "
LoaderString that specifies path to the ELF file that holds the flash loader. Path can be relative or absolute. If path is relative, it

is relative to the location of the JLinkDevices.xml file. This attribute is mandatory. E.g. Loader=“ST/MyFlashLoader.elf” For CMSIS flash loaders the file extension is usually FLM, however any extension is accepted by the J-Link DLL.
LoaderTypeSpecifies the type of the loader specified by Loader. This attribute is mandatory. E.g. LoaderType=" FLASH_ALGO_TYPE_OPEN " For a list of valid attribute values, please refer to Attribute values LoaderType.

Note:

  • No separate closing tag. Directly closed after attributes have been specified: <FlashBankInfo … />

  • Must not occur outside a tag

6.1.1.1 Attribute values - LoaderType

LoaderType 有效属性值:

  • FLASH_ALGO_TYPE_OPEN
    Describes that the used algorithm is an Open Flashloader algorithm. CMSIS based algorithms are also supported via the Open Flashloader concept. For additional information, see Add. Info / Considerations / Limitations .

3. DSK availability

要获得 DSK:

  • templates for SEGGER’s high performance flash loaders

  • functioning reference SEGGER high performance flash loaders in source code

  • templates for device support installers

对于免费且开放但性能较低的闪存加载程序选项,可以使用 CMSIS loaders 程序。

除了 SEGGER 高性能闪存加载器外,J-Link 设备 XML 文件和软件也接受 CMSIS 加载器格式的闪存加载器。

添加设备的过程完全相同,只是为闪存加载程序生成 ELF 文件,其入口点基于 CMSIS 加载程序。

 类似资料: