Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
mlu opened this issue Aug 18, 2015 · 8 comments · Fixed by #1114
Closed

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

mlu opened this issue Aug 18, 2015 · 8 comments · Fixed by #1114

Comments

@mlu
Copy link
Contributor

mlu commented Aug 18, 2015

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.

@xor-gate
Copy link
Member

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

@stlink-org stlink-org deleted a comment from xor-gate Apr 6, 2020
@Nightwalker-87 Nightwalker-87 changed the title Reset and force debug for Cortex M0 targets [reset] Reset and force debug for Cortex M0 targets Oct 22, 2020
@Nightwalker-87 Nightwalker-87 modified the milestones: d) Reset issues, v1.6.2 Oct 22, 2020
@Nightwalker-87 Nightwalker-87 modified the milestones: v1.6.2, Old issues Mar 25, 2021
@Ant-ON
Copy link
Collaborator

Ant-ON commented Mar 31, 2021

@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).

@Nightwalker-87
Copy link
Member

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

@Nightwalker-87 Nightwalker-87 modified the milestones: Old issues, v1.6.2 Mar 31, 2021
@Ant-ON
Copy link
Collaborator

Ant-ON commented Apr 1, 2021

@Nightwalker-87
Copy link
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.

@Ant-ON
Copy link
Collaborator

Ant-ON commented Apr 5, 2021

@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.

@Nightwalker-87
Copy link
Member

Nightwalker-87 commented Apr 5, 2021

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.

@Nightwalker-87
Copy link
Member

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

@stlink-org stlink-org locked as resolved and limited conversation to collaborators Apr 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.