Hi Lwazi,

In fact it wasn't working because I didn't enable a the debug info messages
(debug err and warn wasn't helping, because no err/warn)

When I enabled CONFIG_DEBUG_MM_INFO I got some output:

(gdb) tar rem :3333
Remote debugging using :3333
0x20000044 in g_nshprompt ()
(gdb) monitor arm semihosting enable
semihosting is enabled
(gdb) monitor arm semihosting_fileio enable
semihosting fileio is enabled
(gdb) mon reset halt
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x08000836 msp: 0x20001800, semihosting fileio
(gdb) c
Continuing.
mm_initialize: Heap: name=Umem, start=0x20001800 size=124928
mm_addregion: [Umem] Region 1: base=0x20001970 size=124560
mm_malloc: Allocated 0x20001980, size 72
mm_malloc: Allocated 0x200019c8, size 40
mm_addregion: [Umem] Region 2: base=0x10000000 size=65536
mm_malloc: Allocated 0x10000010, size 48
mm_malloc: Allocated 0x10000040, size 48
mm_malloc: Allocated 0x10000070, size 48
mm_malloc: Allocated 0x100000a0, size 24
mm_malloc: Allocated 0x100000b8, size 16
mm_malloc: Allocated 0x100000c8, size 32
mm_malloc: Allocated 0x100000e8, size 208
mm_malloc: Allocated 0x100001b8, size 2056
mm_malloc: Allocated 0x100009c0, size 48
mm_malloc: Allocated 0x100009f0, size 896
mm_malloc: Allocated 0x10000d70, size 32
mm_malloc: Allocated 0x10000d90, size 16
mm_malloc: Allocated 0x10000da0, size 2056
mm_free: Freeing 0x100001b8
mm_free: Freeing 0x100000e8
mm_malloc: Allocated 0x100000e8, size 768
mm_free: Freeing 0x100000e8
mm_free: Freeing 0x10000d90
mm_free: Freeing 0x10000d70
mm_free: Freeing 0x10000da0
mm_free: Freeing 0x100009f0

I don't know if it only happens here, but the text is printed slowly (about
10 characters per second).

But it is a nice effect hehehe, like in movies or games (like Carmen
Sandiego game printing the message, who here remember it:
https://www.youtube.com/watch?v=X2hy711hDgM )

Thank you very much for your help!

BR,

Alan

On Mon, Oct 13, 2025 at 4:23 PM Lwazi Dube <[email protected]> wrote:

> Alan,
>
> The same change works with stlink on f7. Please test with minimal changes.
> See my diff and gdb log below.
>
> (gdb) mon reset halt
> Info : Unable to match requested speed 2000 kHz, using 1800 kHz
> Unable to match requested speed 2000 kHz, using 1800 kHz
> Info : Unable to match requested speed 2000 kHz, using 1800 kHz
> Unable to match requested speed 2000 kHz, using 1800 kHz
> [stm32f7x.cpu] halted due to debug-request, current mode: Thread
> xPSR: 0x01000000 pc: 0x080003c4 msp: 0x20011b68
> [stm32f7x.cpu] halted due to debug-request, current mode: Thread
> xPSR: 0x01000000 pc: 0x080003c4 msp: 0x20011b68
> (gdb) monitor arm semihosting enable
> semihosting is enabled
> (gdb) monitor arm semihosting_fileio enable
> semihosting fileio is enabled
> (gdb) c
> Continuing.
> mm_initialize: Heap: name=Umem, start=0x20011b68 size=238744
> mm_addregion: Region 1: base=0x20011cd8 size=238376
> mm_malloc: Allocated 0x20011ce8, size 72
> mm_malloc: Allocated 0x20011d30, size 40
> mm_addregion: Region 2: base=0x2004c000 size=16384
> mm_addre^C[stm32f7x.cpu] halted due to debug-request, current mode: Thread
> xPSR: 0x21000000 pc: 0x0800c94a msp: 0x200118f0, semihosting fileio
>
> diff --git a/arch/arm/src/common/arm_nputs.c
> b/arch/arm/src/common/arm_nputs.c
> index 6ec271db77..1f3a22dd05 100644
> --- a/arch/arm/src/common/arm_nputs.c
> +++ b/arch/arm/src/common/arm_nputs.c
> @@ -38,7 +38,7 @@
>   *   This is a low-level helper function used to support debug.
>   *
>
>
> ****************************************************************************/
> -
> +#ifndef CONFIG_ARM_SEMIHOSTING_SYSLOG
>  void up_nputs(const char *str, size_t len)
>  {
>    while (len-- > 0 && *str)
> @@ -46,3 +46,4 @@ void up_nputs(const char *str, size_t len)
>        up_putc(*str++);
>      }
>  }
> +#endif
> diff --git a/arch/arm/src/stm32f7/stm32_serial.c
> b/arch/arm/src/stm32f7/stm32_serial.c
> index aebcd705fb..a977aee0e4 100644
> --- a/arch/arm/src/stm32f7/stm32_serial.c
> +++ b/arch/arm/src/stm32f7/stm32_serial.c
> @@ -3803,6 +3803,7 @@ void stm32_serial_dma_poll(void)
>   *
>
>
> ****************************************************************************/
>
> +#ifndef CONFIG_ARM_SEMIHOSTING_SYSLOG
>  void up_putc(int ch)
>  {
>  #if CONSOLE_UART > 0
> @@ -3814,6 +3815,7 @@ void up_putc(int ch)
>    up_restoreusartint(priv, ie);
>  #endif
>  }
> +#endif
>
>  #else /* USE_SERIALDRIVER */
>
> diff --git a/boards/arm/stm32f7/stm32f746g-disco/configs/nsh/defconfig
> b/boards/arm/stm32f7/stm32f746g-disco/configs/nsh/defconfig
> index c0f15c1e90..9a7e64bed3 100644
> --- a/boards/arm/stm32f7/stm32f746g-disco/configs/nsh/defconfig
> +++ b/boards/arm/stm32f7/stm32f746g-disco/configs/nsh/defconfig
> @@ -21,8 +21,14 @@ CONFIG_ARMV7M_DCACHE=y
>  CONFIG_ARMV7M_DCACHE_WRITETHROUGH=y
>  CONFIG_ARMV7M_DTCM=y
>  CONFIG_ARMV7M_ICACHE=y
> +CONFIG_ARM_SEMIHOSTING_SYSLOG=y
>  CONFIG_BOARD_LOOPSPERMSEC=43103
>  CONFIG_BUILTIN=y
> +CONFIG_DEBUG_FEATURES=y
> +CONFIG_DEBUG_MM=y
> +CONFIG_DEBUG_MM_ERROR=y
> +CONFIG_DEBUG_MM_INFO=y
> +CONFIG_DEBUG_MM_WARN=y
>  CONFIG_DEBUG_SYMBOLS=y
>  CONFIG_HAVE_CXX=y
>  CONFIG_HAVE_CXXINITIALIZE=y
>
> On Mon, 13 Oct 2025 at 08:34, Alan C. Assis <[email protected]> wrote:
>
> > Jean,
> >
> > Maybe the issue is related to stlink support on OpenOCD, maybe we need to
> > use another programmer better compatible with ARM DAP.
> >
> > What programmer are you using with OpenOCD?
> >
> > BR,
> >
> > Alan
> >
> > On Mon, Oct 13, 2025 at 9:24 AM Alan C. Assis <[email protected]> wrote:
> >
> > > Hi Jean,
> > >
> > > Thank you for the suggestion. In fact CONFIG_SYSLOG_DEFAULT is enabled,
> > > but it is not displayed in the defconfig because it is enabled by
> > default,
> > > so the savedefconfig compression doesn't include it.
> > >
> > > BR,
> > >
> > > Alan
> > >
> > > On Mon, Oct 13, 2025 at 5:56 AM Jean Thomas <[email protected]>
> > > wrote:
> > >
> > >> Hi Alan,
> > >>
> > >> > Could you please double check my defconfig for stm32f4discovery (a
> > >> create a
> > >> > config using the nsh as base removing USART support and enabling
> > >> > SEMIHOSTING SYSLOG):
> > >>
> > >> I don't see CONFIG_SYSLOG_DEFAULT=y in there.
> > >>
> > >> Also, can you try to bump CONFIG_SYSLOG_MAX_CHANNELS to a higher value
> > >> than 1 (default)? Syslog is seemingly dynamically registered, so if
> > there's
> > >> not enough room for it, it won't work — I fell into this pitfall the
> > other
> > >> day :)
> > >>
> > >> Cheers,
> > >> Jean
> > >>
> > >>
> > >>
> >
>

Reply via email to