Repository Summary

Description A set of utilities for integrating micro-ROS in a STM32CubeMX project
Checkout URI https://github.com/micro-ros/micro_ros_stm32cubemx_utils.git
VCS Type git
VCS Version jazzy
Last Updated 2024-11-11
Dev Status UNKNOWN
Released UNRELEASED
Tags No category tags.
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Packages

Name Version
micro_ros_stmcube 5.0.1

README

banner banner

micro-ROS for STM32CubeMX/IDE

This tool aims to ease the micro-ROS integration in a STM32CubeMX/IDE project.

This package support the usage of micro-ROS on top of two different middlewares:

  • eProsima Micro XRCE-DDS: the default micro-ROS middleware.
  • embeddedRTPS: an experimental implementation of a RTPS middleware compatible with ROS 2. Instructions on how to use it available here.

Using this package with STM32CubeMX

  1. Clone this repository in your STM32CubeMX project folder. A sample project can be generated with the provided sample_project.ioc.
  2. Make sure that your STM32CubeMX project is using a Makefile toolchain under Project Manager -> Project
  3. Make sure that if you are using FreeRTOS, the micro-ROS task has more than 10 kB of stack: Detail
  4. Configure the transport interface on the STM32CubeMX project, check the Transport configuration section for instructions on the custom transports provided.
  5. Modify the generated Makefile to include the following code before the build the application section:

   #######################################
   # micro-ROS addons
   #######################################
   LDFLAGS += micro_ros_stm32cubemx_utils/microros_static_library/libmicroros/libmicroros.a
   C_INCLUDES += -Imicro_ros_stm32cubemx_utils/microros_static_library/libmicroros/microros_include

   # Add micro-ROS utils
   C_SOURCES += micro_ros_stm32cubemx_utils/extra_sources/custom_memory_manager.c
   C_SOURCES += micro_ros_stm32cubemx_utils/extra_sources/microros_allocators.c
   C_SOURCES += micro_ros_stm32cubemx_utils/extra_sources/microros_time.c

   # Set here the custom transport implementation
   C_SOURCES += micro_ros_stm32cubemx_utils/extra_sources/microros_transports/dma_transport.c

   print_cflags:
      @echo $(CFLAGS)
   
  1. Execute the static library generation tool. Compiler flags will retrieved automatically from your Makefile and user will be prompted to check if they are correct.
   docker pull microros/micro_ros_static_library_builder:jazzy
   docker run -it --rm -v $(pwd):/project --env MICROROS_LIBRARY_FOLDER=micro_ros_stm32cubemx_utils/microros_static_library microros/micro_ros_static_library_builder:jazzy
   
  1. Modify your main.c to use micro-ROS. An example application can be found in sample_main.c.
  2. Continue your usual workflow building your project and flashing the binary:
   make -j$(nproc)
   

Using this package with STM32CubeIDE

micro-ROS can be used with SMT32CubeIDE following these steps:

  1. Clone this repository in your STM32CubeIDE project folder
  2. Go to Project -> Settings -> C/C++ Build -> Settings -> Build Steps Tab and in Pre-build steps add:
   docker pull microros/micro_ros_static_library_builder:jazzy && docker run --rm -v ${workspace_loc:/${ProjName}}:/project --env MICROROS_LIBRARY_FOLDER=micro_ros_stm32cubemx_utils/microros_static_library_ide microros/micro_ros_static_library_builder:jazzy
   
  1. Add micro-ROS include directory. In Project -> Settings -> C/C++ Build -> Settings -> Tool Settings Tab -> MCU GCC Compiler -> Include paths add micro_ros_stm32cubemx_utils/microros_static_library_ide/libmicroros/include
  2. Add the micro-ROS precompiled library. In Project -> Settings -> C/C++ Build -> Settings -> MCU GCC Linker -> Libraries
    • add <ABSOLUTE_PATH_TO>/micro_ros_stm32cubemx_utils/microros_static_library_ide/libmicroros in Library search path (-L)
    • add microros in Libraries (-l)
  3. Add the following source code files to your project, dragging them to source folder:
    • extra_sources/microros_time.c
    • extra_sources/microros_allocators.c
    • extra_sources/custom_memory_manager.c
    • extra_sources/microros_transports/dma_transport.c or your transport selection.
  4. Make sure that if you are using FreeRTOS, the micro-ROS task has more than 10 kB of stack: Detail
  5. Configure the transport interface on the STM32CubeMX project, check the Transport configuration section for instructions on the custom transports provided.
  6. Build and run your project

Windows 11 (Community Contributed)

micro-ROS can be used with SMT32CubeIDE in Windows 11 OS, following these steps:

File truncated at 100 lines see the full file

CONTRIBUTING

Contributing

Want to contribute? Great! You can do so through the standard GitHub pull request model. For large contributions we do encourage you to file a ticket in the GitHub issues tracking system prior to any code development to coordinate with the system_modes development team early in the process. Coordinating up front helps to avoid frustration later on.

Your contribution must be licensed under the Apache-2.0 license, the license used by this project.

Include a copyright notice and license in each new file to be contributed, consistent with the style used by this project. If your contribution contains code under the copyright of a third party, document its origin, license, and copyright holders.

Sign your work

This project tracks patch provenance and licensing using a modified Developer Certificate of Origin (DCO; from OSDL) and Signed-off-by tags initially developed by the Linux kernel project.

system_modes Developer's Certificate of Origin.  Version 1.0
By making a contribution to this project, I certify that:
(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the "Apache License, Version 2.0"
    ("Apache-2.0"); or
(b) The contribution is based upon previous work that is covered by
    an appropriate open source license and I have the right under
    that license to submit that work with modifications, whether
    created in whole or in part by me, under the Apache-2.0 license;
    or
(c) The contribution was provided directly to me by some other
    person who certified (a) or (b) and I have not modified it.
(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    metadata and personal information I submit with it, including my
    sign-off) is maintained indefinitely and may be redistributed
    consistent with this project and the requirements of the Apache-2.0
    license or any open source license(s) involved, where they are
    relevant.
(e) I am granting the contribution to this project under the terms of
    Apache-2.0.
    http://www.apache.org/licenses/LICENSE-2.0

With the sign-off in a commit message you certify that you authored the patch or otherwise have the right to submit it under an open source license. The procedure is simple: To certify above system_modes Developer’s Certificate of Origin 1.0 for your contribution just append a line

Signed-off-by: Random J Developer <random@developer.example.org>

to every commit message using your real name or your pseudonym and a valid email address.

If you have set your user.name and user.email git configs you can automatically sign the commit by running the git-commit command with the -s option. There may be multiple sign-offs if more than one developer was involved in authoring the contribution.

For a more detailed description of this procedure, please see SubmittingPatches which was extracted from the Linux kernel project, and which is stored in an external repository.

Individual vs. Corporate Contributors

Often employers or academic institution have ownership over code that is written in certain circumstances, so please do due diligence to ensure that you have the right to submit the code.

If you are a developer who is authorized to contribute to system_modes on behalf of your employer, then please use your corporate email address in the Signed-off-by tag. Otherwise please use a personal email address.

Each contributor is responsible for identifying themselves in the NOTICE file, the project’s list of copyright holders and authors. Please add the respective information corresponding to the Signed-off-by tag as part of your first pull request.

If you are a developer who is authorized to contribute to system_modes on behalf of your employer, then add your company / organization to the list of copyright holders in the NOTICE file. As author of a corporate contribution you can also add your name and corporate email address as in the Signed-off-by tag.

If your contribution is covered by this project’s DCO’s clause “(c) The contribution was provided directly to me by some other person who certified (a) or (b) and I have not modified it”, please add the appropriate copyright holder(s) to the NOTICE file as part of your contribution.

# Contributing Want to contribute? Great! You can do so through the standard GitHub pull request model. For large contributions we do encourage you to file a ticket in the GitHub issues tracking system prior to any code development to coordinate with the system_modes development team early in the process. Coordinating up front helps to avoid frustration later on. Your contribution must be licensed under the Apache-2.0 license, the license used by this project. ## Add / retain copyright notices Include a copyright notice and license in each new file to be contributed, consistent with the style used by this project. If your contribution contains code under the copyright of a third party, document its origin, license, and copyright holders. ## Sign your work This project tracks patch provenance and licensing using a modified Developer Certificate of Origin (DCO; from [OSDL][DCO]) and Signed-off-by tags initially developed by the Linux kernel project. ``` system_modes Developer's Certificate of Origin. Version 1.0 By making a contribution to this project, I certify that: (a) The contribution was created in whole or in part by me and I have the right to submit it under the "Apache License, Version 2.0" ("Apache-2.0"); or (b) The contribution is based upon previous work that is covered by an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the Apache-2.0 license; or (c) The contribution was provided directly to me by some other person who certified (a) or (b) and I have not modified it. (d) I understand and agree that this project and the contribution are public and that a record of the contribution (including all metadata and personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project and the requirements of the Apache-2.0 license or any open source license(s) involved, where they are relevant. (e) I am granting the contribution to this project under the terms of Apache-2.0. http://www.apache.org/licenses/LICENSE-2.0 ``` With the sign-off in a commit message you certify that you authored the patch or otherwise have the right to submit it under an open source license. The procedure is simple: To certify above system_modes Developer's Certificate of Origin 1.0 for your contribution just append a line Signed-off-by: Random J Developer to every commit message using your real name or your pseudonym and a valid email address. If you have set your `user.name` and `user.email` git configs you can automatically sign the commit by running the git-commit command with the `-s` option. There may be multiple sign-offs if more than one developer was involved in authoring the contribution. For a more detailed description of this procedure, please see [SubmittingPatches][] which was extracted from the Linux kernel project, and which is stored in an external repository. ### Individual vs. Corporate Contributors Often employers or academic institution have ownership over code that is written in certain circumstances, so please do due diligence to ensure that you have the right to submit the code. If you are a developer who is authorized to contribute to system_modes on behalf of your employer, then please use your corporate email address in the Signed-off-by tag. Otherwise please use a personal email address. ## Maintain Copyright holder / Contributor list Each contributor is responsible for identifying themselves in the [NOTICE](NOTICE) file, the project's list of copyright holders and authors. Please add the respective information corresponding to the Signed-off-by tag as part of your first pull request. If you are a developer who is authorized to contribute to system_modes on behalf of your employer, then add your company / organization to the list of copyright holders in the [NOTICE](NOTICE) file. As author of a corporate contribution you can also add your name and corporate email address as in the Signed-off-by tag. If your contribution is covered by this project's DCO's clause "(c) The contribution was provided directly to me by some other person who certified (a) or (b) and I have not modified it", please add the appropriate copyright holder(s) to the [NOTICE](NOTICE) file as part of your contribution. [DCO]: http://web.archive.org/web/20070306195036/http://osdlab.org/newsroom/press_releases/2004/2004_05_24_dco.html [SubmittingPatches]: https://github.com/wking/signed-off-by/blob/7d71be37194df05c349157a2161c7534feaf86a4/Documentation/SubmittingPatches