-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
Description
am currently working on getting PX4 running on the ESP32 with NuttX 12.12.0, and I’m reaching out for guidance on some linking issues I am encountering.
There is a draft PR for updating PX4’s NuttX version to 12.12.0: PX4/PX4-Autopilot#26215
I would like to extend this update to include ESP32 support so that I can take advantage of the many improvements between NuttX 10.3 and 12.12 in our PX4-based solution on ESP32.
Background
I previously got PX4 running on the ESP32 with NuttX 10.3 (PX4 main branch). This required collecting contributions from multiple sources and adding some final adjustments. The main challenge was compiling and linking PX4 with NuttX, and I still don’t fully understand why certain object files need to be explicitly included during linking.
Current Status
I am now trying to compile PX4 with NuttX 12.12 for ESP32. My efforts so far include:
Using the esp32-devkitc:wifinsh board configuration as a base.
Aligning configuration options with stable PX4 boards (e.g., STM32) to ensure consistency.
Verifying my board configuration is correct under:
PX4-Autopilot/boards/espressif/esp32/nuttx-config/nsh/defconfig
The compilation fails during the linking stage, even though compilation of individual object files succeeds.
Im receiving the following error during linking:
/home/henry/.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: warning: cannot find entry symbol __start; not setting start address
Memory region Used Size Region Size %age Used
ROM: 65504 B 4194272 B 1.56%
iram0_0_seg: 1040 B 168 KB 0.60%
irom0_0_seg: 65520 B 3342304 B 1.96%
dram0_0_seg: 0 GB 180736 B 0.00%
drom0_0_seg: 0 GB 4194272 B 0.00%
rtc_iram_seg: 0 GB 8 KB 0.00%
rtc_slow_seg: 0 GB 4 KB 0.00%
rtc_reserved_seg: 0 GB 24 B 0.00%
extmem_seg: 0 GB 4 MB 0.00%
[536/538] Generating ../../espressif_esp32_default.bin
I also had linking issues regarding the standard C library functions:
/home/henry/git/PX4-Autopilot/src/lib/cdev/CDev.cpp:246:(.text._ZN4cdev4CDev4pollEP4fileP6pollfdb+0x5e): undefined reference to `memset'
/home/henry/.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: NuttX/nuttx/libs/libc/libc.a(lib_strncat.o): in function `strncat':
/home/henry/git/PX4-Autopilot/platforms/nuttx/NuttX/nuttx/libs/libc/string/lib_strncat.c:43:(.text.strncat+0x6): undefined reference to `strlen'
Key Areas Relevant to Linking
CMake startup objects / library linking
PX4-Autopilot/platforms/nuttx/CMakeLists.txt
https://github.com/henrykotze/PX4-Autopilot/blob/0f20b703d148586090d9eea0857372af1b4cdd06/platforms/nuttx/CMakeLists.txt#L245
I have added a dedicated section for handling ESP32-specific linking.
Linker scripts / memory layout
PX4-Autopilot/boards/espressif/esp32/nuttx-config/scripts/
Compiler options / toolchain definitions
PX4-Autopilot/platforms/nuttx/NuttX/Make.defs.in
I added ifdef "NuttX" checks and toolchain options for Xtensa:
https://github.com/henrykotze/PX4-Autopilot/blob/0f20b703d148586090d9eea0857372af1b4cdd06/platforms/nuttx/NuttX/Make.defs.in#L61
else ifeq ($(CONFIG_ARCH_XTENSA),y)
include $(TOPDIR)/arch/xtensa/src/lx7/Toolchain.defs
Repository and Build Info
Branch being compiled: esp32-nuttx-12-12-0
Build command:
make espressif_esp32
Toolchain: xtensa-esp-elf-gcc (crosstool-NG esp-13.2.0_20240530) 13.2.0
Request for Assistance
I would greatly appreciate if someone could:
Attempt compiling PX4 for ESP32 with NuttX 12.12 using the branch above.
Assist in debugging the linking issues I am encountering.
My current suspicion is that certain startup and ESP32-specific object files are not being linked correctly, despite being included in the CMake configuration. Any guidance on proper linking order or missing objects would be extremely helpful.
Verification
- I have verified before submitting the report.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status