Skip to content

LPC17xx serial updates - #29

Merged
patacongo merged 31 commits into
apache:pr29from
2G-Engineering:lpc17_serial
Jan 2, 2020
Merged

patacongo merged 31 commits into
apache:pr29from
2G-Engineering:lpc17_serial

Conversation

@ArrestedLightning

Copy link
Copy Markdown
Contributor

For LPC17xx/LPC40xx parts:

  • Adds hardware RS-485 support on UART1
  • Avoids compiling up_earlyserialinit when USE_EARLYSERIALINIT is not defined
  • Incorporates the UART fractional baud rate setup code from the LPC43xx family. The fractional baud rate generator can be enabled or disabled using menuconfig, and defaults to disabled. When the fractional baud rate generator is disabled, the serial driver should behave exactly as it did previously.

jjlange added 30 commits April 5, 2019 12:22
Only use PCLKSEL0 for ADC on LPC176x family.
@patacongo
patacongo changed the base branch from master to pr29 January 2, 2020 21:45
@patacongo
patacongo merged commit 8510107 into apache:pr29 Jan 2, 2020
patacongo pushed a commit that referenced this pull request Jan 2, 2020
    Run all .c and .h files in last PR through tools/nxstyle and fix all complaints.

Author: macman88 <[email protected]>

    LPC17xx serial updates (#29)

    * Save CONFIG_ARCH_BOARD_CUSTOM when running 'make savedefconfig'
    * Don't compile up_earlyserialinit if USE_EARLYSERIALINIT is not defined
    * Added support for RS485 direction control on LPC17xx UART1
    * First pass at fractional baud rate divider on LPC17xx/40xx
    * Added support for fractional divider to console UART
patacongo pushed a commit that referenced this pull request Jan 3, 2020
    Run all .c and .h files in last PR through tools/nxstyle and fix all complaints.

Author: macman88 <[email protected]>

    LPC17xx serial updates (#29)

    * Save CONFIG_ARCH_BOARD_CUSTOM when running 'make savedefconfig'
    * Don't compile up_earlyserialinit if USE_EARLYSERIALINIT is not defined
    * Added support for RS485 direction control on LPC17xx UART1
    * First pass at fractional baud rate divider on LPC17xx/40xx
    * Added support for fractional divider to console UART
GUIDINGLI added a commit to GUIDINGLI/incubator-nuttx that referenced this pull request Oct 11, 2024
set CONFIG_PRIORITY_INHERITANCE=y
set CONFIG_SEM_PREALLOCHOLDERS=0 or CONFIG_SEM_PREALLOCHOLDERS=8

    apache#24 0x4dcab71 in __assert assert/lib_assert.c:37
    apache#25 0x4d6b0e9 in nxsem_destroyholder semaphore/sem_holder.c:602
    apache#26 0x4d80cf7 in nxsem_destroy semaphore/sem_destroy.c:80
    apache#27 0x4d80db9 in sem_destroy semaphore/sem_destroy.c:120
    apache#28 0x4dcb077 in nxmutex_destroy misc/lib_mutex.c:122
    apache#29 0x4dc6611 in pipecommon_freedev pipes/pipe_common.c:117
    apache#30 0x4dc7fdc in pipecommon_close pipes/pipe_common.c:397
    apache#31 0x4ed4f6d in file_close vfs/fs_close.c:78
    apache#32 0x6a91133 in local_free local/local_conn.c:184
    apache#33 0x6a92a9c in local_release local/local_release.c:129
    apache#34 0x6a91d1a in local_subref local/local_conn.c:271
    apache#35 0x6a75767 in local_close local/local_sockif.c:797
    apache#36 0x4e978f6 in psock_close socket/net_close.c:102
    apache#37 0x4eed1b9 in sock_file_close socket/socket.c:115
    apache#38 0x4ed4f6d in file_close vfs/fs_close.c:78
    apache#39 0x4ed1459 in nx_close_from_tcb inode/fs_files.c:754
    apache#40 0x4ed1501 in nx_close inode/fs_files.c:781
    apache#41 0x4ed154a in close inode/fs_files.c:819
    apache#42 0x6bcb9ce in property_get kvdb/client.c:307
    apache#43 0x6bcd465 in property_get_int32 kvdb/common.c:270
    apache#44 0x5106c9a in tz_offset_restore app/miwear_bluetooth.c:745
    apache#45 0x510893f in miwear_bluetooth_main app/miwear_bluetooth.c:1033
    apache#46 0x4dcf5c8 in nxtask_startup sched/task_startup.c:70
    apache#47 0x4d70873 in nxtask_start task/task_start.c:134
    apache#48 0x4e04a07 in pre_start sim/sim_initialstate.c:52

Signed-off-by: ligd <[email protected]>
xiaoxiang781216 pushed a commit that referenced this pull request Oct 11, 2024
set CONFIG_PRIORITY_INHERITANCE=y
set CONFIG_SEM_PREALLOCHOLDERS=0 or CONFIG_SEM_PREALLOCHOLDERS=8

    #24 0x4dcab71 in __assert assert/lib_assert.c:37
    #25 0x4d6b0e9 in nxsem_destroyholder semaphore/sem_holder.c:602
    #26 0x4d80cf7 in nxsem_destroy semaphore/sem_destroy.c:80
    #27 0x4d80db9 in sem_destroy semaphore/sem_destroy.c:120
    #28 0x4dcb077 in nxmutex_destroy misc/lib_mutex.c:122
    #29 0x4dc6611 in pipecommon_freedev pipes/pipe_common.c:117
    #30 0x4dc7fdc in pipecommon_close pipes/pipe_common.c:397
    #31 0x4ed4f6d in file_close vfs/fs_close.c:78
    #32 0x6a91133 in local_free local/local_conn.c:184
    #33 0x6a92a9c in local_release local/local_release.c:129
    #34 0x6a91d1a in local_subref local/local_conn.c:271
    #35 0x6a75767 in local_close local/local_sockif.c:797
    #36 0x4e978f6 in psock_close socket/net_close.c:102
    #37 0x4eed1b9 in sock_file_close socket/socket.c:115
    #38 0x4ed4f6d in file_close vfs/fs_close.c:78
    #39 0x4ed1459 in nx_close_from_tcb inode/fs_files.c:754
    #40 0x4ed1501 in nx_close inode/fs_files.c:781
    #41 0x4ed154a in close inode/fs_files.c:819
    #42 0x6bcb9ce in property_get kvdb/client.c:307
    #43 0x6bcd465 in property_get_int32 kvdb/common.c:270
    #44 0x5106c9a in tz_offset_restore app/miwear_bluetooth.c:745
    #45 0x510893f in miwear_bluetooth_main app/miwear_bluetooth.c:1033
    #46 0x4dcf5c8 in nxtask_startup sched/task_startup.c:70
    #47 0x4d70873 in nxtask_start task/task_start.c:134
    #48 0x4e04a07 in pre_start sim/sim_initialstate.c:52

Signed-off-by: ligd <[email protected]>
xiaoxiang781216 pushed a commit that referenced this pull request Nov 11, 2026
Clear the LR register value, to avoid unwinding to invalid addresses.

Note the invalid data in unwind result.
(gdb) f 12
(gdb) x/16a buffer
0x43158a4c:     0x6e9222 <backtrace_unwind+566> 0x63ac6e <backtrace_record+30>  0x6394aa <nxrmutex_lock+78>     0x637b86 <pipecommon_read+78>
0x43158a5c:     0x68fa18 <file_readv+212>       0x68fade <read+78>      0x72c494 <uv__signal_handler+84>        0x60ebc2 <nxsig_deliver+482>
0x43158a6c:     0x6505d2 <arm_sigdeliver+78>    0x6cf02a <nxsem_wait_slow+1018> 0x55555552      0x0
0x43158a7c:     0x1d97e64 <__stack_chk_guard>   0x42e13818      0x0     0x7ffffffe
(gdb)

(gdb) bt
  #7  _assert (filename=filename@entry=0x1b42c50 "armv7-a/arm_dataabort.c", linenum=linenum@entry=172, msg=msg@entry=0x1bffe04 "panic", regs=0x40275c30 <g_last_regs>, regs@entry=0x431587a0, irq=irq@entry=true) at misc/assert.c:952
 #8  0x0060071e in arm_dataabort (regs=0x431587a0, dfar=3256916992, dfsr=<optimized out>) at armv7-a/arm_dataabort.c:172
 #9  0x00600188 in arm_vectordata () at armv7-a/arm_vectors.S:453
 #10 0x006e8984 in unwind_frame (frame=0x431584f0, frame@entry=0x431589d8) at common/arm_backtrace_unwind.c:568
 #11 0x006e9056 in backtrace_unwind (frame=0x431589d8, frame@entry=0x431589e8, buffer=buffer@entry=0x43158a4c, size=size@entry=16, skip=0x431589d4, skip@entry=0x431589e4) at common/arm_backtrace_unwind.c:652
 #12 0x006e9338 in up_backtrace (tcb=<optimized out>, buffer=buffer@entry=0x43158a4c, size=size@entry=16, skip=<optimized out>, skip@entry=0) at common/arm_backtrace_unwind.c:768
 #13 0x006ceafe in sched_backtrace (tid=<optimized out>, buffer=buffer@entry=0x43158a4c, size=size@entry=16, skip=skip@entry=0) at sched/sched_backtrace.c:106
 ...
 #28 0x006505d4 in arm_sigdeliver () at armv7-a/arm_sigdeliver.c:77
 #29 0x006cf02c in nxsched_add_prioritized (list=0x42dd7bd4, tcb=0x42e13818) at /home/work/ssd1/workspace/Vela-qemu-smartspeaker-trunk-25rc04-CI/nuttx/sched/sched/sched.h:532
 #30 nxsem_wait_slow (sem=0x42dd7bcc) at semaphore/sem_wait.c:233
 #31 0x55555554 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb)

After modification:
Unwind in signal callback:
nsh> kill -10 3
nsh> sched_dumpstack: backtrace:
sched_dumpstack: [ 3] [<0x1b0f6>] backtrace_unwind+0x157/0x15a
sched_dumpstack: [ 3] [<0xb262>] sched_backtrace+0x39/0x88
sched_dumpstack: [ 3] [<0x6e3e>] sched_dumpstack+0x19/0x98
sched_dumpstack: [ 3] [<0x37850>] siguser_action+0x13/0x20
sched_dumpstack: [ 3] [<0x17a46>] nxsig_deliver+0x103/0x204
sched_dumpstack: [ 3] [<0x1986>] arm_sigdeliver+0x3d/0xa4
nsh>

Signed-off-by: xuxingliang <[email protected]>
huojianchaoyy pushed a commit to huojianchaoyy/nuttx that referenced this pull request Nov 23, 2026
It could cause deadlock because of the spin lock of uart.

CPU0:
  (gdb) bt
  #0  0x402805ac in rspin_lock (lock=0x414cfd50 <g_uart0port+76>) at nuttx/include/nuttx/spinlock.h:692
  #1  rspin_lock_irqsave (lock=0x414cfd50 <g_uart0port+76>) at nuttx/include/nuttx/spinlock.h:705
  apache#2  rspin_lock_irqsave_nopreempt (lock=0x414cfd50 <g_uart0port+76>) at nuttx/include/nuttx/spinlock.h:724
  apache#3  uart_spinlock (dev=dev@entry=0x414cfd04 <g_uart0port>, nopreempt=nopreempt@entry=true) at serial/serial.c:2046
  apache#4  0x40221350 in up_putc (ch=91) at chip/r528_serial.c:1318
  apache#5  0x402bfd38 in up_nputs (str=0x450a4ca9 "26/01/04 09:51:39] [CPU1] [657] [ap] mm_map_destroy: Driver munmap failed\n", str@entry=0x450a4ca8 "[26/01/04 09:51:39] [CPU1] [657] [ap] mm_map_destroy: Driver munmap failed\n", len=73, len@entry=74) at common/arm_nputs.c:44
  apache#6  0x40283e86 in syslog_default_write (channel=<optimized out>, buffer=0x450a4ca8 "[26/01/04 09:51:39] [CPU1] [657] [ap] mm_map_destroy: Driver munmap failed\n", buflen=74) at syslog/syslog_channel.c:351
  apache#7  0x402a2e00 in syslog_write_foreach (buffer=buffer@entry=0x450a4ca8 "[26/01/04 09:51:39] [CPU1] [657] [ap] mm_map_destroy: Driver munmap failed\n", buflen=buflen@entry=75, force=false) at syslog/syslog_write.c:148
  apache#8  0x402a2ec2 in syslog_write (buffer=buffer@entry=0x450a4ca8 "[26/01/04 09:51:39] [CPU1] [657] [ap] mm_map_destroy: Driver munmap failed\n", buflen=buflen@entry=75) at syslog/syslog_write.c:253
  apache#9  0x402b17a2 in syslograwstream_flush (self=self@entry=0x450a4c90) at stream/lib_syslograwstream.c:74
  apache#10 0x402b196e in lib_syslograwstream_close (stream=stream@entry=0x450a4c90) at stream/lib_syslograwstream.c:330
  apache#11 0x40283d90 in nx_vsyslog (priority=<optimized out>, fmt=0x4111c81c "%s: Driver munmap failed\n", ap=ap@entry=0x450a4ecc) at syslog/vsyslog.c:275
  apache#12 0x402b2772 in vsyslog (priority=priority@entry=3, fmt=fmt@entry=0x450a4ee8 "L\266,A", ap=..., ap@entry=...) at syslog/lib_syslog.c:82
  apache#13 0x402b278a in syslog (priority=priority@entry=3, fmt=0x4111c81c "%s: Driver munmap failed\n") at syslog/lib_syslog.c:115
  apache#14 0x402bd504 in mm_map_destroy (mm=mm@entry=0x422605f8) at map/mm_map.c:172
  apache#15 0x4026e87a in group_release (ttype=0, group=0x42260558) at group/group_leave.c:101
  apache#16 group_leave (tcb=tcb@entry=0x42260450) at group/group_leave.c:193
  apache#17 0x40271e7e in nxtask_exithook (tcb=tcb@entry=0x42260450, status=status@entry=0) at task/task_exithook.c:485
  apache#18 0x4026c826 in _exit (status=80, status@entry=1109787728) at task/exit.c:106
  apache#19 0x402aec9c in exit (status=1109787728) at stdlib/lib_exit.c:126

CPU1:
  (gdb) bt
  #0  0x4026a1a8 in rspin_lock (lock=<optimized out>) at nuttx/include/nuttx/spinlock.h:692
  #1  rspin_lock_irqsave (lock=<optimized out>) at nuttx/include/nuttx/spinlock.h:705
  apache#2  nxsem_post_slow (sem=sem@entry=0x414cfd20 <g_uart0port+28>) at semaphore/sem_post.c:145
  apache#3  0x4027fc2e in nxsem_post (sem=<optimized out>) at nuttx/include/nuttx/semaphore.h:781
  apache#4  uart_wakeup (sem=0x414cfd20 <g_uart0port+28>) at serial/serial.c:2026
  apache#5  0x402828cc in uart_xmitchars (dev=dev@entry=0x414cfd04 <g_uart0port>) at serial/serial_io.c:121
  apache#6  0x4022116a in uart_interrupt (irq=<optimized out>, context=<optimized out>, arg=0x414cfd04 <g_uart0port>) at chip/r528_serial.c:841
  apache#7  0x40265dd8 in irq_dispatch (irq=irq@entry=34, context=context@entry=0x44194100) at irq/irq_dispatch.c:172
  apache#8  0x4024ac3e in arm_doirq (irq=34, irq@entry=0, regs=0x44194100) at arm_a_r/arm_doirq.c:88
  apache#9  0x40220246 in arm_decodeirq (regs=<optimized out>) at armv7-a/arm_gicv2.c:417
  apache#10 0x40200118 in arm_vectorirq () at armv7-a/arm_vectors.S:242
  apache#11 0x402bb916 in up_irq_restore (flags=31) at nuttx/include/arch/armv7-a/irq.h:438
  apache#12 spin_unlock_irqrestore_notrace (flags=31, lock=0x44194150) at nuttx/include/nuttx/spinlock.h:923
  apache#13 spin_unlock_irqrestore (flags=31, lock=0x44194150) at nuttx/include/nuttx/spinlock.h:961
  apache#14 mempool_release (pool=0x44194100, blk=0x4261e810) at mempool/mempool.c:724
  apache#15 0x402bca90 in mempool_multiple_free (mpool=<optimized out>, blk=<optimized out>, blk@entry=0x4261e810) at mempool/mempool_multiple.c:790
  apache#16 0x402b8f6c in mm_forcefree (heap=0x41a4d4e8, mem=0x4261e810) at mm_heap/mm_free.c:118
  apache#17 0x402b9394 in mm_free (heap=<optimized out>, mem=<optimized out>) at mm_heap/mm_free.c:285
  apache#18 0x402ba2f0 in free (mem=<optimized out>) at umm_heap/umm_free.c:51
  apache#19 0x40725dde in av_free (ptr=<optimized out>) at ffmpeg/libavutil/mem.c:243
  apache#20 av_freep (arg=arg@entry=0x441942b4) at ffmpeg/libavutil/mem.c:253
  apache#21 0x40722010 in av_frame_free (frame=frame@entry=0x441942b4) at ffmpeg/libavutil/frame.c:168
  apache#22 0x40a194fc in media_player_on_event_cb (udata=0x441b3fc0, evt=<optimized out>, args=<optimized out>) at server/media_player.c:312
  apache#23 0x406cbf7e in abufsrc_activate (ctx=0x41b1d0c0) at ffmpeg/libavfilter/asrc_abufsrc.c:329
  apache#24 0x406cff04 in ff_filter_activate (filter=filter@entry=0x41b1d0c0) at ffmpeg/libavfilter/avfilter.c:1485
  apache#25 0x40a25c2e in audio_graph_run_all (graph=0x41abca40) at server/audio_graph.c:635
  apache#26 audio_graph_run_once (ctx=<optimized out>) at server/audio_graph.c:650
  apache#27 0x40a17ede in mediad_main (argc=<optimized out>, argv=<optimized out>) at server/media_daemon.c:162
  apache#28 0x402ad480 in nxtask_startup (entrypt=entrypt@entry=0x40a17c95 <mediad_main>, argc=<optimized out>, argv=<optimized out>) at sched/task_startup.c:66
  apache#29 0x4026c194 in nxtask_start () at task/task_start.c:107
  apache#30 0x00000000 in ?? ()

Signed-off-by: xuxingliang <[email protected]>
Assisted-by: Kiro:claude-opus-5-5
huojianchaoyy pushed a commit to huojianchaoyy/nuttx that referenced this pull request Nov 23, 2026
It could cause deadlock because of the spin lock of uart.

CPU0:
  (gdb) bt
  #0  0x402805ac in rspin_lock (lock=0x414cfd50 <g_uart0port+76>) at nuttx/include/nuttx/spinlock.h:692
  #1  rspin_lock_irqsave (lock=0x414cfd50 <g_uart0port+76>) at nuttx/include/nuttx/spinlock.h:705
  apache#2  rspin_lock_irqsave_nopreempt (lock=0x414cfd50 <g_uart0port+76>) at nuttx/include/nuttx/spinlock.h:724
  apache#3  uart_spinlock (dev=dev@entry=0x414cfd04 <g_uart0port>, nopreempt=nopreempt@entry=true) at serial/serial.c:2046
  apache#4  0x40221350 in up_putc (ch=91) at chip/r528_serial.c:1318
  apache#5  0x402bfd38 in up_nputs (str=0x450a4ca9 "26/01/04 09:51:39] [CPU1] [657] [ap] mm_map_destroy: Driver munmap failed\n", str@entry=0x450a4ca8 "[26/01/04 09:51:39] [CPU1] [657] [ap] mm_map_destroy: Driver munmap failed\n", len=73, len@entry=74) at common/arm_nputs.c:44
  apache#6  0x40283e86 in syslog_default_write (channel=<optimized out>, buffer=0x450a4ca8 "[26/01/04 09:51:39] [CPU1] [657] [ap] mm_map_destroy: Driver munmap failed\n", buflen=74) at syslog/syslog_channel.c:351
  apache#7  0x402a2e00 in syslog_write_foreach (buffer=buffer@entry=0x450a4ca8 "[26/01/04 09:51:39] [CPU1] [657] [ap] mm_map_destroy: Driver munmap failed\n", buflen=buflen@entry=75, force=false) at syslog/syslog_write.c:148
  apache#8  0x402a2ec2 in syslog_write (buffer=buffer@entry=0x450a4ca8 "[26/01/04 09:51:39] [CPU1] [657] [ap] mm_map_destroy: Driver munmap failed\n", buflen=buflen@entry=75) at syslog/syslog_write.c:253
  apache#9  0x402b17a2 in syslograwstream_flush (self=self@entry=0x450a4c90) at stream/lib_syslograwstream.c:74
  apache#10 0x402b196e in lib_syslograwstream_close (stream=stream@entry=0x450a4c90) at stream/lib_syslograwstream.c:330
  apache#11 0x40283d90 in nx_vsyslog (priority=<optimized out>, fmt=0x4111c81c "%s: Driver munmap failed\n", ap=ap@entry=0x450a4ecc) at syslog/vsyslog.c:275
  apache#12 0x402b2772 in vsyslog (priority=priority@entry=3, fmt=fmt@entry=0x450a4ee8 "L\266,A", ap=..., ap@entry=...) at syslog/lib_syslog.c:82
  apache#13 0x402b278a in syslog (priority=priority@entry=3, fmt=0x4111c81c "%s: Driver munmap failed\n") at syslog/lib_syslog.c:115
  apache#14 0x402bd504 in mm_map_destroy (mm=mm@entry=0x422605f8) at map/mm_map.c:172
  apache#15 0x4026e87a in group_release (ttype=0, group=0x42260558) at group/group_leave.c:101
  apache#16 group_leave (tcb=tcb@entry=0x42260450) at group/group_leave.c:193
  apache#17 0x40271e7e in nxtask_exithook (tcb=tcb@entry=0x42260450, status=status@entry=0) at task/task_exithook.c:485
  apache#18 0x4026c826 in _exit (status=80, status@entry=1109787728) at task/exit.c:106
  apache#19 0x402aec9c in exit (status=1109787728) at stdlib/lib_exit.c:126

CPU1:
  (gdb) bt
  #0  0x4026a1a8 in rspin_lock (lock=<optimized out>) at nuttx/include/nuttx/spinlock.h:692
  #1  rspin_lock_irqsave (lock=<optimized out>) at nuttx/include/nuttx/spinlock.h:705
  apache#2  nxsem_post_slow (sem=sem@entry=0x414cfd20 <g_uart0port+28>) at semaphore/sem_post.c:145
  apache#3  0x4027fc2e in nxsem_post (sem=<optimized out>) at nuttx/include/nuttx/semaphore.h:781
  apache#4  uart_wakeup (sem=0x414cfd20 <g_uart0port+28>) at serial/serial.c:2026
  apache#5  0x402828cc in uart_xmitchars (dev=dev@entry=0x414cfd04 <g_uart0port>) at serial/serial_io.c:121
  apache#6  0x4022116a in uart_interrupt (irq=<optimized out>, context=<optimized out>, arg=0x414cfd04 <g_uart0port>) at chip/r528_serial.c:841
  apache#7  0x40265dd8 in irq_dispatch (irq=irq@entry=34, context=context@entry=0x44194100) at irq/irq_dispatch.c:172
  apache#8  0x4024ac3e in arm_doirq (irq=34, irq@entry=0, regs=0x44194100) at arm_a_r/arm_doirq.c:88
  apache#9  0x40220246 in arm_decodeirq (regs=<optimized out>) at armv7-a/arm_gicv2.c:417
  apache#10 0x40200118 in arm_vectorirq () at armv7-a/arm_vectors.S:242
  apache#11 0x402bb916 in up_irq_restore (flags=31) at nuttx/include/arch/armv7-a/irq.h:438
  apache#12 spin_unlock_irqrestore_notrace (flags=31, lock=0x44194150) at nuttx/include/nuttx/spinlock.h:923
  apache#13 spin_unlock_irqrestore (flags=31, lock=0x44194150) at nuttx/include/nuttx/spinlock.h:961
  apache#14 mempool_release (pool=0x44194100, blk=0x4261e810) at mempool/mempool.c:724
  apache#15 0x402bca90 in mempool_multiple_free (mpool=<optimized out>, blk=<optimized out>, blk@entry=0x4261e810) at mempool/mempool_multiple.c:790
  apache#16 0x402b8f6c in mm_forcefree (heap=0x41a4d4e8, mem=0x4261e810) at mm_heap/mm_free.c:118
  apache#17 0x402b9394 in mm_free (heap=<optimized out>, mem=<optimized out>) at mm_heap/mm_free.c:285
  apache#18 0x402ba2f0 in free (mem=<optimized out>) at umm_heap/umm_free.c:51
  apache#19 0x40725dde in av_free (ptr=<optimized out>) at ffmpeg/libavutil/mem.c:243
  apache#20 av_freep (arg=arg@entry=0x441942b4) at ffmpeg/libavutil/mem.c:253
  apache#21 0x40722010 in av_frame_free (frame=frame@entry=0x441942b4) at ffmpeg/libavutil/frame.c:168
  apache#22 0x40a194fc in media_player_on_event_cb (udata=0x441b3fc0, evt=<optimized out>, args=<optimized out>) at server/media_player.c:312
  apache#23 0x406cbf7e in abufsrc_activate (ctx=0x41b1d0c0) at ffmpeg/libavfilter/asrc_abufsrc.c:329
  apache#24 0x406cff04 in ff_filter_activate (filter=filter@entry=0x41b1d0c0) at ffmpeg/libavfilter/avfilter.c:1485
  apache#25 0x40a25c2e in audio_graph_run_all (graph=0x41abca40) at server/audio_graph.c:635
  apache#26 audio_graph_run_once (ctx=<optimized out>) at server/audio_graph.c:650
  apache#27 0x40a17ede in mediad_main (argc=<optimized out>, argv=<optimized out>) at server/media_daemon.c:162
  apache#28 0x402ad480 in nxtask_startup (entrypt=entrypt@entry=0x40a17c95 <mediad_main>, argc=<optimized out>, argv=<optimized out>) at sched/task_startup.c:66
  apache#29 0x4026c194 in nxtask_start () at task/task_start.c:107
  apache#30 0x00000000 in ?? ()

Assisted-by: Kiro:claude-opus-5-5
Signed-off-by: xuxingliang <[email protected]>
huojianchaoyy pushed a commit to huojianchaoyy/nuttx that referenced this pull request Nov 24, 2026
It could cause deadlock because of the spin lock of uart.

CPU0:
  (gdb) bt
  #0  0x402805ac in rspin_lock (lock=0x414cfd50 <g_uart0port+76>) at nuttx/include/nuttx/spinlock.h:692
  #1  rspin_lock_irqsave (lock=0x414cfd50 <g_uart0port+76>) at nuttx/include/nuttx/spinlock.h:705
  apache#2  rspin_lock_irqsave_nopreempt (lock=0x414cfd50 <g_uart0port+76>) at nuttx/include/nuttx/spinlock.h:724
  apache#3  uart_spinlock (dev=dev@entry=0x414cfd04 <g_uart0port>, nopreempt=nopreempt@entry=true) at serial/serial.c:2046
  apache#4  0x40221350 in up_putc (ch=91) at chip/r528_serial.c:1318
  apache#5  0x402bfd38 in up_nputs (str=0x450a4ca9 "26/01/04 09:51:39] [CPU1] [657] [ap] mm_map_destroy: Driver munmap failed\n", str@entry=0x450a4ca8 "[26/01/04 09:51:39] [CPU1] [657] [ap] mm_map_destroy: Driver munmap failed\n", len=73, len@entry=74) at common/arm_nputs.c:44
  apache#6  0x40283e86 in syslog_default_write (channel=<optimized out>, buffer=0x450a4ca8 "[26/01/04 09:51:39] [CPU1] [657] [ap] mm_map_destroy: Driver munmap failed\n", buflen=74) at syslog/syslog_channel.c:351
  apache#7  0x402a2e00 in syslog_write_foreach (buffer=buffer@entry=0x450a4ca8 "[26/01/04 09:51:39] [CPU1] [657] [ap] mm_map_destroy: Driver munmap failed\n", buflen=buflen@entry=75, force=false) at syslog/syslog_write.c:148
  apache#8  0x402a2ec2 in syslog_write (buffer=buffer@entry=0x450a4ca8 "[26/01/04 09:51:39] [CPU1] [657] [ap] mm_map_destroy: Driver munmap failed\n", buflen=buflen@entry=75) at syslog/syslog_write.c:253
  apache#9  0x402b17a2 in syslograwstream_flush (self=self@entry=0x450a4c90) at stream/lib_syslograwstream.c:74
  apache#10 0x402b196e in lib_syslograwstream_close (stream=stream@entry=0x450a4c90) at stream/lib_syslograwstream.c:330
  apache#11 0x40283d90 in nx_vsyslog (priority=<optimized out>, fmt=0x4111c81c "%s: Driver munmap failed\n", ap=ap@entry=0x450a4ecc) at syslog/vsyslog.c:275
  apache#12 0x402b2772 in vsyslog (priority=priority@entry=3, fmt=fmt@entry=0x450a4ee8 "L\266,A", ap=..., ap@entry=...) at syslog/lib_syslog.c:82
  apache#13 0x402b278a in syslog (priority=priority@entry=3, fmt=0x4111c81c "%s: Driver munmap failed\n") at syslog/lib_syslog.c:115
  apache#14 0x402bd504 in mm_map_destroy (mm=mm@entry=0x422605f8) at map/mm_map.c:172
  apache#15 0x4026e87a in group_release (ttype=0, group=0x42260558) at group/group_leave.c:101
  apache#16 group_leave (tcb=tcb@entry=0x42260450) at group/group_leave.c:193
  apache#17 0x40271e7e in nxtask_exithook (tcb=tcb@entry=0x42260450, status=status@entry=0) at task/task_exithook.c:485
  apache#18 0x4026c826 in _exit (status=80, status@entry=1109787728) at task/exit.c:106
  apache#19 0x402aec9c in exit (status=1109787728) at stdlib/lib_exit.c:126

CPU1:
  (gdb) bt
  #0  0x4026a1a8 in rspin_lock (lock=<optimized out>) at nuttx/include/nuttx/spinlock.h:692
  #1  rspin_lock_irqsave (lock=<optimized out>) at nuttx/include/nuttx/spinlock.h:705
  apache#2  nxsem_post_slow (sem=sem@entry=0x414cfd20 <g_uart0port+28>) at semaphore/sem_post.c:145
  apache#3  0x4027fc2e in nxsem_post (sem=<optimized out>) at nuttx/include/nuttx/semaphore.h:781
  apache#4  uart_wakeup (sem=0x414cfd20 <g_uart0port+28>) at serial/serial.c:2026
  apache#5  0x402828cc in uart_xmitchars (dev=dev@entry=0x414cfd04 <g_uart0port>) at serial/serial_io.c:121
  apache#6  0x4022116a in uart_interrupt (irq=<optimized out>, context=<optimized out>, arg=0x414cfd04 <g_uart0port>) at chip/r528_serial.c:841
  apache#7  0x40265dd8 in irq_dispatch (irq=irq@entry=34, context=context@entry=0x44194100) at irq/irq_dispatch.c:172
  apache#8  0x4024ac3e in arm_doirq (irq=34, irq@entry=0, regs=0x44194100) at arm_a_r/arm_doirq.c:88
  apache#9  0x40220246 in arm_decodeirq (regs=<optimized out>) at armv7-a/arm_gicv2.c:417
  apache#10 0x40200118 in arm_vectorirq () at armv7-a/arm_vectors.S:242
  apache#11 0x402bb916 in up_irq_restore (flags=31) at nuttx/include/arch/armv7-a/irq.h:438
  apache#12 spin_unlock_irqrestore_notrace (flags=31, lock=0x44194150) at nuttx/include/nuttx/spinlock.h:923
  apache#13 spin_unlock_irqrestore (flags=31, lock=0x44194150) at nuttx/include/nuttx/spinlock.h:961
  apache#14 mempool_release (pool=0x44194100, blk=0x4261e810) at mempool/mempool.c:724
  apache#15 0x402bca90 in mempool_multiple_free (mpool=<optimized out>, blk=<optimized out>, blk@entry=0x4261e810) at mempool/mempool_multiple.c:790
  apache#16 0x402b8f6c in mm_forcefree (heap=0x41a4d4e8, mem=0x4261e810) at mm_heap/mm_free.c:118
  apache#17 0x402b9394 in mm_free (heap=<optimized out>, mem=<optimized out>) at mm_heap/mm_free.c:285
  apache#18 0x402ba2f0 in free (mem=<optimized out>) at umm_heap/umm_free.c:51
  apache#19 0x40725dde in av_free (ptr=<optimized out>) at ffmpeg/libavutil/mem.c:243
  apache#20 av_freep (arg=arg@entry=0x441942b4) at ffmpeg/libavutil/mem.c:253
  apache#21 0x40722010 in av_frame_free (frame=frame@entry=0x441942b4) at ffmpeg/libavutil/frame.c:168
  apache#22 0x40a194fc in media_player_on_event_cb (udata=0x441b3fc0, evt=<optimized out>, args=<optimized out>) at server/media_player.c:312
  apache#23 0x406cbf7e in abufsrc_activate (ctx=0x41b1d0c0) at ffmpeg/libavfilter/asrc_abufsrc.c:329
  apache#24 0x406cff04 in ff_filter_activate (filter=filter@entry=0x41b1d0c0) at ffmpeg/libavfilter/avfilter.c:1485
  apache#25 0x40a25c2e in audio_graph_run_all (graph=0x41abca40) at server/audio_graph.c:635
  apache#26 audio_graph_run_once (ctx=<optimized out>) at server/audio_graph.c:650
  apache#27 0x40a17ede in mediad_main (argc=<optimized out>, argv=<optimized out>) at server/media_daemon.c:162
  apache#28 0x402ad480 in nxtask_startup (entrypt=entrypt@entry=0x40a17c95 <mediad_main>, argc=<optimized out>, argv=<optimized out>) at sched/task_startup.c:66
  apache#29 0x4026c194 in nxtask_start () at task/task_start.c:107
  apache#30 0x00000000 in ?? ()

Assisted-by: Kiro:claude-opus-5-5
Signed-off-by: xuxingliang <[email protected]>
GUIDINGLI pushed a commit that referenced this pull request Nov 25, 2026
It could cause deadlock because of the spin lock of uart.

CPU0:
  (gdb) bt
  #0  0x402805ac in rspin_lock (lock=0x414cfd50 <g_uart0port+76>) at nuttx/include/nuttx/spinlock.h:692
  #1  rspin_lock_irqsave (lock=0x414cfd50 <g_uart0port+76>) at nuttx/include/nuttx/spinlock.h:705
  #2  rspin_lock_irqsave_nopreempt (lock=0x414cfd50 <g_uart0port+76>) at nuttx/include/nuttx/spinlock.h:724
  #3  uart_spinlock (dev=dev@entry=0x414cfd04 <g_uart0port>, nopreempt=nopreempt@entry=true) at serial/serial.c:2046
  #4  0x40221350 in up_putc (ch=91) at chip/r528_serial.c:1318
  #5  0x402bfd38 in up_nputs (str=0x450a4ca9 "26/01/04 09:51:39] [CPU1] [657] [ap] mm_map_destroy: Driver munmap failed\n", str@entry=0x450a4ca8 "[26/01/04 09:51:39] [CPU1] [657] [ap] mm_map_destroy: Driver munmap failed\n", len=73, len@entry=74) at common/arm_nputs.c:44
  #6  0x40283e86 in syslog_default_write (channel=<optimized out>, buffer=0x450a4ca8 "[26/01/04 09:51:39] [CPU1] [657] [ap] mm_map_destroy: Driver munmap failed\n", buflen=74) at syslog/syslog_channel.c:351
  #7  0x402a2e00 in syslog_write_foreach (buffer=buffer@entry=0x450a4ca8 "[26/01/04 09:51:39] [CPU1] [657] [ap] mm_map_destroy: Driver munmap failed\n", buflen=buflen@entry=75, force=false) at syslog/syslog_write.c:148
  #8  0x402a2ec2 in syslog_write (buffer=buffer@entry=0x450a4ca8 "[26/01/04 09:51:39] [CPU1] [657] [ap] mm_map_destroy: Driver munmap failed\n", buflen=buflen@entry=75) at syslog/syslog_write.c:253
  #9  0x402b17a2 in syslograwstream_flush (self=self@entry=0x450a4c90) at stream/lib_syslograwstream.c:74
  #10 0x402b196e in lib_syslograwstream_close (stream=stream@entry=0x450a4c90) at stream/lib_syslograwstream.c:330
  #11 0x40283d90 in nx_vsyslog (priority=<optimized out>, fmt=0x4111c81c "%s: Driver munmap failed\n", ap=ap@entry=0x450a4ecc) at syslog/vsyslog.c:275
  #12 0x402b2772 in vsyslog (priority=priority@entry=3, fmt=fmt@entry=0x450a4ee8 "L\266,A", ap=..., ap@entry=...) at syslog/lib_syslog.c:82
  #13 0x402b278a in syslog (priority=priority@entry=3, fmt=0x4111c81c "%s: Driver munmap failed\n") at syslog/lib_syslog.c:115
  #14 0x402bd504 in mm_map_destroy (mm=mm@entry=0x422605f8) at map/mm_map.c:172
  #15 0x4026e87a in group_release (ttype=0, group=0x42260558) at group/group_leave.c:101
  #16 group_leave (tcb=tcb@entry=0x42260450) at group/group_leave.c:193
  #17 0x40271e7e in nxtask_exithook (tcb=tcb@entry=0x42260450, status=status@entry=0) at task/task_exithook.c:485
  #18 0x4026c826 in _exit (status=80, status@entry=1109787728) at task/exit.c:106
  #19 0x402aec9c in exit (status=1109787728) at stdlib/lib_exit.c:126

CPU1:
  (gdb) bt
  #0  0x4026a1a8 in rspin_lock (lock=<optimized out>) at nuttx/include/nuttx/spinlock.h:692
  #1  rspin_lock_irqsave (lock=<optimized out>) at nuttx/include/nuttx/spinlock.h:705
  #2  nxsem_post_slow (sem=sem@entry=0x414cfd20 <g_uart0port+28>) at semaphore/sem_post.c:145
  #3  0x4027fc2e in nxsem_post (sem=<optimized out>) at nuttx/include/nuttx/semaphore.h:781
  #4  uart_wakeup (sem=0x414cfd20 <g_uart0port+28>) at serial/serial.c:2026
  #5  0x402828cc in uart_xmitchars (dev=dev@entry=0x414cfd04 <g_uart0port>) at serial/serial_io.c:121
  #6  0x4022116a in uart_interrupt (irq=<optimized out>, context=<optimized out>, arg=0x414cfd04 <g_uart0port>) at chip/r528_serial.c:841
  #7  0x40265dd8 in irq_dispatch (irq=irq@entry=34, context=context@entry=0x44194100) at irq/irq_dispatch.c:172
  #8  0x4024ac3e in arm_doirq (irq=34, irq@entry=0, regs=0x44194100) at arm_a_r/arm_doirq.c:88
  #9  0x40220246 in arm_decodeirq (regs=<optimized out>) at armv7-a/arm_gicv2.c:417
  #10 0x40200118 in arm_vectorirq () at armv7-a/arm_vectors.S:242
  #11 0x402bb916 in up_irq_restore (flags=31) at nuttx/include/arch/armv7-a/irq.h:438
  #12 spin_unlock_irqrestore_notrace (flags=31, lock=0x44194150) at nuttx/include/nuttx/spinlock.h:923
  #13 spin_unlock_irqrestore (flags=31, lock=0x44194150) at nuttx/include/nuttx/spinlock.h:961
  #14 mempool_release (pool=0x44194100, blk=0x4261e810) at mempool/mempool.c:724
  #15 0x402bca90 in mempool_multiple_free (mpool=<optimized out>, blk=<optimized out>, blk@entry=0x4261e810) at mempool/mempool_multiple.c:790
  #16 0x402b8f6c in mm_forcefree (heap=0x41a4d4e8, mem=0x4261e810) at mm_heap/mm_free.c:118
  #17 0x402b9394 in mm_free (heap=<optimized out>, mem=<optimized out>) at mm_heap/mm_free.c:285
  #18 0x402ba2f0 in free (mem=<optimized out>) at umm_heap/umm_free.c:51
  #19 0x40725dde in av_free (ptr=<optimized out>) at ffmpeg/libavutil/mem.c:243
  #20 av_freep (arg=arg@entry=0x441942b4) at ffmpeg/libavutil/mem.c:253
  #21 0x40722010 in av_frame_free (frame=frame@entry=0x441942b4) at ffmpeg/libavutil/frame.c:168
  #22 0x40a194fc in media_player_on_event_cb (udata=0x441b3fc0, evt=<optimized out>, args=<optimized out>) at server/media_player.c:312
  #23 0x406cbf7e in abufsrc_activate (ctx=0x41b1d0c0) at ffmpeg/libavfilter/asrc_abufsrc.c:329
  #24 0x406cff04 in ff_filter_activate (filter=filter@entry=0x41b1d0c0) at ffmpeg/libavfilter/avfilter.c:1485
  #25 0x40a25c2e in audio_graph_run_all (graph=0x41abca40) at server/audio_graph.c:635
  #26 audio_graph_run_once (ctx=<optimized out>) at server/audio_graph.c:650
  #27 0x40a17ede in mediad_main (argc=<optimized out>, argv=<optimized out>) at server/media_daemon.c:162
  #28 0x402ad480 in nxtask_startup (entrypt=entrypt@entry=0x40a17c95 <mediad_main>, argc=<optimized out>, argv=<optimized out>) at sched/task_startup.c:66
  #29 0x4026c194 in nxtask_start () at task/task_start.c:107
  #30 0x00000000 in ?? ()

Assisted-by: Kiro:claude-opus-5-5
Signed-off-by: xuxingliang <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants