Skip to content

[reset] Reset and force debug for Cortex M0 targets #332

Closed

Description

@mlu

It seems that for CortexM0 targets, tested with STM32L053, memory and memory mapped registers cannot be accesed with _stlink_usb_read_debug32 unless the core is halted in debug state after a call to stlink_force_debug(sl). Resetting the core seems to start it again. This has implications for how we can identify the chip reading the cip-id registers.

For cortex M3 and M4 the memory is accessible from the debugger while the core and a program is running so this is not an issue for these cores.

Now the three programs st-util, st-flash and st-info have different behavior and therefore works and fails under different circumstances, making the situation confusing.

st-util normally halts and enters debug mode before handing control to gdb, and calls open with resetflag 0, stlink_open_usb(state.logging_level, 0); and it correctly identifies STM32L053

st-flash must enter debug mode to run RAM based flash loaders, calls open with reset flag 1, stlink_open_usb(state.logging_level, 1); and it fails to identify STM32L053

st-info calls open with reset flag 1, stlink_open_usb(state.logging_level, 1); and it fails to identify STM32L053

This is a bit of a mess and it should be cleaned up, so input is wanted, we dont want to break what is working.

Activity

  1. xor-gate commented on May 20, 2016

    @xor-gate
    Contributor

    This should be fixed in latest v1.2.0 and master, could you verify?

  2. added this to the milestone on Feb 27, 2020
  3. 24 remaining items

  4. Ant-ON commented on Mar 31, 2021

    @Ant-ON
    Collaborator

    @Nightwalker-87
    I think it might be closed by #1114
    The behavior is now more standardized. All applications are called with reset 1 (normal). You can switch to reset 2 (connect under reset) by command line argument. st-info and st-util can use reset 0 (hot plug).

  5. Nightwalker-87 commented on Mar 31, 2021

    @Nightwalker-87
    Member

    I think this should be documented before we close this issue.

  6. modified the milestones: , v1.6.2 on Mar 31, 2021
  7. Ant-ON commented on Apr 1, 2021

    @Ant-ON
    Collaborator
  8. Nightwalker-87 commented on Apr 2, 2021

    @Nightwalker-87
    Member

    @Ant-ON I have taken note of that, but was pointing at

    The behavior is now more standardized. All applications are called with reset 1 (normal). You can switch to reset 2 (connect under reset) by command line argument. st-info and st-util can use reset 0 (hot plug).

    on the code-layer and not on the command line level.

  9. Ant-ON commented on Apr 5, 2021

    @Ant-ON
    Collaborator

    @Nightwalker-87 in command line layer too. See --hot-plug and --connect-under-reset in tutorial.md.
    I no added the --connect-under-reset to gdb. I don't know how to do it there yet. I will add the --hot-plug to the st-flash at evning.

  10. Nightwalker-87 commented on Apr 5, 2021

    @Nightwalker-87
    Member

    Ah now I get it - reset 0, 1 & 2 sounded like enum cases in the code to me at first... That's fine then.
    I was aware of the mentioned command options being listed in the tutorial, as you mentioned it above.

  11. Nightwalker-87 commented on Apr 5, 2021

    @Nightwalker-87
    Member

    As #1114, which addresses this ticket, also includes the related documentation, we can now close this issue as resolved.

  12. locked as resolved and limited conversation to collaborators on Apr 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions