-
Notifications
You must be signed in to change notification settings - Fork 10
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
Fixes to: #31
base: iron
Are you sure you want to change the base?
Fixes to: #31
Conversation
drensber
commented
Mar 6, 2024
* micro-ROS changes over dashing Feature/add security directory (micro-ROS#1) * Added security directory * Updated security directory Feature/avoid filesystem and allocation (micro-ROS#2) * Included RCUTILS_NO_FILESYSTEM and RCUTILS_AVOID_DYNAMIC_ALLOCATION * Added no filesystem options * Default allocators write access * Avoid dynamic allocation and no filesytem on error handling * Typo * New flags for filesystem and avoid dynamic * Error handling template * New allocator approach Add test_security_directory test from rcl. (micro-ROS#3) Merge pull request micro-ROS#4 from micro-ROS/feature/zephyr_fixes Feature/zephyr fixes CMake refactor (micro-ROS#5) Update approach (micro-ROS#6) * Update approach * Remove target_compile_definitions and refactor flags install * Added RCUTILS_NO_FILESYSTEM on new functions * Added RCUTILS_NO_FILESYSTEM on new functions Co-authored-by: Pablo Garrido <[email protected]> Updates 17092020 Fix atomics 64bits (micro-ROS#9) * micro-ROS changes over dashing Feature/add security directory (micro-ROS#1) * Added security directory * Updated security directory Feature/avoid filesystem and allocation (micro-ROS#2) * Included RCUTILS_NO_FILESYSTEM and RCUTILS_AVOID_DYNAMIC_ALLOCATION * Added no filesystem options * Default allocators write access * Avoid dynamic allocation and no filesytem on error handling * Typo * New flags for filesystem and avoid dynamic * Error handling template * New allocator approach Add test_security_directory test from rcl. (micro-ROS#3) Merge pull request micro-ROS#4 from micro-ROS/feature/zephyr_fixes Feature/zephyr fixes CMake refactor (micro-ROS#5) Update approach (micro-ROS#6) * Update approach * Remove target_compile_definitions and refactor flags install * Added RCUTILS_NO_FILESYSTEM on new functions * Added RCUTILS_NO_FILESYSTEM on new functions Co-authored-by: Pablo Garrido <[email protected]> * Initial changes * Add hashing and lock pool * Updates Co-authored-by: Jose Antonio Moral <[email protected]> Fix atomics 64bits (micro-ROS#9) Updates 09102020 * Release micro-ROS Foxy (micro-ROS#8) Update Cleaning Update Update filesystem Updates Adjust logger level Remove build warning (micro-ROS#10) * Avoid not used warnings * Update Reduce error handling static size (micro-ROS#14) (micro-ROS#15) This reverts commit befc608. Reduce error handling static size (micro-ROS#14) (micro-ROS#15) Signed-off-by: Pablo Garrido <[email protected]> (cherry picked from commit 1176652) Co-authored-by: Pablo Garrido <[email protected]> Revert "Revert "Install headers to include\${PROJECT_NAME} (ros2#351)"" This reverts commit 4546892. Fix atomic 64 b description (micro-ROS#17) (micro-ROS#18) (cherry picked from commit 85efa4a) Co-authored-by: Pablo Garrido <[email protected]> Add fork checker for humble Signed-off-by: Pablo Garrido <[email protected]> Update to iron (micro-ROS#27) Signed-off-by: acuadros95 <[email protected]>
(cherry picked from commit 55de2e1) Co-authored-by: Błażej Sowa <[email protected]>
- avoid compiler warnings - avoid unnecessary stack allocations in every log message call. - avoid unnecessary reference to isatty() when building in Zephyr. Signed-off-by: David M. Rensberger <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @drensber I have further review your changes and beyond ones in src/error_handling_helpers.h
I guess that the others shall be done in the rcutils original repo, then they will be backported to micro-ROS automatically.
src/error_handling_helpers.h
Outdated
#endif | ||
|
||
#if !defined(RCUTILS_AVOID_DYNAMIC_ALLOCATION) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#endif | |
#if !defined(RCUTILS_AVOID_DYNAMIC_ALLOCATION) |
Irrelevant please remove
src/logging.c
Outdated
(void)one_semantic; | ||
(void)zero_semantic; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes shall be done in the original repo: https://github.com/ros2/rcutils
Remember that this is a fork
src/logging.c
Outdated
static char msg_buf[1024] = ""; | ||
static char output_buf[1024] = ""; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes shall be done in the original repo: https://github.com/ros2/rcutils
Remember that this is a fork
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could try, but this is a change that really mostly makes sense in the context of small embedded systems. I'm not sure that the main ros2 project would see much reason for a change of this nature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are changing the variable from stack to static section, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's what I'm doing. I could try submitting it to the ros2 repo. There shouldn't technically be anything /wrong/ with doing it that way even on more capable hardware that can handle the overhead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried submitting this to the ros2 repository. They said they can't accept the change that makes the buffer a global (static) variable, because that function is called by multiple threads in a ros2 instance. Does micro-ROS potentially have the same problem, or is micro-ROS guaranteed to be single-threaded with respect to callers of rcutils_logging_console_output_handler()?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They can accept the other change (removing the dependency on isatty() for Zephyr builds), so I'll go ahead and push that to the upstream ros2 repo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
micro-ROS potentially can be used in a threaded environment in some cases with some configuration, so we have the very same problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, then I think the only safe way to do it is dynamic heap allocation (malloc). Could possibly also use locking to prevent more than one thread from calling the function at a time. Do you have any idea if this is a Zephyr-specific issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now, I think I'll leave the buffer allocation changes out of my PR, since no one else seems to have a problem with stack allocation. We'll continue to patch for our own purposes. Doyon have any comments on any of the other changes? It looks like they passed CI this time.
…t cooresponds with the #endif
Is there anything else I need to do here? |