platformio / platform-nordicnrf52

Nordic nRF52: development platform for PlatformIO
https://registry.platformio.org/platforms/platformio/nordicnrf52
Apache License 2.0
103 stars 114 forks source link

Erase Flash fails for nrf52-DK #148

Open zapta opened 2 years ago

zapta commented 2 years ago

I have a simple nrf52 project that can upload and debug using Segger Mini Edu jlink but it fails when I try the Erase Flash function.

platformio.ini:

[env:nrf52_dk]
platform = nordicnrf52
board = nrf52_dk
framework = zephyr

error log:

> Executing task: C:\Users\user\.platformio\penv\Scripts\platformio.exe run --target erase --environment nrf52_dk <

Processing nrf52_dk (platform: nordicnrf52; board: nrf52_dk; framework: zephyr)
-------------------------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/nordicnrf52/nrf52_dk.html
PLATFORM: Nordic nRF52 (9.3.0) > Nordic nRF52-DK
HARDWARE: NRF52832 64MHz, 64KB RAM, 512KB Flash
DEBUG: Current (jlink) On-board (cmsis-dap, jlink) External (blackmagic, stlink)
PACKAGES:
 - framework-zephyr 2.20701.220216 (2.7.1)
 - tool-cmake 3.21.3
 - tool-dtc 1.4.7
 - tool-ninja 1.9.0
 - tool-nrfjprog 1.90702.0 (9.7.2)
 - tool-sreccat 1.164.0 (1.64)
 - toolchain-gccarmnoneeabi 1.80201.190214 (8.2.1)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 0 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Erasing...
ERROR: JLinkARM DLL not found. Please reinstall latest JLinkARM.
*** [erase] Error 30
========================================================== [FAILED] Took 2.81 seconds ==========================================================
The terminal process "C:\Users\user\.platformio\penv\Scripts\platformio.exe 'run', '--target', 'erase', '--environment', 'nrf52_dk'" terminated with exit code: 1.

Terminal will be reused by tasks, press any key to close it.

My jlink directory:

~/.platformio/packages/tool-jlink$  ls -al
total 56438
drwxr-xr-x 1 user 197121        0 Apr  3 21:54 .
drwxr-xr-x 1 user 197121        0 Apr 18 22:49 ..
-rw-r--r-- 1 user 197121      164 Apr  3 21:54 .piopm
drwxr-xr-x 1 user 197121        0 Apr  3 21:54 Devices
drwxr-xr-x 1 user 197121        0 Apr  3 21:54 ETC
drwxr-xr-x 1 user 197121        0 Apr  3 21:54 Firmwares
drwxr-xr-x 1 user 197121        0 Apr  3 21:54 GDBServer
-rwxr-xr-x 1 user 197121  1385248 Jul  8  2021 JFlash.exe
-rwxr-xr-x 1 user 197121   220960 Jul  8  2021 JFlashLite.exe
-rwxr-xr-x 1 user 197121  1079584 Jul  8  2021 JFlashSPI.exe
-rwxr-xr-x 1 user 197121   312096 Jul  8  2021 JFlashSPI_CL.exe
-rwxr-xr-x 1 user 197121   318752 Jul  8  2021 JLink.exe
-rwxr-xr-x 1 user 197121 17842976 Jul  8  2021 JLinkARM.dll
-rwxr-xr-x 1 user 197121   556320 Jul  8  2021 JLinkConfig.exe
-rwxr-xr-x 1 user 197121   126752 Jul  8  2021 JLinkDLLUpdater.exe
-rw-r--r-- 1 user 197121   145330 Jul  1  2021 JLinkDevices.xml
-rwxr-xr-x 1 user 197121   483616 Jul  8  2021 JLinkGDBServer.exe
-rwxr-xr-x 1 user 197121   394528 Jul  8  2021 JLinkGDBServerCL.exe
-rwxr-xr-x 1 user 197121   294688 Jul  8  2021 JLinkGUIServer.exe
-rwxr-xr-x 1 user 197121   186656 Jul  8  2021 JLinkLicenseManager.exe
-rwxr-xr-x 1 user 197121   384800 Jul  8  2021 JLinkRDI.dll
-rwxr-xr-x 1 user 197121   123168 Jul  8  2021 JLinkRDIConfig.exe
-rwxr-xr-x 1 user 197121   142624 Jul  8  2021 JLinkRTTClient.exe
-rwxr-xr-x 1 user 197121   170272 Jul  8  2021 JLinkRTTLogger.exe
-rwxr-xr-x 1 user 197121   325920 Jul  8  2021 JLinkRTTViewer.exe
-rwxr-xr-x 1 user 197121   141088 Jul  8  2021 JLinkRegistration.exe
-rwxr-xr-x 1 user 197121   463136 Jul  8  2021 JLinkRemoteServer.exe
-rwxr-xr-x 1 user 197121   373536 Jul  8  2021 JLinkRemoteServerCL.exe
-rwxr-xr-x 1 user 197121   148768 Jul  8  2021 JLinkSTM32.exe
-rwxr-xr-x 1 user 197121   157472 Jul  8  2021 JLinkSTR91x.exe
-rwxr-xr-x 1 user 197121   240416 Jul  8  2021 JLinkSWOViewer.exe
-rwxr-xr-x 1 user 197121   154400 Jul  8  2021 JLinkSWOViewerCL.exe
-rwxr-xr-x 1 user 197121 18848544 Jul  8  2021 JLink_x64.dll
-rwxr-xr-x 1 user 197121   395552 Jul  8  2021 JMem.exe
-rwxr-xr-x 1 user 197121   262432 Jul  8  2021 JRun.exe
-rwxr-xr-x 1 user 197121   176928 Jul  8  2021 JTAGLoad.exe
-rwxr-xr-x 1 user 197121  2557440 Jul  1  2021 QtCore4.dll
-rwxr-xr-x 1 user 197121  8001024 Jul  1  2021 QtGui4.dll
drwxr-xr-x 1 user 197121        0 Apr  3 21:54 RDDI
-rwxr-xr-x 1 user 197121    75040 Jul  8  2021 SWOAnalyzer.exe
drwxr-xr-x 1 user 197121        0 Apr  3 21:54 Samples
drwxr-xr-x 1 user 197121        0 Apr  3 21:54 USBDriver
-rwxr-xr-x 1 user 197121   421200 Jul  1  2021 msvcp100.dll
-rwxr-xr-x 1 user 197121   773968 Jul  1  2021 msvcr100.dll
-rw-r--r-- 1 user 197121      335 Jul 22  2021 package.json
zapta commented 2 years ago

... and here is the tool-nrfjprog directory

~/.platformio/packages/tool-nrfjprog$ ls -al
total 1907
drwxr-xr-x 1 user 197121      0 Apr 18 22:49 .
drwxr-xr-x 1 user 197121      0 Apr 18 22:49 ..
-rw-r--r-- 1 user 197121    170 Apr 18 22:49 .piopm
-rw-r--r-- 1 user 197121   2218 Dec  1  2017 QspiDefault.ini
drwxr-xr-x 1 user 197121      0 Apr 18 22:49 docs
drwxr-xr-x 1 user 197121      0 Apr 18 22:49 headers
-rwxr-xr-x 1 user 197121 125952 Dec  1  2017 highlevelnrfjprog.dll
-rwxr-xr-x 1 user 197121  67584 Dec  1  2017 jlinkarm_nrf51_nrfjprog.dll
-rwxr-xr-x 1 user 197121  87552 Dec  1  2017 jlinkarm_nrf52_nrfjprog.dll
-rwxr-xr-x 1 user 197121  30720 Dec  1  2017 jlinkarm_unknown_nrfjprog.dll
-rwxr-xr-x 1 user 197121 421200 Dec  1  2017 msvcp100.dll
-rwxr-xr-x 1 user 197121 770384 Dec  1  2017 msvcr100.dll
-rwxr-xr-x 1 user 197121  25088 Dec  1  2017 nrfjprog.dll
-rwxr-xr-x 1 user 197121 382976 Dec  1  2017 nrfjprog.exe
-rw-r--r-- 1 user 197121    620 Dec  1  2017 nrfjprog.ini
-rw-r--r-- 1 user 197121    338 Jul  5  2020 package.json
zapta commented 2 years ago

One workaround is to install the Windows jlink package from Segger. Since the platformio jlink documentation says that all dependencies will be provided by paltformio and the user just needs to run InstDrivers.exe, this is still a bug so I am leaving this bug open.