While trying to create the documentation to semihosting syslog I disabled
the STM32 USART2 driver to avoid the system using the up_putc() from
stm32_serial.c.

But the arch/arm/src/stm32/Make.defs it adding many source files even when
the peripheral is not enabled:

CHIP_CSRCS  = stm32_allocateheap.c stm32_start.c stm32_rcc.c stm32_lse.c
CHIP_CSRCS += stm32_lsi.c stm32_gpio.c stm32_exti_gpio.c stm32_flash.c
CHIP_CSRCS += stm32_irq.c stm32_lowputc.c
CHIP_CSRCS += stm32_serial.c stm32_spi.c stm32_i2s.c stm32_sdio.c
stm32_tim.c
CHIP_CSRCS += stm32_waste.c stm32_ccm.c stm32_uid.c stm32_capture.c
CHIP_CSRCS += stm32_dfumode.c

The stm32_serial.c only should be compiled when CONFIG_STM32_USART is
enabled.

I submitted a PR to fix it and the up_nputs() issue and Lwazi commented
before:

https://github.com/apache/nuttx/pull/17187

BR,

Alan

On Fri, Oct 10, 2025 at 9:49 AM Jean Thomas <j...@lambdaconcept.com> wrote:

> Hi Lwazi,
>
> I've got semihosting syslog working, thanks to your precious insight.
>
> I had to add this into my defconfig:
>  - CONFIG_ARM_SEMIHOSTING_SYSLOG=y
>  - CONFIG_DEV_CONSOLE=n
>  - CONFIG_SYSLOG_DEFAULT=y
>
> And remove:
>  - CONFIG_UART0_SERIAL_CONSOLE=y
>
> I also had to enclose up_putc in rp2040_serial.c like you did in
> uart_16550, and also modified arm_lowputc to direct output to up_putc.
>
> Best regards,
> Jean.
>
> > On 9 Oct 2025, at 22:45, Lwazi Dube <lwa...@gmail.com> wrote:
> >
> > I just tried this on an am335x board (armv7a) and got some logs after the
> > gdb prompt.
> >
> > 1) I am using openocd 0.12.0
> >
> > 2) The board's uart driver is uart_16550. I exclude (16550) up_putc so
> that
> > the other one in "arm_semi_syslog.c" is used.
> >
> > #ifndef CONFIG_ARM_SEMIHOSTING_SYSLOG <-----
> > #ifdef HAVE_16550_CONSOLE
> > void up_putc(int ch)
> > {
> >  FAR struct u16550_s *priv = (FAR struct u16550_s *)CONSOLE_DEV.priv;
> >
> >  u16550_putc(priv, ch);
> > }
> > #endif
> > #endif
> >
> > 3) Fix multiple definition error in "arm_nputs.c" ...
> >
> > #ifndef CONFIG_ARM_SEMIHOSTING_SYSLOG <----
> > void up_nputs(const char *str, size_t len)
> > {
> >  while (len-- > 0 && *str)
> >    {
> >      up_putc(*str++);
> >    }
> > }
> > #endif
> >
> > 4)
> > [*] Enable Debug Features
> >         *** Debug SYSLOG Output Controls ***
> >   [*]   Enable Error Output
> >   [*]     Enable Warnings Output
> >   [*]       Enable Informational Debug Output
> >
> >  [*]   Memory Manager Debug Features
> >   [*]     Memory Manager Error Output
> >   [*]     Memory Manager Warnings Output
> >   [*]     Memory Manager Informational Output
> >
> > 5) Load and run using gdb
> >
> > adapter speed: 16000 kHz
> > core state: ARM
> > semihosting is enabled
> > semihosting fileio is enabled
> > (gdb) load
> > Loading section .text, size 0x205c4 lma 0x8a000000
> > Loading section .ARM.exidx, size 0x8 lma 0x8a0205c4
> > Loading section .data, size 0x394 lma 0x8a0205cc
> > Start address 0x8a0002e0, load size 133472
> > Transfer rate: 210 KB/sec, 12133 bytes/write.
> > (gdb) c
> > Continuing.
> > mm_initialize: Heap: name=Umem, start=0x8a0229e4 size=368956956
> > mm_addregion: Region 1: base=0x8a022b44 size=368956600
> > mm_malloc: Allocated 0x8a022b58, size 72
> > mm_malloc: Allocated 0x8a022ba0, size 40
> > mm_malloc: Allocated 0x8a022bc8, size 48
> > mm_malloc: Allocated 0x8a022bf8, size 48
> > mm_malloc: Allocated 0x8a022c28, size 48
> > mm_malloc: Allocated 0x8a022c58, size 48
> > mm_malloc: Allocated 0x8a022c88, size 48
> > mm_malloc: Allocated 0x8a022cb8, size 48
> > mm_malloc: Allocated 0x8a022ce8, size 1000
> > mm_malloc: Allocated 0x8a0230d0, size 2056
> >
> > Program stopped.
> > _vector_start () at armv7-a/arm_vectortab.S:68
> > 68              ldr             pc, .Lsvchandler                /* 0x08:
> > Software interrupt */
> > (gdb)
> >
> >
> > On Wed, 8 Oct 2025 at 14:00, Adam Feuer <a...@starcat.io> wrote:
> >
> >> Thanks Jean and Alan. At work right now, and I also don't remember
> exactly
> >> what I did for that– I'll need to reply privately.
> >>
> >> Yes, Alan, if I do remember what I did I would be grateful if you did
> >> update the docs.
> >>
> >> -adam
> >>
> >> On Wed, Oct 8, 2025 at 10:06 AM Alan C. Assis <acas...@gmail.com>
> wrote:
> >>
> >>> Hi Jean,
> >>>
> >>> Looking at boards/ seems like the semihost for file system is the most
> >>> common usage, but yes there is one and only one board with SEMIHOST
> >> SYSLOG
> >>> support, that you found.
> >>>
> >>> According to git blame this support was added by Adam Feuer (CC here),
> >> but
> >>> there is no Documentation/ about it.
> >>>
> >>> Adam, do you remember how to test it? If you can share details here I
> >> will
> >>> expand the semihost documentation to include syslog support.
> >>>
> >>> BR,
> >>>
> >>> Alan
> >>>
> >>> On Wed, Oct 8, 2025 at 1:41 PM Jean Thomas <j...@lambdaconcept.com>
> >> wrote:
> >>>
> >>>> Hi everyone,
> >>>>
> >>>> I've been trying to get ARM semihosting syslog working on a RP2040
> board
> >>>> for a little while (debugged using Pi's debugprobe). I added this into
> >> my
> >>>> defconfig:
> >>>>
> >>>> CONFIG_ARM_SEMIHOSTING_SYSLOG=y
> >>>> CONFIG_SYSLOG_CHARDEV=y
> >>>>
> >>>> (inspired by sama5d3-xplained's ethernet-over-usb-2-high-speed
> >> defconfig)
> >>>>
> >>>> and this in my OpenOCD script:
> >>>>
> >>>> monitor arm semihosting enable
> >>>> monitor arm semihosting_fileio enable
> >>>>
> >>>> Syslog disappears from the UART console, but doesn't appear in
> >> OpenOCD...
> >>>> Am I doing something wrong? Does someone have an example of a working
> >>>> syslog over ARM semihosting example? Is there an easy way to debug
> >> what's
> >>>> going on?
> >>>>
> >>>> Cheers,
> >>>> Jean
> >>>
> >>>
> >>
> >> --
> >> Adam Feuer <a...@starcat.io>
> >>
>
>

Reply via email to