platform-atmelsam
platform-atmelsam copied to clipboard
Add ExitOnError 1 to jlink upload script
Fail upload task if there's any error during jlink script execution.
It often happens that jlink commander can't upload firmware and upload task shows success like here:
Building in release mode
Checking size .pio/build/adafruit_matrix_portal_m4/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM: [= ] 6.0% (used 11864 bytes from 196608 bytes)
Flash: [= ] 6.9% (used 35096 bytes from 507904 bytes)
Configuring upload protocol...
AVAILABLE: atmel-ice, jlink, sam-ba
CURRENT: upload_protocol = jlink
Uploading .pio/build/adafruit_matrix_portal_m4/firmware.bin
SEGGER J-Link Commander V7.70a (Compiled Aug 10 2022 16:28:14)
DLL version V7.70a, compiled Aug 10 2022 16:28:07
J-Link Command File read successfully.
Processing script file...
J-Link>h
J-Link connection not established yet but required for command.
Connecting to J-Link via USB...FAILED: Cannot connect to J-Link.
J-Link>loadbin .pio/build/adafruit_matrix_portal_m4/firmware.bin, 0x4000
J-Link connection not established yet but required for command.
Connecting to J-Link via USB...FAILED: Cannot connect to J-Link.
J-Link>r
J-Link connection not established yet but required for command.
Connecting to J-Link via USB...FAILED: Cannot connect to J-Link.
J-Link>q
Script processing completed.
======================================== [SUCCESS] Took 2.94 seconds ========================================
Environment Status Duration
------------------------- -------- ------------
adafruit_matrix_portal_m4 SUCCESS 00:00:02.942
======================================== 1 succeeded in 00:00:02.942 ========================================
* Terminal will be reused by tasks, press any key to close it.
*
After adding ExitOnError it will fail upload task if any errors.
Building in release mode
Checking size .pio/build/adafruit_matrix_portal_m4/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM: [= ] 6.0% (used 11864 bytes from 196608 bytes)
Flash: [= ] 6.9% (used 35096 bytes from 507904 bytes)
Configuring upload protocol...
AVAILABLE: atmel-ice, jlink, sam-ba
CURRENT: upload_protocol = jlink
Uploading .pio/build/adafruit_matrix_portal_m4/firmware.bin
SEGGER J-Link Commander V7.70a (Compiled Aug 10 2022 16:28:14)
DLL version V7.70a, compiled Aug 10 2022 16:28:07
J-Link Command File read successfully.
Processing script file...
J-Link>ExitOnError 1
J-Link Commander will now exit on Error
J-Link>h
J-Link connection not established yet but required for command.
Connecting to J-Link via USB...O.K.
Firmware: J-Link V9 compiled May 7 2021 16:26:12
Hardware version: V9.20
J-Link uptime (since boot): N/A (Not supported by this model)
S/N: -1
VTref=3.303V
Target connection not established yet but required for command.
Device "ATSAMD51J19A" selected.
Connecting to target via SWD
InitTarget() start
InitTarget()
InitTarget() end
InitTarget() end
Found SW-DP with ID 0x2BA01477
DPIDR: 0x2BA01477
CoreSight SoC-400 or earlier
Scanning AP map to find all available APs
AP[2]: Stopped AP scan as end of AP map seems to be reached
AP[0]: AHB-AP (IDR: 0x24770011)
AP[1]: AHB-AP (IDR: 0x74770001)
Iterating through AP map to find AHB-AP to use
AP[0]: Core found
AP[0]: AHB-AP ROM base: 0x41003000
CPUID register: 0x410FC241. Implementer code: 0x41 (ARM)
Found Cortex-M4 r0p1, Little endian.
****** Error: Communication timed out: Requested 4 bytes, received 0 bytes !
Could not read CPU capabilities.
Cannot connect to target.
Script processing completed.
*** [upload] Error 1
========================================= [FAILED] Took 3.05 seconds =========================================
Environment Status Duration
------------------------- -------- ------------
adafruit_matrix_portal_m4 FAILED 00:00:03.052
=================================== 1 failed, 0 succeeded in 00:00:03.052 ===================================
* The terminal process "platformio 'run', '--target', 'upload', '--environment', 'adafruit_matrix_portal_m4'" terminated with exit code: 1.
* Terminal will be reused by tasks, press any key to close it.