lukegluke opened a new issue #2203:
URL: https://github.com/apache/incubator-nuttx/issues/2203


   I've moved from NuttX 8.2 to NuttX 10.0.0.  If uart console is used booting 
is ok. But if only usb console is used (CONFIG_CDCACM_CONSOLE) I get hardfault 
on each boot.
   
   Digging in debug showed that it occurs on first use of stdout or stderr!
   As I see with commit b0797263ca2817cf536be8b843ac5b5aac5d4d9c stdout and 
stderr are now gotten from dynamic stream list
   
https://github.com/apache/incubator-nuttx/blob/d987dd2f5aa5d26f814c66d01eb4509b1efb1672/include/stdio.h#L81-L83
    I supposed due to latter usb console initialization in my case 
`nxsched_get_streams()->sl_head` is null, so 
`nxsched_get_streams()->sl_head->fs_next` causes hardfault.
   
   stdout, stderr could be easily used in board_app_initialize, but stderr is 
certainly used in
   
   apps/nshlib/nsh_console.c:
   
https://github.com/apache/incubator-nuttx-apps/blob/3b884cfb870d21d02542d7e8434d286228e359f6/nshlib/nsh_console.c#L510
   
   on usb console initialization in apps/nshlib/nsh_usbconsole.c
   
https://github.com/apache/incubator-nuttx-apps/blob/3b884cfb870d21d02542d7e8434d286228e359f6/nshlib/nsh_usbconsole.c#L269
   
   before `cdcacm_initialize()` is called. I haven't dig further, but I suppose 
stream allocation is made with `/dev/console` registration, right?
   
   (If it is matters, I'm working with custom board and firmware based on 
latest PX4. But issue definitely related to NuttX)
   
   So it looks like deferred console is special case that should be treated 
carefully.
   @xiaoxiang781216, hope for your help, thanks in advance.
   
   
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to