Preserving a Sub-Range of QSPI-NOR Flash with J-Link Commander on NXP RT1xxx

    • Preserving a Sub-Range of QSPI-NOR Flash with J-Link Commander on NXP RT1xxx

      Hello everyone,
      I’m using Segger J-Link v8.30 and an NXP RT1xxx MCU that boots from external QSPI-NOR flash mapped, for example, at 0x3000 0000. Although the NOR flash supports 4 KiB sector erases at the hardware level, J-Link Commander (and the GDB Server) currently always performs erases in 64 KiB blocks. When I write the FW into the flash I need to preserve 512 bytes at 0x3000 0400–0x3000 05FF, which contain data that must survive every download.
      Key details:
      • Hardware sector erase size: 4 KiB
      • J-Link software erase granularity: 64 KiB
      • Regions to rewrite:
        • 0x3000 0000–0x3000 03FF
        • 0x3000 0600–0x300x xxxx
      • Region to preserve: 0x3000 0400–0x3000 05FF
      In development and debugging I use the GDB Server, but for simple production programming I rely on J-Link Commander.

      How can I achieve this with J-Link software?

      Thank you!
    • Hello,

      I read this: kb.segger.com/ConfigTargetSettings()#Exclude_illegal_regions

      and I tried this script:

      Template_ExcludeIllegalRegions.JLinkScript

      Then I try to attach to MIMXRT1021-EVK:

      /opt/SEGGER/JLink/JLinkExe -if SWD -speed auto -device MIMXRT1021xxx5A -autoconnect 1 -JLinkScriptFile Template_ExcludeIllegalRegions.JLinkScript

      I get this:
      SEGGER J-Link Commander V8.30 (Compiled Apr 30 2025 12:10:43)DLL version V8.30, compiled Apr 30 2025 12:09:37


      Connecting to J-Link via USB...O.K.
      Firmware: J-Link V10 compiled Jan 30 2023 11:28:07
      Hardware version: V10.10
      J-Link uptime (since boot): N/A (Not supported by this model)
      S/N: 260106436
      License(s): FlashBP, GDB
      OEM: SEGGER-EDU
      VTref=3.303V
      Device "MIMXRT1021XXX5A" selected.



      Connecting to target via SWD
      ConfigTargetSettings() start
      ConfigTargetSettings() end - Took 13us
      Found SW-DP with ID 0x0BD11477
      DPIDR: 0x0BD11477
      CoreSight SoC-400 or earlier
      Scanning AP map to find all available APs
      AP[1]: Stopped AP scan as end of AP map has been reached
      AP[0]: AHB-AP (IDR: 0x04770041, ADDR: 0x00000000)
      Iterating through AP map to find AHB-AP to use
      AP[0]: Core found
      AP[0]: AHB-AP ROM base: 0xE00FD000
      CPUID register: 0x411FC271. Implementer code: 0x41 (ARM)
      Cache: L1 I/D-cache present
      Found Cortex-M7 r1p1, Little endian.
      FPUnit: 8 code (BP) slots and 0 literal slots
      CoreSight components:
      ROMTbl[0] @ E00FD000
      [0][0]: E00FE000 CID B105100D PID 000BB4C8 ROM Table
      ROMTbl[1] @ E00FE000
      [1][0]: E00FF000 CID B105100D PID 000BB4C7 ROM Table
      ROMTbl[2] @ E00FF000
      [2][0]: E000E000 CID B105E00D PID 000BB00C SCS-M7
      [2][1]: E0001000 CID B105E00D PID 000BB002 DWT
      [2][2]: E0002000 CID B105E00D PID 000BB00E FPB-M7
      [2][3]: E0000000 CID B105E00D PID 000BB001 ITM
      [1][1]: E0041000 CID B105900D PID 001BB975 ETM-M7
      [1][2]: E0042000 CID B105900D PID 004BB906 CTI
      [0][1]: E0040000 CID B105900D PID 000BB9A9 TPIU-M7
      [0][2]: E0043000 CID B105F00D PID 001BB101 TSG
      I-Cache L1: 16 KB, 256 Sets, 32 Bytes/Line, 2-Way
      D-Cache L1: 16 KB, 128 Sets, 32 Bytes/Line, 4-Way


      ****** Error: Failed to add region 0x60000000 - 0x600001FF because it overlaps with an existing region of type != normal, which cannot be replaced


      Memory zones:
      Zone: "Default" Description: Default access mode
      Cortex-M7 identified.


      I want to override the area 0x60000000-0x600001FF , I need to do this.

      I don't even know how memory regions are defined now (how can I print them?).

      How can I solve it?

      best regards
      Max