Unable to use JLinkExe to flash firmware to device, nrfjprog does work with same file

Hi --

We are in the process of setting up to flash a few hundred devices for our internal testing.  We can currently flash to our board using nrfjprog either directly from the command line or via Visual Studio Code without any major issues.  But if we take the same merged.hex file and attempt to flash it using JLinkExe, it fails.

Environment:

  • Apple Silicon M1 Max MacBook Pro
  • macOS Sequoia 15.2
  • J-Link Base, FW V11, HW V11.0
  • JLinkExe version 18.12b
  • nrfjprog version 10.15.3
  • JLinkARM.dll version 8.12b

This is the process we follow to flash the firmware using JLinkExe:

$ JLinkExe -device CORTEX-M33 -if swd -speed 4000
SEGGER J-Link Commander V8.12b (Compiled Jan 15 2025 13:47:46)
DLL version V8.12b, compiled Jan 15 2025 13:47:14

Connecting to J-Link via USB...O.K.
Firmware: J-Link V11 compiled Dec  4 2024 17:53:35
Hardware version: V11.00
J-Link uptime (since boot): 0d 00h 14m 40s
S/N: 51025827
License(s): GDB
USB speed mode: High speed (480 MBit/s)
VTref=1.799V


Type "connect" to establish a target connection, '?' for help
J-Link>connect
Device "CORTEX-M33" selected.


Connecting to target via SWD
Found SW-DP with ID 0x6BA02477
DPIDR: 0x6BA02477
CoreSight SoC-400 or earlier
Scanning AP map to find all available APs
AP[4]: Stopped AP scan as end of AP map has been reached
AP[0]: AHB-AP (IDR: 0x84770001, ADDR: 0x00000000)
AP[1]: AHB-AP (IDR: 0x84770001, ADDR: 0x01000000)
AP[2]: JTAG-AP (IDR: 0x12880000, ADDR: 0x02000000)
AP[3]: JTAG-AP (IDR: 0x12880000, ADDR: 0x03000000)
Iterating through AP map to find AHB-AP to use
AP[0]: Core found
AP[0]: AHB-AP ROM base: 0xE00FE000
CPUID register: 0x410FD214. Implementer code: 0x41 (ARM)
Feature set: Mainline
Cache: No cache
Found Cortex-M33 r0p4, Little endian.
FPUnit: 8 code (BP) slots and 0 literal slots
Security extension: implemented
Secure debug: enabled
CoreSight components:
ROMTbl[0] @ E00FE000
[0][0]: E00FF000 CID B105100D PID 000BB4C9 ROM Table
ROMTbl[1] @ E00FF000
[1][0]: E000E000 CID B105900D PID 000BBD21 DEVARCH 47702A04 DEVTYPE 00 Cortex-M33
[1][1]: E0001000 CID B105900D PID 000BBD21 DEVARCH 47701A02 DEVTYPE 00 DWT
[1][2]: E0002000 CID B105900D PID 000BBD21 DEVARCH 47701A03 DEVTYPE 00 FPB
[1][3]: E0000000 CID B105900D PID 000BBD21 DEVARCH 47701A01 DEVTYPE 43 ITM
[1][5]: E0041000 CID B105900D PID 002BBD21 DEVARCH 47724A13 DEVTYPE 13 ETM
[1][6]: E0042000 CID B105900D PID 000BBD21 DEVARCH 47701A14 DEVTYPE 14 CSS600-CTI
[0][1]: E0040000 CID B105900D PID 000BBD21 DEVARCH 00000000 DEVTYPE 11 TPIU
Memory zones:
  Zone: "Default" Description: Default access mode
Cortex-M33 identified.
J-Link>erase
No address range specified, 'Erase Chip' will be executed
'erase': Performing implicit reset & halt of MCU.
Reset type: NORMAL (wiki.segger.com/J-Link_Reset_Strategies)
Reset: ARMv8M core with Security Extension enabled detected. Switch to secure domain.
Reset: Halt core after reset via DEMCR.VC_CORERESET.
Reset: Reset device via AIRCR.SYSRESETREQ.
Erasing device...
Erasing done.
J-Link>loadfile merged.hex
'loadfile': Performing implicit reset & halt of MCU.
Reset type: NORMAL (wiki.segger.com/J-Link_Reset_Strategies)
Reset: ARMv8M core with Security Extension enabled detected. Switch to secure domain.
Reset: Halt core after reset via DEMCR.VC_CORERESET.
Reset: Reset device via AIRCR.SYSRESETREQ.
Downloading file [merged.hex]...
Writing target memory failed.
J-Link>

This is the log file I captured when attempting to flash with JLinkExe:

TFD7A8240 002:396.132   SEGGER J-Link V8.12b Log File
TFD7A8240 002:397.350   DLL Compiled: Jan 15 2025 13:47:14
TFD7A8240 002:397.368   Logging started @ 2025-01-16 15:17
TFD7A8240 002:397.384   Process: /Applications/SEGGER/JLink_V812b/JLinkExe
TFD7A8240 002:397.398 - 2397.397ms
TFD7A8240 005:093.366 JLINK_DEVICE_GetIndex(sDeviceName = CORTEX-M33)
TFD7A8240 005:109.722 - 16.355ms returns 24
TFD7A8240 005:111.092 JLINK_ExecCommand("device=CORTEX-M33", ...).
TFD7A8240 005:111.942   Device "CORTEX-M33" selected.
TFD7A8240 005:113.745 - 2.592ms returns 0x00
TFD7A8240 005:113.775 JLINK_EnableLog(...)
TFD7A8240 005:113.788 - 0.013ms
TFD7A8240 005:113.813 JLINK_GetEmuCaps()
TFD7A8240 005:113.826 - 0.013ms returns 0xB9FF7BBF
TFD7A8240 005:113.848 JLINK_TIF_GetAvailable(...)
TFD7A8240 005:114.155 - 0.307ms
TFD7A8240 005:114.180 JLINK_TIF_Select(JLINKARM_TIF_SWD)
TFD7A8240 005:116.068 - 1.889ms returns 0x00
TFD7A8240 005:116.098 JLINK_IsConnected()
TFD7A8240 005:116.114 - 0.017ms returns FALSE
TFD7A8240 005:116.128 JLINK_SetSpeed(4000)
TFD7A8240 005:116.264 - 0.137ms
TFD7A8240 005:116.280 JLINK_Connect()
TFD7A8240 005:117.873   Found SW-DP with ID 0x6BA02477
TFD7A8240 005:119.816   DPIDR: 0x6BA02477
TFD7A8240 005:119.840   CoreSight SoC-400 or earlier
TFD7A8240 005:119.860   Scanning AP map to find all available APs
TFD7A8240 005:121.046   AP[4]: Stopped AP scan as end of AP map has been reached
TFD7A8240 005:121.070   AP[0]: AHB-AP (IDR: 0x84770001, ADDR: 0x00000000)
TFD7A8240 005:121.089   AP[1]: AHB-AP (IDR: 0x84770001, ADDR: 0x01000000)
TFD7A8240 005:121.115   AP[2]: JTAG-AP (IDR: 0x12880000, ADDR: 0x02000000)
TFD7A8240 005:121.143   AP[3]: JTAG-AP (IDR: 0x12880000, ADDR: 0x03000000)
TFD7A8240 005:121.163   Iterating through AP map to find AHB-AP to use
TFD7A8240 005:121.636   AP[0]: Core found
TFD7A8240 005:121.658   AP[0]: AHB-AP ROM base: 0xE00FE000
TFD7A8240 005:121.919   CPUID register: 0x410FD214. Implementer code: 0x41 (ARM)
TFD7A8240 005:121.940   Feature set: Mainline
TFD7A8240 005:122.178   Cache: No cache
TFD7A8240 005:122.197   Found Cortex-M33 r0p4, Little endian.
TFD7A8240 005:124.983   -- Max. mem block: 0x00005C78
TFD7A8240 005:127.958   CPU_ReadMem(4 bytes @ 0xE000EDF0)
TFD7A8240 005:128.347   CPU_WriteMem(4 bytes @ 0xE000EDF0)
TFD7A8240 005:128.615   CPU_ReadMem(4 bytes @ 0xE0002000)
TFD7A8240 005:128.873   FPUnit: 8 code (BP) slots and 0 literal slots
TFD7A8240 005:128.893   CPU_ReadMem(4 bytes @ 0xE000EDFC)
TFD7A8240 005:129.156   CPU_WriteMem(4 bytes @ 0xE000EDFC)
TFD7A8240 005:129.400   CPU_ReadMem(4 bytes @ 0xE0001000)
TFD7A8240 005:129.645   CPU_ReadMem(4 bytes @ 0xE0001000)
TFD7A8240 005:129.892   CPU_ReadMem(4 bytes @ 0xE0001028)
TFD7A8240 005:130.143   CPU_ReadMem(4 bytes @ 0xE0001038)
TFD7A8240 005:130.385   CPU_ReadMem(4 bytes @ 0xE0001048)
TFD7A8240 005:130.637   CPU_ReadMem(4 bytes @ 0xE0001058)
TFD7A8240 005:130.880   CPU_WriteMem(4 bytes @ 0xE0001000)
TFD7A8240 005:131.133   CPU_ReadMem(4 bytes @ 0xE000ED88)
TFD7A8240 005:131.398   CPU_WriteMem(4 bytes @ 0xE000ED88)
TFD7A8240 005:131.664   CPU_ReadMem(4 bytes @ 0xE000ED88)
TFD7A8240 005:131.926   CPU_WriteMem(4 bytes @ 0xE000ED88)
TFD7A8240 005:132.218   CPU_ReadMem(4 bytes @ 0xE000EFB8)
TFD7A8240 005:132.488   Security extension: implemented
TFD7A8240 005:132.506   Secure debug: enabled
TFD7A8240 005:132.520   CoreSight components:
TFD7A8240 005:132.535   ROMTbl[0] @ E00FE000
TFD7A8240 005:132.548   CPU_ReadMem(64 bytes @ 0xE00FE000)
TFD7A8240 005:133.010   CPU_ReadMem(32 bytes @ 0xE00FFFE0)
TFD7A8240 005:133.401   [0][0]: E00FF000 CID B105100D PID 000BB4C9 ROM Table
TFD7A8240 005:133.427   ROMTbl[1] @ E00FF000
TFD7A8240 005:133.442   CPU_ReadMem(64 bytes @ 0xE00FF000)
TFD7A8240 005:133.917   CPU_ReadMem(32 bytes @ 0xE000EFE0)
TFD7A8240 005:134.290   CPU_ReadMem(4 bytes @ 0xE000EFBC)
TFD7A8240 005:134.550   CPU_ReadMem(4 bytes @ 0xE000EFCC)
TFD7A8240 005:134.805   [1][0]: E000E000 CID B105900D PID 000BBD21 DEVARCH 47702A04 DEVTYPE 00 Cortex-M33
TFD7A8240 005:134.822   CPU_ReadMem(32 bytes @ 0xE0001FE0)
TFD7A8240 005:135.211   CPU_ReadMem(4 bytes @ 0xE0001FBC)
TFD7A8240 005:135.461   CPU_ReadMem(4 bytes @ 0xE0001FCC)
TFD7A8240 005:135.711   [1][1]: E0001000 CID B105900D PID 000BBD21 DEVARCH 47701A02 DEVTYPE 00 DWT
TFD7A8240 005:135.721   CPU_ReadMem(32 bytes @ 0xE0002FE0)
TFD7A8240 005:136.082   CPU_ReadMem(4 bytes @ 0xE0002FBC)
TFD7A8240 005:136.326   CPU_ReadMem(4 bytes @ 0xE0002FCC)
TFD7A8240 005:136.567   [1][2]: E0002000 CID B105900D PID 000BBD21 DEVARCH 47701A03 DEVTYPE 00 FPB
TFD7A8240 005:136.577   CPU_ReadMem(32 bytes @ 0xE0000FE0)
TFD7A8240 005:136.930   CPU_ReadMem(4 bytes @ 0xE0000FBC)
TFD7A8240 005:137.179   CPU_ReadMem(4 bytes @ 0xE0000FCC)
TFD7A8240 005:137.434   [1][3]: E0000000 CID B105900D PID 000BBD21 DEVARCH 47701A01 DEVTYPE 43 ITM
TFD7A8240 005:137.444   CPU_ReadMem(32 bytes @ 0xE0041FE0)
TFD7A8240 005:137.789   CPU_ReadMem(4 bytes @ 0xE0041FBC)
TFD7A8240 005:138.049   CPU_ReadMem(4 bytes @ 0xE0041FCC)
TFD7A8240 005:138.297   [1][5]: E0041000 CID B105900D PID 002BBD21 DEVARCH 47724A13 DEVTYPE 13 ETM
TFD7A8240 005:138.308   CPU_ReadMem(32 bytes @ 0xE0042FE0)
TFD7A8240 005:138.659   CPU_ReadMem(4 bytes @ 0xE0042FBC)
TFD7A8240 005:138.902   CPU_ReadMem(4 bytes @ 0xE0042FCC)
TFD7A8240 005:139.169   [1][6]: E0042000 CID B105900D PID 000BBD21 DEVARCH 47701A14 DEVTYPE 14 CSS600-CTI
TFD7A8240 005:139.179   CPU_ReadMem(32 bytes @ 0xE0040FE0)
TFD7A8240 005:139.524   CPU_ReadMem(4 bytes @ 0xE0040FBC)
TFD7A8240 005:139.771   CPU_ReadMem(4 bytes @ 0xE0040FCC)
TFD7A8240 005:140.033   [0][1]: E0040000 CID B105900D PID 000BBD21 DEVARCH 00000000 DEVTYPE 11 TPIU
TFD7A8240 005:140.092 - 23.812ms returns 0x00
TFD7A8240 005:140.104 JLINK_GetIdData(pIdData)
TFD7A8240 005:140.278   pIdData->ScanLen=4
TFD7A8240 005:140.294   pIdData->NumDevices=1
TFD7A8240 005:140.302   pIdData->aId[0]=0x6BA02477
TFD7A8240 005:140.310   pIdData->aIrRead[0]=0
TFD7A8240 005:140.331   pIdData->aScanLen[0]=0
TFD7A8240 005:140.340   pIdData->aScanRead[0]=0
TFD7A8240 005:140.350 - 0.246ms
TFD7A8240 005:140.367 JLINK_GetMemZones(...)
TFD7A8240 005:140.373 - 0.007ms returns 1
TFD7A8240 005:140.386 JLINK_HasError()
TFD7A8240 005:140.395 JLINK_CORE_GetFound()
TFD7A8240 005:140.400 - 0.006ms returns 0xE0200FF
TFD7A8240 006:203.040 JLINK_DEVICE_GetIndex(sDeviceName = <NULL>)
TFD7A8240 006:203.454 - 0.416ms returns 24
TFD7A8240 006:203.482 JLINK_Reset()
TFD7A8240 006:203.778   JLINK_GetResetTypeDesc
TFD7A8240 006:203.801   - 0.022ms
TFD7A8240 006:203.820   Reset type: NORMAL (wiki.segger.com/J-Link_Reset_Strategies)
TFD7A8240 006:203.839   CPU is running
TFD7A8240 006:203.870   CPU_WriteMem(4 bytes @ 0xE000EDF0)
TFD7A8240 006:205.826   CPU_ReadMem(4 bytes @ 0xE000ED44)
TFD7A8240 006:206.222   CPU_ReadMem(4 bytes @ 0xE000EE08)
TFD7A8240 006:206.534   CPU is running
TFD7A8240 006:206.557   CPU_WriteMem(4 bytes @ 0xE000EE08)
TFD7A8240 006:206.837   CPU_ReadMem(4 bytes @ 0xE000EE08)
TFD7A8240 006:207.096   Reset: ARMv8M core with Security Extension enabled detected. Switch to secure domain.
TFD7A8240 006:207.111   CPU is running
TFD7A8240 006:207.121   CPU_WriteMem(4 bytes @ 0xE000EDFC)
TFD7A8240 006:207.380   Reset: Halt core after reset via DEMCR.VC_CORERESET.
TFD7A8240 006:207.740   Reset: Reset device via AIRCR.SYSRESETREQ.
TFD7A8240 006:207.755   CPU is running
TFD7A8240 006:207.764   CPU_WriteMem(4 bytes @ 0xE000ED0C)
TFD7A8240 006:265.904   CPU_ReadMem(4 bytes @ 0xE000EDF0)
TFD7A8240 006:266.222   CPU_ReadMem(4 bytes @ 0xE000EDF0)
TFD7A8240 006:268.973   CPU_WriteMem(4 bytes @ 0xE000EDFC)
TFD7A8240 006:276.732   CPU_ReadMem(4 bytes @ 0xE000EDF0)
TFD7A8240 006:279.448   CPU_ReadMem(4 bytes @ 0xE000EE08)
TFD7A8240 006:279.723   CPU_WriteMem(4 bytes @ 0xE0002000)
TFD7A8240 006:279.990   CPU_ReadMem(4 bytes @ 0xE000EDFC)
TFD7A8240 006:280.252   CPU_ReadMem(4 bytes @ 0xE0001000)
TFD7A8240 006:280.494   CPU_ReadMem(4 bytes @ 0xE000EE08)
TFD7A8240 006:280.749 - 77.266ms
TFD7A8240 006:282.618 JLINK_Halt()
TFD7A8240 006:282.652 - 0.033ms returns 0x00
TFD7A8240 006:282.702 JLINK_EraseChip()
TFD7A8240 006:284.256   CPU_ReadMem(4 bytes @ 0xE000ED90)
TFD7A8240 006:284.553   CPU_ReadMem(4 bytes @ 0xE000ED94)
TFD7A8240 006:286.127 - 3.424ms returns 0
TFD7A8240 013:502.343 JLINK_Reset()
TFD7A8240 013:502.512   JLINK_GetResetTypeDesc
TFD7A8240 013:502.529   - 0.016ms
TFD7A8240 013:502.546   Reset type: NORMAL (wiki.segger.com/J-Link_Reset_Strategies)
TFD7A8240 013:502.574   CPU_WriteMem(4 bytes @ 0xE000EDF0)
TFD7A8240 013:503.426   CPU_ReadMem(4 bytes @ 0xE000ED44)
TFD7A8240 013:503.728   CPU_ReadMem(4 bytes @ 0xE000EE08)
TFD7A8240 013:504.034   CPU_WriteMem(4 bytes @ 0xE000EE08)
TFD7A8240 013:504.288   CPU_ReadMem(4 bytes @ 0xE000EE08)
TFD7A8240 013:504.556   Reset: ARMv8M core with Security Extension enabled detected. Switch to secure domain.
TFD7A8240 013:504.568   CPU_WriteMem(4 bytes @ 0xE000EDFC)
TFD7A8240 013:504.838   Reset: Halt core after reset via DEMCR.VC_CORERESET.
TFD7A8240 013:505.297   Reset: Reset device via AIRCR.SYSRESETREQ.
TFD7A8240 013:505.313   CPU_WriteMem(4 bytes @ 0xE000ED0C)
TFD7A8240 013:563.464   CPU_ReadMem(4 bytes @ 0xE000EDF0)
TFD7A8240 013:563.788   CPU_ReadMem(4 bytes @ 0xE000EDF0)
TFD7A8240 013:564.571   CPU_WriteMem(4 bytes @ 0xE000EDFC)
TFD7A8240 013:571.738   CPU_ReadMem(4 bytes @ 0xE000EDF0)
TFD7A8240 013:576.047   CPU_ReadMem(4 bytes @ 0xE000EE08)
TFD7A8240 013:576.465   CPU_WriteMem(4 bytes @ 0xE0002000)
TFD7A8240 013:576.699   CPU_ReadMem(4 bytes @ 0xE000EDFC)
TFD7A8240 013:576.946   CPU_ReadMem(4 bytes @ 0xE0001000)
TFD7A8240 013:577.202   CPU_ReadMem(4 bytes @ 0xE000EE08)
TFD7A8240 013:577.437 - 75.094ms
TFD7A8240 013:577.463 JLINK_Halt()
TFD7A8240 013:577.513 - 0.050ms returns 0x00
TFD7A8240 013:577.545 JLINK_ExecCommand("SetVerifyRAMDownload = 1", ...).
TFD7A8240 013:577.573 - 0.015ms returns 0x00
TFD7A8240 013:577.595 JLINK_DownloadFile()
TFD7A8240 013:587.573   Data:  90 61 00 20 3D 30 00 00 39 A2 00 00 11 30 00 00 ...
TFD7A8240 013:587.805   CPU_WriteMem(57396 bytes @ 0x00000000)
TFD7A8240 013:591.130 - 13.535ms returns 0xFFFFFEF2
TFD7A8240 013:591.162 JLINK_ExecCommand("SetVerifyRAMDownload = 0", ...).
TFD7A8240 013:591.180 - 0.002ms returns 0x01
TFD7A8240 014:382.137 JLINK_IsOpen()
TFD7A8240 014:382.207 - 0.072ms returns 0x01
TFD7A8240 014:391.427 JLINK_Close()
TFD7A8240 014:393.685   CPU_ReadMem(4 bytes @ 0xE0001000)
TFD7A8240 014:393.946   CPU_WriteMem(4 bytes @ 0xE0001004)
TFD7A8240 014:406.469 - 15.042ms
TFD7A8240 014:406.506   
TFD7A8240 014:406.512   Closed

This previously worked, but I do not have the details as to what version of JLinkExe was used at the time.  When I try using the JLinkFlashLiteExe app, I see the following in the log:

Selected file: merged.hex
Data file contains 2 memory ranges:
  #0: 0x00000000 - 0x0000E033 (57396 Bytes)
  #1: 0x00010000 - 0x0005451F (279840 Bytes)
Connecting to J-Link...
Connecting to target...
Downloading...
ERROR: Could not download file.
Done.

Is there any additional processing I need to do on the merged.hex file before it is ready to be flashed using JLinkExe or JLinkFlashLiteExe?

Thanks!

Related