Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

output printf() messages to the serial terminal on STM32 #3

Conversation

takasehideki
Copy link
Contributor

@takasehideki takasehideki commented Jan 22, 2021

  • 39d18c7 mod comment for the additional file name which IP address should be set
  • ce73608 add STM32_PRINTF_SERIAL macro
    • Enabling this macro can output printf() to the serial terminal (via USART3).
    • Note that linking printf() may increase the file size. This macro is disabled by default.
  • fix some bugs/typos when enabling *_VERBOSE macros
  • 444035e use printf for SEDP_LOG on STM32

My modification to include/rtps/entities/StatefulWriter.tpp (be3c5e2) may be the discussable point.
The original code uses log() to output the messages. I guess the implementation of log() is in progress. I didn't decide how to fix it, so I simply replace log() to printf() when STM32_PRINTF_SERIAL is defined.


NOTE:
My branch was created from dc5e510, which is referred from embeddedRTPS-STM32 as the submodule. 7 commits have happened from dc5e510 to this repository.
https://github.com/embedded-software-laboratory/embeddedRTPS/commits/master

My suggestion is the submodule of embeddedRTPS-STM32 should follow the latest commit of this repository.
If you agree with my suggestion, I will add this work in the following PR.
embedded-software-laboratory/embeddedRTPS-STM32#9

Enabling this macro can output printf() to the serial terminal (via USART3).
Note that linking printf() may increase the file size.
This macro is disabled by default.
Reported error log:
make all
arm-none-eabi-g++ "../rtps/src/messages/MessageReceiver.cpp" -mcpu=cortex-m7 -std=gnu++14 -g3 '-D__weak=__attribute__((weak))' '-D__packed=__attribute__((__packed__))' -DUSE_HAL_DRIVER -DSTM32F767xx '-DEMBEDDEDRTPS_CONFIG_STM32NF767ZI=1' -c -I../Inc -I../Middlewares/Third_Party/LwIP/system -I../Drivers/STM32F7xx_HAL_Driver/Inc -I../Drivers/STM32F7xx_HAL_Driver/Inc/Legacy -I../Middlewares/Third_Party/FreeRTOS/Source/include -I../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS -I../Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM7/r0p1 -I../Middlewares/Third_Party/LwIP/src/include/netif/ppp -I../Drivers/CMSIS/Device/ST/STM32F7xx/Include -I../Middlewares/Third_Party/LwIP/src/include/lwip/apps -I../Middlewares/Third_Party/LwIP/src/include/lwip/priv -I../Middlewares/Third_Party/LwIP/src/include/lwip/prot -I../Middlewares/Third_Party/LwIP/src/include/netif -I../Middlewares/Third_Party/LwIP/src/include/posix -I../Middlewares/Third_Party/LwIP/src/include/posix/sys -I../Middlewares/Third_Party/LwIP/system/arch -I../Drivers/CMSIS/Include -I../Middlewares/Third_Party/LwIP/src/include -I../Middlewares/Third_Party/LwIP/src/include/lwip -I/Users/davidk/Documents/Embedded/embedded-rtps-stm32/rtps/include -I"/~~/stm32/rtps/include" -I"/~~/stm32/rtps/thirdparty/Micro-CDR/include" -Og -ffunction-sections -fno-exceptions -fno-rtti -fno-use-cxa-atexit -Wall -fexceptions  -fstack-usage -std=gnu++11 -fstack-usage -MMD -MP -MF"rtps/src/messages/MessageReceiver.d" -MT"rtps/src/messages/MessageReceiver.o" --specs=nano.specs -mfpu=fpv5-d16 -mfloat-abi=hard -mthumb -o "rtps/src/messages/MessageReceiver.o"
../rtps/src/messages/MessageReceiver.cpp: In member function 'bool rtps::MessageReceiver::processSubmessage(rtps::MessageProcessingInfo&, const rtps::SubmessageHeader&)':
../rtps/src/messages/MessageReceiver.cpp:133:116: error: base operand of '->' has non-pointer type 'const rtps::SubmessageHeader'
             printf("Submessage of type %u currently not supported. Skipping..\n", static_cast<uint8_t>(submsgHeader->submessageId));
                                                                                                                    ^~
../rtps/src/messages/MessageReceiver.cpp: In member function 'bool rtps::MessageReceiver::processDataSubmessage(rtps::MessageProcessingInfo&)':
../rtps/src/messages/MessageReceiver.cpp:161:33: error: base operand of '->' has non-pointer type 'rtps::SubmessageData'
         printEntityId(dataSubmsg->readerId);
                                 ^~
make: *** [rtps/src/messages/subdir.mk:21: rtps/src/messages/MessageReceiver.o] Error 1
"make all" terminated with exit code 2. Build might be incomplete.

17:55:22 Build Failed. 3 errors, 0 warnings. (took 597ms)
@takasehideki
Copy link
Contributor Author

Woops,,, some conflicts have happened,,,
The cause may be also due to the description in NOTE.

@takasehideki
Copy link
Contributor Author

I could have been solved conflicts. All conflicts were caused by clang-format check.
26072bf

@akampmann
Copy link
Contributor

akampmann commented Oct 15, 2021

Hi @takasehideki,

sorry for coming back so late to this pull request, for some reason it didn't catch my attention. Unfortunately there are some conflicts now. Is there something still relevant here that we should consider integrating into master? I think I fixed the verbosity bugs independently.

Regarding printing: I would like to avoid having controller-specific defines in this repository, as it should be agnostic to a particular controller. Maybe we can isolate the printing part into separate functions that are only declared but not defined, or declare them as weakly linked, so it is easy to override them.

Best regards
Alex

@takasehideki
Copy link
Contributor Author

takasehideki commented Oct 15, 2021

Hi @akampmann , thank you for the reply.
I think this PR is no longer meaningful because you have already fixed code for logging in recent commits, e.g., #6 .Is it right?
And also, I agree with your opinion about regarding printing.
So my opinion is to close this PR without merging. How do you think?

@akampmann
Copy link
Contributor

Hi, the issues with different verbosity levels should be fixed. I will close this PR then.

I still have to update the embeddedRTPS commit that the STM32 example is pointing to. I haven't had a chance to see if the latest changes still compile/run for the STM32 (have tried on ARM R5 and Infineon Aurix). At least there are some updates to the config that have to be added. Have you had a chance to try the latest commit on STM32? I will probably not have a chance to do so for a few weeks.

@takasehideki
Copy link
Contributor Author

OK, I closed this PR.

@takasehideki
Copy link
Contributor Author

I still have to update the embeddedRTPS commit that the STM32 example is pointing to. I haven't had a chance to see if the latest changes still compile/run for the STM32 (have tried on ARM R5 and Infineon Aurix). At least there are some updates to the config that have to be added. Have you had a chance to try the latest commit on STM32? I will probably not have a chance to do so for a few weeks.

Yes, I'm watching your great activity. I don't have much time, but I would like to try to update the example for STM32.
BTW, did you check the PRs for embeddedRTPS-STM32 from our team.
embedded-software-laboratory/embeddedRTPS-STM32#5
embedded-software-laboratory/embeddedRTPS-STM32#8

These are for older versions of embeddedRTPS, but we would be grateful if you could consider merging before I will try the update.

@akampmann
Copy link
Contributor

I merged those those PRs just now. Thank you for your contribution!

I stumbled upon your talk at ROSCON Japan and https://github.com/mROS-base/mros2 I think this is very cool, I'm curious to hear more about it. Are there plans to translate the slides to english?

@takasehideki
Copy link
Contributor Author

takasehideki commented Oct 15, 2021

Thank you for merging our works to your repository!

And more, thank you so much for finding out our activity!!
Of course we plan to spread it internationally. I submitted the presentation video to Lighting Talk session on ROS World 2021. But I'm not sure whether our presentation has been accepted and will be published until the day of the event. And also, we plan to write an academic paper of our work and submit it to international conference, because we are also academia,,,

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.

None yet

2 participants