danielappiagyei-bc commented on issue #10556:
URL: https://github.com/apache/nuttx/issues/10556#issuecomment-1712709998

   > it's wrong to use public(C++ keyword) in stream interface, please provide 
a patch to rename public to other word(e.g. common).
   
   Should I also provide a patch for the `this` keyword being used? Also would 
forbidding the use of C++ keywords in C be something to add to the [C coding 
standard](https://nuttx.apache.org/docs/latest/contributing/coding_style.html) 
as well as automated checks in `nxstyle`? Not sure if this is something that 
should be brought up in the mailing list or not.
   
   > 4. rtt serial console: https://github.com/apache/nuttx/pull/9777
   
   Thanks Xiang, it looks like this is equivalent to what I was looking for. I 
see that this PR introduced the `SERIAL_RTT` kconfig.
   This was after NuttX 12.2.1 was released so it didn't make the cut.
   For posterity, I'll post a code snippet of how I was able to get RTT working 
in my nuttx version in a C file:
   
   ```
     #include <nuttx/segger/rtt.h>
     ....
   
     struct lib_rttoutstream_s out_stream = {0};
    /* channel 0 is reserved by RTT for the Terminal*/
     lib_rttoutstream_open(&out_stream, 0, CONFIG_SEGGER_RTT_BUFFER_SIZE_UP);
   
     /* the below should be equivalent to 
`out_stream.public.puts(&out_stream.public, "dan\r\n", sizeof("dan\r\n");`  */
     out_stream.public.putc(&out_stream.public, (int)'d');
     out_stream.public.putc(&out_stream.public, (int)'a');
     out_stream.public.putc(&out_stream.public, (int)'n');
     out_stream.public.putc(&out_stream.public, (int)'\r');
     out_stream.public.putc(&out_stream.public, (int)'\n');
     out_stream.public.putc(&out_stream.public, (int)'\0');
   
     while (1){
           usleep(500);
       }
   
   ```
   
   Using Segger's 
[JLinkRTTViewer](https://www.segger.com/products/debug-probes/j-link/tools/rtt-viewer/),
 I attached to the existing J-link debug session I had with Segger Ozone and 
was able to see my log in Terminal 0: 
   
![image](https://github.com/apache/nuttx/assets/66082730/a90eabdd-e6b2-4fb3-bbe1-77f13daa6d60)
   


-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to