Sunday, September 24th 2017, 1:33am UTC+2

You are not logged in.

  • Login
  • Register

Dear visitor, welcome to SEGGER Forum. If this is your first visit here, please read the Help. It explains how this page works. You must be registered before you can use all the page's features. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

RobMeades

Beginner

Date of registration: Oct 3rd 2016

Posts: 1

1

Thursday, October 6th 2016, 11:41am

[SOLVED] Resetting M0 target with known bad code

Hi there. I'm trying to track down a problem with code optimisation which results in my M0 target crashing at boot. On this target platform I have to load code onto the target (via the SEGGER J-Link box) using a third party executable (as hashes are written as well as the code). Unfortunately this third party application resets the target after download. As soon as the target is running with this bad code that I want to debug, J-Link can no longer connect to it so I am unable to see what's going on.

My question is: is there some way I'm missing to get J-Link to definitively connect to a target (over SWD) whatever code it is running?

Here's the J-Link output from the bad case:

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
SEGGER J-Link Commander V6.10c (Compiled Sep 28 2016 18:45:46)
DLL version V6.10c, compiled Sep 28 2016 18:45:15

Connecting to J-Link via USB...O.K.
Firmware: J-Link V9 compiled Sep  1 2016 18:29:50
Hardware version: V9.30
S/N: 59304256
License(s): GDB
VTref = 1.780V

Type "connect" to establish a target connection, '?' for help
J-Link>connect
Please specify device / core. : CORTEX-M0
Type '?' for selection dialog
Device>
Please specify target interface:  J) JTAG (Default)  S) SWD
TIF>S
Specify target interface speed [kHz]. : 4000 kHz
Speed>100
Device "CORTEX-M0" selected.

Found SWD-DP with ID 0x5BA02477
AP-IDR: 0x74770001, Type: AHB-AP
****** Error: DAP error while reading AIRCR / CPUID register
Found SWD-DP with ID 0x5BA02477
AP-IDR: 0x74770001, Type: AHB-AP
Found SWD-DP with ID 0x5BA02477
AP-IDR: 0x74770001, Type: AHB-AP
Found SWD-DP with ID 0x5BA02477
AP-IDR: 0x74770001, Type: AHB-AP
Cannot connect to target.

...and, for reference, here is the J-Link output from a good case (i.e. with the target running less optimised code which runs fine):

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
SEGGER J-Link Commander V6.10c (Compiled Sep 28 2016 18:45:46)
DLL version V6.10c, compiled Sep 28 2016 18:45:15

Connecting to J-Link via USB...O.K.
Firmware: J-Link V9 compiled Sep  1 2016 18:29:50
Hardware version: V9.30
S/N: 59304256
License(s): GDB
VTref = 1.780V

Type "connect" to establish a target connection, '?' for help
J-Link>connect
Please specify device / core. : CORTEX-M0
Type '?' for selection dialog
Device>
Please specify target interface:  J) JTAG (Default)  S) SWD
TIF>S
Specify target interface speed [kHz]. : 4000 kHz
Speed>100
Device "CORTEX-M0" selected.

Found SWD-DP with ID 0x5BA02477
AP-IDR: 0x74770001, Type: AHB-AP
Found Cortex-M0 r0p0, Little endian.
FPUnit: 4 code (BP) slots and 0 literal slots
CoreSight components:
ROMTbl 0 @ E00FF000
ROMTbl 0 [0]: FFF0F000, CID: B105E00D, PID: 000BB008 SCS
ROMTbl 0 [1]: FFF02000, CID: B105E00D, PID: 000BB00A DWT
ROMTbl 0 [2]: FFF03000, CID: B105E00D, PID: 000BB00B FPB
Cortex-M0 identified.

Rob

This post has been edited 17 times, last edit by "RobMeades" (Oct 6th 2016, 12:47pm)


SEGGER - Alex

Super Moderator

Date of registration: Dec 18th 2007

Posts: 1,508

2

Wednesday, October 19th 2016, 10:48pm

Quoted

My question is: is there some way I'm missing to get J-Link to definitively connect to a target (over SWD) whatever code it is running?


Short answer: No


Longer answer:
It depends on the actual targets. For most targets, there is no 100% working fallback for such cases (general design weakness in the Cortex-M design).
For some devices there is, but J-Link needs to know the exact device to do a special connect for a certain device (if there is one available at all)


Best regards
Alex