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

iox-#1982 FreeRTOS platform implementation #1983

Merged

Conversation

JakubSosnovec
Copy link
Contributor

@JakubSosnovec JakubSosnovec commented May 10, 2023

Pre-Review Checklist for the PR Author

  1. Code follows the coding style of CONTRIBUTING.md
  2. Tests follow the best practice for testing
  3. Changelog updated in the unreleased section including API breaking changes
  4. Branch follows the naming format (iox-123-this-is-a-branch)
  5. Commits messages are according to this guideline
  6. Update the PR title
    • Follow the same conventions as for commit messages
    • Link to the relevant issue
  7. Relevant issues are linked
  8. Add sensible notes for the reviewer
  9. All checks have passed (except task-list-completed)
  10. All touched (C/C++) source code files from iceoryx_hoofs are added to ./clang-tidy-diff-scans.txt
  11. Assign PR to reviewer

Notes for Reviewer

Changes

  • Add freertos iceoryx platform implementation.
  • Add iceoryx_dust cmake configuration for constants in NamedPipe, for further memory consumption optimization.
  • Fix a few inconsistencies with integer types that appeared as warnings when building for 32-bit systems:
    • int32_t -> int for file descriptors
    • size_t -> uint64_t for vector sizes/indices
    • Use std::thread::native_handle_type instead of pthread types, for the cases when the native handle has different type.

Explanation

Adding this new platform implementation is unfortunately a bit more complicated than with the normal operating systems such as Linux. We tried to make this implementation is general and generic as possible, however, it just wasnt possible always.

Apart from the standard FreeRTOS kernel (https://freertos.org/RTOS.html), this implementation depends on the official FreeRTOS+POSIX extension (https://freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_POSIX/index.html) and additionally on a little third-party C++ threading library for FreeRTOS (https://github.com/grygorek/FreeRTOS_cpp11).

In order to test this implementation easily, we made this "integration" repository: https://github.com/NXPHoverGames/iceoryx_freertos It basically brings all of the dependencies as well as iceoryx together, provides the CMake build system and compiler toolchain (mostly taken from FreeRTOS_cpp11) in order to be able to build for a particular platform and execute it in an emulator environment (QEMU). Moreover, all of these steps can be easily reproduced because they are wrapped in Docker container image.

For further information and background, I recommend to read the README in our integration repo: https://github.com/NXPHoverGames/iceoryx_freertos/blob/main/README.md as well as the README in the C++ threading lib: https://github.com/grygorek/FreeRTOS_cpp11/blob/master/README.md

Checklist for the PR Reviewer

  • Commits are properly organized and messages are according to the guideline
  • Code according to our coding style and naming conventions
  • Unit tests have been written for new behavior
  • Public API changes are documented via doxygen
  • Copyright owner are updated in the changed files
  • All touched (C/C++) source code files from iceoryx_hoofs have been added to ./clang-tidy-diff-scans.txt
  • PR title describes the changes

Post-review Checklist for the PR Author

  1. All open points are addressed and tracked via issues

References

@JakubSosnovec JakubSosnovec marked this pull request as ready for review May 10, 2023 08:24
@JakubSosnovec
Copy link
Contributor Author

Hi all! I have now finally got the green light to open this long-promised FreeRTOS platform implementation.

Please do review carefully and ask any and all questions that you have! Also, if you think it could be beneficial, I would be happy to jump on a call with you guys (perhaps the bi-weekly iox call?) in order to properly explain everything and answer any more complex and involved things and questions.

@elfenpiff
Copy link
Contributor

@JakubSosnovec awesome! As soon as I have time I will look at it!

Copy link
Member

@elBoberido elBoberido left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just an initial brief look at the code. Did not yet look at all the platform files

@elBoberido
Copy link
Member

@JakubSosnovec regarding the iceoryx developer meetup today. All of us have an important meeting at that time and we will only be available from 17:30. So if you want to join today keep in mind that it starts later

@JakubSosnovec
Copy link
Contributor Author

@JakubSosnovec regarding the iceoryx developer meetup today. All of us have an important meeting at that time and we will only be available from 17:30. So if you want to join today keep in mind that it starts later

@elBoberido Unfortunately today I wont be able to join at all.

@elBoberido
Copy link
Member

@JakubSosnovec no problem. Is the regular meeting in two weeks soon enough for you or would you like to have something sooner?

@JakubSosnovec
Copy link
Contributor Author

@JakubSosnovec no problem. Is the regular meeting in two weeks soon enough for you or would you like to have something sooner?

I think that is fine for me :)

@elBoberido
Copy link
Member

@JakubSosnovec can you please run clang-format on the changed files?

@elBoberido
Copy link
Member

@JakubSosnovec okay, there is still an issue left. Could you please add csignal to tools/used-headers.txt? I have the feeling we should get rid of that file but that's something for an other PR.

Copy link
Member

@elBoberido elBoberido left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From my POV just a few minor things. Sorry for the slow review :)

@JakubSosnovec
Copy link
Contributor Author

JakubSosnovec commented Jul 7, 2023

@JakubSosnovec okay, there is still an issue left. Could you please add csignal to tools/used-headers.txt? I have the feeling we should get rid of that file but that's something for an other PR.

Its already there :( https://github.com/eclipse-iceoryx/iceoryx/blob/master/tools/scripts/used-headers.txt#L37

Edit: Oh, I guess I need to add it to the # QNX platform / libc headers category. I will try that.
Edit2: Hmm, now its still failing, even though I updated the used-headers.txt file. The script output doesnt match the new file. Not sure whats going on.

@elBoberido
Copy link
Member

@JakubSosnovec oh, my bad. Please remove all csignal from tools/used-headers.txt. You removed that header from process_manager.cpp and it seems it was not used elsewhere.

@elBoberido
Copy link
Member

@JakubSosnovec I hope our slow response has not discouraged you :)

@codecov
Copy link

codecov bot commented Jul 26, 2023

Codecov Report

Merging #1983 (190291a) into master (90996dc) will increase coverage by 0.26%.
Report is 114 commits behind head on master.
The diff coverage is 84.61%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1983      +/-   ##
==========================================
+ Coverage   74.05%   74.31%   +0.26%     
==========================================
  Files         404      414      +10     
  Lines       15924    16086     +162     
  Branches     2243     2249       +6     
==========================================
+ Hits        11793    11955     +162     
+ Misses       3422     3416       -6     
- Partials      709      715       +6     
Flag Coverage Δ
unittests 74.10% <84.61%> (+0.37%) ⬆️
unittests_timing 14.89% <23.07%> (+0.14%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
...dust/include/iceoryx_dust/internal/cxx/convert.inl 41.42% <ø> (ø)
.../include/iceoryx_dust/posix_wrapper/named_pipe.hpp 100.00% <ø> (ø)
...ceoryx_hoofs/internal/posix_wrapper/posix_call.inl 100.00% <ø> (ø)
...fs/internal/posix_wrapper/shared_memory_object.hpp 87.50% <ø> (ø)
...six_wrapper/shared_memory_object/shared_memory.hpp 100.00% <ø> (ø)
...oofs/internal/posix_wrapper/unix_domain_socket.hpp 100.00% <ø> (ø)
...ofs/include/iceoryx_hoofs/posix_wrapper/thread.hpp 100.00% <ø> (ø)
iceoryx_hoofs/primitives/include/iox/algorithm.hpp 92.85% <ø> (ø)
iceoryx_hoofs/source/concurrent/loffli.cpp 87.87% <ø> (+3.03%) ⬆️
..._hoofs/source/posix_wrapper/unix_domain_socket.cpp 61.66% <ø> (ø)
... and 11 more

... and 37 files with indirect coverage changes

Copy link
Contributor

@elfenpiff elfenpiff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets fix the comma and get it merged.


cc_library(
name = "iceoryx_dust",
srcs = glob([
"source/**/*.cpp",
"source/**/*.hpp",
]),
hdrs = glob(["include/**"] + glob(["vocabulary/**"])),
hdrs = glob(["include/**"] + glob(["vocabulary/**"])) + [,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you have to remove the comma here to get the bazel CI running again.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The coma in the next line probably also :)

Copy link
Contributor

@elfenpiff elfenpiff Jul 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@elBoberido coma ... sounds like you made a @budrus and this is not allowed under the Cobra License ;) ... Please correct your typo to something like cmoma

@elfenpiff
Copy link
Contributor

@JakubSosnovec you did a great job here. Now we have freertos support that is awesome, we only require a CI job for it and we are done.
I will try to take care of it after my 3 weeks vacation.

Copy link
Member

@elBoberido elBoberido left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost done. Thanks for your effort


cc_library(
name = "iceoryx_dust",
srcs = glob([
"source/**/*.cpp",
"source/**/*.hpp",
]),
hdrs = glob(["include/**"] + glob(["vocabulary/**"])),
hdrs = glob(["include/**"] + glob(["vocabulary/**"])) + [,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The coma in the next line probably also :)

Copy link
Member

@elBoberido elBoberido left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Updating the release notes would be nice but that can also be done in a follow up. Could be merged from my point of view

@elfenpiff elfenpiff merged commit 7a5d86b into eclipse-iceoryx:master Jul 27, 2023
17 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement iceoryx platform for FreeRTOS
4 participants