[SOLVED] Resetting M0 target with known bad code

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [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. SEGGER J-Link Commander V6.10c (Compiled Sep 28 2016 18:45:46)
    2. DLL version V6.10c, compiled Sep 28 2016 18:45:15
    3. Connecting to J-Link via USB...O.K.
    4. Firmware: J-Link V9 compiled Sep 1 2016 18:29:50
    5. Hardware version: V9.30
    6. S/N: 59304256
    7. License(s): GDB
    8. VTref = 1.780V
    9. Type "connect" to establish a target connection, '?' for help
    10. J-Link>connect
    11. Please specify device / core. : CORTEX-M0
    12. Type '?' for selection dialog
    13. Device>
    14. Please specify target interface: J) JTAG (Default) S) SWD
    15. TIF>S
    16. Specify target interface speed [kHz]. : 4000 kHz
    17. Speed>100
    18. Device "CORTEX-M0" selected.
    19. Found SWD-DP with ID 0x5BA02477
    20. AP-IDR: 0x74770001, Type: AHB-AP
    21. ****** Error: DAP error while reading AIRCR / CPUID register
    22. Found SWD-DP with ID 0x5BA02477
    23. AP-IDR: 0x74770001, Type: AHB-AP
    24. Found SWD-DP with ID 0x5BA02477
    25. AP-IDR: 0x74770001, Type: AHB-AP
    26. Found SWD-DP with ID 0x5BA02477
    27. AP-IDR: 0x74770001, Type: AHB-AP
    28. Cannot connect to target.
    Display All

    ...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. SEGGER J-Link Commander V6.10c (Compiled Sep 28 2016 18:45:46)
    2. DLL version V6.10c, compiled Sep 28 2016 18:45:15
    3. Connecting to J-Link via USB...O.K.
    4. Firmware: J-Link V9 compiled Sep 1 2016 18:29:50
    5. Hardware version: V9.30
    6. S/N: 59304256
    7. License(s): GDB
    8. VTref = 1.780V
    9. Type "connect" to establish a target connection, '?' for help
    10. J-Link>connect
    11. Please specify device / core. : CORTEX-M0
    12. Type '?' for selection dialog
    13. Device>
    14. Please specify target interface: J) JTAG (Default) S) SWD
    15. TIF>S
    16. Specify target interface speed [kHz]. : 4000 kHz
    17. Speed>100
    18. Device "CORTEX-M0" selected.
    19. Found SWD-DP with ID 0x5BA02477
    20. AP-IDR: 0x74770001, Type: AHB-AP
    21. Found Cortex-M0 r0p0, Little endian.
    22. FPUnit: 4 code (BP) slots and 0 literal slots
    23. CoreSight components:
    24. ROMTbl 0 @ E00FF000
    25. ROMTbl 0 [0]: FFF0F000, CID: B105E00D, PID: 000BB008 SCS
    26. ROMTbl 0 [1]: FFF02000, CID: B105E00D, PID: 000BB00A DWT
    27. ROMTbl 0 [2]: FFF03000, CID: B105E00D, PID: 000BB00B FPB
    28. Cortex-M0 identified.
    Display All

    Rob

    The post was edited 17 times, last by RobMeades ().

  • 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