Skip to content

atomic patch not working for esp32 #251

@ernie-thi

Description

@ernie-thi
  • Hardware description: esp32
  • RTOS: FreeRTOS
  • Installation type: espidf, component
  • Version or commit hash: humble

Steps to reproduce the issue

Clone this repo in components folder, then as always:

idf.py set-target esp32
idf.py build 

Actual behavior

build fails:

/home/raphael/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: esp-idf/newlib/libnewlib.a(stdatomic.c.obj): in function `__atomic_exchange_8':
/home/raphael/esp/v5.3/esp-idf/components/newlib/stdatomic.c:77: multiple definition of `__atomic_exchange_8'; /home/raphael/idf_components/micro_ros_espidf_component/libmicroros.a(librcutils-atomic_64bits.c.obj):atomic_64bits.c:(.text.__atomic_exchange_8+0x0): first defined here
/home/raphael/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: esp-idf/newlib/libnewlib.a(stdatomic.c.obj): in function `__atomic_fetch_add_8':
/home/raphael/esp/v5.3/esp-idf/components/newlib/stdatomic.c:77: multiple definition of `__atomic_fetch_add_8'; /home/raphael/idf_components/micro_ros_espidf_component/libmicroros.a(librcutils-atomic_64bits.c.obj):atomic_64bits.c:(.text.__atomic_fetch_add_8+0x0): first defined here
/home/raphael/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: esp-idf/newlib/libnewlib.a(stdatomic.c.obj): in function `__atomic_load_8':
/home/raphael/esp/v5.3/esp-idf/components/newlib/stdatomic.c:77: multiple definition of `__atomic_load_8'; /home/raphael/idf_components/micro_ros_espidf_component/libmicroros.a(librcutils-atomic_64bits.c.obj):atomic_64bits.c:(.text.__atomic_load_8+0x0): first defined here
/home/raphael/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: esp-idf/newlib/libnewlib.a(stdatomic.c.obj): in function `__atomic_store_8':
/home/raphael/esp/v5.3/esp-idf/components/newlib/stdatomic.c:77: multiple definition of `__atomic_store_8'; /home/raphael/idf_components/micro_ros_espidf_component/libmicroros.a(librcutils-atomic_64bits.c.obj):atomic_64bits.c:(.text.__atomic_store_8+0x0): first defined here
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
ninja failed with exit code 1, output of the command is in the

Additional information

By modifying the file libmicroros.mk i was able to make it work:
in line 110 i added esp32 as target too. So the full line looks like this then:
ifeq ($(IDF_TARGET),$(filter $(IDF_TARGET), esp32 esp32s2 esp32c3))
However, i`m not experienced enough to know whether this has any side effects and is a valid change.

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