On Sun, Jul 27, 2025 at 7:43 PM Liviu Ionescu <i...@livius.net> wrote:
>
>
>
> > On 27 Jul 2025, at 19:35, Antonio Borneo <borneo.anto...@gmail.com> wrote:
> >
> > If I understand correctly, Liviu uses this exit code in some test that
> > runs OpenOCD, let OpenOCD start a FW on target, get the exit status of
> > the FW and quit OpenOCD with that exit status. The test gets the exit
> > status from OpenOCD.
>
> Yes, this is the intended use case for Arm semihosting when running unit 
> tests.

Well, I often see developers using semihosting during development to
simply get a console output before the HW UART drivers are ready, or
on projects where there is no UART available.
This is one of the cases where exit() is not welcome.
But I agree with you, probably this is not the intended use case for
semihosting.

Nevertheless, I completely understand your use case, and it needs to
be supported.

And also the possibility to keep OpenOCD alive after firmware's exit()
is important for me; I often debug with OpenOCD without any GDB
attached.
And exit() in OpenOCD is not the right solution as we should pass
through the `shutdown` command.

So something similar to the command I proposed
`arm semihosting_on_exit [halt|resume|exit]`
should work for everyone.

Let's also wait for Marek reply.

Antonio

Reply via email to