Hi Lena,

If you aren't aware, you can also load more than one elf file in GDB via 'add-symbol-file', to have access to both S and NS (and BL2 if necessary).

For example:

$ arm-none-eabi-gdb-py -s build/zephyr/zephyr.elf -ex "target remote tcp:localhost:2331"
(gdb) add-symbol-file build/tfm/install/outputs/ARM/MPS3/AN547/bl2.elf
(gdb) add-symbol-file build/tfm/install/outputs/ARM/MPS3/AN547/tfm_s.elf
(gdb) monitor reset halt
(gdb) break main
(gdb) continue

You might also find this useful if you have a larger terminal window and are using basic tui mode in GDB, to see a bit more detail when step-through debugging:

$ arm-zephyr-eabi-gdb -tui -s build/zephyr/zephyr.elf \
  -ex "tui new-layout split-asm src 1 {-horizontal asm 1 regs 1} 1 status 0 cmd 1" \
  -ex "layout split-asm" \
  -ex "set tui border-kind ascii" \
  -ex "target remote tcp:localhost:2331" \
  -ex "monitor reset halt" \
  -ex "break main" \
  -ex "c"

Here's a short talk I gave on debugging with GDB which may or may not be useful to you: https://resources.linaro.org/en/resource/MQ3H8gjNg4F6nMB8aZVt72

Best regards,
Kevin

On Thu, 1 Jun 2023 at 16:22, Lena Boeckmann via TF-M <tf-m@lists.trustedfirmware.org> wrote:
Hi!
I found the e-mail below from 2020 and this is exactly where I'm at right now:
I have a Zephyr application with TF-M flashed on an nrf9160dk and managed to open a debugging session following the explanation here: https://tf-m-user-guide.trustedfirmware.org/platform/nxp/lpcxpresso55s69/README.html (might be good to mention in the documentation that this also works on other platforms or have a general "Debug with GDB section").

So far I can either debug the secure image or or the non-secure image, but I would actually like to see the communication between the two. Is it even possible to debug across the boundary?
I'm not very experienced in using GDB (except for the basics). Is there some kind of TF-M specific tutorial or explanation by now? Or is there anyone who can give me a hint on how to do this?

Kind regards,
Lena

Kevin Townsend wrote:
> Hi Anton,
> One particular difficulty I've encountered working with TF-M for the Zephyr
> certification demo app, and with the LPC55S69 port to upstream TF-M is the
> debugging experience with GDB and the dual execution environments. GDB can
> be quite powerful if you are familiar with it, but there is a definite
> learning curve, and the S and NS separation and the dual binary images
> (three with BL2) adds an additional degree of complexity.
> I think having a dedicated debugging tutorial around GDB would be very
> useful to people adopting TF-M and perhaps new to GDB, just to show how
> some basic debugging might happen, how to debug across the NS/S boundary,
> etc.
> For example, the '--tui' option for GDB may not be very well known, and it
> may be useful to highlight (see screenshots at the bottom of this issue:
> https://github.com/microbuilder/trusted-firmware-m/issues/1)
> Practical, step-by-step debugging documentation just seems like a good
> investment to help flatten this inevitable learning curve developing
> real-world solutions with TF-M?
> Best regards,
> Kevin
> On Thu, 27 Feb 2020 at 13:13, Anton Komlev via TF-M <
> tf-m@lists.trustedfirmware.org> wrote:
> > A kind reminder.
> > Your feedback is valuable all the time with no deadline defined.
> > *From:* TF-M tf-m-bounces@lists.trustedfirmware.org * On Behalf Of *Anton
> > Komlev via TF-M
> > *Sent:* 07 February 2020 13:13
> > *To:* tf-m@lists.trustedfirmware.org
> > *Cc:* nd nd@arm.com
> > *Subject:* [TF-M] Call for a feedback on TF-M adaptation experience
> > Dear All,
> > As I mentioned on yesterday’s call, there is a concern on user experience
> > related to TF-M use.
> > To In order to understand and potentially improve it I am looking for a
> > voice of partners who adopted TF-M project.
> > Please share your experience and thoughts on parts which are good or might
> > be done better to simplify TF-M integration with your project.
> > You feedback will be very appreciated in any form – as a response to this
> > mail or as a direct mail to me (anton.komlev@arm.com) if it’s more
> > comfortable for you.
> > Thank you in advance,
> > Anton
> > TF-M mailing list
> > TF-M@lists.trustedfirmware.org
> > https://lists.trustedfirmware.org/mailman/listinfo/tf-m
> >
--
TF-M mailing list -- tf-m@lists.trustedfirmware.org
To unsubscribe send an email to tf-m-leave@lists.trustedfirmware.org


--
Thanks and best regards,

Kevin Townsend
Tech Lead - LITE, Vertical Technologies
Linaro.org │ Open source software for ARM SoCs