`libmicroros.a` is built with a hand-maintained toolchain file that may drift from IDF's compile flags (ABI mismatch risk)
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 48/100
- Issue-Typ
- Bug
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Ruhig
- Tech-Stack
- c, cmake
- Bereich
- build-system, embedded-iot
Rechercherichtung
Beginne mit esp32_toolchain.cmake.in, libmicroros.mk und der äußeren CMakeLists.txt, um nachzuverfolgen, wie die IDF-Kompilierungsflags den separaten colcon-Build erreichen. Vergleiche die von IDF-Komponenten verwendeten Flags mit denen, die an libmicroros.a übergeben werden, mit besonderem Augenmerk auf RISC-V-ABI- und PSRAM-Optionen. Als erledigt gilt die Aufgabe, wenn der Sub-Build die relevanten Flags ohne eine manuell auseinanderlaufende Liste erhält oder die nicht synchronisierten Flags ausdrücklich dokumentiert sind.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
From https://github.com/micro-ROS/micro_ros_espidf_component/pull/334#issuecomment-4829889550
The following content was generated by AI
Cause
micro-ROS is not built as regular IDF component sources. Instead, the component's CMake configure step invokes libmicroros.mk, which runs a separate colcon build to produce libmicroros.a, and the result is linked back into the ELF via add_prebuilt_library. This separate build uses its own toolchain file (esp32_toolchain.cmake.in) that only passes through a hand-picked subset of compile options (compiler binary, C standard, sdkconfig.cmake, IDF includes, a few hardcoded flags), rather than inheriting the full set of flags IDF applies to its own components.
Impact
Some ABI-affecting flags used by the main IDF build are not propagated to the micro-ROS sub-build, so libmicroros.a can be compiled with settings inconsistent with the rest of the firmware. Known gaps:
- RISC-V
-march/-mabiare not set (relies on compiler defaults) — a mismatch here breaks the calling convention/ABI. - PSRAM cache workaround flags (e.g.
-mfix-esp32-psram-cache-issue) are not forwarded. - The hardcoded flag list in
esp32_toolchain.cmake.inmust be kept in sync manually and can silently drift as IDF changes.
(Note: many flags like optimization level or stack protector are not ABI-breaking, so their absence is harmless — the concern is specifically the ABI/codegen-relevant ones.)
Because the same compiler is used and sdkconfig.cmake is included, most struct-layout / config-dependent mismatches are already avoided, so this is a latent risk rather than a guaranteed failure — but it can produce hard-to-debug link/runtime issues in specific configurations (e.g. SPIRAM enabled, certain RISC-V targets).
Possible fix
Keeping micro-ROS as a separately built static library is unavoidable (it depends on the ROS 2 / colcon / rosidl build system), so the goal is not to remove this mechanism but to make the sub-build inherit IDF's ABI-relevant flags instead of hardcoding a subset:
- Query the flags IDF actually uses for its components (e.g.
CMAKE_C_FLAGS/COMPILE_OPTIONS, especially RISC-V-march/-mabiand PSRAM-related flags) in the outerCMakeLists.txtand pass them throughlibmicroros.mkinto the toolchain file. - As a minimum/interim step, document the list of flags that are known not to be synced and must be verified manually.
- Vorherrschende Sprache
- C
- Sterne
- 422
- Forks
- 123
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus micro-ROS/micro_ros_espidf_component
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 52/100
-
embeddedRTPS build issueOffen
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 45/100
micro-ROS/micro_ros_espidf_component#336 · 3 Kommentare ·
-
The issue of porting esp32p4Evtl. vergeben @Narukara hat das vor 158 Tagen übernommen. Offen
micro-ROS/micro_ros_espidf_component#314 · 3 Kommentare · 1 zugewiesene Person ·
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 25/100
micro-ROS/micro_ros_espidf_component#310 · 2 Kommentare ·
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 55/100
micro-ROS/micro_ros_espidf_component#309 · 1 Kommentar ·
Alle Issues in micro-ROS/micro_ros_espidf_component
Ähnliche Issues
-
documentation severity: low
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 88/100
luainkernel/lunatik#2231 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
apache/arrow-swift#209 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
libretiny-eu/libretiny#435 ·
Maintainer antworten meist innerhalb von 4 Tagen
-
Needs-Triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
Maintainer antworten meist innerhalb von 2 Tagen
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 64/100
trezor/trezor-firmware#8210 ·
Maintainer antworten meist innerhalb von 3 Tagen