You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The main issues found when porting rcutils package to embedded systems with RTOS during micro-ROS development were:
4
-
- the lack of filesystem
5
-
- dynamic memory allocations out of the RTOS control (usually with standar library implementations of `malloc` and `free`)
6
-
- the POSIX API dependency
8
+
The main issues found when porting rcutils package to embedded systems with RTOS during micro*ROS development were:
9
+
* the lack of filesystem
10
+
* dynamic memory allocations out of the RTOS control (usually with standard library implementations of `malloc` and `free`)
11
+
* the POSIX API dependency
7
12
8
13
This document addresses the first two items.
9
14
10
-
In order to avoid the **filesystem** dependency without modifiying highlevel layers (such as `rcl` or `rmw`), it is proposed to use a combination between the available `rcl_logging_noop` package and a modified version of the filesystem dependecies in `rcutils`. This approach is enabled using `RCUTILS_NO_FILESYSTEM` flag in compilation time.
15
+
To avoid the **filesystem** dependency without modifying high*level layers (such as `rcl` or `rmw`), it is proposed to use a combination between the available `rcl_logging_noop` package and a modified version of the filesystem dependencies in `rcutils`. This approach is enabled using the`RCUTILS_NO_FILESYSTEM` flag in compilation time.
11
16
12
-
**Dynamic memory allocation** must be bounded to ROS2 custom allocators. `rcl` and `rmw` layers usually rely on `rcutils_get_default_allocator` function in order to obtain allocators, so a setter function is proposed.
17
+
**Dynamic memory allocation** must be bounded to ROS2 custom allocators. `rcl` and `rmw` layers usually rely on `rcutils_get_default_allocator` function to obtain allocators, so a setter function is proposed.
13
18
This way, using `rcutils_set_default_allocator` function is possible to modify the defaults easing the use of custom memory management in embedded systems.
14
19
15
20
Dynamic memory allocation is also found when dealing with error handling in `rcutils`. By using `RCUTILS_AVOID_DYNAMIC_ALLOCATION` some string related `memmove` functions along the error handling are avoided.
@@ -20,120 +25,120 @@ Dynamic memory allocation is also found when dealing with error handling in `rcu
20
25
21
26
### error_handling.h
22
27
23
-
- Macro **RCUTILS_SAFE_FWRITE_TO_STDERR** in `rcutils` error_handling.h:
* Problem: use `fwrite` to print to stderr and relies on a filesytem
31
+
* Appears in:
32
+
* rcl/rcl/src/rcl/expand_topic_name.c
33
+
* rcl/rcl/src/rcl/logging_rosout.c
34
+
* rcl/rcl/src/rcl/logging.c
35
+
* rcl/rcl/src/rcl/context.c
36
+
* rcl/rcl_yaml_param_parser/src/parser.c
37
+
* rcutils/src/split.c
38
+
* rcutils/src/error_handling.c
39
+
* rcutils/src/allocator.c
40
+
* rcutils/src/logging.c
41
+
* rcutils/src/error_handling_helpers.h
42
+
* rcutils/include/rcutils/logging.h
43
+
* rcutils/include/rcutils/error_handling.h
44
+
* rcl/rcl/src/rcl/expand_topic_name.c
45
+
* rcl/rcl/src/rcl/logging_rosout.c
46
+
* rcl/rcl/src/rcl/logging.c
47
+
* rcl/rcl/src/rcl/context.c
48
+
* rcl/rcl_yaml_param_parser/src/parser.c
49
+
* rmw/rmw/include/rmw/error_handling.h
50
+
51
+
* Macro **RCUTILS_SET_ERROR_MSG** in `rcutils` error_handling.h: [Check here](https://github.com/micro-ROS/rcutils/commit/bcaa00a6ed12fc62d05dc5e44521a1648fd2d07f#diff-1b06d4a1ccca0f0dff66d961923143a1R202)
52
+
* Problem: use inconditionally `memmove` inside `__rcutils_copy_string()` inside `rcutils_set_error_state`. It implies dynamic memory allocation.
53
+
* Dependecies:
54
+
* rcl/rcl/include/rcl/error_handling.h
55
+
* rcutils/src/security_directory.c
56
+
* rcutils/src/time_unix.c
57
+
* rcutils/src/split.c
58
+
* rcutils/src/error_handling.c
59
+
* rcutils/src/time.c
60
+
* rcutils/src/string_map.c
61
+
* rcutils/src/uint8_array.c
62
+
* rcutils/src/hash_map.c
63
+
* rcutils/src/char_array.c
64
+
* rcutils/src/logging.c
65
+
* rcutils/src/string_array.c
66
+
* rcutils/src/array_list.c
67
+
* rcutils/include/rcutils/types/array_list.h
68
+
* rcutils/include/rcutils/types/hash_map.h
69
+
* rcutils/include/rcutils/allocator.h
70
+
* rcutils/include/rcutils/error_handling.h
71
+
* rcl/rcl/include/rcl/error_handling.h
72
+
* rmw/rmw/include/rmw/error_handling.h
73
+
74
+
* Macro **RCUTILS_SET_ERROR_MSG_WITH_FORMAT_STRING** in `rcutils` error_handling.h:. [Check here](https://github.com/micro-ROS/rcutils/commit/bcaa00a6ed12fc62d05dc5e44521a1648fd2d07f#diff-1b06d4a1ccca0f0dff66d961923143a1R218)
75
+
* Problem: use `RCUTILS_SET_ERROR_MSG`, see above.
76
+
* Dependecies:
77
+
* rcl/rcl/include/rcl/error_handling.h
78
+
* rcutils/src/security_directory.c
79
+
* rcutils/src/string_map.c
80
+
* rcutils/src/logging.c
81
+
* rcutils/include/rcutils/error_handling.h
82
+
* rcl/rcl/include/rcl/error_handling.h
83
+
* rmw/rmw/include/rmw/error_handling.h
79
84
80
85
### security_directory.c (moved from `rcl` to `rcutils`)
81
86
82
-
- Function **get_best_matching_directory** in `rcutils` security_directory.c [Check here](https://github.com/micro-ROS/rcutils/commit/9804287c3489ce9c88b714832abf54f9a7b7198d#diff-1ca0173d6a68ba1bdcd9ff908b769911R91)
83
-
- Problem: use **tinydir** library which relies on filesytem
84
-
- Dependecies:
85
-
- rcutils/src/security_directory.c
86
-
- rcl/rcl/src/rcl/security_directory.c
87
+
* Function **get_best_matching_directory** in `rcutils` security_directory.c [Check here](https://github.com/micro-ROS/rcutils/commit/9804287c3489ce9c88b714832abf54f9a7b7198d#diff-1ca0173d6a68ba1bdcd9ff908b769911R91)
88
+
* Problem: use **tinydir** library which relies on filesytem
89
+
* Dependecies:
90
+
* rcutils/src/security_directory.c
91
+
* rcl/rcl/src/rcl/security_directory.c
87
92
88
-
- Function **prefix_match_lookup**. [Check here](https://github.com/micro-ROS/rcutils/commit/9804287c3489ce9c88b714832abf54f9a7b7198d#diff-1ca0173d6a68ba1bdcd9ff908b769911L151)
89
-
- Problem: use **tinydir** library which relies on filesytem
90
-
- Dependencies:
91
-
- rcutils/src/security_directory.c
92
-
- rcl/rcl/src/rcl/security_directory.c
93
+
* Function **prefix_match_lookup**. [Check here](https://github.com/micro-ROS/rcutils/commit/9804287c3489ce9c88b714832abf54f9a7b7198d#diff-1ca0173d6a68ba1bdcd9ff908b769911L151)
94
+
* Problem: use **tinydir** library which relies on filesytem
95
+
* Dependencies:
96
+
* rcutils/src/security_directory.c
97
+
* rcl/rcl/src/rcl/security_directory.c
93
98
94
99
### allocator.c
95
100
96
-
- Function **rcutils_get_default_allocator**. [Check here](https://github.com/micro-ROS/rcutils/commit/3abb1eb2c9b206054101293997c0d4e541b1c657)
97
-
- Problem: use static allocated **default_allocator** which uses malloc/free. **rcutils_set_default_allocator** is proposed.
0 commit comments