Skip to content

Unable to compile for ESP32-S2 and ESP IDF v4.2 #18

Closed

Description

@MS71

Hi,
i am trying to build the int32_publisher example for the ESP32-S2.

My steps:

1.)
Install IDF as defined in:
https://docs.espressif.com/projects/esp-idf/en/release-v4.2/esp32/get-started/index.html
git clone -b release/v4.2 --recursive https://github.com/espressif/esp-idf.git

2.)
checkout micro_ros_espidf_component

3.)
idf.py set-target esp32s2
idf.py build

Problem A:
This build is not working because the cmake IDF_TARGET variable is not used.
IDF_TARGET contains "esp32" or "esp32s2".

If I modify the include path in esp32_toolchain.cmake.in, then i am able to compile
the example. I think esp32_toolchain.cmake.in should use the IDF_TARGET variable
for building the include path.

esp32s2.patch.txt

Unfortunately, it is still not linking. I get this error:

[ 99%] Linking CXX executable int32_publisher.elf
.espressif/tools/xtensa-esp32s2-elf/esp-2020r3-8.4.0/xtensa-esp32s2-elf/bin/../lib/gcc/xtensa-esp32s2-elf/8.4.0/../../../../xtensa-esp32s2-elf/bin/ld: esp-idf/xtensa/libxtensa.a(stdatomic.c.obj): in function `__atomic_fetch_add_8':
esp-idf-v4.2/components/xtensa/stdatomic.c:116: multiple definition of `__atomic_fetch_add_8'; micro_ros_espidf_component/libmicroros.a(librcutils-atomic_64bits.c.obj):atomic_64bits.c:(.text.__atomic_fetch_add_8+0x0): first defined here
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/int32_publisher.elf.dir/build.make:396: int32_publisher.elf] Error 1
make[1]: *** [CMakeFiles/Makefile2:2245: CMakeFiles/int32_publisher.elf.dir/all] Error 2
make: *** [Makefile:130: all] Error 2
make failed with exit code 2

Do you have got any hint?

I would be great, if this component could support esp32-s2 too.

Activity

  1. pablogs9 commented on Nov 30, 2020

    @pablogs9
    Member

    Hello @MS71, thanks for the ideas. I'm creating a PR for integrating this ESP32-S2 support: #19

    Regarding the atomics: we have a problem here, micro-ROS provides a minimal implementation of 64-bits atomics that of course can be enabled and disabled with the flag RCUTILS_NO_64_ATOMIC in the colcon.meta.

    This optional extension provides implementations if the platform does not have support for:

    • __atomic_load_8
    • __atomic_store_8
    • __atomic_exchange_8
    • __atomic_fetch_add_8

    The point is that ESP-IDF for ESP32-S2 is providing just some of them:

    • __atomic_fetch_add_8

    This way, if you disable the micro-ROS 64-bit atomic extension it complains about missing load and store, but if you enable it it complains about having fetch_add twice.

    Do you have any suggestion?

  2. pablogs9 commented on Nov 30, 2020

    @pablogs9
    Member

    Cool, we are going to merge the PR: https://github.com/micro-ROS/micro_ros_espidf_component/pull/19/checks?check_run_id=1472900469.

    Reopen this if you have any problem or question.

    BTW: I don't have here an ESP32-S2 for testing this. If you could give us some feedback, it would be super nice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions