I don't want to use nrfjprog as the runner. I want to use jlink runner when flashing. However it doesn't work, neither do nrfutil.
nRF Connect for VSCode doesn't work when runner is NOT nrfjprog with nRF5340. Neither using nrfutil or jlink as runner works.
I'm on nRF Connect SDK v2.6.0
I have this issue in a custom board, but can be easily reproduced on nRF5340 dk. Easiest way to choose which runner to use is to directly modify zephyr/boards/arm/nrf5340dk_nrf5340/board.cmake.
You will see following:
Using JLink runner
- I added some extra logging to see exactly, jlink runner works when it's a single image build (hex file called merged.hex) but building with Bluetooth doesn't work as it tries to flash the merged_domain.hex, which fails.
- If I go in and manually edit the zephyr/scripts/west_commands/runners/jlink.py
- As you can see in the log, it successfully flashes the app core image, but fails with the net core it seems
Flashing build_dk to 960158604 west flash -d /home/jakkra/Documents/project/zephyr/samples/bluetooth/peripheral_dis/build_dk --skip-rebuild -i 960158604 -- west flash: using runner jlink -- runners.jlink: JLink version: 7.88k Do reset False ['ExitOnError 1', 'r', 'loadfile "/home/jakkra/Documents/project/zephyr/samples/bluetooth/peripheral_dis/build_dk/zephyr/merged_domains.hex"', 'g', 'writeDP 1 0', 'readDP 1', 'q'] -- runners.jlink: Flashing file: /home/jakkra/Documents/project/zephyr/samples/bluetooth/peripheral_dis/build_dk/zephyr/merged_domains.hex SEGGER J-Link Commander V7.88k (Compiled Jul 5 2023 15:00:37) DLL version V7.88k, compiled Jul 5 2023 15:00:17 J-Link Command File read successfully. Processing script file... J-Link>ExitOnError 1 J-Link Commander will now exit on Error J-Link>r J-Link connection not established yet but required for command. Connecting to J-Link via USB...O.K. Firmware: J-Link OB-K22-NordicSemi compiled Oct 30 2023 12:12:53 Hardware version: V1.00 J-Link uptime (since boot): 0d 00h 33m 27s S/N: 960158604 License(s): RDI, FlashBP, FlashDL, JFlash, GDB USB speed mode: Full speed (12 MBit/s) VTref=3.300V Target connection not established yet but required for command. Device "NRF5340_XXAA_APP" selected. Connecting to target via SWD ConfigTargetSettings() start ConfigTargetSettings() end - Took 13us InitTarget() start InitTarget() end - Took 1.59ms Found SW-DP with ID 0x6BA02477 DPIDR: 0x6BA02477 CoreSight SoC-400 or earlier AP map detection skipped. Manually configured AP map found. AP[0]: AHB-AP (IDR: Not set) AP[1]: AHB-AP (IDR: Not set) AP[2]: MEM-AP (IDR: Not set) AP[3]: MEM-AP (IDR: Not set) 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. Reset delay: 0 ms Reset type NORMAL: Resets core & peripherals via SYSRESETREQ & VECTRESET bit. Reset: ARMv8M core with Security Extension enabled detected. Reset: Halt core after reset via DEMCR.VC_CORERESET. Reset: Reset device via AIRCR.SYSRESETREQ. J-Link>loadfile "/home/jakkra/Documents/project/zephyr/samples/bluetooth/peripheral_dis/build_dk/zephyr/merged_domains.hex" 'loadfile': Performing implicit reset & halt of MCU. Reset: ARMv8M core with Security Extension enabled detected. Reset: Halt core after reset via DEMCR.VC_CORERESET. Reset: Reset device via AIRCR.SYSRESETREQ. Downloading file [/home/jakkra/Documents/project/zephyr/samples/bluetooth/peripheral_dis/build_dk/zephyr/merged_domains.hex]... Comparing flash [100%] Done. Erasing flash [100%] Done. Programming flash [100%] Done. J-Link: Flash download: Bank 2 @ 0x00000000: 1 range affected (73728 bytes) J-Link: Flash download: Total: 0.685s (Prepare: 0.067s, Compare: 0.006s, Erase: 0.000s, Program & Verify: 0.565s, Restore: 0.046s) J-Link: Flash download: Program & Verify speed: 127 KB/s Writing target memory failed. Script processing completed. FATAL ERROR: command exited with status 1: /opt/SEGGER/JLink_V788k/JLinkExe -USB 960158604 -nogui 1 -if swd -speed 4000 -device nrf5340_xxaa_app -CommanderScript /tmp/tmpr50rillvjlink/runner.jlink -nogui 1 * The terminal process terminated with exit code: 1.
Using nrfutil runner (nrfutil downloaded from here today https://www.nordicsemi.com/Products/Development-tools/nRF-Util/Download)
- Doesn't work at all
Flashing build_dk to 960158604 west flash -d /home/jakkra/Documents/project/zephyr/samples/bluetooth/peripheral_dis/build_dk --skip-rebuild -i 960158604 -- west flash: using runner nrfutil -- runners.nrfutil: reset after flashing requested -- runners.nrfutil: Flashing file: /home/jakkra/Documents/project/zephyr/samples/bluetooth/peripheral_dis/build_dk/zephyr/merged_domains.hex -- runners.nrfutil: /home/jakkra/Documents/project/zephyr/samples/bluetooth/peripheral_dis/build_dk/zephyr/merged_domains.hex targets both nRF53 coprocessors; splitting it into: /home/jakkra/Documents/project/zephyr/samples/bluetooth/peripheral_dis/build_dk/zephyr/GENERATED_CP_NETWORK_merged_domains.hex and /home/jakkra/Documents/project/zephyr/samples/bluetooth/peripheral_dis/build_dk/zephyr/GENERATED_CP_APPLICATION_merged_domains.hex error: unrecognized subcommand 'execute-batch' tip: some similar subcommands exist: 'x-execute', 'x-execute-batch' Usage: nrfutil device [OPTIONS] [COMMAND] For more information, try '--help'. FATAL ERROR: command exited with status 2: nrfutil --json device execute-batch --batch-path /home/jakkra/Documents/project/zephyr/samples/bluetooth/peripheral_dis/build_dk/zephyr/generated_nrfutil_batch.json --serial-number 960158604
VSCode debug generate:
For help and support, visit the Nordic DevZone at https://devzone.nordicsemi.com/. { "platform": { "os": "linux", "osVersion": "#29~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Apr 4 14:39:20 UTC 2", "osKernel": "6.5.0-28-generic", "vscode": "1.89.1", "electron": "28.2.8", "node": "v18.18.2" }, "system": { "date": "2024-05-12T13:17:31.923Z", "vscodeRoot": "/snap/code/159/usr/share/code/resources/app", "nrfConnectForDesktopInstalled": "unknown", "vscodeUptime": "25:08:19", "osUptime": "28:46:55", "cpu": "Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz" }, "workspace": { "name": "project", "workspaceFile": null, "folders": [ "/home/jakkra/Documents/project" ] }, "sdks": [ { "version": "v2.6.0", "path": "/home/jakkra/ncs/v2.6.0" }, { "version": "v0.7.0-0", "path": "/home/jakkra/Documents/project" } ], "activeBuild": "/home/jakkra/Documents/project/zephyr/samples/bluetooth/peripheral_dis/build_dk", "apps": [ { "workspace": "/home/jakkra/Documents/project", "uri": "/home/jakkra/Documents/project/zephyr/samples/bluetooth/peripheral_dis", "buildConfigurations": [ { "id": "/home/jakkra/Documents/project/zephyr/samples/bluetooth/peripheral_dis/build_dk", "name": "build_dk", "boardId": "nrf5340dk_nrf5340_cpuapp", "type": "Zephyr", "isChild": false, "isStale": false, "taskBindings": { "build": [], "pristineBuild": [], "flash": [], "eraseAndFlash": [] } } ] }, ], "topdir": "/home/jakkra/Documents/project", "workspaceState": "workspace-ready", "toolchains": [ { "version": "2.6.0", "path": "/home/jakkra/ncs/toolchains/2be090971e" }, { "version": "2.4.2", "path": "/home/jakkra/ncs/toolchains/1f9b40e71a" }, { "version": "2.4.0", "path": "/home/jakkra/ncs/toolchains/1f9b40e71a" } ], "connectedDevices": [ { "serialNumber": "000960158604" } ], "deviceProvider": "nrfutil", "tools": { "/home/jakkra/ncs/toolchains/2be090971e/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc": "0.16.5", "/opt/SEGGER/JLink/JLinkExe": "7.88k", "/usr/local/bin/nrfjprog": "10.22.0", "/usr/bin/nrfutil": "7.7.1", "/home/jakkra/ncs/toolchains/2be090971e/usr/local/bin/cmake": "3.21.0", "/home/jakkra/ncs/toolchains/2be090971e/usr/local/bin/west": "1.2.0", "/home/jakkra/ncs/toolchains/2be090971e/usr/local/bin/python3": "3.9.18", "/home/jakkra/ncs/toolchains/2be090971e/usr/local/bin/ninja": "1.10.2", "/home/jakkra/ncs/toolchains/2be090971e/usr/bin/gperf": "3.1", "/home/jakkra/ncs/toolchains/2be090971e/usr/bin/dtc": "1.5.0", "/home/jakkra/ncs/toolchains/2be090971e/opt/bin/gn": "2132", "/home/jakkra/ncs/toolchains/2be090971e/usr/local/bin/git": "2.37.3", "gdbPath": "/home/jakkra/ncs/toolchains/2be090971e/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gdb" }, "nrfutil": { "nrfutil-device": { "version": "2.0.0", "binPath": "/home/jakkra/.vscode/extensions/nordic-semiconductor.nrf-connect-2024.3.25-linux-x64/platform/nrfutil/bin/nrfutil-device" }, "nrfutil-toolchain-manager": { "version": "0.14.1", "binPath": "/home/jakkra/.vscode/extensions/nordic-semiconductor.nrf-connect-2024.3.25-linux-x64/platform/nrfutil/bin/nrfutil-toolchain-manager" } }, "environment": { "westEnv": { "ELECTRON_RUN_AS_NODE": "1", "GIT_EXEC_PATH": "/home/jakkra/ncs/toolchains/2be090971e/usr/local/libexec/git-core", "HOME": "/home/jakkra", "PATH": "/home/jakkra/ncs/toolchains/2be090971e/usr/bin:/home/jakkra/ncs/toolchains/2be090971e/usr/bin:/home/jakkra/ncs/toolchains/2be090971e/usr/local/bin:/home/jakkra/ncs/toolchains/2be090971e/opt/bin:/home/jakkra/ncs/toolchains/2be090971e/opt/nanopb/generator-bin:/home/jakkra/ncs/toolchains/2be090971e/opt/zephyr-sdk/aarch64-zephyr-elf/bin:/home/jakkra/ncs/toolchains/2be090971e/opt/zephyr-sdk/x86_64-zephyr-elf/bin:/home/jakkra/ncs/toolchains/2be090971e/opt/zephyr-sdk/arm-zephyr-eabi/bin:/home/jakkra/ncs/toolchains/2be090971e/opt/zephyr-sdk/riscv64-zephyr-elf/bin:/home/jakkra/.local/bin:/home/jakkra/.local/bin:/home/jakkra/.local/lib/python3.10/site-packages:/home/jakkra/.local/bin:/home/jakkra/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin:/home/jakkra/.local/bin:/home/jakkra/.local/bin:/home/jakkra/.local/bin:/home/jakkra/.local/bin:/home/jakkra/.local/lib/python3.10/site-packages:/home/jakkra/.local/bin:/home/jakkra/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin:/home/jakkra/.local/bin:/home/jakkra/.local/bin", "ZEPHYR_BASE": "/home/jakkra/Documents/project/zephyr", "ZEPHYR_TOOLCHAIN_VARIANT": "zephyr", "ZEPHYR_SDK_INSTALL_DIR": "/home/jakkra/ncs/toolchains/2be090971e/opt/zephyr-sdk", "PYTHONPATH": "/home/jakkra/ncs/toolchains/2be090971e/usr/local/lib/python3.9:/home/jakkra/ncs/toolchains/2be090971e/usr/local/lib/python3.9/site-packages", "USER": "jakkra" }, "inherited": { "ELECTRON_RUN_AS_NODE": "1", "HOME": "/home/jakkra", "PATH": "/home/jakkra/.local/bin:/home/jakkra/.local/bin:/home/jakkra/.local/lib/python3.10/site-packages:/home/jakkra/.local/bin:/home/jakkra/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin:/home/jakkra/.local/bin:/home/jakkra/.local/bin", "USER": "jakkra" }, "toolchainPath": "/home/jakkra/ncs/toolchains/2be090971e", "toolchainBinPath": "/home/jakkra/ncs/toolchains/2be090971e/opt/zephyr-sdk/arm-zephyr-eabi/bin", "toolchainVersion": "2.6.0" }, "terminal": { "defaultProfile": null }, "config": { "nordic-semiconductor.nrf-connect": { "topdir": "", "toolchain": { "path": "${nrf-connect.toolchain:2.6.0}" }, "ozonePath": "", "applications": [ "${workspaceFolder}/app", "${workspaceFolder}\\app", "${workspaceFolder}/zephyr/samples/bluetooth/peripheral_dis", "${workspaceFolder}/zephyr/samples/subsys/usb/mass" ], "applicationOptions": {}, "kconfig": { "interface": "kconfig" }, "west": { "env": { "$base": "terminal" } }, "boardRoots": [ "${workspaceFolder}/app", "${workspaceFolder}\\app", "${workspaceFolder}/zephyr", "${workspaceFolder}\\zephyr" ], "taskBindings": {}, "buildTerminal": { "condensedProgress": true }, "debugging": { "flash": false, "bindings": { "${workspaceFolder}/app/build": "Launch build" }, "justMyCode": false }, "activeAppFollowActiveEditor": true, "deviceProvider": "", "flash": { "softreset": false, "erase": false, "recover": false }, "enableTelemetry": true, "thirdpartyIntegration": {}, "toolchainManager": { "indexURL": null, "installDirectory": null }, "nrfutil": { "home": null }, "defaultOpenAction": "ask", "welcome": { "showOnStartup": true } }, "nordic-semiconductor.nrf-terminal": { "terminalMode": "character" } }, "extensions": { "internal": { "nordic-semiconductor.nrf-connect": { "version": "2024.3.25", "path": "/home/jakkra/.vscode/extensions/nordic-semiconductor.nrf-connect-2024.3.25-linux-x64", "isActive": true }, "nordic-semiconductor.nrf-terminal": { "version": "2024.3.15", "path": "/home/jakkra/.vscode/extensions/nordic-semiconductor.nrf-terminal-2024.3.15", "isActive": true }, "nordic-semiconductor.nrf-devicetree": { "version": "2024.3.78", "path": "/home/jakkra/.vscode/extensions/nordic-semiconductor.nrf-devicetree-2024.3.78", "isActive": true }, "nordic-semiconductor.nrf-kconfig": { "version": "2024.3.21", "path": "/home/jakkra/.vscode/extensions/nordic-semiconductor.nrf-kconfig-2024.3.21", "isActive": true } }, "external": { "marus25.cortex-debug": null, "ms-vscode.cpptools": "1.20.5", "ms-vscode.js-debug": "1.89.0", "ms-vscode.js-debug-companion": "1.1.2", "ms-vscode.vscode-js-profile-table": "1.0.9", "chiehyu.vscode-astyle": "0.9.0", "GitHub.copilot": "1.188.0", "GitHub.copilot-chat": "0.15.1", "ms-python.debugpy": "2024.6.0", "ms-python.python": "2024.6.0", "ms-python.vscode-pylance": "2024.5.1", "ms-vscode-remote.remote-containers": "0.362.0", "ms-vscode.hexeditor": "1.10.0", "smcpeak.default-keys-windows": "0.0.10", "trond-snekvik.gnu-mapfiles": "1.1.0", "twxs.cmake": "0.0.17", "webfreak.debug": "0.27.0" } } }
EDIT: After writing this ticker I saw that nRF COnnect 2.6.1 was released also, so I tried it, but flashing still fails there.