xiaoxiang781216 commented on issue #10556: URL: https://github.com/apache/nuttx/issues/10556#issuecomment-1712696651
> Hi, Is there any documentation or examples on how to use Segger's RTT functionality in NuttX? I've read [segger's documentation](https://wiki.segger.com/RTT) and set the appropriate [nuttx kconfig's](https://github.com/apache/nuttx/blob/nuttx-12.2.1/drivers/segger/Kconfig): > > ``` > CONFIG_STREAM_RTT=y > CONFIG_SEGGER_RTT=y > # IMXRT1064 cache line is 4 bytes > CONFIG_SEGGER_RTT_CPU_CACHE_LINE_SIZE=4 > ``` > > After compiling I see an `RTT` directory generated under `drivers/segger/` with segger's source and header RTT implementation files. In most case, you don't need use rtt stream in the code directly, rtt already integrate into various nuttx subsystem: 1. semihost(access PC file): enable CONFIG_FS_HOSTFS and ARM_SEMIHOSTING_HOSTFS, issue this command in nsh: ``` mount -t hostfs -o fs=/path/to/host /path/to/nuttx ``` 2. sysview: https://github.com/apache/nuttx/issues/5843 https://github.com/apache/nuttx/issues/9991 3. thread awareness: https://github.com/apache/nuttx/issues/9200 4. rtt serial console: https://github.com/apache/nuttx/pull/9777 5. rtt syslog: https://github.com/apache/nuttx/pull/5388 > I include [segger/rtt.h](https://github.com/apache/nuttx/blob/nuttx-12.2.1/include/nuttx/segger/rtt.h) in a file of mine that gets compiled **as C++** but compilation fails due to `rtt.h` using the C++ reserved keyword `public` for fields in `struct lib_rttoutstream_s` and `struct lib_rttinstream_s`. Additionally, the transitive include [streams.h](https://github.com/apache/nuttx/blob/nuttx-12.2.1/include/nuttx/streams.h) uses `public` as well as the `this` keyword (e.g., [here](https://github.com/apache/nuttx/blob/nuttx-12.2.1/include/nuttx/streams.h#L73) and [here](https://github.com/apache/nuttx/blob/nuttx-12.2.1/include/nuttx/streams.h#L140)). > > rtt.h uses a '#ifdef __cplusplus' guard [here](https://github.com/apache/nuttx/blob/nuttx-12.2.1/include/nuttx/segger/rtt.h#L62) so I'm assuming including it from a c++ file was an intended use case. Could someone help me understand if this is a bug or if I'm attempting to use the RTT API incorrectly? > it's wrong to use public(C++ keyword) in stream interface, please provide a patch to rename public to other word(e.g. common). -- 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]
